text:
Q: Strings in Java : equals vs ==
Possible Duplicate:
How do I compare strings in Java?

  String s1 = "andrei";
  String s2 = "andrei";

  String s3 = s2.toString();

  System.out.println((s1==s2) + " " + (s2==s3));

Giving the following code why is the second comparison s2 == s3 true ?
What is actually s2.toString() returning ? Where is actually located (s2.toString()) ?

A: First of all String.toString is a no-op:
/**
 * This object (which is already a string!) is itself returned.
 *
 * @return  the string itself.
 */
public String toString() {
    return this;
}

Second of all, String constants are interned so s1 and s2 are behind the scenes changed to be the same String instance.

A: The method String.intern() can be used to ensure that equal strings have equal references. String constants are interned, so s1 and s2 will reference the same string. String.toString() simply returns itself, that is, a.toString() returns a, when a is a String. So, s2 also == s3.
In general, strings should not be compared by reference equality, but by value equality, using equals(). The reason is that it's easy to get two strings that are equivalent but different references. For example, when creating substrings. An exception to this rule is that if you know both strings have been interned beforehand (or you intern them as part of the comparison.)
To answer your implied question about heap or stack, Strings are allocated on the heap. Even if they were allocated on the stack, such as with the upcoming escape analysis and stack allocation, the semantics of the program will not change, and you will get the same result for both heap and stack allocation.

A: Basically when you use new String("something") you're forcing Java to create a brand new object.
When you assign to a String literal ="something", that string is stored in the constant pool, an optimization done by the JVM. So when you assign another reference to the same constant, the Object stored in the constant pool gets reused, basically, it's the same object.

A: You should be using .equals and not == when comparing java strings.
== Compares references and therefore s2.ToString() returns s2.
From the java glossary about heap / stack:

In Sun's JVM, the interned Strings (which includes String literals) are

stored in a  special pool of RAM
  called the perm gen, where the JVM
  also loads classes and stores
  natively compiled code. However, the
  intered Strings behave no differently
  than had they  been stored in the
  ordinary object heap.

A: From the java virtual machine spec:

String literals and, more generally, strings that are the values of constant expressions are "interned" so as to share unique instances, using the method String.intern.

"andrei" is a String literal and therefore "interned". Therefore both String s1and s2 refer to the same String object, an interned String with the content "andrei".
Therefore (s1 == s2) && (s1.equals(s2)) is true. String#toString() doesn't create a new String (like many other methods from String) but simple returns this. Therfore s2 == s3 is true.

A:
Why the first result is false ?

== compares references and you create two different objects.

I understood that for none primitive types, when we do '==',

A String is not a primitive.  References will be == when they refer to the same object.

A: Given that == compares references, you can see from s2 == s3 being true that s2.toString() returns s2.

A: Since String are immutables, a useful implementation of the toString method is - in the String class - to return this.
As an example, my rt.jar contains the following implementation :
public String toString() {
return this;
}

As a consequence, the reference associated to s3 is the same than the one associated to s2.
Considering the s1==s2 statement, it is due to the automatic call to intern() for all constant Strings. That means that at compile time, s2 initialization code will be replaced by s2=s1, which makes the assertion quite obvious, no ?

A: The reason for the first comparison to fail is, that you do create two Objects by calling new. Now, the == operator does compare two memory addresses, which yields the return you got because the two objects are not at the same memory cell.
The reason why it works with constant Strings is, that the java compiler, javac, does optimize the code. By that optimisation similar string constants are being placed in one and the same memory cell. If you would have done the following, then the result would have been the same for your String objects.
String s2 = new String("toto");
String s3 = new String("toto");
System.out.println(s2==s3); //yields false!!

Your way to go is .equals(other).
For that you'll have to implement the method equals in the class Mystring:
class MyString{

    private String s;

    public MyString (String s){
        this.s = s;
    }

    public String getContent(){
        return s;
    }

    @Override
    public boolean equals(Object other){
        if(other instanceof MyString){
            MyString compareTo = (MyString) other;
            return this.s.equals(compareTo.getContent());
        }
        return false;
    }
}

A: Only interned (String.intern()) strings are safe to compare with == for all other cases you should use equals.
In your case you define your own type MyString which has small in common with java String so comparing s and s1 you compare references to two distinct objects that is why you got false.

A: Every instance of MyString sits in a different memory location, so, forgetting about the contents of the instances, for every two different instances the == test is going to result in false.
In case of the String class, there's a small, but important difference, when you do assignment of a String variable and the right hand side operator is a literal (i.e. String s = "foo";), a new memory location is going to be occupied by "foo" only if "foo" was not encountered before as a literal. If this is the case (i.e. String s = "foo"; String otherS = "foo";), otherS is just going to reference the already present "foo".
This behaviour is called String pooling.

A: When comparing s == s1 you are comparing two different MyString objects. Think of your situation like this

s and s1 are different objects, but their attribute point to the same instance of toto.
They are different objects because of the way you create them:
MyString s = new MyString("toto");
MyString s1 = new MyString("toto");

So s == s1 will return false. For it to return true, they had to be the same object. You could achieve it like this:
MyString s = new MyString("toto");
MyString s1 = s;

That would be the result

A: "==" is compare reference. But Equals() method in Object class is compare reference only. And the behavior of method equals() in the subclass is based on the implement of overriding this method.

A: When you use == on strings, only the references are compared. Thus, == is only guaranteed to return true in situations like:
String s1 = "...";
String s2 = s1;    // reference assignment!

Here, s1 == s2. In all other situations, == may or may not return true even if the two strings contain the same character sequence.
To compare the contents of the two strings, use equals():
if (s1.equals(s2)) {
   ...
}

A: s2.toString () is returning a String representation. Since it's already a String it returns itself (thats why the comparison is true).
All Strings are allocated on the Heap, the coparison operator just compares whether they are the same object (thats why s1 != s2).


text:
Q: Imagem não se alinham Tenho o seguinte relatório que estou fazendo para fins de aprendizagem.

ul.ulHorizontal {
    height: 50px;
}
ul.ulHorizontal li {
    display: inline-block;
    line-height: 50px;
}

Leve

Produto 1

120.33

1

Correios

uma ul (que representa cada linha) é como acima.
O problema é que não consigo centralizar as figurinhas no centro vertical.
Percebam que os textos estão ok.
O que devo fazer?
EDITADO:
Li com a imagem:

Li com os textos:

Perceba a diferença nos tamanhos das caixas das li's
Edição:

function verifica(msg) {

 return confirm(msg);

};
/* CSS Document */
@import url('http://fonts.googleapis.com/css?family=Open+Sans');
*,
*:before,
*:after,
*:active,
*:hover {
    font-family: 'Open Sans';
 margin: 0;
 padding: 0;
    border:0;
    outline: none;
    -webkit-box-sizing: border-box;
       -moz-box-sizing: border-box;
            box-sizing: content-box; /*Comprimir(diminuir) as medidas do elemento para não aumentá-lo quando adicinar margin e padding*/
}
ul {
 list-style: none;

}ul.topo{
 background-color: #000000;
 color: #FFFFFF;
}
ul.topo li {
 text-align: center;
}
ul.ulHorizontal {
 height: 50px;
}
ul.ulHorizontal li {
 display: inline-block;
 line-height: 50px;
}
ul.ulHorizontal li img {
    vertical-align: middle;
}

img {
    max-width: 100%;
}
a, a:hover {
    text-decoration: none;
}
button,
input[type=button],
input[type=submit],
input[type=reset] {
 cursor: pointer;
 background-color: #CCCCCC;
}
button:hover,
input[type=button]:hover,
input[type=submit]:hover,
input[type=reset]:hover {
 background-color: #DCDCDC;
 border: 1px rgba(0,0,0,.2) solid;
}
button:active,
input[type=button]:active,
input[type=submit]:active,
input[type=reset]:active {
 background-color: #FFFFFF;
}
/************   CORES   **************/
.bgcCinza100 {
 background-color: #CCC;
}
.bgcCinza25 {
 background-color: #DCDCDC;
}
.bgcPreto100 {
 background-color: #000;
}
.bgcBranco100 {
 background-color: #FFF;
}
.bgcVermelho100 {
 background-color: #F00;
}
.bgAzulCiano {
 background-color: #007EAE;
}
/************   CORES   **************/

  <title>MVC PDO CRUD</title>
     <link rel="shortcut icon" type="image/x-icon" href="imgs/favicon.png"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

CATEGORIA

NOME

PREÇO

FRETE

TRANSPORTE

EDITAR

BLOQUEIO

EXCLUIR

Leve

Produto 1

120.33

1

Correios

A: Basicamente basta colocar vertical-align: middle nas img.

ul.ulHorizontal {
    height: 50px;
}
ul.ulHorizontal li {
    display: inline-block;
    line-height: 50px;
}
ul.ulHorizontal li img {
    vertical-align: middle;
}

Leve

Produto 1

120.33

1

Correios

redpajama_set_name: RedPajamaStackExchange


