text:
Q: Any sequence whose elements are non-zero, and which converges to non-zero, is bounded away from zero The question is to prove the above proposition.
I can see that this statement is obviously true, but don't know how to translate the condition "[all] elements are non-zero" into something that can help me do the proof.

A: Let $a_n$ be the sequence in question with $a_n\rightarrow a$. Now write down convergence for $a_n$: For all $\varepsilon>0$ you can find a natural number $n_0=n_0(\varepsilon)$ such that for every $n\geq n_0$ you have
$$|a_n-a|<\varepsilon.$$
If you now choose $\varepsilon=\frac{|a|}{2}$, then $|a_n|\geq \frac{|a|}{2}$ for every $n\geq n_0(\frac{|a|}{2})$, hence these are bounded away from zero.
Now you still have the elements $a_1,\ldots a_{n_0-1}$. Since they are all nonzero and there are only finitely many, they can be bounded by a constant $C$. Hence
$$|a_n|\geq\min(C,\frac{|a|}{2}).$$

A: I think you want to show that $\exists m>0: |a_n|>m \forall n\in\mathbb{N} $
Suppose this fails to hold: Then $\forall m>0: \exists n:|a_n|\leq m $. This means that taking $m=\frac{1}{n}, n=1,2,\dots$ results in a subsequence converging to $0$.  (Note how we used that the entries are non-zero - if there was a $0$ entry, then we wouldn't get a sequence). But as you initial sequence is convergent and converges to $l \neq 0$ then you get a contradiction.


text:
Q: I want to use a hexadecimal code from firebase in Flutter I am new to Firebase and I finally got the data from Firebase to flutter.
I work with colors and each card has a color and color nummer.
I have in Firebase:
A field colorCode, which is a String and has a value '0xFFFFB142'
In Flutter I tried to do it like this:
final int colorCode = list[index]['colorCode'].hashCode;

                            Container(
                              height: 25.0,
                              width: 25.0,
                              color: Color(colorCode),
                            ),

I get no failure, but I see no color.
It has to be an int, but it is a hexadecimal in a string code.
When I try in Firebase a int, I got a failure because it is hex.
Update:
Thank you all for your help so far!
I have input the code myself in Firebase. It is the same you normally put in that place, like color: Color(0xFFFFB142), where FFB142, is the color #FFB142
In Firebase I have used a String, because an int or plain code isn't allowed.
With my code, when I print it: it got 171924876, that's not the right color code.
I have tried this:
                    final dynamic colorCode =
                        list[index]['colorCode'].toString();

                    print(colorCode); // the right color code is printend: 0xFFFFB142

And when I put this in:
                            Container(
                              height: 25.0,
                              width: 25.0,
                              color: Color(0xFFFFB142),

It works fine, but I have for each item another colorCode in Firebase.
I find it very strange that I got this error message, because I don't want an int there, but a colorcode like 0xFFFFB142
 type 'String' is not a subtype of type 'int'

Hope you can help me!

A: You could use a function that truncates the 0x and parses the rest as hex.
Color convertToColor(String prefixedHex) => Color(int.parse(
      prefixedHex.substring(2),
      radix: 16,
    ));

A: I have found a simple solution to convert the string code '#FFB142' to a color code by using a package: Flutter_Color.
https://pub.dev/packages/flutter_color
Code I used:
import 'package:flutter_color/flutter_color.dart';

final String colorCode = list[index]['colorCode'];

                            Container(
                              height: 25.0,
                              width: 25.0,
                              color: HexColor(colorCode),

So I imported the package, let the color code be a string and used HexColor instead of Color.
Hope this simple solution will help others also.
Thank all the others here for pointing me out in the right direction. In the end it was not about firebase, but converting a string to a color code and so I googled this package.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Android source code Home sample I am looking to alter the android source code Home sample, just to have a play around and increase my knowledge.
I have placed the sample on a Samsung S2 and when I press the home button the option comes up to select between the home sample and TouchWiz.
I am looking to alter the code to have an icon available on the stock home screen so that when it is selected the option is given to select between the home sample and TouchWiz. I can't seem to find in the source code where I need to alter this.
If anyone could point me in the right direction it would be much appreciated.
Thanks

A:
I am looking to alter the code to have an icon available on the stock home screen so that when it is selected the option is given to select between the home sample and TouchWiz.

I am assuming that by "stock home screen" you mean "sample home screen". In that case, the "stock home screen" is an Activity. You would add an "icon" to the "stock home screen" the same way that you would in any other Android activity, such as by modifying the res/layout/home.xml layout file to contain an ImageButton.

A: I believe if you want to add an 'icon' to the home screen (assume you're referring to Launcher2 in AOSP source), you can just add an <favorite> tag in [Launcher2/res/xml/default-workspace.xml][1] and recompile using mmm.
However, this approach requires the 'icon' pointing to a package (or an Application) that is actually installed on the device.  I am not sure if favorite can launch an intent directly, as the action to pick home screen is usually initiated when user sends HOME intent; another issue with using intent directly is once the user sets certain application as default handler, launching the intent no longer brings up the application selector and thus will nullify your desire to switch launcher.


text:
Q: How to correctly understand stack race provided by Google play console crash report I'm getting crash details as following from the Google play console crash report.
java.lang.NullPointerException:
  at com.csa.bluetoothremote.MainActivity$11.onClick (MainActivity.java:62)
  at androidx.appcompat.app.AlertController$ButtonHandler.handleMessage (AlertController.java:37)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:246)
  at android.app.ActivityThread.main (ActivityThread.java:8506)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)

But I can't figure out what is the meaning of $11 in MainActivity$11 and 62 of (MainActivity.java:62) in the 2nd line above. I thought 62 means a line number. But in my code there is some imports in line number 62. So what are the meaning of those numbers. I want to know how to correctly map these details in my source code and find where is the error exactly.
The problem is at some where here as I guess. But I want to know exact place
        LayoutInflater inflater = LayoutInflater.from(this);
        View view = inflater.inflate(R.layout.add_widget_dialog, null);
        final RelativeLayout mainViewLayout = view.findViewById(R.id.mainViewLayout);
        ImageButton btnIcon = view.findViewById(R.id.btn_widget_icon);
        final ImageButton mainImgBtn = view.findViewById(R.id.mainImgBtn);
        Button btnColor = view.findViewById(R.id.btn_widget_color);
        final Button mainTxtBtn = view.findViewById(R.id.mainTxtBtn);
        final EditText txtId = view.findViewById(R.id.txt_widget_id);
        final EditText txtDown = view.findViewById(R.id.txt_down);
        final EditText txtUp = view.findViewById(R.id.txt_up);
        final Switch swchIsTgl = view.findViewById(R.id.swch_isTgl);

        btnColor.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                selectColor(values, v, mainImgBtn, mainTxtBtn, mainViewLayout);
            }
        });

        btnIcon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                selectIcon(values, v, mainImgBtn, mainTxtBtn, mainViewLayout);
            }
        });

        AlertDialog.Builder dBld = new AlertDialog.Builder(this);

        dBld.setView(view);

        dBld.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                ...
            }
        });

        dBld.setNegativeButton("Cancel", null);
        AlertDialog dlg = dBld.create();
        dlg.show();


text:
Q: A convergence problem in distribution theory. If we identify a locally integrable function with a distribution, then any locally integrable function is a distribution of order 0. Suppose $u_n$ is a constant function for each $n$. If we know that the corresponding distribution $u_n$ in the distribution space converges to a distribution $u$. Then is the distribution $u$ a constant function? To be more precise:
$$ u_n\rightarrow u$$ as distributions and $$u_n=C_n$$ where $C_n$ are constants. Is there any constant $C$, such that $$C_n\rightarrow C?$$.In other word is $u$  a constant?

A: Pick a test function $\varphi$ such that $\varphi \geq 0$ and $\int \varphi \, dx = 1$. Then we have
$$ |\langle C_m, \varphi \rangle - \langle C_n, \varphi \rangle |
= \left| (C_m - C_n) \int\varphi \, dx \right|
= |C_m - C_n|$$
Since the sequence $( \langle C_n, \varphi \rangle )_{n \geq 1}$ is Cauchy, the same is true for $(C_n)_{n \geq 1}$ and hence $(C_n)$ converges to some constant $C$. Then for any test function $\phi$, we have
$$ \langle C_n, \phi \rangle = C_n \int \phi \, dx \to C \int \phi \, dx = \langle C, \phi \rangle $$
and therefore $C_n \to C$ as distribution.


text:
Q: Should IP tables rules affect a serial port on Linux I'm trying to setup some iptables rules on my embedded Debian Linux system, using a serial console I entered this:

root@ts7600-47aad3:~# iptables -F
root@ts7600-47aad3:~# iptables -P INPUT DROP

but it seems to have dropped my serial port connection, I can't type any more commands.  I was not expecting this, I thought iptables only affected IP interfaces?