text:
Q: Java creating and download a file using ajax not working I am trying to generate some reports and download as csv file using my Java Spring MVC Web Application. I have a list of data displayed on the browser with option to select multiple rows and the I am trying to create a csv file with selected rows and download the csv file. My controller method is as follows:
public String downloadBusinessAsFile(@ModelAttribute("ids") String selectedIds, HttpServletRequest request, HttpServletResponse response, ModelMap model)
{
    String fileName = new SimpleDateFormat("yyyyMMddHHmmss'.csv'").format(new Date());
    response.setContentType("application/octet-stream");
    response.setHeader("Content-Disposition","attachment;filename="+fileName);
    try
    {
        Map<String, Obj> sessionBusinesses = (Map<String, Obj>) httpSession.getAttribute("objMap");
        ServletOutputStream out = response.getOutputStream();
        StringBuffer sb = reportService.writeBusinessesToCSV(selectedIds, sessionData);
        InputStream in =
                    new ByteArrayInputStream(sb.toString().getBytes("UTF-8"));

        byte[] outputByte = new byte[4096];
        //copy binary contect to output stream
        while(in.read(outputByte, 0, 4096) != -1)
        {
            out.write(outputByte, 0, 4096);
        }
        in.close();
        out.flush();
        out.close();
        httpSession.invalidate();
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
    return "success";
}

StringBuffer object returned has the required value. I am using the following scripts to call the controller method:
$(document).on('click', '#add-biz', function(){
    var selectedRow = '';
    for (var i = 0; i< $('#datTable tbody tr.selected').length; i++)
    {
         if (i <= 0)
         {
             selectedRow+=$('#datTable tbody tr.selected')[i].id;
         }
        else
        {
            selectedRow+=','+$('#datTable tbody tr.selected')[i].id;
        }
    }
    var url = $("#addUrl").val();
    $.ajax(
    {
        url : url,
        type: "GET",
        data : {ids: selectedRow},
        dataType : "html",
        success:function(htmlData)
        {
            if(htmlData == "error")
            {
                $('#btn-div').html("
An error occurred
")
            }
            else
            {
                $("#successAlert").show();
            }
            $('#divLoading').hide();
        },
        error: function( xhr, status, errorThrown ) {
            console.log( "Error: " + errorThrown );
            console.log( "Status: " + status );
            console.dir( xhr );
        },
    });
});

I do not get any error while running the code but do not see any download option.


text:
Q: MySQL recursion depth resets to 0 in Nodejs Basically I have a recursive stored procedure in my database.
Now, while creating it I put SET max_sp_recursion_depth=100; right before the CREATE PROCEDURE line and then calling the procedure works fine.
Now I am trying to call that procedure by nodejs using the npm-mysql module.
But when I now call it, it shows the error Recursive limit 0 (as set by the max_sp_recursion_depth variable) was exceeded for routine insertStation even though the procedure is already created in the database along with setting its configuration.
The code that I used is
con.query("CALL insertMain('A','J')");
Then, I noticed that while I restart the MySQl server, I usually have to create the procedure again because it automatically resets to 0 recursion depth. But I can't afford to create the procedure again and again everytime (have to integrate nodejs to website).
So, is there a way to permanentally change the recursion depth OR pass the configuration along with the nodejs query.

A: Well I just found out that con.query("SET max_sp_recursion_depth=100;"); does the job.


text:
Q: Is there a way to run Bash scripts on Windows? I have bought and I use Windows 7 Ultimate, and I like to use it to develop applications. One of the down sides (as with every OS) is that I can not run Bash scripts. Is there a way to run Bash scripts on Windows by installing some software? It is ok if it does not work 100%, but as long as the most common functionality is available it should be great.

A: In order to run natively, you will likely need to use Cygwin (which I cannot live without when using Windows).  So right off the bat, +1 for Cygwin.  Anything else would be uncivilized.
HOWEVER, that being said, I have recently begun using a combination of utilities to easily PORT Bash scripts to Windows so that my anti-Linux coworkers can easily run complex tasks that are better handled by GNU utilities.
I can usually port a Bash script to Batch in a very short time by opening the original script in one pane and writing a Batch file in the other pane.  The tools that I use are as follows:

*

*UnxUtils (http://sourceforge.net/projects/unxutils/)

*Bat2Exe (http://bat2exe.net/)

I prefer UnxUtils to GnuWin32 because of the fact that [someone please correct me if I'm wrong] GnuWin utils normally have to be installed, whereas UnxUtils are standalone binaries that just work out-of-the-box.
However, the CoreUtils do not include some familiar *NIX utilities such as cURL, which is also available for Windows (curl.haxx.se/download.html).
I create a folder for the projects, and always SET PATH=. in the .bat file so that no other commands other than the basic CMD shell commands are referenced (as well as the particular UnxUtils required in the project folder for the Batch script to function as expected).
Then I copy the needed CoreUtils .exe files into the project folder and reference them in the .bat file such as ".\curl.exe -s google.com", etc.
The Bat2Exe program is where the magic happens.  Once your Batch file is complete and has been tested successfully, launch Bat2Exe.exe, and specify the path to the project folder.  Bat2Exe will then create a Windows binary containing all of the files in that specific folder, and will use the first .bat that it comes across to use as the main executable.  You can even include a .ico file to use as the icon for the final .exe file that is generated.
I have tried a few of these type of programs, and many of the generated binaries get flagged as malware, but the Bat2Exe version that I referenced works perfectly and the generated .exe files scan completely clean.
The resulting executable can be run interactively by double-clicking, or run from the command line with parameters, etc., just like a regular Batch file, except you will be able to utilize the functionality of many of the tools that you will normally use in Bash.
I realize this is getting quite long, but if I may digress a bit, I have also written a Batch script that I call PortaBashy that my coworkers can launch from a network share that contains a portable Cygwin installation.  It then sets the %PATH% variable to the normal *NIX format (/usr/bin:/usr/sbin:/bin:/sbin), etc. and can either launch into the Bash shell itself or launch the more-powerful and pretty MinTTY terminal emulator.
There are always numerous ways to accomplish what you are trying to set out to do; it's just a matter of combining the right tools for the job, and many times it boils down to personal preference.

A: Best Option I could find is Git Windows Just install it and then right click on and click "Git Bash Here" this will open a bash window
This will open a bash window like this:
and the linux commands work...
I've tried 'sh' , 'vi' , 'ssh' , 'curl' ,etc... commands

A: If you're looking for something a little more native, you can use getGnuWin32 to install all of the Unix command line tools that have been ported. That plus winBash gives you most of a working Unix environment. Add console2 for a better terminal emulator and you almost can't tell you're on Windows!
Cygwin is a better toolkit overall, but I have found myself running into surprise problems because of the divide between it and Windows. None of these solutions are as good as a native Linux system though.
You may want to look into using virtualbox to create a linux VM with your distro of choice. Set it up to share a folder with the host os, and you can use a true linux development environment, and share with windows. Just watch out for those EOL markers, they get ya every time.

A: There's one more theoretical possibility to do it: professional versions of Windows have built-in POSIX support, so bash could have been compiled for Windows natively.
Pity, but I still haven't found a compiled one myself...

A: Best option? Windows 10. Native Bash support!

A: You can always install Cygwin to run a Unix shell under Windows. I used Cygwin extensively with Window XP.

A: After installing git-extentions (http://gitextensions.github.io/) you can run .sh file from the command prompt. (No ./script.sh required, just run it like a bat/cmd file)
Or you can run them in a "full" bash environment by using the MinGW  Git bash shell.
I am not a great fan of Cygwin (yes I am sure it's really powerful), so running bash scripts on windows without having to install it perfect for me.

A: Install Cygwin, which includes Bash among many other GNU and Unix utilities (without whom its unlikely that bash will be very useful anyway).
Another option is MinGW's MSYS which includes bash and a smaller set of the more important utilities such as awk (you may also want to check the competing fork - Mingw-w64). Personally I would have preferred Cygwin because it includes such heavy lifting tools as Perl and Python which I find I cannot live without, while MSYS skimps on these and assumes you are going to install them yourself.
Updated:
If anyone is interested in this answer and is running MS-Windows 10, please note that MS-Windows 10 has a "Windows Subsystem For Linux" feature which - once enabled - allows you to install a user-mode image of Ubuntu and then run Bash on that. This provides 100% compatibility with Ubuntu for debugging and running Bash scripts, but this setup is completely standalone from Windows and you cannot use Bash scripts to interact with Windows features (such as processes and APIs) except for limited access to files through the DrvFS feature.


text:
Q: How to apply glPointSize(float) in Qt OpenGL? I just started working on Qt OpenGL. I could draw some simple shapes on the screen with that. I need to draw points of various sizes on the screen in QWidget. I used standard glPointSize(float) for that. This does not seem to work. I wrote a command line program for that and in works just fine. Can any one help?

A: Presumably you are doing this in a QGlWidget not a QWidget?
Did you remember glBegin(GL_POINTS)?
Do you mean you can't see the points or the size change has no effect?
The size value is arbitrary, sometimes you have to specify a much bigger value (10 or 20) to see any change from 1.


text:
Q: Django - is it possible to avoid/minimize use of migrations? This is a general question.  I'll give a sample of what I am concerned about, but the general idea I am after is:  can I bypass migrations to manage the schema for the models?  Now, I know there are lots of good reasons people like migrations, but I am proficient with DDL SQL and looking after schema changes and am finding that, for my use cases, I spend way more time working around migrations than I do benefiting from them.  I don't use fixtures for example and I don't need very dynamic migration capability a la Chef/Puppet, at least not until I am in production.
In fact, I find the lack of transparency around migration DDL quite scary.
This is just a sample issue I am dealing with:
class Profile(models.Model):
    rdbname = RDBNAME
    name = models.CharField(max_length=80, blank=True)
    creation = models.DateTimeField(auto_now=True)
    rolecount = models.IntegerField(default=0)
    usercount = models.IntegerField(default=0)

    def __unicode__(self):
        return self.name

    class Meta:
        ordering = ["-rolecount", "name"]

I have just added this index, it shows up in migrations,
but it doesn't get created
        unique_together = ("rdbname", "name")

This is the output:
Running migrations:
   No migrations to apply.

But this is NOT a request to help me troubleshoot my migration.  I can probably drop the affected tables get migrations to recreate them.  Or add the index by hand.  I just generally don't want to use manage.py migrate and I wonder if there are ways to benefit from Models but look after your db the old fashioned, manual way.
One possible approach would be to use makemigrations in a "from-scratch/dry-run/sql output" mode to create a sql script.  With all drop/create tables and indices, as if the database was empty.  If you compare that to your previous from-scratch, you would see whatever was changed and you could create a script to say just add a column.  Or my index in my case.
And you would execute that in your favorite sql utility, psql (Postgres) in my case.
Can I not get a long set of explanations why migrations are the cat's pajamas?  I am aware of those already.  But I would be happy to hear from people who have tried that there is no way out, that's a useful data point for me. I'll just have to bite the bullet as well.
Just wondering if anyone else has managed to work around them somewhat.


text:
Q: Estimating genetic relatedness between subsamples of a population I have my Bed/Bim/Fam files with a large number of people (100,000+).
I would like to estimate genetic relatedness between a subgroup A and another subgroup B without having to estimate the full (A+B) x (A+B).
I just want to get an A x B resulting matrix.
I cannot find this option in PLink nor GCTA. Is there a way to do this with some other software? (example command or code would be very appreciated if there)

A: I recommend trying KING:
http://people.virginia.edu/~wc9c/KING/
You could simply compute genetic relatedness between all individuals and subset for your two groups afterwards. It is really fast and should do what you want, see manual:
http://people.virginia.edu/~wc9c/KING/manual.html
For example, to compute pairwise relatedness:
king -b ex.bed --related

Where input is a PLINK binary PED file. LD pruning your SNPs prior to analysis is not necessary, as specified by the manual; however, I pruned SNPs for a cohort of 20,000 samples as the analysis with ~800,000 array genotyped SNPs took to long and didn't results in appreciable benefit in my case.
Below is procedure I used:
# 1. Filter for SNPs that pass all QC tests
plink --bfile input --extract good-qual.txt --make-bed --out input2
# Exclude regions of high LD
plink --bfile input2 --exclude high-LD-regions-hg19.txt --range --make-bed --out input3
# Only consider SNPs with MAF > 0.01 and genoptype missingness < 0.01.
plink --bfile input3 --maf 0.01 --geno 0.01 --make-bed --out input4
# LD prune SNPs and extract pruned SNPs
plink --bfile input4 --indep-pairwise 5000kb 5 0.1 --out input4
plink --bfile input4 --extract clsa1-b1to4-qc3.prune.in --make-bed --out input4-pruned
# Run KING, infer down to 3rd degree
king -b input4-pruned --related --degree 3 --rplot --prefix input4-pruned-related-degree3

Regions of high LD on GRCh37:
1       48287980        52287979        1
2       86088342        101041482       2
2       183174494       190174494       3
3       47524996        50024996        4
3       83417310        86917310        5
5       44464243        50464243        6
5       128972101       131972101       7
6       25392021        33392022        8
6       56892041        63942041        9
6       139958307       142458307       10
7       55225791        66555850        11
8       7962590         11962591        12
8       42880843        49837447        13
8       111930824       114930824       14
10      36959994        43679994        15
11      87860352        90860352        16
12      33108733        41713733        17
20      32536339        35066586        18


text:
Q: No me ejecuta el código JavaScript No me muestra el codigo en la pagina donde lo estoy haciendo, empece hace muy poco a aprender
este lenguaje y es el primer codigo que escribo solo. No se donde esta el error, busque
soluciones en varias paginas pero ninguna me puedo solucionar el problema
```
  const contenedor = document.querySelector(".flex-container");

function crearTaza(color,modelo,precio,img){
     color= `<h2> ${color} </h2>`;
      modelo=`<h3> ${modelo} </h3>`;
        precio=`<p> Precio: <b> ${precio} </b> </p>`;
          img="<img src:'taza.png'>";
        return [img,color,modelo,precio];

}
   let documentFragment = document.createDocumentFragment();

  var words=['Negro','Azul','Rojo','Blanco','Amarillo','Verde','Celeste','Marron','Rosa'];
    var number= Math.floor(Math.random()*words.length);
   var word= words[number];
    for (var i=0; i<15; i++){
         let colorRandom = (Math.random()*words);
        let modeloRandom = Math.round(Math.random()*25);
         let precioRandom = Math.round(Math.random()*1000+299);
        let taza = crearTaza(`Taza ${i}`,`Color ${colorRandom}`,`Modelo ${modeloRandom}`,
     precioRandom);
       let div = document.createElement(div);
         div.classList.add(`item-${i}`,`flex-item`);
         contenedor.innerHTML = taza[0] + taza[1] + taza[2] + taza[3];
       documentFragment.appendChild(div);
    }

    contenedor.appendChild(documentFragment);
```

A: En problema en tu código es que no estás usando las comillas para indicar el tipo de elemento que quieres crear aquí:
   let div = document.createElement(div);

Debes colocarlo así:
   let div = document.createElement('div');

Por otra parte, el código que usas para obtener el color aleatorio, no es correcto.
Así debería funcionar:

  const contenedor = document.querySelector(".flex-container");

function crearTaza(color,modelo,precio,img){
     color= `<h2> ${color} </h2>`;
     modelo=`<h3> ${modelo} </h3>`;
     precio=`<p> Precio: <b> ${precio} </b> </p>`;
     img="";
     return [img,color,modelo,precio];

}
   let documentFragment = document.createDocumentFragment();

    var words=['Negro','Azul','Rojo','Blanco','Amarillo','Verde','Celeste','Marron','Rosa'];
    var number= Math.floor(Math.random()*words.length);
    var word= words[number];
    for (var i=0; i<15; i++){
        let colorRandom =words[Math.floor(Math.random()*words.length)];
        let modeloRandom = Math.round(Math.random()*25);
        let precioRandom = Math.round(Math.random()*1000+299);
        let taza = crearTaza(`Taza ${i}`,`Color ${colorRandom}`,`Modelo ${modeloRandom}`,
     precioRandom);
        let div = document.createElement('div');
        div.classList.add(`item-${i}`,`flex-item`);
        contenedor.innerHTML = taza[0] + taza[1] + taza[2] + taza[3];
        documentFragment.appendChild(div);
    }

    contenedor.appendChild(documentFragment);


text:
Q: Why is there no 'expiration' on user privileges? With the recent changes to reputation gain from asking questions, I just received a whole bunch of reputation on StackOverflow, where I now have over 15k reputation. This now means I have access to the "Protect questions" privilege. However, I must admit, I have not been an active contributor to StackOverflow for a while, and I've become a more casual user on the site recently, only posting 3 questions and 1 answer there.
After thinking about this for a second, I thought it was kind of weird that I got this so to say "promotion" in privileges on the site, despite my inactivity there. In this case, it's a bit of an exceptional situation because of the changes in reputation, but still, my reputation has been trickling in for a while based on questions and answers posted there a few years ago.
So this caused me to wonder, why don't privileges depend on activity on the site you have privileges on? I mean, I am sure I won't abuse these rights at all, but I am very doubtful I have any legitimate use for them any time soon, and the only time I would be able to use them would be if I get more active on the site again. This is kind of with the idea of the Principle of Least Privilege in mind: inactive users have no legitimate use for some of the more powerful tools available to users with high reputation, so it would be better to remove those kinds of rights from those users.
I am in no way implying these users cannot be trusted; anyone who has at one point spent enough effort in a site to eventually get a high reputation will probably have the best interests at heart for the site. I'm just saying it's probably a better practice to only give access to some of the unlockable privileges for users who can constructively use them, and not to those who have no legitimate use for them.
With this, I don't mean that people who have not cumulated 15k reputation in the past 3 years should lose their privileges, I just think that it might be better if some of the privileges become temporarily locked if a user does not meet a level of current activity on the site, which would then easily be unlocked again by simply participating more actively.
More specifically, I am thinking of something that only locks privileges after a user has posted <10 questions and <10 review queues in the past 6 months or so, ie. something very easily reachable for anyone who is still in any way active on the site. And as soon as the user then reaches that level of activity again, the privilege lock would automatically be lifted again. Of course this is just a rough and very arbitrary amount, but it illustrates the rough idea I have about this. Also, my idea is that this would only apply to for example just the privileges that require >5000 rep, because the other ones are relatively harmless.
As indicated in this question's tags, this is mostly meant as a discussion. I'm wondering what others think about this, and if anyone else thinks this is something that might be useful to at least look into.
tl;dr: Should users who have high reputation privileges be restricted to only the users who have a legitimate use for them?

A: You want people to design, write, and test a pile of code, and run into edge cases and strange things, to what end? You say yourself that you don't think a user who doesn't bother interacting with the site at all will come and interact maliciously. And of course as soon as they interact with it at all, they're not inactive any more. If they're editing, flagging, voting, then they're active (even if they're not earning rep.) So deciding that earning rep (which you can do while literally never visiting the site) is somehow a marker of being active strikes me as a wrong first guess. Asking questions? On some sites I've only ever asked one or two, though I answer plenty.
I don't think there's a better guess, either. Either you come to the site and use your privileges (nobody currently records that I looked at a deleted answer, so that's an example of using a privilege that if you wanted to track, you'd have to add and test a bunch of code), or you don't. If you do, great, you do. And you're probably doing it right whether you're still earning rep or not. If you do it wrong, we have safety mechanisms for most of it - closed things can be re-opened, for example. Tag synonyms can be undone. And if you never come to the site then the fact you could do things you're not doing seems completely irrelevant.
So this seems like a bad plan all around to me. Let's not worry about privileges expiring in any way.


text:
Q: Insert column into a matrix in OjAlgo - How to do that? I have an matrix
Primitive64Store X

And I want to insert a column vector y
double[] y

To a specific column in X. How can I do that in OjAlgo?

A: I found the answer!
X.fillColumn(0, column, Access1D.wrap(y));


text:
Q: How to add a new row inside the table with the addition of @html.helper When pressing the new row button it should add a new line with the @html.helper.
@model  List

        code item
        name item:
        unit:
        quantity:
        price:
        total:

      @foreach (Table.Invoice_Details Loop in Model)
      {

            @Html.TextBoxFor(modelitem => Loop.Item_Period.Item.Code_Item, new { id = "Code_Item", @class = "form-control item_code" , href= "javascript:;" })

            @Html.DisplayFor(modelitem => Loop.Item_Period.Item.Name_Item, new { id = "Name_Item_" + Loop.ID_Invoice_Details, @class = "form-control item_name", disabled = "disabled" })

             @{
              if (Loop.Item_Period != null)
              {
                var a = (from i in Loop.Item_Period.Item.Item_Unit select i.Unit).ToList();
                @Html.DropDownList("Unit", new SelectList(a, "ID_Unit", "Name_Unit"), new { id = "Name_Unit_" + Loop.ID_Invoice_Details, @class = "form-control", width = "120px" })
              }
              else
              {
                List
 unit = new List
();
                @Html.DropDownList("Unit", new SelectList(unit, "ID_Unit", "Name_Unit"), new { id = "Name_Unit_" + Loop.ID_Invoice_Details, @class = "form-control", width = "120px" })
              }
            }

            @Html.TextBoxFor(modelitem => Loop.Quantity, new { id = "Quantity_" + Loop.ID_Invoice_Details, style = "width:60px;" })

            @Html.TextBoxFor(modelitem => Loop.Spical_Rate, new { style = "width:80px" })

            @Html.TextBoxFor(modelitem => Loop.Total, new { id = "Total_Money_W_Taxes", style = "width:80px" })

      }

<button>new row</button>

I used the following code using the insertRow command but it doesn't add @html.helper widgets
function addRows() {

  var table = document.getElementById('tbl_invoice'),
    row = table.insertRow(table.rows.length),
    cell1 = row.insertCell(0),
    cell2 = row.insertCell(1);

  cell1.innerHTML = 'Cell 1';
  cell2.innerHTML = 'Cell 2';
}


text:
Q: Сравнение смайликов в MySQL Подскажите пожалуйста почему два разных смайлика в базе видит как один и тот же?
Запрос1 - где ищу дубликаты:
SELECT brand,title,author,buyer_rating,review_content, COUNT(*) AS dublicate
FROM simba_dublicate
GROUP BY brand,title,author,buyer_rating,review_content
HAVING dublicate > 1

Результат запроса:

Запрос 2, чтоб увидеть что дубликата только два а не три:
SELECT *
FROM simba_dublicate
WHERE author = 'Daddy'

Результат в табличке:

A: За сравнение символов (и пофиг, буквы это или там смайлы) отвечает COLLATION. Укажите выполнять сравнение с использованием BINARY COLLATION:
SELECT brand,
       title COLLATE utf8mb4_0900_bin,
       author,
       buyer_rating,
       review_content,
       COUNT(*) AS dublicate
FROM simba_dublicate
GROUP BY 1,2,3,4,5
HAVING dublicate > 1

Откорректируйте COLLATION, чтобы соответствовать текущему CHARSET. При необходимости укажите COLLATION и для других полей.
DEMO


text:
Q: "Ionic upload" and "ionic package" ignore proxy settings I am using the Ionic CLI behind a corporate proxy. I have configured CNTLM (0.92.3) to allow the use of command line tools. All Ionic commands work as expected except for two; the Ionic upload and ionic package commands both ignore all proxy settings. I have tried the commands on Ionic Beta and on many other versions of the Ionic framework with the same results:
There was an error trying to upload your app.
An error occurred uploading the build: The specific error message: Error: socket
hang up

The specific error message: Error: socket hang up (CLI v2.0.0)

My system information:
Cordova CLI: 6.2.0
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Framework Version: 1.2.4
Ionic CLI Version: 2.0.0
Ionic App Lib Version: 2.0.0-beta.20
OS: Windows 7 SP1
Node Version: v4.4.4'

I've also tried several GitHub solutions that suggest modifying the following files and using an npm package named https-proxy-agent. I've tried every suggested solution in each of the threads with no success.
form_data.js
package.json
upload.js

https://github.com/driftyco/ionic-cli/issues/290https://github.com/driftyco/ionic-app-lib/pull/58
https://github.com/form-data/form-data/pull/179

A: did you tried this :
$ export HTTP_PROXY="http://proxy.example.com:8888"
$ export HTTPS_PROXY="https://proxy.example.com:8888"
$ export IONIC_HTTP_PROXY="http://proxy.example.com:8888"

$ npm config set proxy http://proxy.company.com:8888
$ npm config set https-proxy https://proxy.company.com:8888

$ git config --global http.proxy http://proxy.example.com:8888


text:
Q: Can a stack overflow be sometimes misinterpreted by the compiler as an Access violation? I have a fortran code compiled with Intel fortran compiler 2013 and VS2010 under windows 7 that started to give me unhandled exceptions without showing the line in which the code was crashing. Usually an error like this was showing up:
Unhandled exception at 0x73e1d3d2 in GRIB2METEOriparto.exe: 0xC0000005: Access violation writing location 0x00240ef4....

and the call stack had only dbghelp.dll or verifies.dll and no source available.
I moved my source files under Cygwin, I compiled with gfortran with all the possible warning/error flags on (including check bounds and implicit interfaces) and no warning at all and the program runs smoothly. All interfaces are explicit cause I am using "CONTAINS". Therefore if there was a mismatching number of arguments the debugger would catch it. No uninitialized variables are present.
I went back to VS2010, I did a "clean solution" and I rebuilt the project. The code started to crash inside different C routines (that I did not write) such as:
crt0.c at the line:

mainret = _tmain(__argc, _targv, _tenviron);

or
osinfo.c at line (if I well remember):

EnterCriticalSection( &(_pioinfo(fh)->lock) );

The code was not even reaching the first line of executable code (a breakpoint there was not reached).
I started commenting some lines of code I recently added in the past days and when running the thread was finally passing successfully the few first lines and it crashed at a subroutine call with a stackoverflow error. That finally helped me understand the problem. I have a bunch of characters declared as   character*2560 (both in the subroutine and in the main code). I substituted them with character*256 and it was not crashing anymore. I rewrote character*2560 and I added the flag /stack:2000000 in the link options and now everything runs smoothly. I removed the extra comments I added in those line of codes (that where calling the faulty subroutine with too many character*2560) and everything runs smoothly. I recompiled  everything with gfortran in Cygwin and everything is still good. Is this normal? Am I safe now? Was initially the stack overflow error for some reason wrongly interpreted as a access violation? Is that possible?
EDIT: this is my faulty declaration in the main program (I have similar ones (but shorter) in other subroutines):
 character*2560   DOScallINV,FORMdosCALLtxt,FORMdosCALLinv,filenam,FILEinv,provSTR,FMTtimeMETEO,&
        TIMEstring,fmtGRID,fmtTIMEstring,FMTdataMETEO,WORKINGdir,path,DIRgribs,PATHgribs,&
        DIRresultsRUN,PATHoutput,previousDIR,filePATH,PATHresultsRUN,PATHinputD3D,textFILE,&
        newLINE,textFILE1,textFILE2,PATHlogs,LOGfile,LOGdir,ilineTXT,message,PATHresultsREST,&
        LastRUNfolder,PATHobs,PATHopenda,PATHresultsRUNm1,workworkWITHnum,pathSTOBS,pathSTMOD,pathALG,&
        toBEfound,COLLECTdirect,COLLECTdirectLOC,PATHwork,filePATHtot,filePATHlong,stringCAL,string,&
        pathNM,filePATH_d3model,CDstring,toBEadded,stringCALini,filePATH_d3wrapper,fileWIND,dudFILE,stringL,stringU,fileWINDcal,&
        PATHweb,pathREGR,fileWEB,PATHfileANALYSIS,threadFILE,threadFILEcopy


text:
Q: CMD Batch file virtually press the enter key I am working in a manufacturing company. We manufacture PCB for HDD. Each PCB need to be loaded with firmware in manufacturing process. I would open the application the i would browse for the suitable ini file and then start uploading the FW to PCB.My problem is when I open the application initially it would show some warning message box with window name "Warning" for CRC error. Then I would close this window by clicking OK button or the "X" button int the corner an then load correct ini file and start uploading the process. I would like to create a batch file which will open the FW application close this warning window. I find that there are only three possible ways.

*

*The batch file must virtually press "Enter" key to click OK button to close the warning window.

*The batch file must virtually press the corner "X" button to close the warning window.

*The batch file must look for the window name "Warning" and close it.

I have surfed through internet for a solution but I end up helpless. If there is any way it would be greatly helpful.

A: Autohotkey is a great free app that can do what you require - http://www.autohotkey.com/board/topic/20202-automatically-clicking-ok-in-a-dialog-box/

A: TaskKill  /f /Im whatever.exe /t <--Kills all Instances
TaskKill /f /fi "windowtitle eq whatever - Internet Explorer" /im "iexplore.exe" /T <--Isolates the specific But Tricky To Determine Exact window title. The /f is force the /t is any other System process started by it Closes to.

This will only work if the message window Shows up as a separate
Task from the initial application.
--Alternative Method Auto Create VBS Script--
Echo set oshell = createobject("wscript.shell") >PressEnter.vbs
Echo oshell.sendkeys "{enter}" >>PressEnter.vbs
Echo wscript.quit >>PressEnter.vbs
Start PressEnter.vbs
Del /Q PressEnter.vbs


text:
Q: Reasoning and datatypes of Literals In Turtle-RDF it is convenient to omit the datatype extension ^^xsd:string for string literals. But when i try to do reasoning with StarDog, http://www.stardog.com/, only the individual :YYY with the extension "green"^^xsd:string is found to be a :GreenButton
@prefix :      <http://stackoverflow.com/q/29075078/1281433#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

:color   a            owl:DatatypeProperty ;
         rdfs:range   xsd:string ;
         rdfs:domain  :Button .

:XXX     :color       "green"             .
:YYY     :color       "green"^^xsd:string .

:Button         a     rdfs:Class .

:GreenButton    a     rdfs:Class ;
                owl:equivalentClass [ a owl:Restriction;
                                      owl:onProperty :color ;
                                      owl:hasValue "green"
                                    ] .

:TestButton     a     :GreenButton .

Reasoning result:
+-------------+----------+----------------------------------------------------+
|      s      |    p     |         o                                          |
+-------------+----------+----------------------------------------------------+
| :XXX        | rdf:type | :Button                                            |
| :YYY        | rdf:type | :Button                                            |
| :YYY        | rdf:type | :GreenButton                                       |

| :TestButton | rdf:type | :GreenButton                                       |
| :TestButton | :color   | "green"^^<http://www.w3.org/2001/XMLSchema#string> |
  ...

What is the best way to deal with it?

A: According to OWL semantics "green" and "green"^^xsd:string are actually equivalent. They are also equivalent in RDF 1.1. Stardog does not support RDF 1.1 yet and there is a bug wrt string literal reasoning as you noticed. Your observation is correct: plain literals in OWL axioms are automatically converted to xsd:string but literals in instance assertions are not. There is an open ticket (#2340) for this and you can check release notes in the future to see when this is fixed. Until then the workaround is to always use xsd:string for instances.

A: According to the docs:

RDF parsing in Stardog is strict: it requires typed RDF literals to
  match their explicit datatypes, URIs to be well-formed, etc. In some
  cases, strict parsing isn't ideal—it may be disabled using the
  --strict-parsing=FALSE.
However, even with strict parsing disabled, Stardog's RDF parser may
  encounter parse errors from which it cannot recover. And loading data
  in lax mode may lead to unexpected SPARQL query results. For example,
  malformed literals ("2.5"^^xsd:int) used in filter evaluation may lead
  to undesired results.

Have you tried disabling strict-parsing and see what the effects are?
p.s. see Joshua's comment in the question. I am not advising to switch off strict parsing, but it may be the only option if dealing with arbitrary/external data that is sparsely typed (assuming it does resolve the issue).


text:
Q: 2 backup programs - want to stop program truncating exchange logs I'm managing a server and have 2 pieces of backup software installed. I have StorageCraft ShadowProtect and since signing up for a cloud backup provider we have Peaceguard software also. After having them both running for a few days I've come across a problem regarding exchange. It seems that SP is doing its daily (local!) incremental backups and then deleting the log files after. When the Peaceguard online backup kicks in after 6PM (the time when bandwidth stops being expensive!) it cannot properly do an incremental backup of the exchange, as most of the log files are missing.
What I'd like to know, is a way round this without rescheduling SP to only do once a day after the PG backup has completed. This seems like a bit of a step backwards as the reason I've got this setup is so consistent incremental backups can be completed. Is there a flag I can set in the exchange VSS writer to stop it purging the logs? Perhaps if this was the case, I could get it to leave logs then have a batch file or alternative to clear the logs every 24/48 hours? I can't find an option in SP to disable the deletion of the files. Does anyone have any experience with a similar setup, and a potential solution perhaps?
Any help with this would be much appreciated :)

I spoke to shadowprotect support, and they said the deleting of the logs is managed by the Exch VSS writer, so as a consequence I've decided to try disabling the VSS Exchange writer for shadowprotect. I don't know if there is an option somewhere to say to the VSS not to delete the logs. Fortunately, SP has an option to name VSS' that it shouldn't use. I know this will compromise the integrity of the database, but I'm hoping it will still be restorable without too much difficulty. If the worst does happen, I can recover pretty much everything from the latest off-site image and get the exchange database from our cloud provider. I think this is a good compromise as the image will still be restorable (meaning easy recovery from a system crash) and the data will still be avaliable in an un-corrupted state (the exchange!) from the cloud source. Usefully our cloud provider is 20 minutes down the road so practically sneakernet distance ;)
I will be trying a virtual machine restore from the SP backup to see how potentially damaged the database might be when I restore it.
Thanks for all your help, and I wish I could have found a more elegant solution.

I've now disabled the VSS Exchange writer in SP specifically. I am going to attempt a virtual machine restore to check the integrity of the database on the SP backup. Both backup programs seem to be acting as they should. I'm currently in the process of bringing the cloud backup 'up to date' but once its there, I will ask them to check the integrity of the database. Seems this is now solved. I will update with any results.

A: Don't do this the way you're doing it.
Classic example of "backups are useless without restores." If you have two different products doing incrementals, heaven help you trying to do a restore, because each one breaks the other's log chain.
So, change at least one of these tools to be doing fulls, and evaluate your need to be doing incrementals at all.

A: If Shadowprotect is using the Exchange VSS provider, it's not an image backup. Your theory with first restoring the (old-ish) image and then applying recent cloud-based backups on top would work in theory, but for that to work you need to use an image backup that actually does that. Like the comments above state; having multiple products performing incremental Exchange backups (or full ones for that matter) is asking for trouble.
Call the Shadowprotect guys and explain that the only thing you want is image-backup from their software. If they can't help you, there's your problem.


text:
Q: Добавление Activity view indicator в экран загрузки Экран загрузки основан на launch image set. Для всех типов устройств. Необходимо добавить activity view indicator, чтобы при загрузке было видно этот индикатор

A: Launch Image set это просто набор картинок для каждого устройства. Если вы хотите добавить индикатор загрузки, создайте контроллер, и сделайте его initialize. Затем на вьюху добавьте ту же картинку и индикатор загрузки.

A: Не уверен, что понял вопрос. Предполагаю, что вы хотите показать индикатор загрузки на splash screen. Если так то:
Добавить его на splash не получится.
Что можно сделать: после запуска приложения на первом ViewController показать ту же картинку, что и сплэш (картинку отдельно добавлять не надо, можно использовать сам сплэш) и на ней уже добавить activity indicator. Поскольку вам надо знать, на каком устройстве вы грузитесь, чтобы поставить соответствующую картинку, для этого нужно узнать размер экрана - [UIScreen mainScreen].bounds и на основании этого уже выбрать изображение.


text:
Q: Understanding how Adobe Flash Player Garbage Collector works Can anyone tell me how the Flash Player Garbage Collector works please?
No worry about version, even if you tell me about GC in Flash Player 8.0, 9.0, or 10.0 it does not matter.
Many articles in Adobe Connection just tell the same old things: trees, counters and indeterminacy of deallocation times... all things we know....
But how about deallocation policies? Are there pools just like CLR in .NET (well explained in MSDN) or any other particular approach? I am interested in the algorithms...
Thankyou.

A: Long story short, the Flash player (at least up to 11.2) will:

*

*Mark an sweep objects based on any strong references

*References are tracked via DRC (Deferred Reference Counting)

The best article I've found was on JPauclair's blog which goes into details:
http://jpauclair.net/2009/12/23/tamarin-part-iii-current-garbage-collector-in-flash-10-0/
At the bottom he lists a few additional references / sources including the 3 part series by Grant Skinner.

A: Grant Skinner wrote a few good articles on garbage collection and resource management. You can find them here


text:
Q: VSCode 1.22.2: Emmet disappeared? I made the switch to VSCode about a month ago and I'm really into it, been using Sublime for years and VSCode is everything I always wanted, plus things I didn't even know I wanted!
But, so, today I was working on a project and noticed that the Emmet functionality stopped working. In all the languages I work with, not just one. I couldn't remember if Emmet was native in VSCode or if I installed it as a extension because when I checked, there was no sign of it. I tried searching for the extension to no avail. I seem to have a faint memory that it was already featured without having to install it separately. Am I imagining this?
I disabled any other extension that might have a keybinding conflict with the tab functionality, notably ESLint but that didn't seem to do anything. Worth mentioning, too- this all happened out of no where: no new extensions, no new files, this was the same project folder I've been working on for a week now, a collection of MySQL and NodeJS files. I have no idea what happened.
Any insight would be really appreciated! It's crazy going from using Emmet for years to not having it and realizing how robot-reflex it made me, oy!
Thank you!

A: Looks like I figured it out-
in my preferences, I had switched off suggestions for a little project I was working on that was getting in way with suggestions I didn't need.
If anyone else is running into this problem, try adding this into your preferences json-
editor.quickSuggestions: true


text:
Q: Run screen touch-event before anchor tag touch loads new web page In a website i am showing a popup to display some results by clicking on chat menu button on website. When user touch outside the popup ,it is hidden with animation. But when user touches any anchor property then it does not hide the popup, it loads linked page. And until the new page is fully loading popup is showing on previous page.
window.addEventListener('touchStart', function(e) {
  if(document.getElementById('btnChat').classList.contains('hideChatBtn')){
    if (!document.getElementById('cro-script').contains(e.target)){
      jQuery(document).find(".search").hide(600);
      document.getElementById('btnChat').classList.remove('hideChatBtn');
      document.getElementById('btnChat').classList.add("showChatDiv");
    }
  }
});

Here btnChat is id of chat button and search is the id of popup.


text:
Q: Show that if $f_1(1+xy+x^4)+f_2(y^2+x-1)+f_3(xy-1)=1$ in $k[x,y]$ no $f_i$ can be a nonzero element of $k$. This is a statement in "Using Algebraic Geometry" by Cox et. al., Exercise 27 of Section 5.1:

Let $R=k[x_1,\dots,x_n]$. There exists unimodular rows $A$ with the property that no $\vec{f}\in R^l$ such that $A\vec{f}=1$ has an entry which is a nonzero element of $k$. In the case $R=k[x,y]$, the matrix $A=(1+xy+x^4, y^2+x-1, xy-1)$ is an example.

Background:
The goal of this Exercise is to investigate the syzygy of $A=(g_1,\dots,g_l)$, when $\langle g_1,\dots,g_l\rangle=1$. The previous parts have been devoted to showing that if $f_1g_1+\cdots+f_lg_l=1$ such that $f_i$ is a nonzero constant in $k$ for some $i$, then the syzygy form a free module. I have shown this.
My question:
I cannot see how the above matrix $A=(1+xy+x^4, y^2+x-1, xy-1)$ is an example in which when $\sum f_ig_i=1$, no $f_i$ can be a nonzero constant. I tried the following:
$$f_1=a_0+a_1x+a_2y+a_3x^2+a_4xy+a_5y^2+\cdots\\
f_2=b_0+b_1x+b_2y+\cdots\\
f_3=c_0+c_1x+c_2y+\cdots\\
f_1g_1+f_2g_2+f_3g_3=0\implies\\
(a_0+a_1x+a_2y+\cdots)(1+xy+x^4)+(b_0+b_1x+b_2y+\cdots)(y^2+x-1)+(c_0+c_1x+c_2y+\cdots)(xy-1)=1
$$
Setting $f_1,f_2,$ or $f_3$ to be a constant, this then leads to a system of infinitely many equations. But how can I prove that this cannot stop in finite steps? Or is there a better way?
Thank you for your help!

A: Assume$$1 = f_1 (1+xy+x^4) + f_2 (y^2 + x - 1) + f_3 (xy-1)$$ where $f_i \in k[x,y]$. It's easy to see that the set $\{1,1+xy+x^4,y^2+x-1,xy-1\}$ is linearly independent, therefore it is not possible that every $f_i \in k$.
Assume that $f_1$ is the only nonzero $f_i \in k$, then we must have $f_1 = 1$ for degree reasons. Now the $x^4$ term on the right side has to cancel with $f_2 x$, which shows that the $x-$degree of $f_2$ is $\geq 3$, but then $f_2 y^2$ contains a term with $(x,y)$-degree greater or equal to $(3,2)$, which can only cancel with $f_3 xy$. If that is the case, the degree in $x$ and $y$ of $f_3$ must be greater or equal to 1, which means that we are left with a term $xy$ (coming from $f_1 xy$) on the right hand side that is not cancelled out, so this case is not possible. The cases where $f_2, f_3$ are the only nonzero $f_i \in k$ can be dealt with similarly.
Now assume that there are two nonzero $f_i \in k$, let's say $f_1,f_2$. Then we have $f_1 - f_2 = 1$. We would need $f_1 xy$ to cancel either with $f_3xy$ or $-f_3$. In the first case, we would have $f_1,f_2,f_3 \in k$ which we already know is not possible. In the second case, we would have $f_3 = f_1 xy$ but then we are left with a $f_1 x^2y^2$ term that does not cancel out.
All the cases here can be handled this way, although it is not pretty.


text:
Q: Use special 'propose' object's instead of arrays its gonna be a fully theoretical thread.
Let's talk about change arrays to specially object's, to compare and work on it.
For example we have a EntityClass, EntityInterface, SomeRepository, SomeManager, SomeCommand.
Entities is a clear object, example:
class EntityClass implements EntityInterface {
    public $name;

    public funtion getName() {
        return $this->name;
    }

    public function assign($data) {
        $this->name = $data['name'];
    }
...
}

Repository ofc. have method's to save object in source and get it from source.
Manager have all of 'busines logic', it can modify a entities using command pattern, one command for one properties, so a busines logic for all properties its store in separate's command's, and manager fire it's.
Now, in manager start all logic and fun.
Little shorthand:

*

*Repository create new entity by getOne().

*We create a new instance of manager and pass by constructor some dependencies like array of data from controller and Entity.

*Array of data have information about changes, example: ['name' => 'New name']; mapper resolve what command should have been fired by manager for given array.

*Manager execute all commands for this request and passing raw array to each command.

Now, why we passing a array ? when we are in OOP, why don't use special variation of EntityClass ??
Now let's add a new interface EntityProposeInterface, and change a raw array to class implements this interface, and pass them.
for example we can add to SomeManager speciall method to morph entity like this (PHP7+):
class SomeManager {
   public function morph($entity) {
       $buff = new class extends EntityClass implements EntityProphoseInterface{};
       $buff->assign($entity->toArray());
       return $buff;
  }

And now we have a EntityProphose lets make some changes on it, now manager change a EntityProphose from raw data array, and all commands and other method's in our code work's on object kinde EntityProphose instead of array.
But ofc. our repository cant save object's instance of EntityProphoseInterface.
And that's all...
Is there some design pattern name ? or something like this ?
Or this idea is very bad ?
I hope it's clear for all of you, if not please ask.
Any ideas ? advice ?

A: What makes me go crazy is why you would implement a function to assign values from an array to the whole class instead of just using regular assignments:
$entity->name = name;
$entity->age = age;

Perhaps you want to simplify this code... but what's the point of using arrays?
Your manager class (actually, a service) should provide functions with either parameters corresponding to whatever entity you want to modify or operate with, or just receive a DTO or the entity itself.
In the other hand, if you want to centralize how DTOs or entities are mapped one to another, maybe you need to implement object mappers:
class EntityMapper {
    public function mapCustomerToCustomer($customerA, $customerB) {
         if($customerA->name != null) {
               $customerB->name = $customerA->name;
         }
         // and so on...
    }
}

...and you can inject it wherever you want to map entities. For example, a CustomerService might look as follows:
class CustomerService {
   function __construct($entityMapper) {
        $this->entityMapper = $entityMapper;
   }

   public function update($customer) {
        $customerToUpdate = $this->repository.getById($customer->id);
        $this->entityMapper->mapCustomerToCustomer($customer, $customerToUpdate);

        $this->repository.addOrUpdate($customerToUpdate);
   }
}


text:
Q: NSMutableArray losing data I have create a property for NSMutableArray and when Assign a value to it I have written a following code
[self setTotalCells:[[NSMutableArray alloc] initWithArray:[jsonDictionary valueForKey:@"data"]]];

I am using it in searchbar method. however once I used that property then the array is becoming empty.
cells = [[NSMutableArray alloc]init];
NSLog(@"filterContentForSearchText");
NSLog(@"**************************************************************");
if ([totalCells count]<= 0) {
    totalCells = [_jsonPropertiesDictionary valueForKey:@"data"];
}
NSLog(@"%@",totalCells);
NSLog(@"**************************************************************");
for (id cell in totalCells)
{
    NSLog(@"bedrooms : %@",[cell valueForKey:@"BEDROOMS"]);
    NSLog(@"DISPLAY_ADDRESS : %@",[cell valueForKey:@"DISPLAY_ADDRESS"]);
    NSLog(@"PRICE : %@",[cell valueForKey:@"PRICE"]);
    NSLog(@"searchText : %@",searchText);
    NSComparisonResult result = NSOrderedAscending;
    if ([[cell valueForKey:@"BEDROOMS"] isKindOfClass:[NSString class]] && [[cell valueForKey:@"BEDROOMS"] length] > 0) {
        result = [[cell valueForKey:@"BEDROOMS"] compare:searchText options:(NSCaseInsensitiveSearch) range:NSMakeRange(0, [searchText length])];

        if (result == NSOrderedSame)
            [self.filteredListContent addObject:cell];
    }
    if ([[cell valueForKey:@"DISPLAY_ADDRESS"] isKindOfClass:[NSString class]] && [cell valueForKey:@"DISPLAY_ADDRESS"] != nil && [cell valueForKey:@"DISPLAY_ADDRESS"] != @"" && [[cell valueForKey:@"DISPLAY_ADDRESS"] length] > 0) {
        result = [[cell valueForKey:@"DISPLAY_ADDRESS"] compare:searchText options:(NSCaseInsensitiveSearch) range:NSMakeRange(0, [searchText length])];

        if (result == NSOrderedSame)
            [self.filteredListContent addObject:cell];
    }
    if ([[cell valueForKey:@"PRICE"] isKindOfClass:[NSString class]] && [cell valueForKey:@"PRICE"] != nil && [[cell valueForKey:@"PRICE"] length] > 0) {
        result = [[cell valueForKey:@"PRICE"] compare:searchText options:(NSCaseInsensitiveSearch) range:NSMakeRange(0, [searchText length])];

        if (result == NSOrderedSame)
            [self.filteredListContent addObject:cell];
    }
    if ([searchText isEqualToString:@"" ]) {
        filteredListContent = totalCells;
        break;
    }
}
if (self.filteredListContent.count > 0) {
    cells = self.filteredListContent;//added by prajakta
}

[self.propertyList_table reloadData];
NSLog(@"filteredListContent : %@ ",filteredListContent);

I have declared this property as
@property(atomic,retain)NSMutableArray *totalCells;

Any help will be appreciated

A: why don't you use to filter this way? it won't ruin you original data source...
cells = [[NSMutableArray alloc]init];
NSLog(@"filterContentForSearchText");
NSLog(@"**************************************************************");
if ([totalCells count]<= 0) {
    totalCells = [_jsonPropertiesDictionary valueForKey:@"data"];
}
NSLog(@"%@",totalCells);
NSLog(@"**************************************************************");

/*
 * replace your code FROM here...
 */

NSArray *filteredCells = [totalCells filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
    NSDictionary *cell = (NSDictionary *)evaluatedObject;
    if ([[cell valueForKey:@"BEDROOMS"] isKindOfClass:[NSString class]] && [[cell valueForKey:@"BEDROOMS"] length] > 0) {
        return [[cell valueForKey:@"BEDROOMS"] compare:searchText options:(NSCaseInsensitiveSearch) range:NSMakeRange(0, [searchText length])];
    }
    if ([[cell valueForKey:@"DISPLAY_ADDRESS"] isKindOfClass:[NSString class]] && [cell valueForKey:@"DISPLAY_ADDRESS"] != nil && [cell valueForKey:@"DISPLAY_ADDRESS"] != @"" && [[cell valueForKey:@"DISPLAY_ADDRESS"] length] > 0) {
        return [[cell valueForKey:@"DISPLAY_ADDRESS"] compare:searchText options:(NSCaseInsensitiveSearch) range:NSMakeRange(0, [searchText length])];
    }
    if ([[cell valueForKey:@"PRICE"] isKindOfClass:[NSString class]] && [cell valueForKey:@"PRICE"] != nil && [[cell valueForKey:@"PRICE"] length] > 0) {
        return [[cell valueForKey:@"PRICE"] compare:searchText options:(NSCaseInsensitiveSearch) range:NSMakeRange(0, [searchText length])];
    }
    return FALSE;
}]];

/*
 * TO here...
 */

if (self.filteredListContent.count > 0) {
    cells = self.filteredListContent;//added by prajakta
}

[self.propertyList_table reloadData];
NSLog(@"filteredListContent : %@ ",filteredListContent);


text:
Q: jQuery - Toggle megamenu submenu items by click I am currently trying to create a clickable menu item. The menu item has a dropdown mega menu.
I want the dropdown menu to only display and hide when it is clicked, not when hovered over with the mouse.
The menu item is called "meny" and has a hamburger icon next to it :)
Here's the code I've made so far, but it's not working:
<script>
jQuery(document).ready(function(){
jQuery(".et_fullwidth_nav #top-menu li.mega-menu > ul").click(function(){
jQuery("this").toggle();
});
</script>

my page link is byes.hankens.net
using wordpress 4.6.1
I am new to jQuery and would love some help.. Thank you

A: Try this ->
jQuery(document).ready(function($) {
 $('#menu-main-menu a').click(function( event ){
 var visibleSubmenu = $('#menu-main-menu ul.sub-menu:visible');
 var submenu = $(this).next('ul.sub-menu');
 if( submenu.length >= 1 ) {
 event.preventDefault();
 visibleSubmenu.slideUp();
 submenu.slideToggle();
 }
 });
});


text:
Q: Recommended path for caching images on external memory / sd card When I look at my sd card root directory in Android file transfer or Astro file manager it's a mess because apps are storing files all over the place.
As developers we follow best practice by caching images/files etc to make our apps quicker and we use Environment.getExternalStorageDirectory() to get the root of the external storage (not hardcoding /sdcard). But what should go next? ideal world we'd follow a convention for dumping our cached files on the open field that is the external storage?
Here's a couple of the options I see from my own device/experience:

*

*/.cache/app_name/

*/.app_name/

*/cache/<app_name>/

*/data/<app_name>/

*/com.package.name/

*/app_name/
I currently prefer the first option as hidden by default from on device file managers.
Does anyone know of recommendations from Google or conventions followed by several popular/big names apps? or reasons this is a bad idea?

A: According to the Developer Docs

Saving cache files
If you're using API Level 8 or greater, use getExternalCacheDir() to open a File that represents the external storage directory where you should save cache files. If the user uninstalls your application, these files will be automatically deleted. However, during the life of your application, you should manage these cache files and remove those that aren't needed in order to preserve file space.
If you're using API Level 7 or lower, use getExternalStorageDirectory() to open a File that represents the root of the external storage, then write your cache data in the following directory:
/Android/data/<package_name>/cache/
The <package_name> is your Java-style package name, such as "com.example.android.app".

More info here
http://developer.android.com/guide/topics/data/data-storage.html#filesExternal
Hope it helps

A: The Developer Guide states that files should be stored in the directory /Android/data/<package_name>/files/, which is seemingly where a fair few apps store their files. As an added benefit, files here will get deleted once your app is uninstalled and it doesn't clutter up the root. I'd think putting cache files in /Android/data/<package_name>/cache/ would probably be a good option!


text:
Q: I am trying to install bcml library but it errors I am trying to install something but it keeps giving me errors, this is the command:
pip3 install bcml
I have tried to upgrade my pip, setuptools, but it keeps giving me errors.
This is what shows up when I try and execute:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools>pip3 install bcml
Collecting bcml
  Using cached bcml-3.10.1-cp39-none-win_amd64.whl (18.8 MB)
Collecting pywebview~=3.6.3
  Using cached pywebview-3.6.3-py3-none-any.whl (351 kB)
Collecting oead~=1.2.4
  Using cached oead-1.2.6-cp39-cp39-win_amd64.whl (978 kB)
Collecting aamp~=1.4.1
  Using cached aamp-1.4.1-py3-none-any.whl (337 kB)
Collecting numpy==1.19.2
  Using cached numpy-1.19.2.zip (7.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [265 lines of output]
      Running from numpy source directory.
      setup.py:470: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
        run_build = parse_setuppy_commands()
      Processing numpy/random\_bounded_integers.pxd.in
      Processing numpy/random\bit_generator.pyx
      Processing numpy/random\mtrand.pyx
      Processing numpy/random\_bounded_integers.pyx.in
      Processing numpy/random\_common.pyx
      Processing numpy/random\_generator.pyx
      Processing numpy/random\_mt19937.pyx
      Processing numpy/random\_pcg64.pyx
      Processing numpy/random\_philox.pyx
      Processing numpy/random\_sfc64.pyx
      Cythonizing sources
      blas_opt_info:
      blas_mkl_info:
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries mkl_rt not found in ['c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\libs']
        NOT AVAILABLE

      blis_info:
        libraries blis not found in ['c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\libs']
        NOT AVAILABLE

      openblas_info:
        libraries openblas not found in ['c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\libs']
      get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
      customize GnuFCompiler
      Could not locate executable g77
      Could not locate executable f77
      customize IntelVisualFCompiler
      Could not locate executable ifort
      Could not locate executable ifl
      customize AbsoftFCompiler
      Could not locate executable f90
      customize CompaqVisualFCompiler
      Could not locate executable DF
      customize IntelItaniumVisualFCompiler
      Could not locate executable efl
      customize Gnu95FCompiler
      Could not locate executable gfortran
      Could not locate executable f95
      customize G95FCompiler
      Could not locate executable g95
      customize IntelEM64VisualFCompiler
      customize IntelEM64TFCompiler
      Could not locate executable efort
      Could not locate executable efc
      customize PGroupFlangCompiler
      Could not locate executable flang
      don't know how to compile Fortran code on platform 'nt'
        NOT AVAILABLE

      atlas_3_10_blas_threads_info:
      Setting PTATLAS=ATLAS
        libraries tatlas not found in ['c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\libs']
        NOT AVAILABLE

      atlas_3_10_blas_info:
        libraries satlas not found in ['c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\libs']
        NOT AVAILABLE

      atlas_blas_threads_info:
      Setting PTATLAS=ATLAS
        libraries ptf77blas,ptcblas,atlas not found in ['c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\libs']
        NOT AVAILABLE

      atlas_blas_info:
        libraries f77blas,cblas,atlas not found in ['c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\libs']
        NOT AVAILABLE

      accelerate_info:
        NOT AVAILABLE

      C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\system_info.py:1914: UserWarning:
          Optimized (vendor) Blas libraries are not found.
          Falls back to netlib Blas library which has worse performance.
          A better performance should be easily gained by switching
          Blas library.
        if self._calc_info(blas):
      blas_info:
        libraries blas not found in ['c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\libs']
        NOT AVAILABLE

      C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\system_info.py:1914: UserWarning:
          Blas (http://www.netlib.org/blas/) libraries not found.
          Directories to search for the libraries can be specified in the
          numpy/distutils/site.cfg file (section [blas]) or by setting
          the BLAS environment variable.
        if self._calc_info(blas):
      blas_src_info:
        NOT AVAILABLE

      C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\system_info.py:1914: UserWarning:
          Blas (http://www.netlib.org/blas/) sources not found.
          Directories to search for the sources can be specified in the
          numpy/distutils/site.cfg file (section [blas_src]) or by setting
          the BLAS_SRC environment variable.
        if self._calc_info(blas):
        NOT AVAILABLE

      non-existing path in 'numpy\\distutils': 'site.cfg'
      lapack_opt_info:
      lapack_mkl_info:
        libraries mkl_rt not found in ['c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\libs']
        NOT AVAILABLE

      openblas_lapack_info:
        libraries openblas not found in ['c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\libs']
        NOT AVAILABLE

      openblas_clapack_info:
        libraries openblas,lapack not found in ['c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\libs']
        NOT AVAILABLE

      flame_info:
        libraries flame not found in ['c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\libs']
        NOT AVAILABLE

      atlas_3_10_threads_info:
      Setting PTATLAS=ATLAS
        libraries lapack_atlas not found in c:\users\scarl\appdata\local\programs\python\python39\lib
        libraries tatlas,tatlas not found in c:\users\scarl\appdata\local\programs\python\python39\lib
        libraries lapack_atlas not found in C:\
        libraries tatlas,tatlas not found in C:\
        libraries lapack_atlas not found in c:\users\scarl\appdata\local\programs\python\python39\libs
        libraries tatlas,tatlas not found in c:\users\scarl\appdata\local\programs\python\python39\libs
      <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
        NOT AVAILABLE

      atlas_3_10_info:
        libraries lapack_atlas not found in c:\users\scarl\appdata\local\programs\python\python39\lib
        libraries satlas,satlas not found in c:\users\scarl\appdata\local\programs\python\python39\lib
        libraries lapack_atlas not found in C:\
        libraries satlas,satlas not found in C:\
        libraries lapack_atlas not found in c:\users\scarl\appdata\local\programs\python\python39\libs
        libraries satlas,satlas not found in c:\users\scarl\appdata\local\programs\python\python39\libs
      <class 'numpy.distutils.system_info.atlas_3_10_info'>
        NOT AVAILABLE

      atlas_threads_info:
      Setting PTATLAS=ATLAS
        libraries lapack_atlas not found in c:\users\scarl\appdata\local\programs\python\python39\lib
        libraries ptf77blas,ptcblas,atlas not found in c:\users\scarl\appdata\local\programs\python\python39\lib
        libraries lapack_atlas not found in C:\
        libraries ptf77blas,ptcblas,atlas not found in C:\
        libraries lapack_atlas not found in c:\users\scarl\appdata\local\programs\python\python39\libs
        libraries ptf77blas,ptcblas,atlas not found in c:\users\scarl\appdata\local\programs\python\python39\libs
      <class 'numpy.distutils.system_info.atlas_threads_info'>
        NOT AVAILABLE

      atlas_info:
        libraries lapack_atlas not found in c:\users\scarl\appdata\local\programs\python\python39\lib
        libraries f77blas,cblas,atlas not found in c:\users\scarl\appdata\local\programs\python\python39\lib
        libraries lapack_atlas not found in C:\
        libraries f77blas,cblas,atlas not found in C:\
        libraries lapack_atlas not found in c:\users\scarl\appdata\local\programs\python\python39\libs
        libraries f77blas,cblas,atlas not found in c:\users\scarl\appdata\local\programs\python\python39\libs
      <class 'numpy.distutils.system_info.atlas_info'>
        NOT AVAILABLE

      lapack_info:
        libraries lapack not found in ['c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\scarl\\appdata\\local\\programs\\python\\python39\\libs']
        NOT AVAILABLE

      C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\system_info.py:1748: UserWarning:
          Lapack (http://www.netlib.org/lapack/) libraries not found.
          Directories to search for the libraries can be specified in the
          numpy/distutils/site.cfg file (section [lapack]) or by setting
          the LAPACK environment variable.
        return getattr(self, '_calc_info_{}'.format(name))()
      lapack_src_info:
        NOT AVAILABLE

      C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\system_info.py:1748: UserWarning:
          Lapack (http://www.netlib.org/lapack/) sources not found.
          Directories to search for the sources can be specified in the
          numpy/distutils/site.cfg file (section [lapack_src]) or by setting
          the LAPACK_SRC environment variable.
        return getattr(self, '_calc_info_{}'.format(name))()
        NOT AVAILABLE

      numpy_linalg_lapack_lite:
        FOUND:
          language = c
          define_macros = [('HAVE_BLAS_ILP64', None), ('BLAS_SYMBOL_SUFFIX', '64_')]

      C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\_distutils\dist.py:275: UserWarning: Unknown distribution option: 'define_macros'
        warnings.warn(msg)
      running dist_info
      running build_src
      build_src
      building py_modules sources
      creating build
      creating build\src.win32-3.9
      creating build\src.win32-3.9\numpy
      creating build\src.win32-3.9\numpy\distutils
      building library "npymath" sources
      Traceback (most recent call last):
        File "c:\users\scarl\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 351, in <module>
          main()
        File "c:\users\scarl\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "c:\users\scarl\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 152, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\build_meta.py", line 157, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\build_meta.py", line 248, in run_setup
          super(_BuildMetaLegacyBackend,
        File "C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\build_meta.py", line 142, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 499, in <module>
          setup_package()
        File "setup.py", line 491, in setup_package
          setup(**metadata)
        File "C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\core.py", line 169, in setup
          return old_setup(**new_attr)
        File "C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\__init__.py", line 165, in setup
          return distutils.core.setup(**attrs)
        File "C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
          dist.run_commands()
        File "C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
          self.run_command(cmd)
        File "C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
          cmd_obj.run()
        File "C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\command\dist_info.py", line 31, in run
          egg_info.run()
        File "C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\command\egg_info.py", line 24, in run
          self.run_command("build_src")
        File "C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
          cmd_obj.run()
        File "C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\command\build_src.py", line 144, in run
          self.build_sources()
        File "C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\command\build_src.py", line 155, in build_sources
          self.build_library_sources(*libname_info)
        File "C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\command\build_src.py", line 288, in build_library_sources
          sources = self.generate_sources(sources, (lib_name, build_info))
        File "C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\command\build_src.py", line 378, in generate_sources
          source = func(extension, build_dir)
        File "numpy\core\setup.py", line 650, in get_mathlib_info
          st = config_cmd.try_link('int main(void) { return 0;}')
        File "C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\_distutils\command\config.py", line 243, in try_link
          self._link(body, headers, include_dirs,
        File "C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\command\config.py", line 161, in _link
          return self._wrap_method(old_config._link, lang,
        File "C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\command\config.py", line 95, in _wrap_method
          ret = mth(*((self,)+args))
        File "C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\_distutils\command\config.py", line 137, in _link
          (src, obj) = self._compile(body, headers, include_dirs, lang)
        File "C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\command\config.py", line 104, in _compile
          src, obj = self._wrap_method(old_config._compile, lang,
        File "C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\command\config.py", line 95, in _wrap_method
          ret = mth(*((self,)+args))
        File "C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\_distutils\command\config.py", line 132, in _compile
          self.compiler.compile([src], include_dirs=include_dirs)
        File "C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 401, in compile
          self.spawn(args)
        File "C:\Users\scarl\AppData\Local\Temp\pip-build-env-0ar11i87\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 505, in spawn
          return super().spawn(cmd, env=env)
        File "C:\Users\scarl\AppData\Local\Temp\pip-install-5zi0nmxu\numpy_bfc579247c784570b8bf0b27259d9e90\numpy\distutils\ccompiler.py", line 90, in <lambda>
          m = lambda self, *args, **kw: func(self, *args, **kw)
      TypeError: CCompiler_spawn() got an unexpected keyword argument 'env'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I tried to execute the command: pip3 install bcml
I have tried to upgrade my resources
I have python 3.9
It keeps breaking

A: You cannot use python 3.9 with this package, it has requirements only available on Python 3.7.x or 3.8.x.
For full installation instructions for this package, check out the wiki article

BCML requires Python 3.8.10 or 3.7.9, and the x64 Visual C++ redistributable. When you open the Python installer, there will be a checkbox that says Add Python to PATH. You MUST check this box, or else BCML can't be installed. From here, continue as normal, and install the x64 Visual C++ redistributable.
Open a command prompt anywhere (if you don't know how, just type cmd into Windows Search).
Run pip install bcml (in normal cmd, NOT the python console). You should see a bunch of progress bars, and then a success message.
To run BCML all you need to do is type bcml into a cmd prompt.
If you would like to have a shortcut made, BCML has that option on the settings page.


text:
Q: Find K subsets of a list with elements 1...N while preserving the order of the elements Given a list of integers from 1...N I am trying to find K subsets of the elements, while preserving the order of the elements. For example, when N = 4 and K = 2:
[1] [2, 3, 4]
[1, 2] [3, 4]
[1, 2, 3] [4]
[1, 2, 3, 4] []
Would be the correct output.
So far I've gotten the first column of possibilities. But I am struggling to get the correct logic.
    final = [['' for x in range(K)] for y in range(N)]
    i = 0
    for k in range(0, K):
        # row tracker
        i = 0
        while i < N:
            if k > 0:
                st = len(final[i][k - 1])
            else:
                st = 0
            for j in range(0, N):
                tmp = ""
                prefix = chemicals[:j + 1]
                tmp = tmp.join(str(i) for i in prefix)
                final[i][k] = tmp
                i += 1
        print

Again, correct output would be:
[1] [2, 3, 4]
[1, 2] [3, 4]
[1, 2, 3] [4]
[1, 2, 3, 4] []
Where a set can be empty.
Update: This is the correct output for N=4, K=3
[1] [2] [3, 4]
[1] [2, 3] [4]
[1] [2, 3, 4] []
[1, 2] [3] [4]
[1, 2] [3, 4] []
[1, 2, 3] [4] []
[1, 2, 3, 4] [] []

A: I think a simple list comprehension with slicing should suffice. You may want to use itertools.combinations as well:
import itertools

N = 4
K = 2

elements = list(range(1, N + 1))
final = [[elements[a:b] for a, b in zip([0] + cuts, cuts + [N])]
                        for cuts in (list(c) for c in itertools.combinations(elements, K - 1))]

for x in final:
    print(*x)

Output:
[1] [2, 3, 4]
[1, 2] [3, 4]
[1, 2, 3] [4]
[1, 2, 3, 4] []

A: You can use a function that iterates an index from a given starting number, defaulting to 1, to n, yields a range of numbers from the starting number to the index, and recursively joins the subsets from the recursive call with a starting index of one higher and one less subset, until either starting index is greater than n or k becomes 1, at which point the remaining range should be yielded:
def get_subsets(n, k, s=1):
    if s > n or k == 1:
        yield [list(range(s, n + 1))] + [[] for _ in range(1, k)]
        return
    for i in range(s, n + 1):
        for subsets in get_subsets(n, k - 1, i + 1):
            yield [list(range(s, i + 1))] + subsets

so that:
for s in get_subsets(4, 2):
    print(*s)

outputs:
[1] [2, 3, 4]
[1, 2] [3, 4]
[1, 2, 3] [4]
[1, 2, 3, 4] []

and that:
for s in get_subsets(4, 3):
    print(*s)

outputs:
[1] [2] [3, 4]
[1] [2, 3] [4]
[1] [2, 3, 4] []
[1, 2] [3] [4]
[1, 2] [3, 4] []
[1, 2, 3] [4] []
[1, 2, 3, 4] [] []


text:
Q: @ModelAttribute annotation, when to use it? Lets say we have an entity Person, a controller PersonController and an edit.jsp page (creating a new or editing an existing person)
Controller
@RequestMapping(value = "/edit", method = RequestMethod.POST)
public String editPerson(@RequestParam("fname") String fname, Model model) {
    if(fname == null || fname.length() == 0){
        model.addAttribute("personToEditOrCreate", new Person());
    }
    else{
        Person p = personService.getPersonByFirstName(fname);
        model.addAttribute("personToEditOrCreate", p);
    }

    return "persons/edit";
}

@RequestMapping(value = "/save", method = RequestMethod.POST)
public String savePerson(Person person, BindingResult result) {

    personService.savePerson(person);
    return "redirect:/home";
}

edit.jsp
<form:form method="post" modelAttribute="personToEditOrCreate" action="save">
    <form:hidden path="id"/>

            <form:label path="firstName">First Name</form:label>
            <form:input path="firstName" />

            <form:label path="lastName">Last Name</form:label>
            <form:input path="lastName" />

            <form:label path="money">Money</form:label>
            <form:input path="money" />

                <input type="submit" value="Add/Edit Person"/>

</form:form>

Im trying the code above (without using the @ModelAttribute annotation in the savePerson method, and it works correct. Why and when do i need to add the annotation to the person object:
@RequestMapping(value = "/save", method = RequestMethod.POST)
public String savePerson(@ModelAttribute("personToEditOrCreate") Person person, BindingResult result) {

    personService.savePerson(person);
    return "redirect:/home";
}

A: You don't need @ModelAttribute (parameter) just to use a Bean as a parameter
For example, these handler methods work fine with these requests:
@RequestMapping("/a")
void pathA(SomeBean someBean) {
  assertEquals("neil", someBean.getName());
}

GET /a?name=neil

@RequestMapping(value="/a", method=RequestMethod.POST)
void pathAPost(SomeBean someBean) {
  assertEquals("neil", someBean.getName());
}

POST /a
name=neil

Use @ModelAttribute (method) to load default data into your model on every request - for example from a database, especially when using @SessionAttributes. This can be done in a Controller or in a ControllerAdvice:
@Controller
@RequestMapping("/foos")
public class FooController {

  @ModelAttribute("foo")
  String getFoo() {
    return "bar";  // set modelMap["foo"] = "bar" on every request
  }

}

Any JSP forwarded to by FooController:
${foo} //=bar

or
@ControllerAdvice
public class MyGlobalData {

  @ModelAttribute("foo")
  String getFoo() {
    return "bar";  // set modelMap["foo"] = "bar" on every request
  }

}

Any JSP:
${foo} //=bar

Use @ModelAttribute (parameter) if you want to use the result of @ModelAttribute (method) as a default:
@ModelAttribute("attrib1")
SomeBean getSomeBean() {
  return new SomeBean("neil");  // set modelMap["attrib1"] = SomeBean("neil") on every request
}

@RequestMapping("/a")
void pathA(@ModelAttribute("attrib1") SomeBean someBean) {
  assertEquals("neil", someBean.getName());
}

GET /a

Use @ModelAttribute (parameter) to get an object stored in a flash attribute:
@RequestMapping("/a")
String pathA(RedirectAttributes redirectAttributes) {
  redirectAttributes.addFlashAttribute("attrib1", new SomeBean("from flash"));
  return "redirect:/b";
}

@RequestMapping("/b")
void pathB(@ModelAttribute("attrib1") SomeBean someBean) {
  assertEquals("from flash", someBean.getName());
}

GET /a

Use @ModelAttribute (parameter) to get an object stored by @SessionAttributes
@Controller
@SessionAttributes("attrib1")
public class Controller1 {

    @RequestMapping("/a")
    void pathA(Model model) {
        model.addAttribute("attrib1", new SomeBean("neil")); //this ends up in session due to @SessionAttributes on controller
    }

    @RequestMapping("/b")
    void pathB(@ModelAttribute("attrib1") SomeBean someBean) {
        assertEquals("neil", someBean.getName());
    }
}

GET /a
GET /b

A: Your question appears to be answered already:
What is @ModelAttribute in Spring MVC?
To summarize the answer and blog post: when you want your form backing object (instance of Person) to be persisted across requests.
Otherwise, without the annotation, the request mapped method will assume Person is a new object and in no way linked to your form backing object. The blog post that poster references is really awesome by the way, definitely a must-read.

A: An @ModelAttribute on a method argument indicates the argument will be retrieved from the model.If not present in the model, the argument will be instantiated first and then added to the model.


text:
Q: Can I receive a stream over HTTP with JavaScript, Flash, or Silverlight? I'm prototyping a realtime notification mechanism using http over port 80. The aim of the project is to allow a Flash application to respond to an event on a remote server quickly (specifically an inbound phone call being connected to a phone next to the computer.) Polling is one approach, but is too slow. Currently I use a socket connection to get low latency notification of the events on the server, which works well but isn't firewall friendly. I don't want to install anything except Flash, or Silverlight on the client. Cross compatibility of browsers isn't a concern - in this application I can specify what browser the client uses but IE is preferred.
I've made a server HttpHandler in .NET which never closes the connection and sends the "events" to the client by writing out bytes to the http response stream (ConnectedClientContext.Response.OutputStream.Write etc) and I have a .NET client application which can read these messages okay.
My Question:
Can I receive the bytes from the server over HTTP as they arrive using JavaScript, Flash or Silverlight? So far I can only find a way to get notified of the "download progress" and don't get the actual bytes until the response is closed - I want them as they arrive.
Best Regards,
Daniel

A: I don't know about Flash but in Javascript (by which you mean in browser) and Silverlight you are limited pretty much to the http protocol.
You can use the AJAX Http Streaming pattern.  The basic ideas which is different from what you are trying is that as soon as data is available outstanding request ends and a new is immediately initiated asychronously, mean while your client process the newly arrived data.
Silverlight gives you more options since is HTTP stack is purely asynchronous but you can get your hands on the stream to you as soon as data starts to arive by setting the HttpWebRequest.AllowReadStreamBuffering to false.  (Unlike XmlHttpRequest which always buffers).

A: it's very easy to use the Comet ideas for notifications.  you don't even have to use a comet-specific framework.  simply do an ajax request with a callback on answer, wrap this on a loop and you have an event loop, just like a GUI app.  on the server side, don't bother answering the request until there's either an event, or a timeout (which is just a 'null' event).

A: Flex and Flash have several AMF/XML remoting libraries available that support data pushing. I would certainly look into that.
http://raghuonflex.wordpress.com/2008/04/17/data-push-in-flex-with-backend/
These libraries use a Comet - like implementation to achieve this.


text:
Q: jquery динамичное изменение типа поля Здраствуйте. Меняю тип поля:
$(document).ready(function () {

 $("#idADDED_SUM_TO_PRICE_SECOND").prop("type", "number");

}

и срабатывает корректно ,но при вводе числового значения  выдется предупреждение типа: "The specified value 111 1 cannot be parsed, or is out of range."
Насколько я понимаю ,проблема в пробеле, но в самом поле пробел отсутсвует ,обычное поле типа number со стрелками. В чем загвоздка и куда копать? Спасбо