A: iptables does not effect data sent over the serial port (unless you're running PPP or similar over the port, of course).
But that command you gave is pretty broad, for example, you dropped packets that are entirely internal to the machine (go over lo). Depending on how your serial port is set up, maybe that was required. Dropping traffic over lo tends to break a lot of stuff; some other program running on the machine could have reacted poorly to it (and, for example, took the machine down via thrashing).
Finally, not sure if you had the console visible somewhere (including sent over the serial port), maybe there was a kernel panic?


text:
Q: onmouseover for the last of several generated divs will not work in IE I have a JavaScript function:
function addTool(id, text, tool, pic) {
   var container = getById('infobox');
   var origimg = getById('tempimg').src;
   container.innerHTML += "
" + text + "

";
   getById(id).setAttribute('onMouseOver', "mOver('"+ id +"', '" + pic + "');");
   getById(id).setAttribute('onMouseOut', "mOut('"+ id +"', '" + origimg + "');");
   getById(id).setAttribute('href', 'javascript:mClick(id);');
}

Which generates several divs, using this code:
addTool("1p", "Bar", "tool1.jpg", 'img/p&g-part-2_skiss1-2.jpg');
addTool("2p", "Tube", "tool1.jpg", 'img/p&g-part-2_skiss1-2.jpg');
addTool("3p", "Rotating", "tool1.jpg", 'img/p&g-part-2_skiss1-2.jpg');

The mouse events work fine in all major browsers except IE. It seems that all divs except the last will have the mouse event in lowercase which will have the mouse event exactly as written, with upper case letters.
All mouse events will fire except for the last div, even if I write onmouseover instead of say ONmouseOVER, which works fine on all except the last.

A: Do not use setAttribute to add events. Use attachEventListener/addEvent
The problem you have is adding the elements to the div. You are basically wiping it away each time when you are adding the new elements. That is bad. You should be using appendChild to add new content to the div.
Basic idea:
function attachEvent(elem, eventName, fn) {
    if ( elem.attachEvent ) {
        elem.attachEvent( 'on' + eventName, fn);
    } else {
        elem.addEventListener( eventName, fn, false );
    }
}

function addTool(text, message) {

   var container = document.getElementById('infobox');
   var newTool = document.createElement("a");
   newTool.innerHTML = text;
   newTool.href="#";
   var myClickFnc = function(e) {
       alert(message);
       return false;
   }
   attachEvent(newTool, "click", myClickFnc);
   container.appendChild(newTool);
}

addTool("cat","meow");
addTool("dog","bark");
addTool("pig","oink");

running example

A: Just as @epascarello pointed out, it seems that the setAttribute was the culprit, so I resolved it by setting the events in inline, such as this:
function addTool(id, text, tool, pic) {
    var container = getById('infobox');
    var origimg = getById('tempimg').src;
    container.innerHTML += "
" + text + "

";
}

Which worked just fine in all browsers, including IE.

A: You could do this part with JQuery:
$("#"+ id).mouseover(function() {
  mOver('"+ id +"', '" + pic + "');
});

You can even take this a lot further:
https://stackoverflow.com/a/4158203/190596


text:
Q: PyQt5 only child item clicked My question is:
I have a QListWidget with items(on the left side of window) and QTextEdit on the right
items               textEdit
-item1
---subitem1
---subitem2
-item2
---subitem1
---subitem2

I fill the listWidget like this:
for name in names:
        item = QtWidgets.QTreeWidgetItem([name])
        self.treeWidget.addTopLevelItem(item)
        for cmd in description:
            item2 = QtWidgets.QTreeWidgetItem([cmd])
            item.addChild(item2)

Then i want that if i cklicked on subitems some text appears in textEdit
Only subitems can appear text.
I wrote
self.treeWidget.itemClicked.connect(self.item2Clicked)
....
def item2Clicked(self, item, column):
    self.textEdit.insertPlainText("hello")

But it's not right, because if i click on the item1 - text appears too.
Thanks for your help and sorry for my english:)

A: Top-level items don't have a parent, so you could do:
    def item2Clicked(self, item, column):
        if item.parent() is not None:
            self.textEdit.insertPlainText("hello")

More generally, you can set a type for each item in the constructor:
    item = QtWidgets.QTreeWidgetItem([name], 1)
    self.treeWidget.addTopLevelItem(item)
    for cmd in description:
        item2 = QtWidgets.QTreeWidgetItem([cmd], 2)

and then do:
    def item2Clicked(self, item, column):
        if item.type() == 2:
            self.textEdit.insertPlainText("hello")


text:
Q: login impossible after the modification of the group for the folder /etc Due to some permission purposes I have changed the group of all folders in /etc.
Now I can't log in any more.
Is there a way to go back. (I'm using ubuntu 20.04 on a VM)
Many thanks in advance.

A: You can quite easily rollback, as most directories have group root. Only a few directories are different and that should be the same or similar between systems.
Run following commands from a terminal:
# change group for all directories to root
sudo find /etc -type d chgrp root {} +

# change group of some other directories to their default groups
sudo chgrp dip /etc/chatscripts
sudo chgrp dip /etc/ppp
sudo chgrp dip /etc/ppp/peers
sudo chgrp ssl-cert /etc/ssl/private
sudo chgrp lp /etc/cups
sudo chgrp lp /etc/cups/ssl
sudo chgrp lp /etc/cups/ppd

This list is copied from my system, got it with command
sudo find /etc -type d -not -group root -printf 'sudo chgrp %g %p\n'

Your setup might differ slightly, e.g. on another machine I also have /etc/postgresql and subdirs belong to group postgres. Anyways, this should make you be able to login again.
If you cannot access a terminal on the machine, you need to run from a live system, mount your drive and change /etc/ to /path/to/mountpoint/etc/ for the commands above.

A: Possible options:

*

*Restore a backup if you have one.

*Restore a VM snapshot if you have one.

*Boot the VM from an ISO image with a live system to

*

*repair your system, if you know what exactly to change (see pLumo's answer), or

*save your important data, e.g. to a shared folder. Then install a fresh system and restore your saved data.

*Create a new VM with a fresh install, add the virtual harddisk of your old VM to the new VM and

*

*copy your important data directly from the old disk to the new disk or

*compare the directories between the old disk and the new disk fix the broken ones on the old disk.


text:
Q: Show ImageView when click on ITEM of Adapter(Photos) of RecyclerView on Fragment I have a problem, i read about it and i cant do that on OnBindViewHolder, but i use this in other sites and always same error...
After my error i use too, on LONG click to do one thing and it work correctly but before that i want to use on Clock normal, not long, for when i click, show an alertbox with image (i try to do this with imageview normal too, without alertbox)
but nothing, same error...
I want with this to take on one photo of recyclerview, and open it from directory and "zoom" in alertbox...
The code
public class Fotos extends RecyclerView.Adapter<Fotos.ViewHolder> {

    private Context context;
    private List<ImageItem> fotosLista;
    private ImageButton image;

    public Fotos(List<ImageItem> fotosLista, Context context) {
        this.fotosLista = fotosLista;
        this.context = context;

    }

    public Fotos() {

    }

    public static class ViewHolder extends RecyclerView.ViewHolder {

        public View view;
       public ImageButton image;

        public ViewHolder(View itemView) {
            super(itemView);
            view = itemView;
            image = itemView.findViewById(R.id.imagen);

        }

    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
        View itemView = LayoutInflater.from(viewGroup.getContext())
                .inflate(R.layout.grid_item, viewGroup, false);

        ViewHolder tvh = new ViewHolder(itemView);

        return tvh;

    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    public void onBindViewHolder(final ViewHolder viewHolder, int pos) {

        final ImageItem item = fotosLista.get(pos);
        image = viewHolder.view.findViewById(R.id.imagen);
        image.setImageBitmap(item.getImage());
        image.setImageBitmap(Bitmap.createScaledBitmap(item.getImage(), 120, 120, false));

        viewHolder.image.setOnClickListener(new View.OnClickListener() {
            @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
            @Override
            public void onClick(View v) {
                File[] listFile;
                File file = new File("storage/emulated/0/Pictures/myDirectoryName/");
                listFile = file.listFiles();
                for (int i = 0; i < listFile.length; i++) {
                    String path = listFile[i].getAbsolutePath();
                    Bitmap bitmapMostrar = BitmapFactory.decodeFile(path);

                    ImageView mostrarImagen=(ImageView)viewHolder.view.findViewById(R.id.mostrarImagen2);
                    mostrarImagen.setImageBitmap(bitmapMostrar);

                }
                    AlertDialog.Builder transferencia2 = new AlertDialog.Builder(viewHolder.view.getContext());
                    transferencia2.setView(R.layout.imagenzoom);
                    AlertDialog dialog2 = transferencia2.create();
                    dialog2.show();

            }
        });

        viewHolder.image.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {

                AlertDialog.Builder transferencia = new AlertDialog.Builder(viewHolder.view.getContext());
                transferencia.setMessage("¿Deseas enviar la foto al servidor?");
                transferencia.setTitle("Transferir/Cancelar ");
                transferencia.setPositiveButton("Transferir", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {

                        dialogInterface.cancel();

                        //Aquí va lo de la BD + Update

                    }

                });
                transferencia.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {

                        //Aquí se cierra el alertBox y se cancela la transferencia.

                        dialogInterface.cancel();

                    }
                });

                AlertDialog dialog2 = transferencia.create();
                dialog2.show();

                return true;
            }
        });

    }

    @Override
    public int getItemCount() {
        return (null != fotosLista ? fotosLista.size() : 0);
    }

The problem is on OnBindViewHolder, on first onClick method...
*LogCat error:*
05-08 17:26:47.870 14576-14576/com.example.practicas_.arcadiatruck E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.practicas_.arcadiatruck, PID: 14576
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.setImageBitmap(android.graphics.Bitmap)' on a null object reference
    at com.example.practicas_.arcadiatruck.Fotos$1.onClick(Fotos.java:105)
    at android.view.View.performClick(View.java:5637)
    at android.view.View$PerformClick.run(View.java:22433)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6119)
    at java.lang.reflect.Method.invoke(Native Method)
    at

com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
05-08 17:26:47.873 1135-4779/? W/ActivityManager:Force finishing activity com.example.practicas_.arcadiatruck/.ActividadFragments

The alertbox is a layout with only one image, i test it with android:src and drawable image on it and i click and it work...
Thank u guys, i lose a lot of hours with this xD

A: Remove this line
image = viewHolder.view.findViewById(R.id.imagen);

And when you use setImageBitmap access the image like that
viewHolder.image.setImageBitmap(yourImage);

EDIT:
There is a lot of stuff happening in your onBindViewHolder and you inflate your views (findViewById) in different places. All that work should be moved to a ViewHolder it will be much easier to manage.
First of all, you have this line twice image = viewHolder.view.findViewById(R.id.imagen);, you don't need to do that, you only need to do it once, do it once in ViewHolder constructor and that's it.
Also  this line ImageView mostrarImagen=(ImageView)viewHolder.view.findViewById(R.id.mostrarImagen2); is better off in your ViewHolder constructor and not in onBindViewHolder.
After that, remove the View view from your ViewHolder and remove this line from the constructor as well view = itemView;, no need to do that.
Now your ViewHolder constructor and declaration should look something like this:
public ImageButton image;
public ImageView mostrarImagen

public ViewHolder(View itemView) {
    super(itemView);
    image = itemView.findViewById(R.id.imagen);
    mostrarImagen = itemView.findViewById(R.id.mostrarImagen2);
}

And when you use the ImageButton and the ImageView in onBindViewHolder don't do findViewById just use viewHolder.image and viewHolder.mostrarImagen.
Regarding your onClickListener and onLongClickListener, put them in your ViewHolder class, it's much cleaner. Put these lines in your ViewHolder constructor:
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);

Also, make sure that your ViewHolder implements onClickListener like this:
public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener

And then in your ViewHolder class override onClickListener and onLongClickListener:
@Override
public void onClick(View view) {
    // your code
}

@Override
public boolean onLongClick(View view) {
    // your code
    return true;
}


text: Q: TransportControls for two MediaPlayerElement I just have 2 MediaPlayerElement and I want them to connect to MediaTransportControls Xaml controll. How can I do this ? I tried to do {Binding ElementName=myTransportControls} but it doesn't work


text:
Q: How to know what sam/cloudformation stack lambda is executing in I have a sam/cloudformation template I am using to manage my stack. I use the same sam/cloudformation template across multiple stacks.
For example I have a dev stack and a prod stack. We have git and CI that updates the corresponding stack based on the branch.
My question is, how can I tell what stack/context my lambda function is running in? This would be useful for configuring DB endpoints.
I know I can setup Environment Variables through the console, but I would like to keep this in the template as much as possible. I don't see a good way to incorporate this into the template.

A: The way I do it is to pass in the stack name to the Lambda functions as an ENV var this way:
Globals:
  Function:
    Environment:
      Variables:
        STACK_NAME: !Ref AWS::StackName

It uses SAM's Globals section (so the Environment is set on all Lambda's that are in the template), combined with Cloudformation's Pseudoparameters.


text:
Q: Как сверстать такую линию перед текстом? Вырезать эти линии как картинки из макета или создать их собственноручно с помощью css?

A: Скачивайте картинку в svg. Далее код:

.item {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  width: 300px;
  -ms-flex-negative: 0;
  flex-shrink: 0;
}
.item span {
  font-weight: 400;
  font-size: 24px;
  line-height: 18px;
  margin-left: 10px;
}

    85%

Приехали второй раз

    95%

Научились кататься

    99%


text:
Q: On hardhat when deploying a contract or minting an NFT getting error: ProviderError: invalid sender I am using HardHat to deploy contracts on Polygon (Matic), it works most of the time when deploying or minting.. but then it usually breaks when I switch from testnet to mainnet.
For example: I switched from mainnet to rpc-mumbai.maticvigil.com, then I get the error ProviderError: invalid sender.
Then I updated my hardhat.config.js to point to matic-mumbai.chainstacklabs.com and I am able to mint and deploy contracts with no errors.
I am reaching out to see if this is a known issue occurring with polygon and or hardhat?

A: Add this to your hardhat.config.js, after accounts:
 gasPrice: 8000000000, // default is 'auto' which breaks chains without the london hardfork

Full entry:
  matic: {
      url: "https://matic-mumbai.chainstacklabs.com",
      accounts: [PRIVATE_KEY],
      gasPrice: 8000000000, // default is 'auto' which breaks chains without the london hardfork
    }

Ref: https://github.com/nomiclabs/hardhat/issues/1828

A: I discovered the issue with "Invalid sender". This for me was that the wallet address had not sent any transactions and only had deposits from the testnet faucet. For whatever reason it made that error disappear when I sent a transaction manually through Metamask then sent it back then tried to issue the hardhat run command again.
From what I am now seeing however, the transaction still hangs without any errors and --verbose provides nothing useful. This appears to be some kind of conflict pertaining to the London Hardfork. I have not resolved the issue. Will report back later with more information if I have it.
What I have done so far:

*

*Tried adding gasPrice and/or gas to the hardhat.config.js networks.matic object

*Tried to put 0x in front of the privateKey

*Tried adding chainId:80001 to the hardhat.config.js networks.matic object

*Tried increasing gasPrice to over 500 gwei

*Tried 3 different RPC endpoints including a private one requiring an API key

Hardhat github made an update to 2.6.2, which also does not resolve the problem.

A: Confirmed the solution of "The Vikk" is working. Added also the account details and 0x before the private key.
 mumbai: {
  url: "https://polygon-mumbai.g.alchemy.com/v2/<API_KEY>",
  accounts: [`0x${PRIVATE_KEY}`]
  }


text:
Q: ReactJs - data is undefiend Вот что в бразуере
Uncaught TypeError: date is undefined
CostDate CostDate.jsx:5
React 16
addCostHandler App.js:27
saveCostDataHandler NewCost.jsx:10
submitHandler CostForm.jsx:28
onSubmit CostForm.jsx:36
React 23
js index.js:6
factory react refresh:6

Как понял компонент CostDate принимает нужный формат даты и переменная не пустая но потом выскакивает ошибка(когда идут новые значения с CostForm > CostItem и уже в CostDate значения undefined)

Uncaught TypeError: date is undefined

Date Sun Oct 23 2022 00:00:00 GMT+0200 (Центральная Европа, летнее время)
CostDate.jsx:8
Date Wed Mar 01 2023 00:00:00 GMT+0100 (Центральная Европа, стандартное время)
CostDate.jsx:8
Uncaught TypeError: date is undefined
    CostDate CostDate.jsx:5
    React 17
    addCostHandler App.js:27
    saveCostDataHandler NewCost.jsx:10
    submitHandler CostForm.jsx:28
    onSubmit CostForm.jsx:36
    React 23
    js index.js:6
    factory react refresh:6
    Webpack 3
CostDate.jsx:5
Date Sun Oct 23 2022 00:00:00 GMT+0200 (Центральная Европа, летнее время)
CostDate.jsx:8
Date Wed Mar 01 2023 00:00:00 GMT+0100 (Центральная Европа, стандартное время)
CostDate.jsx:8

Вот код из компонентов:
App.jsx
    import { useState } from "react";
import Costs from "./components/Costs/Costs";
import NewCost from "./components/NewCost/NewCost";
function App() {
  const INITIAL_DATA = [{
    date: new Date(2022, 9, 23),
    name: 'Xolodilnik',
    cost: 999
  }, {
    date: new Date(2023, 2, 1),
    name: 'Televizor',
    cost: 1235
  }]

  const[costData, setCostData] = useState(INITIAL_DATA)
  const addCostHandler = (data) => {
    setCostData(prev=>{return[costData,...prev]})
  }
  return (

      <NewCost onAddCostData = {addCostHandler}/>
      <Costs CostData = {costData} />

  );
}

export default App;

NewCost.jsx:
import React from 'react'
import CostForm from './CostForm'
function NewCost({onAddCostData}) {
  const saveCostDataHandler = (inputCostData) => {
    const costData = {
      ...inputCostData,
      id: Math.floor(Math.random().toString()*1000)
    }
    console.log(costData);
    onAddCostData(costData);
    console.log(costData.date);
  }
  return (

      <CostForm onSaveCostData = {saveCostDataHandler}/>

  )
}

export default NewCost

CostForm.jsx:
import React from "react";
import "./styles/CostForm.css";
function CostForm({onSaveCostData}) {
  //Hooks
  const [inputName, setInputName] = React.useState("");
  const [inputAmount, setInputAmount] = React.useState("");
  const [inputDate, setInputDate] = React.useState("");

  //Handler & Func
  const NameChangeHandler = (e) => {
    setInputName(e.target.value);
  };
  const AmountChangeHandler = (e) => {
    setInputAmount(e.target.value);
  };
  const DateChangeHandler = (e) => {
    setInputDate(e.target.value);

  };
  const submitHandler = (e) => {
    e.preventDefault();

    const costData = {
      name: inputName,
      cost: inputAmount,
      date: new Date(inputDate)
    }
    onSaveCostData(costData);

    setInputName('');
    setInputAmount('');
    setInputDate('');
  };
  //
  return (
    <form onSubmit={(e) => submitHandler(e)}>

          Name Cost
          <input
            type="text"
            name=""
            id=""
            value={inputName}
            onChange={(e) => NameChangeHandler(e)}
          />
          Cost
          <input
            type="number"
            name=""
            id=""
            min="0.1"
            step="0.1"
            value={inputAmount}
            onChange={(e) => AmountChangeHandler(e)}
          />
          Date
          <input
            type="date"
            name=""
            id=""
            value={inputDate}
            onChange={(e) => DateChangeHandler(e)}
          />

            <button className="new-cost__btnAdd" type="submit">
              Add Cost
            </button>
            <button className="new-cost__btnCancel">Cancel</button>

    </form>
  );
}

export default CostForm;

CostItem.jsx:
    import React from "react";
    import "./styles/CostItem.css";
    import CostDate from "./CostDate";
    import Card from "../UI/Card";
    function CostItem({ date, cost, name }) {
      return (
        <Card className="cost-item">
          <CostDate date = {date} />

{name}

            ${cost}

        </Card>
      );
    }

    export default CostItem;

CostDate.jsx:
import './styles/CostDate.css'
import React from 'react'

function CostDate({date}) {
    const month = date.toLocaleString('ru-RU', {month: "long"});
    const year = date.getFullYear();
    const day = date.toLocaleString('ru-RU', {day: "2-digit"});
    console.log(date);
  return (

{month}

{year}

{day}

  )
}
export default CostDate;

Costs.jsx
import React from "react";
import "./styles/Costs.css";
import CostItem from "./CostItem";
import CostFilter from "./CostFilter";
import Card from "../UI/Card";
function Costs({ CostData }) {
  const [filterValue, setFilterValue] = React.useState('');
  const FilterValueHandler = (filterData) => {
    setFilterValue(filterData);
  }
  return (<>
    <CostFilter onFilterValueHandler = {FilterValueHandler}/>
    <Card className="costs">

{filterValue}

      {CostData.map((data) => {
        return <CostItem date={data.date} name={data.name} cost={data.cost} />;
      })}
    </Card>
    </>
  );
}

export default Costs;


text:
Q: CQRS or App Service? So I like the concepts of CQRS in our application, mainly because we already support event sourcing (conceptually, not following any prescriptions that you see out there).  However, it really seems like CQRS is geared toward Big Data, Eventual consistency, that kind of thing.  We are always going to be a Relational DB app, so I am not sure if it fits.
I also have concerns because I think I need to do some special things in my app layer.  When doing a read, I need to enforce security and filter data, things that are traditionally implemented in the application layer.
My first question is, does my app fit (a traditional MVC / Relational DB app)?  Or does it make more sense to have a traditional app layer and use a DTO Mapper?
My second question is, does it make sense to issue commands to your domain model out of a traditional application layer?  I like the idea of commands / command handlers and eventing.
Let me clarify my question.  I have concerns around data filtering that are tied to authorization.  When a user requests data, there has to be a filter that restricts access to certain data elements by removing them all together (So they are not returned to the caller), hiding the values, or applying masks to the data.  In a contrived example, for a Social Security Number, the user making the request may only be able to see the last 4 numbers, so the result would appear like ###-##-1234.
My assertion is that this responsibility goes in the Application layer.  I consider this an aspect, where all responses to queries or commands have to go through this filter mechanism.  Here is where my CQRS naivity shines through, perhaps it is that commands never return data, just pointers to data that are looked up through the read model?
Thanks!

A: First and foremost: CQRS and Relational Databases don't exclude each other. In advanced scenarios it may make sense to replace the SQL-based DB with other means of storage, but CQRS as a concept doesn't care about the persistence mechanism.
In the case of multiple views that depend on roles and/or users, the Thin Read Layer should probably provide multiple result sets:

*

*One containing the full SSN for users that are authorized to access that information.

*A different one for users that are not authorized to see that information

*...

These can be stored in a separate data store, but they can also be provided through SQL views if you work with a single SQL-based database.
In CQRS the Application Service still exists in the form of Command Handlers. These can be nested, i.e. handling authorization first, then posting the command to a contained command handler.
public class AuthorizationHandler {

    public CrmAuthorizationService(CrmCommandHandler handler) {
        _next = handler;
    }

    public void Handle(SomeCommand c) {
        if (authorized) _next.Handle(c);
    }
}

// Usage:
var handler = new CrmAuthorizationService(new CrmCommandHandler());
bus.Register<SomeCommand>(handler.Handle);

This way you can nest multiple handlers, e.g. as a REST envelope, for logging, transactions, etc.
To answer your questions:
First: Is CQRS a good fit for your app? No-one can tell without really digging into the specific requirements. Just because you use MVC and a relational DB doesn't mean anything when it comes to the pros and cons of CQRS.
Second: Yes, in some cases it can make sense to let your application layer interact with the client in a classical way and handle things like authentication, authorization, etc., and then issue commands internally. This can be useful when putting an MVC-based UI or a REST API on top of your application.
Update in response to comment:
In an ideal, puristic CQRS scenario Sally would have her own denormalized data for every view, e.g. a couple of documents in a NoSQL DB called CustomerListForSally, CustomerDetailsForSally, etc. These are populated with what she's allowed to see.
Once she gets promoted - which would be an important domain event - all her denormalized data would automatically be overwritten, and extended to contain what she's allowed to see now.
Of course we must stay reasonable and pragmatic, but this ideal should be the general direction that we're heading for.
In reality you probably have some kind of user/role or user/group based system. To be able to view sensitive information, you'd have to be member of a particular role or group. Each of these could have their defined set of views and commands. This doesn't need t be denoalized data It can be as simpe as a cope of SQL-Views:

*

*CustomerDetailsForSupportStaff

*CustomerDetailsForSupportExecutive with unmasked SSN

*CustomerListForSupportStaff

*CustomerListForSupportExecutive with customer revenue totals

*etc.


text:
Q: scaling three columns out of the dataset effects on the data I have a dataset I'm working on and I applied the k-means algorithm. Since some values in certain columns where huge, I was advised to take the logarithm of each value in those columns (specifically three of them).
My question is: why can we only logarithmize those 'problematic' columns? Does this not affect the integrity of the dataset? And if it does, how is it affected?


text:
Q: ¿Cómo generar código alfanumerico en ASP.NET MVC? Necesito que se me genere un código alfanumerico al hacer un submit y sea insertado en un campo "Código verificación.
El Código serviría para que el usuario pueda verificar el estado de su solicitud, como funciona en las páginas de solicitud de visado, te dan dos códigos que te sirven de tracking para ver el estado de tu solicitud.
He buscado en la web, pero no termino de entender mucho o simplemente no es lo que ando buscando.
Espero logren ayudar.

A: Estás buscando un GUID. Los GUIDs se generan automáticamente y garantizan ser únicos, aunque no puedes cambiar su formato. Realmente no son únicos 100%, pero es muy muy muy poco probable que se generen dos GUIDs iguales. Hay mucha documentación escrita al respecto, por si quieres informarte más sobre el tema.
var code = Guid.NewGuid().ToString();

Esto te devuelve una cadena con el formato xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. Si quieres quitar los guiones, simplemente haz un replace.
code = code.Replace("-", string.Empty);


text:
Q: "Control enters method a" What does control mean in this context? From this page (Java Monitors Are Reentrant) there's a sentence that says:

Reentrant contains two synchronized methods: a and b. The first
  synchronized method, a, calls the other synchronized method, b.
When control enters method a, the current thread acquires the monitor
  for the Reentrant object.

What does the "control" refer to in the sentence "control enters method a"?

A: Control is "The place where the next instruction is going to be executed."  If you are familiar with Assembly Language, you can think of it as the value contained in the Program Counter register.
The term comes from the notion "Flow of Control," the specific order in which statements are executed to produce a computing result.
So when someone says that "Control enters method A," it means that method A is about to be executed.  Or, more specifically, the instructions or statements in method A are about to be executed.


text:
Q: Draw mouse pointer in a position without changing its actual position In my WPF application, I have a canvas with a grid in the background. The idea is, once the cursor has entered the canvas (and the mousemove event is being fired), to draw the mouse pointer  as it moves only in the grid intersection closest to its actual position, without - logically - changing it (since otherwise i would be stuck in an intersection and would never be able to calculate the proper intersection where it should be drawn), until it has reached an intersection closer to its actual position than the current one. Can't seem to use
Cursor.Draw()

because System.Drawing.Graphics is not WPF...


text:
Q: Flex Pan & Zoom with vector images I've looked at http://www.adobe.com/devnet/flex/samples/fig_panzoom/ for pan & zoom, and it does a very good job of it.  However, it only works with raster images.  Does anyone know how to modify this for vector images (SVG converted to SWF).
My limited attempts have not gone well, as the Imageviewer.as class is clearly designed around bitmaps.
I can load the SVG images in an Image, but I'd really like to pan & zoom too.
Thanks.

A: Have you looked at OpenZoom? AFAIK it supports anything that can be loaded on the stage.


text:
Q: Как изменить подсветку в web storm 2019 В проекте много тестовых файлов, которые web-storm почему-то подсвечивает ярким зелёным,на фоне которых остальные файлы теряются для глаза. Где можно изменить этот параметр? Мне не удалось его найти

A: Цвет можно настроить в Settings | Appearance & Behavior | File Colors, Tests


text:
Q: Why can't I start Eclipse and Minecraft at the same time? I'm running Java SE Development Kit Update 25 (64-bit).
It appears that I'm unable to run both Eclipse and Minecraft at the same time. This is really really weird, since I can easily start two instances of Minecraft (but not of Eclipse).
I'm guessing that the reason for this bug is that Eclipse is looking for other instances of itself when it starts (because it doesn't want to start more than once).
Is there any way to fix this?

A: You are running Java in a 64-bits environment, but are you allocating enough memory to it ?
The -Xms and -Xmx command line options could be what you need. They specify the initial and maximum size of the heap, respectively, and have low default values on some systems, depending on the way Java was installed.
I don't know what machine you run this on, and how much memory you can allocate, but if you use 64-bits architecture, I'd say java -Xms1G -Xmx3G is safe and will provide more space.


text:
Q: multiple response in single array in golang I am new to golang . and I want to get my response as multiple result. I do some method but I need to change that one
impartErrl := ph.profileService.ValidateSchema(gojsonschema.NewStringLoader(string(b)))
        if impartErrl != nil {
            ctx.JSON(http.StatusBadRequest, impart.ErrorResponse(impartErrl))
            return
        }

func (ps *profileService) ValidateSchema(document gojsonschema.JSONLoader) (errors []impart.Error) {
    result, err := gojsonschema.Validate(ps.schemaValidator, document)
    if err != nil {
        ps.SugaredLogger.Error(err.Error())
        return impart.ErrorResponse(
            impart.NewError(impart.ErrBadRequest, "unable to validate schema"),
        )
    }

    if result.Valid() {
        return nil
    }
    // msg := fmt.Sprintf("%v validations errors.\n", len(result.Errors()))
    msg := "validations errors"
    for i, desc := range result.Errors() {
        msg += fmt.Sprintf("%v: %s\n", i, desc)
        er := impart.NewError(impart.ErrValidationError, fmt.Sprintf("%s ", desc), impart.ErrorKey(desc.Field()))
        errors = append(errors, er)
    }
    return errors
}

func NewError(err error, msg string, args ...interface{}) Error {
    key := GetErrorKey(args...)
    return impartError{
        err: err,
        msg: msg,
        key: key,
    }
}

func ErrorResponse(err interface{}) []Error {
    var errorResponse []Error
    switch err.(type) {
    case Error:
        errorResponse = []Error{err.(Error)}
    case []Error:
        errorResponse = err.([]Error)
    default:
        errorResponse = []Error{
            NewError(ErrUnknown, fmt.Sprintf("%v", err)),
        }
    }
    return errorResponse
}

type Error interface {
    error
    HttpStatus() int
    ToJson() string
    Err() error
    Msg() string
}

Now I am getting the output as
[
    {
        "error": "validation error",
        "msg": "email: Does not match format 'email' ",
        "key": "email"
    },
    {
        "error": "validation error",
        "msg": "screenName: String length must be greater than or equal to 4 ",
        "key": "screenName"
    }
]

but I require my response as
{
     0 :{
            "error": "validation error",
            "msg": "email: Does not match format 'email' ",
            "key": "email"
        },
    1 : {
        "error": "unable to complete the request",
        "msg": "invalid screen name, must be alphanumeric characters only",
        "key": "screen_name"
    }

}

How can I get these type of response. ? because in ios app while parsing the response [] showing error. so I need to change the output.
please help me.

A: The ErrorResponse func should return a map[int]Error instead of []Error. As Example:
func ErrorResponse(err interface{}) map[int]Error {
    errorResponse := map[int]Error{}
    switch e := err.(type) {
    case Error:
        errorResponse[0] = e
    case []Error:
        for i, k := range e {
            errorResponse[i] = k
        }
    default:
        errorResponse[0] = NewError(ErrUnknown, fmt.Sprintf("%v", err))
    }
    return errorResponse
}


text:
Q: Changing color for different letters in python tkinter I want to use different colors for different letters.
For example a letter will be yellow and b letter will be blue in Text() widget.
For windows.
from tkinter import *

app = Tk()

txt = Text(app)
txt.pack()

app.mainloop()

How can I accomplish this?

A: You can use .tag_config(...) to apply colors on certain tags and then bind a <KeyRelease> event handler on Text widget to add tag on input using .tag_add(...).
Below is an example:
import tkinter as tk

# colors for certain characters
colormap = {'b':'blue', 'c':'cyan', 'g':'green', 'm':'magenta', 'o':'orange', 'p':'pink', 'r':'red', 'y':'yellow'}

def on_key(event):
    if event.char in colormap:
        # attach a tag (the character itself) if the character is in the colormap
        event.widget.tag_add(event.char, 'insert-1c')

root = tk.Tk()

text = tk.Text(root)
text.pack()
text.bind('<KeyRelease>', on_key) # on_key() will be executed when a key is pressed inside Text widget
# setup colors for certain characters using tag_config(...)
for c in colormap:
    text.tag_config(c, foreground=colormap[c])

root.mainloop()

A: import tkinter as tk

class Application(tk.Tk):

    def __init__(self, *args, **kwargs):
        tk.Tk.__init__(self, *args, **kwargs)
        self.title("Colorful text")
        self.geometry("256x64")
        self.resizable(width=False, height=False)

        self.text = tk.Text(self)
        self.text.pack()
        self.text.insert("end", "First Line\nSecond Line")

        self.apply_color()

    def apply_color(self):
        from itertools import cycle

        colors = ["Red", "Green", "Blue"]
        color_iterator = cycle(colors)

        # Get the string from the tk.Text widget.
        text_str = self.text.get("1.0", "end-1c")

        lines = text_str.splitlines(True)

        for line_index, line in enumerate(lines, start=1):
            for char_index, char in enumerate(line):
                if char.isspace():
                    # Ignore whitespace
                    continue
                color = next(color_iterator)
                self.text.tag_add(color, f"{line_index}.{char_index}")
        for color in colors:
            self.text.tag_config(color, foreground=color)

def main():

    application = Application()
    application.mainloop()

    return 0

if __name__ == "__main__":
    import sys
    sys.exit(main())


text:
Q: How do I search through all the parameters? I'm currently searching by name only. In addition, large and small letters are taken into account. How do I search in all the parameters of the user? and without taking into account the big and small letters?
I have the following options: lastName, company, title, email, phone, street, city, country.
dispatch => ({
    onFindPeople: (firstName) => {
        console.log(firstName);
        dispatch({ type: 'FIND_PEOPLE', payload: firstName})
    }
})

I added a sample code here

A: try
const isMatch = (user, filter) =>
  new RegExp(filter, "i").test(JSON.stringify(user));

state.allPeople.filter(user => isMatch(user, state.filterPeople));


text:
Q: The default action of a file input disappears while parent div return false I have a parent div which contains an input element, and every time the parent div is clicked, it returns false.

    <input  type="file" name="picture-label" >

$('body').on({
        click:function(){
            return false;
        }
},'.media-asset');

The problem is when the parent div returns false, the default action of a file input is gone, and it won't prompt the user to upload a file. Is it possible to manually trigger the default action of a file input?
$('body').on({
            click:function(){
                //manually trigger the file input
                return false;
            }
    },'.media-asset input');

The reason I let the parent div to return false is when the user click outside of the parent div, it would hide the parent div, and while the user click inside of the parent div, it would not hide itself.

A: No need to manually trigger it. Specify event.stopPropagation() on the '.media-asset input' click event and remove the return false from that as well:

event.stopPropagation()
Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
— event.stopPropagation() - jQuery API Documentation

$('body').on({
  click:function(){
    return false;
  }
},'.media-asset');

$('body').on({
  click:function(event){
    event.stopPropagation();
  }
},'.media-asset input');

    <input  type="file" name="picture-label" >


text:
Q: DirectShow stop/resume live stream I'm using DirectShow to play audio/video files in my application. I use IGraphBuilder::RenderFile() to build the filter graph and the IMediaControl interface to play/pause/stop the media. This works fine for local media files, but causes problems with live mms streams.
If I call IMediaControl::Stop() on a live stream, the stream will stop playing as expected. However, if I call IMediaControl::Run() to resume the stream, nothing happens. The graph generates an EC_COMPLETE event, but the video does not play anymore.
Calling IMediaControl::Pause() followed by IMediaControl::Run() will resume the stream where it left off, but will eventually stop. It seems to just playback the data that was in the buffer when IMediaControl::Pause() was called, instead of re-syncing with the live stream.
Does anybody know how to resume playing a live stream without destroying and rebuilding the filter graph?

A: *

*Why are you calling Stop()? you should call Pause()

*The DirectShow Filters for MMS are know to have problems with MMS, for starters they don't support the latest MMS 9 (that comes with Win 2003) protocol. You should use the Media Player Control or the Format SDK if you want proper support for MMS.

A: The behavior indicates that one of the filters in the graph exhibits buggy behavior. The filter has to be replaced if you want to be able to re-run the feed. Also there is no good source filter to render mms:// streams which are obsolete themselves as protocol. Windows Media Player in Windows 7 is using its private DirectShow filter which is not available to applications. You might end up using custom source filter based on Windows Media Format SDK, or a third party replacement.
UPDATE: In Windows XP, mms:// URLs are rednered by Windows Media Splitter filter (wmpasf.dll). It is obviously responsible for the bug in question. So, if you are still going to use it, you might have to remove, re-add a new instance of the filter and re-render its pins in order to restart streaming. As I mentioned, this filter is no longer available in more recent versions of Windows (Windows 7 at the very least).


text:
Q: Determine if $\left| {\mathop {\lim \sup }\limits_{n \to \infty } {A_n}\Delta \mathop {\lim \sup }\limits_{n \to \infty } {B_n}} \right| = 0$ The question is

Is $\left| {\mathop {\lim \sup }\limits_{n \to \infty } {A_n}\Delta \mathop {\lim \sup }\limits_{n \to \infty } {B_n}} \right| = 0$ if given $\left| {{A_n}\Delta {B_n}} \right| = 0$ and $\left| {\bigcup\nolimits_{n = 1}^\infty  {{A_n}} \Delta  \cup \bigcup\nolimits_{n = 1}^\infty  {{B_n}} } \right| = 0$?

Here $|*|$ means Lebesgue measure and $\Delta $ means symmetric difference, i.e. $A\Delta B = (A\backslash B) \cup (B\backslash A)$.
Let $E_1={\bigcup\nolimits_{n = 1}^\infty  {{A_n}} \Delta  \cup \bigcup\nolimits_{n = 1}^\infty  {{B_n}} }$, $E_2={\mathop {\lim \sup }\limits_{n \to \infty } {A_n}\Delta \mathop {\lim \sup }\limits_{n \to \infty } {B_n}} $.
I found neither $E_1\subseteq E_2$ nor $E_2\subseteq E_1$. If $x\in E_1$, then $x$ belongs to some $A_n$ but none of $B_n$ or vice versa. If $x\in E_2$, then $x$ belongs to infinite many $A_n$ but at most finite many $B_n$ or vise versa.
Then $x\in E_1$ cannot imply $x\in E_2$ if $x$ only appears in finite many $A_n$ or $B_n$; $x\in E_2$ cannot imply $x\in E_1$ if $x$ appears if $x$ appears in both some $A_n$ and some $B_n$.
But $E_1$ and $E_2$ has an intersection in which $x$ belongs to infinite many $A_n$ but none of $B_n$ or vise versa, and the measure of this intersection is zero since it is a subset of $E_1$.
How do I go on from here to infer if $E_2$ has measure zero or not? Or there is other way to solve it? Thank you!

A: The crucial property is $\lvert A_n \triangle B_n\rvert = 0$ for all $n$. That means that $A_n$ and $B_n$ are "essentially the same set", and in any countable sequence of operations, replacing $A_n$ with $B_n$ can only lead to changes of measure $0$.
To make things precise, define $C_n = A_n \cap B_n$, and $M_n = A_n \setminus C_n$, $N_n = B_n \setminus C_n$. By definition, $A_n \triangle B_n = M_n \cup N_n$, so $M_n$ and $N_n$ are null sets. Hence $M = \bigcup M_n$ and $N = \bigcup N_n$ are null sets.
For the task at hand, recall the definition of the limes superior of a sequence of sets,
$$\limsup_{n\to\infty} A_n = \bigcap_{n = 1}^\infty \Biggl(\bigcup_{k = n}^\infty A_k\Biggr).$$
Since we have $C_k \subset A_k$ for all $k$, we have
$$\bigcup_{k = n}^\infty C_k \subset \bigcup_{k = n}^\infty A_k$$
for all $n$, whence
$$\limsup_{n\to\infty} C_n \subset \limsup_{n\to\infty} A_n.$$
But we also have $A_k = C_k \cup M_k \subset C_k \cup M$ for all $k$, so
$$\bigcup_{k = n}^\infty A_k \subset \bigcup_{k = n}^\infty (C_k\cup M) = M \cup \bigcup_{k = n}^\infty C_k,$$
and therefore
$$\limsup_{n\to\infty} A_n = \bigcap_{n = 1}^\infty \Biggr(\bigcup_{k = n}^\infty A_k\Biggr) \subset \bigcap_{n = 1}^\infty \Biggr( M \cup \bigcup_{k = n}^\infty C_k\Biggr) = M \cup \bigcap_{n = 1}^\infty \Biggr(\bigcup_{k = n}^\infty C_k\Biggr) = M \cup \limsup_{n\to\infty} C_n.$$
So $\limsup\limits_{n\to\infty} A_n$ and $\limsup\limits_{n\to\infty} C_n$ differ only by a null set (a subset of $M$).
Doing the same for $\limsup\limits_{n\to \infty} B_n$ shows that indeed
$$\Bigl\lvert \limsup_{n\to\infty} A_n \triangle \limsup_{n\to\infty} B_n \Bigr\rvert = 0.$$


text:
Q: LC3 Assembly Programming Error: constant outside of allowed range I have a simple demo assembly program named as a.asm:
bash-3.2$ cat a.asm
; demo program:

; R1 contains INPUT A, for example, x0001

; R2 contains INPUT B, for example, #-1 (xFFFF)

; R3 contains the result of subtraction of two numbers

.ORIG       x3000                     ; Program storage location

            LD    R1,INPUT1           ; R1 contains input number
            LD    R2,INPUT2           ; R2 contains -1
            ADD   R3,R1,R2            ; R3 contains result of A-B
            TRAP x25

INPUT1     .FILL  x0001               ; Input #1

INPUT2     .FILL  xFFFF               ; 2's complement of 1 (i.e. #-1)

.END

bash-3.2$ lc3as a.asm
STARTING PASS 1
14: constant outside of allowed range
1 errors found in first pass.
bash-3.2$
If I change xFFFF to #-1, the error would go away and the program worked as expected:
bash-3.2$ lc3as a.asm
STARTING PASS 1
0 errors found in first pass.
STARTING PASS 2
0 errors found in second pass.
bash-3.2$
What is wrong with the line: "INPUT2        .FILL      xFFFF" ?


text:
Q: How can I validate all the mandatory fields in POST request using postman automation I want to validate whether all the fields in the request body are mandatory or not using Postman automation
example:
{
    "id": "A123",
    "Name": "Ravi",
    "registered": "Yes",
    "address_attributes": {
    "address": "Karnataka",
    "pincode": 123456
  }
}

I have a request like this, I want to remove each field at a time and send the request.
first request:
{
    "Name": "Ravi",
    "registered": "Yes",
    "address_attributes": {
    "address": "Karnataka",
    "pincode": 123456
  }
}

second request:
{
    "id": "A123",
    "registered": "Yes",
    "address_attributes": {
    "address": "Karnataka",
    "pincode": 123456
  }
}

and follows..
Appreciate the help

A: You could add something like this to the Pre-request Script:
pm.test("Check request properties", () => {
    let requestData = JSON.parse(pm.request.body.raw)
    pm.expect(requestData).to.have.keys(['id', 'Name', 'registered', 'address_attributes'])
    pm.expect(_.get(requestData, 'address_attributes')).to.have.keys(['address','pincode'])
})

There's probably an easier and cleaner way of doing it though.


text:
Q: Presenting Storyboard ViewController Error Only for iOS 13 I'm trying to present a ViewController I created in storyboard programmatically in iOS 13 but it keeps crashing. The identifier is correct because works for iOS 12, just not 13. It crashes at where I instantiateViewController.
 @IBAction func addStock(_ sender: Any) {
    let storyBoard = UIStoryboard(name: "Main", bundle: nil)
    let searchVC = storyBoard.instantiateViewController(withIdentifier: "SearchViewController") as! SearchViewController

    searchVC.delegate = self
    let navController = UINavigationController(rootViewController: searchVC)

    present(navController, animated: true, completion: nil)
}


text:
Q: How to Get Auth::User() Array Elements Value in Laravel I want to get array elements value in Auth::User(). After
{{dd(Auth::User()}} output of array shows many elements:
  Admin {#474 ▼
  #guard: "admin"
  #fillable: array:4 [▶]
  #hidden: array:2 [▶]
  #connection: "mysql"
  #table: null
  #primaryKey: "id"
  #keyType: "int"
  +incrementing: true
  #with: []

I'm trying to access using Auth::user()->guard; this but it does not work for me. Please tell me how to get this. Many Thanks in Advance.

A: Check this function. It checks the current logged in user against all guard. Here I used dd to dump the logged in guard. But you can extract and utilize it to do whatever you want.
  $guards = array_keys(config('auth.guards'));
  foreach ($guards as $guard) {
    if(Auth::guard($guard)->check()) dd($guard);
  }


text:
Q: Can docker-compose profiles be used together with docker-compose override to have a common code with configurable environments? I have the requirement of having a unique docker-compose.yaml / infrastrucutre code which will be versioned across the different deployment stages.
I would like to have some ports exposed in development and not in production. As I learned from other questions this seems to not be possible (using the same .env file that is used to configure other environment variables for the containers).
My idea would be to have my docker-compose.yaml, for example:
version: "3.9"
services:
  myservice:
    image: myimage
    # **
    # configuration
    # **
    ports:
        - 80:80
        - 19980:19980

Then in production overrideit with a profile docker-compose.production.yaml
version: "3.9"
services:
  myservice:
    profiles:
      - production
    ports:
        - 80:80

This would allow to have always the same configuration (both .yamlf iles) and switch between them by just calling the docker-compose up command with the production profile (--profile).
My question is, does this work as expected or is the service always overwritten also when the profile flag is not provided?

A: Compose profiles only affect which services start; they do not have any effect on the options those services use.  If you have multiple Compose files then the options in those files are merged according to a set of rules.  My expectation is that this would take effect before the profile selection took place.
What you're describing seems like a fairly routine setup for multiple Compose files, without using the profile feature.  The most common case I've seen is that a "development" setup strictly adds options to a "production" setup.  In your example, both "production" and "development" publish port 80, but only development also publishes the debugger port.  There also might be additional environment variables or bind mounts that only make sense in development, but you (usually) are not trying to remove values.
So in this setup, your base docker-compose.yml file would contain the production setup, with the minimum values that are used in all environments.
# docker-compose.yml
version: '3.8'
services:
  myservice:
    image: myimage
    ports:
      - '80:80'

Then you'd have a second file that only has the options that are added for the development setup:
# docker-compose.dev.yml / docker-compose.override.yml (see below)
version: '3.8'
services:
  myservice:
    # (do not need to repeat `image:`; could add `build:`)
    ports:
      - '19980:19980'

If you name the file docker-compose.override.yml, Compose will use both files automatically, and you need to make sure to push the base file but not the override file to the production environment.
# uses both files, if docker-compose.override.yml is present
docker-compose up -d

If you name it something else, you need to explicitly name all of the files with docker-compose -f options, on every Compose invocation.
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
docker-compose -f docker-compose.yml -f docker-compose.dev.yml ps

(Or you can set the $COMPOSE_FILE environment variable, but you have to remember to set it in every shell session in every environment.)


text:
Q: How to parallelize file downloads? I can download a file at a time with:
import urllib.request

urls = ['foo.com/bar.gz', 'foobar.com/barfoo.gz', 'bar.com/foo.gz']

for u in urls:
  urllib.request.urlretrieve(u)

I could try to subprocess it as such:
import subprocess
import os

def parallelized_commandline(command, files, max_processes=2):
    processes = set()
    for name in files:
        processes.add(subprocess.Popen([command, name]))
        if len(processes) >= max_processes:
            os.wait()
            processes.difference_update(
                [p for p in processes if p.poll() is not None])

    #Check if all the child processes were closed
    for p in processes:
        if p.poll() is None:
            p.wait()

urls = ['http://www.statmt.org/wmt15/training-monolingual-nc-v10/news-commentary-v10.en.gz',
'http://www.statmt.org/wmt15/training-monolingual-nc-v10/news-commentary-v10.cs.gz',
'http://www.statmt.org/wmt15/training-monolingual-nc-v10/news-commentary-v10.de.gz']

parallelized_commandline('wget', urls)

Is there any way to parallelize urlretrieve without using os.system or subprocess to cheat?
Given that I must resort to the "cheat" for now, is subprocess.Popen the right way to download the data?
When using the parallelized_commandline() above, it's using multi-thread but not multi-core for the wget, is that normal? Is there a way to make it multi-core instead of multi-thread?

A: You could use a thread pool to download files in parallel:
#!/usr/bin/env python3
from multiprocessing.dummy import Pool # use threads for I/O bound tasks
from urllib.request import urlretrieve

urls = [...]
result = Pool(4).map(urlretrieve, urls) # download 4 files at a time

You could also download several files at once in a single thread using asyncio:
#!/usr/bin/env python3
import asyncio
import logging
from contextlib import closing
import aiohttp # $ pip install aiohttp

@asyncio.coroutine
def download(url, session, semaphore, chunk_size=1<<15):
    with (yield from semaphore): # limit number of concurrent downloads
        filename = url2filename(url)
        logging.info('downloading %s', filename)
        response = yield from session.get(url)
        with closing(response), open(filename, 'wb') as file:
            while True: # save file
                chunk = yield from response.content.read(chunk_size)
                if not chunk:
                    break
                file.write(chunk)
        logging.info('done %s', filename)
    return filename, (response.status, tuple(response.headers.items()))

urls = [...]
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s')
with closing(asyncio.get_event_loop()) as loop, \
     closing(aiohttp.ClientSession()) as session:
    semaphore = asyncio.Semaphore(4)
    download_tasks = (download(url, session, semaphore) for url in urls)
    result = loop.run_until_complete(asyncio.gather(*download_tasks))

where url2filename() is defined here.


text:
Q: Iterating through a PHP array and extracting values I'm trying to create a menu page that is divided by menu type (div_id) and item type (grp_id), and displays the item info: title, description, price, etc.  Something like the following, though each grp_id should be in it's own html table (e.g. "Beer - bottled" all items listed in one table, "Beer - draft" in another). Also, each menu (e.g. Beverages, Salads, etc.) should be in a separate accordion window:
Beverages
Beer - bottled
Killian's : $4.75
Molson : $4.75
Peroni : $6.00
Beer - draft
Guiness : $5.50
Wine - red
Banfi, "Colle di Sasso", Italy : $15.75
Bell'agio, Chianti, Italy : $16.95
Wine - white
Beringer, Moscato, Califormia : $14.95
Placido, Pinot Grigio, Italy : $14.95
Salads
Antipasto Salad : $6.25
Grilled Chicken Salad : $7.95
Mesclun Side Salad : $4.95
And so on...
The data is in a MYSQL table:
Column  Type    Null    Default
menu_id int(10)     No
div_id  int(10)     No
grp_id  int(10)     Yes     NULL
cat_id  int(10)     Yes     NULL
date_b  date    No
date_e  date    No
price   float(6,2)  Yes     NULL
price2  float(6,2)  Yes     NULL
price3  float(6,2)  Yes     NULL
title   varchar(255)    No
descr   text    Yes     NULL
special enum('n', 'y')  No      n
ordr    int(4)  No      10
div_id, grp_id, and cat_id are foreign keys whose tables contain the menu type (div_id)(div_name) and item type (grp_id)(grp_name).
In trying to do accomplish this I have queried the DB like this:
$query_listMenu = sprintf("SELECT menu.menu_id, menu.div_id, m_div.div_name, menu.grp_id, m_grp.grp_name, menu.cat_id, m_cat.cat_name, m_cat.cat_ord, menu.title, menu.descr, menu.price, menu.price2, menu.price3, menu.date_b, menu.date_e
FROM menu
LEFT JOIN m_div ON ( menu.div_id = m_div.div_id )
LEFT JOIN m_grp ON ( menu.grp_id = m_grp.grp_id )
LEFT JOIN m_cat ON ( menu.cat_id = m_cat.cat_id )
WHERE menu.date_e >= NOW()
ORDER BY m_div.div_name, ordr, m_grp.grp_name, menu.title");

dumping the results into a multidimensional array $menuRows
$listMenu = mysql_query($query_listMenu, $siteuser);
while ( $row = mysql_fetch_array($listMenu, MYSQL_ASSOC) )
{
$menuRows[] = $row;
}

Here is the code I have used to iterate through the array and display the contents, but it's not working correctly:
foreach ($menuRows as $section => $type) {
echo "
" . $type['div_name'] . "
";
echo "
";
echo "
" . $type['grp_name'] . "
";
foreach ($menuRows as $menu => $item) {
    if ($item['div_name'] == $type['div_name']) {
        echo "
" . $item['title'] . "" . $item['descr'] . "	" . $item['price'] . "	" . $item['price2'] . "	" . $item['price3'] . "
";
}
} echo '
';
}

The problem is that each menu is repeated as many times as there are items within the category.  For example, Beverages has 8 items, so the Beverages section is repeated 8 times.  Every category entry repeats equal to the number of items in that category.  This clearly is the result of having the nested foreach functions, but I can't figure out the right code.
Also, the code shown does not filter based on grp_name, so all beverages are ending up in one html table, beer and wine.  Though Wine - red will have its own table, just like Beer - draft, all beverages will be repeated in each.
Any help would be much appreciated.

A: If you want to subsection your rows like that, you need to create the array how you want it, not just dump the data in. For instance, to get you started, this is how you would create an item:
while ( $row = mysql_fetch_array($listMenu, MYSQL_ASSOC) )
{
    $item = array('title'=>$row['title'],'descr'=>$row['descr'],'price'=>$row['price'],'price2'=>$row['price2'],'price3'=>$row['price3']);

    $menuRows[$row['div_name']][$row['grp_name']][] = $item;

}

Then inside that same while loop, you would assign that item to a group array, and then that to a menu array. Your array will eventually look like this:
$menuRows = array(
    'menu1'=>array(
        'group1'=>array($item1, $item2, $item3),
        'group2'=>array($item4, $item5, $item6)
    ),
    'menu2'=>array(
        'group3'=>array($item7, $item8, $item9)
)

Once your array is built, you would use your foreach like this:
foreach($menuRows as $divname=>$grp){
  // echo out what you want... contains Beverages, Salads
  foreach($grp as $grpName=>$itemArr){
     // again, echo out the divs
     foreach($itemArr as $item{
       // and now you can echo out your items
     }
  }
}


text:
Q: Add references from copied package.config I want to copy packages.config of a project into newly created project and add reference with it in VS2015 SP3.
This post introduces Update-Package -Reinstall -ProjectName Your.Project.Name but it does not work as I expected. Not all packages are added to project even though it has same build environment (.NET 4.5.2 Console App). Moreover, it overwrites packages.config to only added packages after the reinstall process.
How to do it correctly?
+ Append Below is my actual packages.config content.
<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net452" />
  <package id="Microsoft.Azure.WebJobs" version="1.1.2" targetFramework="net452" />
  <package id="Microsoft.Azure.WebJobs.Core" version="1.1.2" targetFramework="net452" />
  <package id="Microsoft.Azure.WebJobs.Extensions" version="1.0.1" targetFramework="net452" />
  <package id="Microsoft.Data.Edm" version="5.8.1" targetFramework="net452" />
  <package id="Microsoft.Data.OData" version="5.8.1" targetFramework="net452" />
  <package id="Microsoft.Data.Services.Client" version="5.8.1" targetFramework="net452" />
  <package id="Microsoft.EntityFrameworkCore" version="1.1.0" targetFramework="net452" />
  <package id="Microsoft.EntityFrameworkCore.Relational" version="1.1.0" targetFramework="net452" />
  <package id="Microsoft.EntityFrameworkCore.SqlServer" version="1.1.0" targetFramework="net452" />
  <package id="Microsoft.Extensions.Caching.Abstractions" version="1.1.0" targetFramework="net452" />
  <package id="Microsoft.Extensions.Caching.Memory" version="1.1.0" targetFramework="net452" />
  <package id="Microsoft.Extensions.DependencyInjection" version="1.1.0" targetFramework="net452" />
  <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="1.1.0" targetFramework="net452" />
  <package id="Microsoft.Extensions.Logging" version="1.1.0" targetFramework="net452" />
  <package id="Microsoft.Extensions.Logging.Abstractions" version="1.1.0" targetFramework="net452" />
  <package id="Microsoft.Extensions.Options" version="1.1.0" targetFramework="net452" />
  <package id="Microsoft.Extensions.Primitives" version="1.1.0" targetFramework="net452" />
  <package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net452" />
  <package id="Microsoft.Tpl.Dataflow" version="4.5.24" targetFramework="net452" />
  <package id="Microsoft.Web.WebJobs.Publish" version="1.0.12" targetFramework="net452" />
  <package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.3" targetFramework="net452" />
  <package id="ncrontab" version="2.0.0" targetFramework="net452" />
  <package id="NETStandard.Library" version="1.6.1" targetFramework="net452" />
  <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
  <package id="Remotion.Linq" version="2.1.1" targetFramework="net452" />
  <package id="SimpleInjector" version="3.3.2" targetFramework="net452" />
  <package id="SimpleInjector.Extensions.ExecutionContextScoping" version="3.3.2" targetFramework="net452" />
  <package id="SlowCheetah" version="2.5.15" targetFramework="net452" />
  <package id="System.Collections" version="4.3.0" targetFramework="net452" />
  <package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net452" />
  <package id="System.Collections.Immutable" version="1.3.1" targetFramework="net452" />
  <package id="System.ComponentModel" version="4.3.0" targetFramework="net452" />
  <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net452" />
  <package id="System.Diagnostics.DiagnosticSource" version="4.3.0" targetFramework="net452" />
  <package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net452" />
  <package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net452" />
  <package id="System.Globalization" version="4.3.0" targetFramework="net452" />
  <package id="System.Interactive.Async" version="3.0.0" targetFramework="net452" />
  <package id="System.IO" version="4.3.0" targetFramework="net452" />
  <package id="System.IO.Compression" version="4.3.0" targetFramework="net452" />
  <package id="System.Linq" version="4.3.0" targetFramework="net452" />
  <package id="System.Linq.Expressions" version="4.3.0" targetFramework="net452" />
  <package id="System.Linq.Queryable" version="4.3.0" targetFramework="net452" />
  <package id="System.Net.Http" version="4.3.0" targetFramework="net452" />
  <package id="System.Net.Primitives" version="4.3.0" targetFramework="net452" />
  <package id="System.ObjectModel" version="4.3.0" targetFramework="net452" />
  <package id="System.Reflection" version="4.3.0" targetFramework="net452" />
  <package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net452" />
  <package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net452" />
  <package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net452" />
  <package id="System.Runtime" version="4.3.0" targetFramework="net452" />
  <package id="System.Runtime.CompilerServices.Unsafe" version="4.3.0" targetFramework="net452" />
  <package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net452" />
  <package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net452" />
  <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net452" />
  <package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net452" />
  <package id="System.Spatial" version="5.8.1" targetFramework="net452" />
  <package id="System.Text.Encoding" version="4.3.0" targetFramework="net452" />
  <package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net452" />
  <package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net452" />
  <package id="System.Threading" version="4.3.0" targetFramework="net452" />
  <package id="System.Threading.Tasks" version="4.3.0" targetFramework="net452" />
  <package id="System.Threading.Timer" version="4.3.0" targetFramework="net452" />
  <package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net452" />
  <package id="System.Xml.XDocument" version="4.3.0" targetFramework="net452" />
  <package id="WindowsAzure.Storage" version="8.0.1" targetFramework="net452" />
</packages>

A: Please accept the Reload or Reload All after the reinstall process complete.
I got the same result after accept the Reload or Reload All to load the update project from disk in the process of reinstalling. Because your project is unload after accept the Reload or Reload All and the process of reinstalling is in progress. The packages could not be installed to the project during the project unload, NuGet will over write the package.config to only added packages before project unload.
The solution for this issue is that accept the Reload or Reload All after the reinstall process complete.
Update
There are different prompt for Conflicting File Modification Detected during the reinstalling. Please accept Reload or Overwrite after the reinstall process complete.


text:
Q: How to check for revocation list only from the CRL? I am using WinVerifyTrust to verify a file signature.
the connection to the internet is very bad so I want to check only the local cache.
The problem is that I am confused about how should I set the parameters in WinTrustData
regarding fdwRevocationChecks - the documentation is as following:

No additional revocation checking will be done when the WTD_REVOKE_NONE flag is used in conjunction with the HTTPSPROV_ACTION value set in the pgActionID parameter of the WinVerifyTrust function. To ensure the WinVerifyTrust function does not attempt any network retrieval when verifying code signatures, WTD_CACHE_ONLY_URL_RETRIEVAL must be set in the dwProvFlags parameter.

What does it mean "No additional revocation checking" - in addition to what? does it make revocation checks using the CRL? if I set this field to *WTD_REVOKE_WHOLECHAIN* will it check online too?
If I set WTD_CACHE_ONLY_URL_RETRIEVAL does it enough in order to make sure that it won't attempt to get the revocation list from the internet?
bottom line: how do I make sure that the there is a CRL check, but there isn't any online check.
Thanks

A: You should set fdwRevocationChecks to WTD_REVOKE_NONE and also add the WTD_CACHE_ONLY_URL_RETRIEVAL flag to dwProvFlags. This will make sure that WinVerifyTrust will look only in the cached CRL when verifying embedded signature.


text:
Q: How to authenticate with Microsoft Graph API in backend jobs I have a scenario in which users have a calendar on my Laravel web app. As a feature, I'd like to offer a sync between the website app calendar and their Outlook calendar. Now the plan was to add a button where users can authorize and then I take it from there. (Important is that these users are from different organisations. So I can't just ask for the admin permission once)
Every night I would run a cronjob that syncs events from my end to the Outlook calendar.
The past few hours, I've been digging in the docs but I can't seem to find an ideal situation for me. If I work with refresh tokens, people say I can't save that in my database because it is unsafe.
Can you guys help me and point me in the right direction? I have already tried with the refresh tokens, which works. But is deemed to be unsafe
Thanks!


text:
Q: Select IN with same order with Django? I would like to select items in my table in a custom order,
with SQL, if you do not specify an order, ascending primary key is used so the 'IN' order is lost.
I read in SO that one can use this SQL request to keep the 'IN' order :
SELECT * FROM table WHERE id IN (118,17,113,23,72) ORDER BY FIELD(id,118,17,113,23,72)

Now, how can I do to code this request within django ?
NOTE : I do not want to use .in_bulk() queryset method because I want SQL to do the job.

A: You can do this using the raw() manager method in Django 1.2+.
ids = "118,17,113,23,72"
results = MyModel.objects.raw('SELECT * FROM myapp_mymodel WHERE `id` IN (%s) '
                              'ORDER BY FIELD (id, %s)' % (ids, ids))

A few notes:

*

*This is potentially vulnerable to SQL injection attacks, because you can't use the parameter handling for the ORDER BY element. Be sure to sanitise the ids list.

*raw() doesn't cache queries like a normal queryset - it will re-evaluate the query every time you iterate it. If you need the values more than once, call list() on it first.

*ORDER BY FIELD is a MySQL-specific extension.

*Also note that your final request doesn't make sense: in_bulk() does use SQL to do the job. However, it isn't suitable for your query anyway.

A: I've tried this:
from django.db.models import Q
# first you get the IDs
ids = [1,2,3,4,5]
# after that you can get a list of Q objects
q_objects = [Q(id=id) for id in ids]
# then you need to combine all the Q objects
# I'll use a functional approach, an operation called fold_left but you can use a for instead

# i need the first element
first_q = q_objects.pop()
final_q = reduce(lambda total,q: total | q,q_objects,first_q)
# now you can get the result
MyModel.objects.filter(q)
#if you need an order simply append order_by
MyModel.objects.filter(q).order_by(something)

Anyway, take a look at the query performed by in_bulk, becouse it does use the IN SQL clause. This is a test with django 1.3 and MySQL:
python manage.py shell

>>> from testapp.models import Car
>>> from django.db import connection
>>> cars = Car.objects.in_bulk([1,2])
>>> my_queries = connection.queries
>>> my_queries[0]['sql']

This is the SQL result:
SELECT [fields]
FROM [my_table] WHERE [my_model].`id` IN (1, 2)

Of course you could only use django_toolbar.


text:
Q: Programmatically retrieving ECID of iphone Is there a way to find the ECID of a iPhone programmatically?
I know that this is the same question as https://stackoverflow.com/questions/4978725/calling-amdevicecopyvalue-from-mobiledeviceframework-help-please/30481898#30481898 but the answers there use IOKit which has been depreciated. so is there any other way to it.
Can this be done in iOS7?

A: Could you give us an idea what you need the ECID for?
Apple no longer allow of the usage of unique device ID's, the best you can get is the Vendor ID see the docs here.  (Assuming you are going to be submitting to the app store). Also this ID value may change on app reinstall, which may or may not be a problem for you.
The exception to this is the Advertising ID but they may only be used for serving advertisements, see here.
You could also use NSUUID to generate you own ID string, see docs here.
Also, saving whatever ID value you use in the keychain will allow persistance through app reinstalls. Keychain docs are here.


text:
Q: How to move cell data so that it becomes a column header and move other cell data under it? The best way to articulate what I am trying to do is by referring to the screenshot
I need to move the green cells in column A so that each one becomes a column header as shown. Additionally, I need to place any and all red cells that fall BELOW each green cell in column A under the respective column header as shown.
I was successful in writing a function to move one green cell into a column header and one red cell under it but I can't figure out how to repeat it for the rest. This is what I have tried:
function OrganizeResults(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var results = ss.getSheetByName("results");
var rowCombos = sheet.getLastRow();
var resultsRows = results.getLastRow();
var red = sheet.getRange(2,5).getBackgroundColor();
var green = sheet.getRange(2,2).getBackgroundColor()

for (i=1; i<=resultsRows; i++) {
for (n=2; n<=resultsRows; n++){

if (green == results.getRange(i,1).getBackgroundColor())
{
var row = results.getRange(i,2).getValue();
if (red == results.getRange(n,1).getBackgroundColor())
{
var redrow = results.getRange(n,2).getValue();
if (row < redrow)
{
   results.getRange(1,3).setBackgroundColor(green).setValue(
        results.getRange(i,1).getValue()) &&
        results.getRange(2,3).setBackgroundColor(red).setValue(
          results.getRange(n,1).getValue());

}
}

}
}
}

Interestingly, the function places each green cell in C1 (starting with the first) then each red cell in C2 and iterates through each one thereafter. I can't get it to place them and leave them and move on to the next column.

A:
This is before running the script.
function redgreenshow()
{
  var colvA=[];
  var colcA=[];
  for(var i=0;i<10;i++) //initialized output array to keep from having to mess with that
  {
    colvA[i]=[];
    colcA[i]=[];
    for(var j=0;j<10;j++)
    {
      colvA[i][j]=' ';
      colcA[i][j]=' ';
    }
  }
  var s = '';
  var sht=SpreadsheetApp.getActiveSheet();
  var rng=sht.getDataRange();
  var rngcA=rng.getBackgrounds();
  var rngvA=rng.getValues();
  var cidx=0;
  for(var i=0;i<rngcA.length;i++)
  {
    if(rngcA[i][0]=='#00ff00')//finds the greenies
    {
      var ridx=0;
      colvA[ridx][cidx]=rngvA[i][0];//store greenie value
      colcA[ridx][cidx]=rngcA[i][0];//store greenie color
      ridx++;
      for(var j=i+1;j<rngcA.length;j++)
      {
          if(rngcA[j][0]=='#ff0000')//finds the reddies below the greenie
          {
            colvA[ridx][cidx]=rngvA[j][0];//store reddy value
            colcA[ridx][cidx]=rngcA[j][0];//store reddy color
            ridx++;
          }

        }
        s+='colvA[' + ridx + '][' + cidx + ']=' + colvA[ridx][cidx] + '
colcA[' + ridx + '][' + cidx + ']=' + colcA[ridx][cidx] + '
';
        cidx++;
      }
    }
    var outrng = sht.getRange(1, 3, 10, 10);//10 x 10 because I initialize that way.
    outrng.setValues(colvA);//set the values
    outrng.setBackgrounds(colcA);//set the colors

}

After running the script.


text:
Q: DexPathList error popped up and now crashes my app out of the blue I am using Android Studio 2.2.3. This issue came up all of a sudden without me changing a single piece of code.
FATAL EXCEPTION: main
                                                                     Process: com.grassroots.gruapp, PID: 5462
                                                                     java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
                                                                         at android.app.ActivityThread.installProvider(ActivityThread.java:5103)
                                                                         at android.app.ActivityThread.installContentProviders(ActivityThread.java:4698)
                                                                         at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4638)
                                                                         at android.app.ActivityThread.access$1500(ActivityThread.java:155)
                                                                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1384)
                                                                         at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                         at android.os.Looper.loop(Looper.java:135)
                                                                         at android.app.ActivityThread.main(ActivityThread.java:5376)
                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                         at java.lang.reflect.Method.invoke(Method.java:372)
                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
                                                                      Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/com.grassroots.gruapp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.grassroots.gruapp-1/lib/arm, /vendor/lib, /system/lib]]
                                                                         at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                         at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                                         at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                                         at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
                                                                         at android.app.ActivityThread.installProvider(ActivityThread.java:5103)
                                                                         at android.app.ActivityThread.installContentProviders(ActivityThread.java:4698)
                                                                         at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4638)
                                                                         at android.app.ActivityThread.access$1500(ActivityThread.java:155)
                                                                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1384)
                                                                         at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                         at android.os.Looper.loop(Looper.java:135)
                                                                         at android.app.ActivityThread.main(ActivityThread.java:5376)
                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                         at java.lang.reflect.Method.invoke(Method.java:372)
                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
                                                                        Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.common.internal.zzbq
                                                                         at java.lang.Class.classForName(Native Method)
                                                                         at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                                                         at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                                                         at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                                                                                ... 14 more
                                                                      Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

I have tried on multiple machines, recloned my project, tried a different stable branch, tried running on emulators. Note: I have enabled multiDex and double checked my dependencies also.
I have 4 modules in the project, with the following dependencies
dependencies {
    compile project(':aPdfLib')
    compile project(':glibs')
    compile files('libs/BrotherPrintLibrary.jar')
    compile files('libs/MobilePrintLib.jar')
    compile files('libs/RequestService.jar')
    compile files('libs/android-async-http-1.4.2.jar')
    compile files('libs/mint-5.1.0.jar')
    compile files('libs/jsoup-1.7.2.jar')
    compile files('libs/junit-4.11.jar')
    compile files('libs/ksoap2-android-assembly-2.6.5-jar-with-dependencies.jar')
    compile files('libs/magtek-scra.jar')
    compile files('libs/org.apache.http.legacy.jar')
    compile files('libs/swiperapi-android-4.3.2.jar')
    compile files('libs/aws-android-sdk-core-2.2.10.jar')
    compile files('libs/aws-android-sdk-ses-2.2.10.jar')
    compile files('libs/mail.jar')
    compile files('libs/activation.jar')
    compile files('libs/additionnal.jar')
    compile files('libs/logback-android-1.1.1-5.jar')
    compile files('libs/slf4j-api-1.7.21.jar')
    compile files('libs/log4j-1.2.17.jar')
    compile files('libs/android-logging-log4j-1.0.3.jar')

    compile 'com.paypal.sdk:paypal-android-sdk:2.15.3'

    compile 'com.braintreepayments.api:drop-in:3.+'

    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.github.MKergall:osmbonuspack:6.3'
    compile 'org.osmdroid:osmdroid-third-party:5.6.4'
    compile 'com.squareup:android-times-square:1.6.5@aar'

    compile 'com.google.dagger:dagger:2.9'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
    provided 'javax.annotation:jsr250-api:1.0'

    compile 'joda-time:joda-time:2.2'

    compile 'com.android.support:design:26.0.1'
    compile 'com.android.support:support-v4:26.0.1'

    debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
    releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'

    compile 'com.jakewharton.hugo:hugo-runtime:1.2.1'
    debugCompile 'com.jakewharton.hugo:hugo-runtime:1.2.1'
    compile 'com.jakewharton:butterknife:8.5.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'

    compile 'com.github.GrenderG:Toasty:1.1.4'

    compile 'org.sufficientlysecure:html-textview:3.4'
}

2.)

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.0.1'
    testCompile 'junit:junit:4.12'

    //gson
    compile 'com.google.code.gson:gson:2.8.0'

    //streaming
    compile 'com.annimon:stream:1.1.5'

    //dagger
    compile 'com.google.dagger:dagger:2.9'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
    provided 'javax.annotation:jsr250-api:1.0'

    //retrofit
    compile 'com.squareup.retrofit2:retrofit:2.2.0'
    compile 'com.squareup.retrofit2:converter-gson:2.2.0'
    compile 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'

    //rxJava
    compile 'com.jakewharton.rxbinding2:rxbinding:2.1.1'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.2'
    compile 'io.reactivex.rxjava2:rxjava:2.0.8'

    //okhttp
    compile 'com.squareup.okhttp3:okhttp:3.6.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.6.0'

    //bottleneck analysis
    compile 'com.jakewharton.hugo:hugo-runtime:1.2.1'
    debugCompile 'com.jakewharton.hugo:hugo-runtime:1.2.1'
}

3.)

dependencies {
    compile 'com.jakewharton:butterknife:8.5.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'

    compile 'com.android.support:multidex:1.0.1'

    internalDebugCompile 'com.jakewharton.hugo:hugo-runtime:1.2.1'
    compile 'com.jakewharton.hugo:hugo-runtime:1.2.1'
    compile 'org.sufficientlysecure:html-textview:3.4'
}

4.)

dependencies {
    compile 'com.android.support:support-v4:26.0.1'
    compile files('libs/com.radaee.view.jar')
}

A: This dependency is suspicious
compile 'com.braintreepayments.api:drop-in:3.+'

Can you try to depend on exact version
compile 'com.braintreepayments.api:drop-in:3.2.1'

If it fix your issue, probably you have problem with version 3.3.0 (latest version)