Overflow-x de uma  que contém outras três

Question:
Bem, eu fiz uma div principal, e ela contém outras 3 div.
O conteúdo dessas 3 divisões internas é 1234567890 três vezes seguidas, e gostaria que o width delas se expandisse dentro da div principal de acordo com o tamanho do conteúdo na horizontal, e que essa div principal não ultrapassasse o tamanho máximo da tela mas que tivesse uma rolagem horizontal com o overflow-x. Sendo que ativa o overflow-x das divisões internas, e a divisão principal não faz uso.
Código no CSS:
#divResultadosNaTela {
    margin: 0.5% 0.5% 0.5% 0; /* Espaçamento do elemento, no caso a divisão, com outros elementos. 20px com top, 0 com right e bottom, e 20 com left. */
    max-height: 430px; /* Altura máxima de 430 pixels. */
    font-size: 100%;
    display: flex; /* Coloca as divisões dos resultados um do lado do outro. */
    overflow-x: scroll; /* Coloca uma barra de rolagem no eixo x. */
}

/* Aqui é a classe das divisões dos resultados. */
.result {
    overflow-y: auto; /* Rolagem vertical automática. */
    max-height: 410px; /* Limita a altura das divisões dos resultados em 400 pixels para que não ultrapassem a tela. */
    margin: 0.5%; /* Espaçamento do elemento em relação a outros elementos. */
    padding: 0.5%; /* Espaçamento interno com relação aos elementos internos. */
}

Não consegui encontrar nenhuma resposta no site que me ajude. Como corrigir isso apenas com Html5 e CSS3?
Answer: Recomendo que use uma outra div dentro da div.result. Digo isso pq é muito problemático trabalhar com overflow em filhos diretor de um pai com display:flex. Então ou vc coloca o overflow-y no próprio pai ou no "neto"...

Segue o código da imagem acima.

#divResultadosNaTela {
  margin: 0.5% 0.5% 0.5% 0;
  /* Espaçamento do elemento, no caso a divisão, com outros elementos. 20px com top, 0 com right e bottom, e 20 com left. */
  max-height: 430px;
  font-size: 100%;
  display: flex;
  /* Coloca as divisões dos resultados um do lado do outro. */
  overflow-x: scroll;
  /* Coloca uma barra de rolagem no eixo x. */
  width: 100%;
}

/* Aqui é a classe das divisões dos resultados. */
.result {
  border: 1px solid #000;
  margin: 0.5%;
  /* Espaçamento do elemento em relação a outros elementos. */
  padding: 0.5%;
  /* Espaçamento interno com relação aos elementos internos. */
}

/* esse é o conteinar que vai receber o overflow, não use overflow no filho direto de um pai flex. */
.result>div {
  max-height: 100%;
  overflow-y: auto;
}

mmmmmmmmmmm123123213m12m3m12m3m12m3m12m3m12m3m12m3m12m3m123m12 Lorem ipsum dolor sit amet, consectetur
      adipisicing elit. Aperiam nobis ratione laborum inventore libero molestias ducimus. In dolorem
      necessitatibus quisquam nemo, autem dolore illum earum libero accusantium sit saepe nisi! Eum
      consectetur mollitia cum dolor est explicabo impedit, culpa aliquam, dolorum omnis ab? Molestias,
      asperiores? Aliquid hic laboriosam maiores iste eveniet exercitationem deserunt, nesciunt odit earum
      beatae nihil, quis ipsum minus laudantium. Dolor dicta eos esse similique est nesciunt, eligendi et
      reprehenderit at dolore adipisci. In facilis reprehenderit quis quo labore magnam hic ad laborum odit,
      natus debitis ab sed deleniti ipsum omnis officiis exercitationem architecto fugiat odio autem ex
      eligendi obcaecati. Illum recusandae nesciunt cupiditate harum officiis asperiores molestiae. Pariatur
      modi quibusdam id repellat tempora repudiandae asperiores, beatae esse, expedita quam qui rem maiores
      magnam velit sequi quia eum nostrum voluptates aliquid. Cumque iusto dicta id, culpa cum ullam ut
      tempora vel, beatae voluptas enim laboriosam ipsa doloremque a ea architecto cupiditate harum tempore
      nulla eaque illum nobis itaque? Repellat fuga, aliquid deleniti numquam sunt nobis quisquam cupiditate
      voluptas nihil perferendis eum rem optio voluptatum reprehenderit illo dignissimos necessitatibus.
      Incidunt et quae dolore qui. Molestiae in, velit, sint esse, enim omnis quo laborum possimus earum
      doloremque unde deleniti tenetur. Provident totam necessitatibus perspiciatis delectus eveniet ipsa
      dolores assumenda a libero. Magnam nesciunt quos voluptatibus facilis in sunt animi reiciendis dicta
      rerum fuga ea aliquam repellendus, perspiciatis, veniam cumque recusandae velit quibusdam, eos
      necessitatibus dolores natus. Tempore deserunt, voluptatem possimus quasi suscipit, ad minus quibusdam
      neque temporibus omnis quis esse magnam. Repellat enim incidunt at molestiae minima adipisci, odio culpa
      sapiente itaque consectetur ut magnam repellendus, quo explicabo reprehenderit illo fugiat magni iure
      dolor illum! Veritatis corporis dicta minima quas natus. Aspernatur magnam, porro eaque saepe dolore
      delectus, ullam ipsam nisi, unde molestiae odit maxime illum et suscipit voluptatum eos.

mmmmmmmmmmm123123213m12m3m12m3m

mmmmmmmmmmm123123213m12m3m12m3m12m3m12m3m12m3m12m3

Opção que não recomendo. Pois vc pode precisar do overflow-y caso o conteúdo tenha muitas linhas
Vc colocou overflow nas divs filhas classe .result. Basicamente tirando isso resolve, assim a div de resultado expande conforme o conteúdo. Deixe essas divs com uma borda apenas pra vc verificar até onde cada uma vai.

Segue o código da imagem acima

#divResultadosNaTela {
        margin: 0.5% 0.5% 0.5% 0; /* Espaçamento do elemento, no caso a divisão, com outros elementos. 20px com top, 0 com right e bottom, e 20 com left. */
        max-height: 430px; /* Altura máxima de 430 pixels. */
        font-size: 100%;
        display: flex; /* Coloca as divisões dos resultados um do lado do outro. */
        overflow-x: scroll; /* Coloca uma barra de rolagem no eixo x. */
    }

/* Aqui é a classe das divisões dos resultados. */
.result {
    /* overflow-y: auto; */ /* TIRA ESSE OVERFLOW / Rolagem vertical automática. */
    border: 1px solid #000;
    max-height: 410px; /* Limita a altura das divisões dos resultados em 400 pixels para que não ultrapassem a tela. */
    margin: 0.5%; /* Espaçamento do elemento em relação a outros elementos. */
    padding: 0.5%; /* Espaçamento interno com relação aos elementos internos. */
}

mmmmmmmmmmm123123213m12m3m12m3m12m3m12m3m12m3m12m3m12m3m123m12

mmmmmmmmmmm123123213m12m3m12m3m

mmmmmmmmmmm123123213m12m3m12m3m12m3m12m3m12m3m12m3

Comment: Essa resposta não está perfeita, pode não funcionar para o seu caso em específico. O pai por ser flex deixa os filhos com um controle de overflow estranho... Se não se aplicar no modelo final seria interessante fazer o CSS com Display:inline-block ou mesmo Float...
Answer: Perfeito, eu usei a primeira alternativa. Para "esticar" a largura das divs "filhas" eu coloquei mais caracteres dentro delas, e creio que vou deixar caracteres de espaço no resultado final como uma gambiarra. E o resultado foi este a seguir com um div principal, 3 divs "filhas", e cada "filha" com uma div "neta" pra quem tiver a mesma dúvida:

HTML5:

123456789012345678901234567890123456789012345678901234567890

123456789012345678901234567890123456789012345678901234567890

123456789012345678901234567890123456789012345678901234567890

CSS3:
#divResultadosNaTela {
    margin: 0.5% 0.5% 0.5% 0; /* Espaçamento do elemento, no caso a divisão, com outros elementos. 20px com top, 0 com right e bottom, e 20 com left. */
    max-height: 430px; /* Altura máxima de 430 pixels. */
    font-size: 100%;
    display: flex; /* Coloca as divisões dos resultados um do lado do outro. */
    overflow-x: scroll; /* Coloca uma barra de rolagem no eixo x. */
}

/* Aqui é a classe das divisões dos resultados. (divs "filhos") */
.result {
    max-height: 410px; /* Altura máxima. */
    margin: 0.5%; /* Espaçamento do elemento em relação a outros elementos. */
    padding: 0.5%; /* Espaçamento interno com relação aos elementos internos. */
    border: dashed; /* Coloca a borda como tracejada. */
}

/* Classe das divisões internas às divisões dos resultados. (divs "netos") */
.result2 {
    margin: 0.5%; /* Espaçamento externo. */
    padding: 0.5%; /* Espaçamento interno. */
    overflow-y: auto; /* Barra de rolagem automática no eixo y. */
    max-height: 355px; /* Altura máxima. */
    font-size: 18px; /* Tamanho da fonte. */
    border: dotted; /* Coloca a borda como pontilhada. */
}


To improve Tesseract Accuracy

Question: I have been developing an application for License Plate Recognition and I am able to detect the number plate successfully from the image using OpenCV. But the problem is with the output of Tesseract e.g. if there is a number say "BI6 COL" in image, Tesseract detect it as "BISWCDL"
I have tried several image preprocessing methods (resampling,morphological operations, binarization...) but the accuracy in results is still low.
Please suggest how can I improve the quality of output
Comment: Please share what you've tried.
Answer: If you are working on number plate recognition, I would recommend you to train Tesseract exclusively for number plate characters as per your country, considering most countries have different fonts used for writing on the number plate. Pre-processing the image will not much of a difference unless you train Tesseract to recognize characters on number plate.
USEFUL LINKS

I would recommend you to go through this Stack Overflow thread.
If you wish to train Tesseract, check out this git repository.

To improve Tesseract Accuracy


WordPress page: Uncaught TypeError: $ is not a function

Question: I'm getting this error with the code below embedded in a WordPress page. I can't find what is wrong with it.
<code><script>
  jQuery(window).load(function($) {
    if ($(".default-hero .hero-image img").length) {
      console.log($(".default-hero .hero-image img").css("height"));
      // Hero image exits. Adjust the .default-hero .inside .row to the minimum height of the image.
      $(".default-hero .inside .row").css("min-height", $(".default-hero .hero-image img").css("height"));
    }
  });
</script>
</code>
Comment: load does not return a reference to jQuery. It is the event object.
Answer: load does not return a reference to jQuery like ready() does. It is the event object which is not a function.
<code>(function($){
  jQuery(window).load(function() {
    console.log($);
  });
})(jQuery);
</code>
Comment: Hi, I changed my code accordingly, but it is not setting the min-height at all now.  `jQuery(window).load(function() {
   if ($(".default-hero .hero-image img").length) {
     // Hero image exits. Adjust the .default-hero .inside .row to the minimum height of the image.
     $(".default-hero .inside .row").css("min-height", $(".default-hero .hero-image img").css("height"));
   }
 });
})(jQuery);`


Prove that any derivative of a given function is bounded

Question: Let the function $f\left( x \right) = \left( {\frac{{1 - \cos x}}
{{{x^2}}}} \right)\cos (3x)$ if $x\ne 0$ and $f(0)=\frac{1}{2}$. Prove that any derivative of $f$ is bounded on $\mathbb{R}$. Thank so much for helping.
Answer: The original function is an entire function hence its derivatives are bounded on $[-1,1]$. Moreover, any derivative of $\frac{1-\cos x}{x^2}$ is bounded on $\mathbb{R}\setminus[-1,1]$ since it is a linear combination of functions of the form $\frac{f(x)}{x^k}$ where $f(x)$ is bounded trigonometric function and $k\geq 2$; so the same holds for $\frac{1-\cos x}{x^2}\cos(3x)$ over $\mathbb{R}$.
Comment: I understand your hint. Thank you so much.
Comment: Can you explain more precisely for me why any derivative of $\frac{1-\cos x}{x^2}$ is a linear combination of functions of the form $\frac{f(x)}{x^k}$ ?
Comment: Just use the formula for differentiating a product of two functions $n$ times. Any derivative of $1-\cos x$, as well as any derivative of $\frac{1}{x^2}$, is bounded on $\mathbb{R}\setminus[-1,1]$.


How can I disable the windows authentication mode of SQL Server

Question: How can I disable the windows authentication mode of SQL Server and restrict it to ask for username and password every time, with no windows authentication?
Comment: Probably not the best idea.
Comment: This should be on Serverfault.com
Answer: It's not possible to disable windows authentication mode.  SQL Server suports only two modes:

Windows authentication only
Mixed mode (windows authentication and SQL Server authentication)

You can limit access via windows authentication by restricting (or removing) the permissions of the windows users/groups with logins in SQL Server.
Answer: As the other posters say you cannot remove windows authentication mode.  You can however remove all windows account logins from the server instance and then you acheive the same end, nobody can log in using integrated windows authentication.
Comment: I wouldn't do that windows accounts are sysadmin-level logins that need to be available for SQL Server to function correctly.  For example deleting NT SERVICE\SQLSERVERAGENT will prevent SQL Agent from starting.  Instead its better to revoke access from windows logins.
Answer: Windows authentication is the recommended way to access SQL Server. Hence, what you're trying to do is go with the insecure way to login. SQL authentication allows for passing SQL passwords in plain view. Your passwords are not encrypted.
Answer: I don't believe this is possible. The best that you can do is to remove any unwanted Windows accounts from the permissioning.
Answer: To do what others have explained above, run the following steps

Login Using SQL Server Authentication mode,
Run the following script
USE [master]
GO
ALTER LOGIN [DomainName\Login] DISABLE
GO


How to report odds ratio for interaction between 2 categorical variables

Question: Students were split into 2 groups and were both tested on their knowledge of spaced items and massed items.
The research question is testing the difference of the difference, i.e. the difference between groups in the difference between learning spaced vs massed words.
I performed glmer(Posttest ~ group × spacing + (1|subject) + (1|item))
    subject   Item    Group   Spacing
      S1       1      G1      spaced
      S1       2      G1      spaced
      S1       3      G1      massed
      S1       4      G1      massed
      S2       1      G1      spaced
      S2       2      G1      spaced
      S2       3      G1      massed
      S2       4      G1      massed
      S3       1      G2      spaced
      S3       2      G2      spaced
      S3       3      G2      massed
      S3       4      G2      massed
      S4       1      G2      spaced
      S4       2      G2      spaced
      S4       3      G2      massed
      S4       4      G2      massed

Result: The effect of spacing depended on group (χ²(1) = 9.71, P = .002)
                   Posttest

       Predictors           Odds Ratios           CI      p

       (Intercept)             0.22         0.07 – 0.67 0.008
       group [G2]              2.74         1.26 – 6.00 0.011
       spacing [massed]        0.81         0.34 – 1.93 0.632
       group [G2]*spacing      0.45         0.27 – 0.74 0.002
       [massed]

BUT no example found in articles for reporting odds ratio when both variables are categorical.
Is my attempt below correct?
The odds of a correct response for spaced items compared to massed items were twice as high in Group2 compared to Group1 (OR = 1/Exp(B) = 1/0.45 = 2.22, 95% CI [0.27, 0.74]). Additional analysis in which massed items were taken as reference category confirmed that the reverse was true for G2 group.
Answer: You have two questions. The first question is in your title.

How to report odds ratio for interaction between 2 categorical variables?

The answer will depend on how many levels these variables have. I am glad that your both variables only have two levels, because this makes things a bit easier. So you have a two by two matrix where all observations fit.
| Group\Spacing | Spaced              | Massed              |
|---------------|---------------------|---------------------|
| Group 1       | Group1_Spaced (25%) | Group1_Massed (25%) |
| Group 2       | Group2_Spaced (25%) | Group2_Massed (25%) |

The resulting distribution of the observations in these four groups, would be equivalent as if you had only one variable with four levels.
| Group_Spaces | % of cases |
|--------------|------------|
| G1_spaced    | 25%        |
| G2_spaced    | 25%        |
| G1_massed    | 25%        |
| G2_spaced    | 25%        |

The interpretation of each of the constituent parts of the interaction term will also be equivalent to what you would obtain if you add only that hypothetical variable with four levels. That is, you would have a dummy indicator variable for each level, and one of the levels (usually the first) would have to be dropped off from the model (to avoid perfect multicollinearity). The dropped level would be the reference category for all other coefficients. So, you would have odds ratios as below:
| Group_Spaces | Odds Ratio |
|--------------|------------|
| G1_spaced    | (omitted)  |
| G2_spaced    | 2.74       |
| G1_massed    | 0.81       |
| G2_spaced    | 0.45       |

It is important to remember that all coefficients are measuring the average effect of changing levels related to omitted level, that is to "G1_spaced".
Your second question:

Is my attempt below correct?
The odds of a correct response for spaced items compared to massed items were twice as high in Group2 compared to Group1 (OR = 1/Exp(B) = 1/0.45 = 2.22, 95% CI [0.27, 0.74]). Additional analysis in which massed items were taken as reference category confirmed that the reverse was true for G2 group.

I don't think so. From your statement ("The odds of a correct response for spaced items compared to massed items were twice as high in Group2 compared to Group1"), it sounds to me like you are comparing the odds of:
$$
\frac{Group2\_spaced \div Group2\_massed}{Group1\_spaced \div Group1\_massed}
$$
However, from your calculations, you are comparing the odds of:
$$
\frac{Group1\_spaced}{Group2\_massed} = \frac{1}{0.45} = 2.22
$$
If you truly wanted the first option (which I assume you stated), then it would be:
$$
\frac{2.74 \div 0.45}{1 \div 0.81} = 4.932
$$
I think the statement you are trying to make is a bit confusing, because you are trying to compare four different categories with just one number. Mathematically, it can be done, but it is hard for our human mind to understand. So perhaps, it will work better if you compare two groups at each time. From the above table, you may say:

Students of Group 2 have 2.74 times (or 174%) higher odds of a correct answer in spaced items than students of Group 1.
Students of Group 1 have 1.8 times (or 80%) higher odds of a corrected answer in massed items than students of Group 2 (Given by 0.81/0.45).
Students of Group 1 have 23% (or 1.23 times) higher odds of a correct response in spaced items than in massed items (Given by 1/0.81).
Students of Group 2 have 6.08 times higher odds of a correct response in spaced items than in massed items (Given by 2.74/0.45)

Getting the odds and the probabilities:
In odds ratio everything is relative: 2 times more may sound a lot. But if the actual odds are 1%, then it is just a 1% increase. If the actual odds are 50%, then it is a 50% increase. Our minds do not have a good reference when working with odds ratio. They are non-intuitive and hard to interpret.
In the above calculations, We considered that the odds-ratio of the reference category is 1. This makes sense, as it is related to itself. However, if both factors are coded as dummies (0 and 1), then the intercept would be equivalent to the actual odds of the reference category. This is because, as you only have these two variables, and the intercept is the expected value when all variables are equal to zero. Therefore, I would strongly suggest you coding your factor variables this way.
If this is already the case, then you could work with the actual odds of getting each item type correct for each group:
| Group\Spacing | spaced               | massed               |
|---------------|----------------------|----------------------|
| Group 1       | 0.22                 | 0.1782 (0.22 x 0.81) |
| Group 2       | 0.6028 (0.22 x 2.74) | 0.099 (0.22 x 0.45)  |

Perhaps this numbers are easier to understand. We can see that those highly different odds ratios were all referring to actual odds lower than 1. Which means that every group has less than 50% average probability of getting the items correct.
For me, even better and more intuitive would be working with average predicted probabilities. Assuming that your factors are already coded as 0 and 1, then you could calculate your average predicted probabilities also from your coefficients and intercept:
| Group\Spacing | spaced            |  massed              |
|---------------|-------------------|----------------------|
| Group 1       | 18.0% (0.22/1.22) |  15.1% (0.178/1.178) |
| Group 2       | 37.6% (0.60/1.60) |  9% (0.099/ 1.099)   |

The advantage of working with probabilities is that it also allows you to work in additive terms and have a better idea of absolute values. If you plot the averages predicted probabilities, which is the current best practice for logistic regressions, you will make much easier to see the interaction effect (probably the main reason for adding the interaction term). In group 2, item type has a huge effect, while in group 1, it has a small effect (perhaps not even statistically significant, if you ask R to compute these values).
Additional comments:
It would be worth noticing that you are running a multilevel logistic regression model, with two cross-classified second levels. I don't know how many items or subjects you have, but if you do have only four items, it might be the case that you get a better model fit without specifying item as a second level.
Comment: Your interpretation does not fit my research question which is: comparing the difference of difference. i.e. compare the difference between groups in their spacing advantage. so your answer is not applicable unfortunately since it does not not serves this aims.
Comment: For number of items and subjects its 16 and 110, respectively.
Comment: @Acer, If you want to compare differences of difference, then I would strongly recommend you to work with predicted probabilities. Because they are ready to be computed in additive terms. Odds ratio are multiplicative, so it is a bit confusing to work with them in terms of differences in differences. For example, with probabilities, you could say: Group 2 have a 28.6 p p. increase in probabilities of getting corrected spaced items compared to massed items, while for Group 1 this increase was of 2.9 p.p.
Comment: I am not sure you are in some sort of experimental setting, but for differences-in-differences approach, I think you would need also before and after measurements
Comment: Maybe that's why researchers prefer not to report odds ratio in this case, because it is confusing.
Comment: There is a long debate on the issue of odds ratio vs. predicted probabilities. For a perspective in favor of predicted probabilities, check [this paper](https://academic.oup.com/esr/article-abstract/26/1/67/540767)


simple code doesn't work. Dunno why

Question: Got xCode 5.0.2 bought mac yesterday and do not understand why this simple code doesn't work.
#include "stdio.h"

int main(){
    int N;
    printf("vvedite koli4estvo dannih\n");//mistake and warning is here
    scanf("%d", &N);
    int *arr = new (int [N]);

    return 0;
}

mistake is
expected expression

implicit declaration of function 'new' is invalid in c99

Comment: This is in `main.m` file? Change to `main.mm`
Comment: try this `int arr[N];`
Comment: tried int arr[N] also mistake
Answer: Your code is written in C but you are using new; a C++ operator. Use malloc instead.
int *arr = malloc(sizeof(int)*N); // allocates memory for N itegers

Comment: don't you know how I can make my xCode to read c++ as well as c? because on MSDN first code reads well
Comment: Almost all ansi C codes run on c++ compilers.

simple code doesn't work. Dunno why


Why is $\exists$ used in the ZFC Axiom of Power Set instead of $\exists !$

Question: I recently obtained an old textbook on the theme Mathematical Structures (in my mother language, Slovenian). The content is truly fascinating, so naturally, after I dug through some of the main concepts, I sought universal applicability, or in simpler words, how the notation ultimately corresponds, regardless of the language in which the different textbooks are written.
To my horror, I quickly found a damming difference between my textbook and the ZFC axioms as presented in this Wikipedia website. The Definition of Power Set in my textbook is such:

To put it in LaTeX context:
$$\mathcal{P}A = \{ X; \; X \subseteq A \}$$
Which we could read as: A Power Set of a chosen set A is a set which consists of all the subsets of set A. As you can see, an example is given in the photo I provided as well. Up to this point, everything is normal. But for the existence of a Power Set, we have to propose a special axiom, which ensures a non-contradictory framework (so Cantor sets won't be a problem):

Once again, a LaTeX equivalence:
$$(\forall A)(\exists ! C)(C = \mathcal{P}A)$$
We read: For a given set A, there exists precisely one set C such that set C is the Power Set of set A. I find the little detail in this axiom that is $\exists !$ absolutely necessary, as there mustn't exist multiple modules of one set that derive from one definition. However, the Wikipedia page about ZFC axioms proposes this:
$$\forall X \exists Y \forall Z[Z \subseteq X \Rightarrow Z \in Y]$$
Which, put in words, gives: For every set X, there exists a set Y, such that for every set Z follows that if Z is a subset of X, then Z is an element of Y. At first glance, this axiom is even more elegant than the one found in my textbook, as it uses three sets and doesn't immediately assume their origin. But I am very bothered by the fact that the operand is not a $\exists !$, rather a $\exists$, thus not excluding a possibility of multiple Power Sets, at least it seems so.
Please help me. Though I have a hypothesis as to why this is so, it is NOT straight-forward: My initial thought was that the operand $\exists !$ was not needed in the Wikipedia page, because the definition of a power set was wider, therefore making the specification obsolete. Answers, criticisms and remarks are welcome. Cheers!
EDIT: Please ignore the fact that the author used old mathematical notation (e.g.: the old equivalence of $\exists !$ is $\mathsf{E} !$). Rest assured that all of the symbols mean the same as new notation.
Answer: There are two reasons:

$\exists!$ is not a standard quantifier. It is a shorthand, $\exists!x\varphi(x)$ is really $\exists x(\varphi(x)\land\forall y(\varphi(y)\rightarrow x=y))$. This means that any statement where $\exists!$ is used, is inherently more complicated than a statement where only $\exists$ is used.
The axiom of extensionality ensures that definitions give us unique sets. In particular, if there are two sets whose elements are exactly the subsets of $x$, then the two sets are equal. Therefore, we can prove that $\exists y$ is really $\exists!y$, when we define $y$ to be the power set of $x$.
Comment: The zfc axiom says there is a set containing the power set. The axiom of separation then gives the actual power set from this.
Comment: Thank you for the answer! Since you have proved that $\exists !$ is more composite than $\exists$, how would you comment on the fact that the author chose the former operand to construct the axiom. Is the proposition therefore faulty/could be done better? Do I have good mathematical literature?
Comment: @Gregor: I don't know why the author chose this formulation. This can be pedagogical, where one does not care at all about logical complexity; or it could be that whoever wrote this document is not actually a working set theorist, and wasn't paying attention to this kind of detail. Or it could be anything else. I don't know.
Comment: @Kyle: Yes, one can formulate the power set axiom in a broader sense, but one can also require that there is a set which is exactly the power set.
Comment: @AsafKaragila Okay. I wanted to make sure that I am reading legit literature and that after digesting it, I will have a deep-enough understanding of Set Theory. Cheers!
Comment: It's common to write versions of the axioms that guarantees the existence of sets containing at least all the elements you would want, and then use comprehension to get at the exact set. This goes for both power set, union and pairing. I know that at least K. Kunen does so in his set theory book.
Comment: @Arthur: Indeed. It is, however, better to use the "exact" versions, because sometimes one is interested in theories which satisfy very limited comprehension schemata.
Comment: @Asaf I pointed it out because you didn't completely address the difference in the power set axioms given in the book and in Wikipedia, which I took to be part of the question. It is easy for someone just learning axiomatic set theory to miss the uses of separation.


Unable to Update to latest core

Question: Update from 8.5.0 to 8.5.1 is failing on one of my drupal instance.
<code>>composer update drupal/core --with-dependencies
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package symfony/debug (locked at v4.0.6, required as ^3.4.0)
 is satisfiable by symfony/debug[v4.0.6] but these conflict with your
requirements or minimum-stability.
</code>
What does this mean? What should I do?
PS: Please find below some more related information
<code>>composer outdated
consolidation/output-formatters       3.1.13       3.2.0
dflydev/dot-access-data               v1.1.0       v2.0.0
drupal/core                           8.5.0        8.5.1
drupal/metatag                        1.4.0        1.5.0
egulias/email-validator               1.2.14       2.1.3
guzzlehttp/guzzle                     6.3.0        6.3.2
nikic/php-parser                      v3.1.5       v4.0.1
psy/psysh                             v0.8.17      v0.8.18
symfony-cmf/routing                   1.4.1        2.0.3
symfony/config                        v3.4.6       v4.0.6
symfony/console                       v3.4.6       v4.0.6
symfony/dependency-injection          v3.4.6       v4.0.6
symfony/event-dispatcher              v3.4.6       v4.0.6
symfony/filesystem                    v3.4.6       v4.0.6
symfony/finder                        v3.4.6       v4.0.6
symfony/http-foundation               v3.4.6       v4.0.6
symfony/http-kernel                   v3.4.6       v4.0.6
symfony/process                       v3.4.6       v4.0.6
symfony/routing                       v3.4.6       v4.0.6
symfony/serializer                    v3.4.6       v4.0.6
symfony/translation                   v3.4.6       v4.0.6
symfony/validator                     v3.4.6       v4.0.6
symfony/var-dumper                    v3.4.6       v4.0.6
symfony/yaml                          v3.4.6       v4.0.6
twig/twig                             v1.35.2      v2.4.7
</code>
composer.json file:
<code>    "name": "drupal/drupal",
    "description": "Drupal is an open source content management platform powering millions of websites and applications.",
    "type": "project",
    "license": "GPL-2.0+",
    "require": {
        "composer/installers": "^1.0.24",
        "wikimedia/composer-merge-plugin": "^1.4",
        "drush/drush": "^9.2",
        "drupal/ctools": "^3.0",
        "drupal/devel": "^1.2",
        "drupal/ds": "^3.1",
        "drupal/conditional_fields": "^1.0@alpha",
        "drupal/field_group": "^1.0",
        "drupal/filefield_paths": "^1.0@beta",
        "drupal/bootstrap_layouts": "^5.1",
        "drupal/page_manager": "^4.0@beta",
        "drupal/page_manager_ui": "^4.0@beta",
        "drupal/magnific_popup": "^1.3",
        "drupal/config_update": "^1.5",
        "drupal/config_update_ui": "^1.5",
        "drupal/duration_field": "^1.1",
        "drupal/pathauto": "^1.1",
        "drupal/token": "^1.1",
        "drupal/metatag": "^1.4",
        "drupal/bootstrap": "^3.10",
        "drupal/features": "^3.7",
        "drupal/admin_toolbar": "^1.23",
        "drupal/linked_field": "^1.1",
        "drupal/core": "^8.5",
        "drupal/bootstrap_paragraphs": "^2.0@beta",
        "drupal/entity_reference_revisions": "^1.4",
        "drupal/paragraphs": "^1.2",
        "drupal/eva": "^1.3",
        "drupal/slick_views": "^1.0@RC",
        "drupal/yaml_editor": "^1.0"
    },
    "replace": {
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "preferred-install": "dist",
        "autoloader-suffix": "Drupal8"
    },
    "extra": {
        "_readme": [
            "By default Drupal loads the autoloader from ./vendor/autoload.php.",
            "To change the autoloader you can edit ./autoload.php.",
            "This file specifies the packages.drupal.org repository.",
            "You can read more about this composer repository at:",
            "https://www.drupal.org/node/2718229"
        ],
        "merge-plugin": {
            "include": [
                "core/composer.json"
            ],
           ],
            "recurse": false,
            "replace": false,
            "merge-extra": false
        },
        "installer-paths": {
            "core": [
                "type:drupal-core"
            ],
            "modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "drush/contrib/{$name}": [
                "type:drupal-drush"
            ],
            "modules/custom/{$name}": [
                "type:drupal-custom-module"
            ],
            "themes/custom/{$name}": [
                "type:drupal-custom-theme"
            ]
        }
    },
    "autoload": {
        "psr-4": {
            "Drupal\\Core\\Composer\\": "core/lib/Drupal/Core/Composer"
        }
    },
    "scripts": {
        "pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
        "post-autoload-dump": [
            "Drupal\\Core\\Composer\\Composer::ensureHtaccess"
        ],
        "post-package-install": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup",
        "post-package-update": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup"
    },
    "repositories": {
        "0": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    }
}
</code>
Comment: Can you also add your composer.json file?
Comment: Added composer.json to the log
Comment: Anybody, any suggestions? I am stuck, I don't want to do the manual upgrade...
Comment: See https://drupal.stackexchange.com/questions/258940/how-do-i-update-core-to-8-5, you have basically the same problem as far as I see, you are mixing drupal/drupal and drupal/core
Comment: Thanks @Berdir! Looks like I need to start from drupal-project as you suggested.
Answer: Try to delete the composer.lock file and try
<code>composer update drupal/core --with-dependencies
</code>
Comment: Not working!
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package symfony/debug (installed at v4.0.6, required as ^3.4.0) is satisfiable by symfony/debug[v4.0.6] but these conflict with your requirements or minimum-stability.
Comment: Can you try this `composer update --with-dependencies drupal/core:~8.5 symfony/class-loader:~3.2.13 drush/drush:~9.@dev`
Comment: where  `"drupal/core": "^8.x",` is written in composer.json file. I think you should write it in `require { "drupal/core": "^8.x", }` part.
Comment: Composer.json is added to the quesiton. The above command still showing error.

Unable to Update to latest core


How to include both dummy measure and continuous measure of one variable into regression models?

Question: Suppose here is a market for softwares. The softwares can be free or paid, which is captured by dummy variable paid. At the same time, we have another variable, price, to measure how much the softwares are charged. Of course, price=0 refers to paid=0. The outcome variable of interest is the number of installations.
I want to see both "free vs. price effect" (the coefficient of paid) of  and "marginal price effect" (the coefficient of price). Can I just include both terms into the regression model? Or must I run two separate models? Is the correlation between the two variables a concern? Why or why not?
Answer: If you were to include both variables in the model, multicollinearity could be a concern. In an OLS model, the variance of an estimated parameter $\hat\beta$ is calculated as:$$Var(\hat\beta)=\frac{\sigma^2}{SST_j(1-R^2_j)}$$
where $\sigma^2$ is the error variance, $SST_j$ is the total sample variation for an independent variable $x_j$, and $R^2_j$ is the $R^2$ regressing $x_j$ on the remaining independent variables. Generally, we want as small an $R^2_j$ value as possible, and ideally a value of 0 with no correlation between the independent variables.
In your example there won't a perfect correlation, but the high $R^2_j$ could result in variance estimates which are too large to be useful. It can be viewed as analogous to problems using small samples.
So this is basically why you might run into problems including both in the model. Note that OLS can still be applied provided the correlation is not perfect, and that the question "how much multicollinearity is acceptable?" is contentious. Whether you include both or model them separately is possibly down to the extent to which you believe they measure the same phenomenon.
Hope that helps :)
Answer: If you believe that paid effect is exist. You should include them in a model both to rid of estimator bias, although you will suffer multicollinearity. For instance, I build the "real model" to illustrate it by simulate:
$$
ins = \beta_1 + \beta_2 paid + \beta_3 price + u \\
u \sim N(0,1) \\
\beta_1  = \beta_2 = \beta_3 = 1 \\
X \sim U(-1,1) \quad price \sim \max(0,X) \quad  paid \sim sign(price)
$$
and I fit the data generated from the "real model" by two model form:
$$
ins = \beta_1 + \beta_2 paid + \beta_3 price + u \\
ins = \beta_1 + \beta_3 price + u
$$
<code>experiment <- function(size = 100, b1 = 1, b2 = 1, b3 = 1, sigma = 1){
    r <- runif(size,-1,1)
    free <- r > 0
    price <- r * free
    u <- rnorm(size,0,sigma)
    ins <- b1 + b2*free + b3*price + u
    df <- data.frame(ins = ins,free = free, price = price)
    mod1 <- lm(ins~free+price,data=df)
    mod2 <- lm(ins~price,data=df)
    return(list(mod1,mod2))
}

nums <- 1000 # the number of simulation
mods <- replicate(nums, experiment())
mods1 <- mods[seq(1,2000,2)]
mods2 <- mods[seq(2,2000,2)]
mods1b3 <- sapply(mods1,function(mod)unlist(mod)$coefficients.price)
mods2b3 <- sapply(mods2,function(mod)unlist(mod)$coefficients.price)

mean(mods1b3) # output: 0.983897849329834
mean(mods2b3) # output: 2.19213258786454
sd(mods1b3) # output: 0.504819985630698
sd(mods2b3) # output: 0.327550381543426
</code>
As you can see, model without $\beta_2$ have lower sd but fatal bias to real value(2.19 to 1.0), while the bias of the model with $\beta_2$ is unsignificant(0.98 to 1.0). Thus, lower sd(0.32 to 0.50) is pointless. You need non-bias version and bear the bigger sd that should be beared.


I can't to expose the option sort Post Date in a view in Drupal 7

Question: I have created a view type content, with the follow features:
Format
Format: Unformatted list | Settings
Show: Content | Teaser
Fields
The selected style or row format does not utilize fields.
Filter criteria
Content: Type (= article)
Content: Published (Yes)
Sort criteria
Content: Post date (desc)
When I checked the option "Expose this sort to visitors, to allow them to change it " in Sort Criteria>Post Date and press Apply, the sort Expose doesn't show and when I am going again to Post Date I can see that the change was not stored, the "Expose this sort to visitors, to allow them to change it" appears unabled.
What's my error?
Thanks for your help.
Answer: It seems to be an issue with having the devel module enabled.  If you are using it try disabling it and it should work.


Muting my trombone

Question: Playing the trombone in a jazz band sometimes a damper is required to mute the trombone or to play effects as wah-wah. I'm playing at intermediate level and I'm fresh to any kind of muting my instrument.
Since there are lots of dampers available on the market, and since I don't want to carry 5 different dampers in my bag all the time:
Which one is the best to start and which one covers most jazz pieces?
Is there a favorite damper? And which material do you prefer for dampers?
Answer: For trombone you'll typically see a number of mute markings, but the style of music changes what you'll frequently need.
In traditional, classical music and other chamber style music you may see the term Con Sord or some similar Italian or even German markings (Con Sordino, Mit Dampfer, etc.). If a mute type is not stipulated, the vast majority of the time you should use a straight mute. In this setting a metal or wooden (not cardboard though) mute is typically desired.  Jo-Ral and Dennis Wick are common brands of this type of straight mute.
When it comes to commercial music, mutes are not generally as expensive but it isn't unusual to carry around at least five mutes if not more. However, most of the time, a particular type of mute is indicated.
Plunger or 1/2 (Half) Plunger - This mute is just like it sounds. It is literally a plunger, like what you would use to unclog a toilet, minus the stick.  When indicated, what you will do is hold the plunger with the part that would hold the stem between two of your fingers with the bottom part facing the bell. You won't totally close off the bell, but - as the second name indicates - cover it at around a 45 degree angle such that about half of the total direction that the sound can go is blocked.
You will also frequently see symbols "o" and "+".  O means "open" and "+" means closed. So if you see a plus sign, it will mean put the mute over the whole bell.  Usually this is done for effect such that you will see, for example, one note with a + and the next note with an "O" creating a "wah-wah" style sound.
If you play jazz, this is a necessity as it isn't unusual to at least need this for one song on every gig, if not many more.
Straight Mute - A commercial straight mute is different than the traditional, classical straight mute that I mentioned above.  Sometimes. It depends on what the composer or arranger wanted.  Usually in commercial settings players aren't too picky about what you play. Some actually prefer the cardboard style mutes such as from the company Stonelined. This will be your cheapest option and also likely 100% fine for any commercial application you have. If you play classical music, you may want to save money and buy a more expensive one as indicated above because most of the time you'll be able to use one of those on commercial music as well. The intent in this style of music is mostly to cause a sharp, buzzy sound and blend will not as often be as important as it is in classical settings.
Straight mutes aren't as common as others in commercial and jazz settings, but you will still see it fairly frequently.
Cup Mute - This is much more common than a straight mute. Again, the stonelined cardboard style mutes are fine.  More expensive models exist, such as the Dennis Wick cup convertible - which actually doubles as a straight mute because you can remove the cup for transport. If I was going to suggest one mute, I'd probably suggest that one because it can satisfy both cup and straight needs for commercial, jazz, and many classical settings too depending on the level of the players you are with.  However, if you play something like pit music where there may be many quick switches between straight and cup mutes, this may be an unsatisfactory option because it takes around 30 seconds to remove or reinstall the cup portion of the mute.
Bucket Mute - This is another fairly common type of mute, but less so than the three mentioned above. You may not use this on a gig, but over the course of 4-5 gigs you will probably use one - again, depending on the level of the players that you are with.  In more informal settings, not everyone may have one in which case you may play in stand, which I will talk about later. There are several types of bucket mute:
In bell - This one sticks into the bell like a straight or cup mute. The primary difference is that the bottom is very deep and usually has some kind of material such as cotton in it to dampen the sound. The goal of a bucket mute is to provide a very soft tone without much edge. A good example of one of these mutes would be a Jo-Ral bucket.
Clamp-on - These types of mutes literally have clamps on the side that attach to the bell directly.  They provide a more authentic sound and have much less resistance because they don't insert all the way into the bell, but have drawbacks.  First, the mutes themselves have to be exactly the same size as the bell you have. If you have a 7.5" bell, you need a 7.5" mute. And if you want to use it on two horns with different bells, you need two of them. Secondly, they can scratch the lacquer on your bell or even cause damage if you don't put it on right.
Drape-over (softone)- This type of bucket mute is not a traditional bucket mute at all, but rather a type of neoprene that is literally draped over the bell.  The sound isn't as authentic as the two above, but they are extremely portable.  They can also double as a plunger mute depending on how far over the bell you drape it. They can also triple as a practice mute if you put it over the whole bell. But it doesn't take away much sound. Good for backstage warming up if nothing has started yet, but not so good if someone is sleeping in the same house as you and you need to be super quiet.
The only one of the drape-over that I'm aware of is the "Softone" mut. This is what I use. I primarily use this one because on bass trombone, it isn't super unusual to see notes that require both plunger and the F attachment to be used simultaneously, which is fine if you have three arms... but with the softone, I can just cover it more and it sounds pretty close to the plunger sound.
Hat mute or Derby - Unless you're doing super authentic music, you aren't likely to actually have anyone bring one of these to a gig. You an either substitute a plunger or just play in the stand.
In stand - This is not a mute, but just advice for how to play something that says this. It literally means face your bell into the stand.  On some gigs you may have someone not bring or otherwise forget their bucket mute. You can sort of substitute the whole section playing in the stand for that.  When you see derby, you can also put your bell in the stand. If the derby requires the "O" and "+" effects, you can use a plunger.
Pixie - This is a mute that fits in the bell very deeply and gives a very raspy sound. Often used with a plunger. You can substitute a cheap trumpet straight mute (stonelined only, the other ones flare too much at the bottom) if you're a tenor player. (DO NOT PUT A TRUMPET STRAIGHT MUTE IN A BASS TROMBONE BELL UNLESS YOU HAVE CUSTOMIZED THE CORKS, IT IS VERY EASY TO GET STUCK).  I actually prefer a trumpet straight mute for these applications over the trombone pixie mutes.
You will likely never be asked for this mute combination in an ensemble, but it might come up on combo performances where a very specific style is being emulated.  Either mute you choose, you will probably want to buy two sets of corks. Glue the first set on and file them down. You'll notice that it'll start to sound really good and then a little more material will sound really bad. Glue on the second set of corks and file them down to the good spot and then remove the first set.  If you use a trumpet stonelined, you can do the whole process for less than $20.
Wah-Wah or Solotone - This is a really niche mute. You will probably only see it in pit gigs from mid 1900s musicals.  Unless the director has a specific sound in mind, you can probably substitute this literally without anyone noticing. They can be acquired for around $40 though, so if you really want to, you can pick up one of these eventually but it probably will never pay for itself.
I can't recommend one mute because plungers are inexpensive and just as necessary as a cup so...
...given all of these types of mutes if I had to recommend two I would recommend:
Plunger + Dennis Wick convertible.
If I was to recommend three, I'd recommend:
Plunger + Dennis Wick convertible + Softone
because the'll cover probably 95%-100% of any mute application you'd use in most commercial music.
If I were to recommend four, I'd probably do the same as above but separate the Dennis Wick convertible for a stonelined cup mute and a Jo-Ral or otherwise metal, possibly copper bottomed, straight mute because that would cover more applications and not be much more expensive than the recommendations from above.
A final note: The wood mutes I mentioned earlier are for fairly specialized applications. They alone are rather expensive and not necessary. However, you may much prefer the sound of wood over metal or cardboard mutes. If you have a section that is willing to all shell out the money for the wooden mutes (such as from the company Facet) you may be very pleased with the results. However, you'd probably also want to have a set of the ones above because they are much more common and will blend better with other gear that the typical player will have.
Comment: Stonelined mutes are a *type* of mute rather than a *brand*. It's a cardboard mute doped internally with a thin cement mix. Several companies make them.
Comment: Doh, yes good catch. Anytime I referred to Stonelined mutes, I typically was referring to H&B Stonelined series.
Answer: I went many years having only a straight mute, cup mute, and plunger. Those three come up in jazz band music all of the time. If you can really only afford one, get a cup mute and use your hand over the bell instead of a plunger.
I find that stone-lined mutes give the most authentic sound, however they do sound like what they are: cardboard. For a plunger, I got a toilet plunger from the hardware store and removed the stick. So much cheaper than an official "plunger mute" and again a more authentic sound (IMO).
Recently I did invest in additional mutes, obtaining a metal straight mute, a bucket mute and a solotone mute. That has me covered for 99.9% of music I play. Very rarely, I'll come across a piece that wants a harmon mute, but I find that a straight mute substitutes well.
Answer: In orchestral music 'mute' means 'Straight Mute' 99% of the time. But playing jazz arrangements you'll need Straight Mute and Cup Mute as a minimum.  Harmon Mute and Plunger are also often called for.  You may be asked for Bucket Mute.  Yes, I'm afraid jazz and commercial players DO have to carry around 5 different mutes!
If you're playing unwritten jazz it's more up to you.  Some noted players rarely use a mute.  Others make a great feature of plunger work, maybe combined with pixie mute.  If you're a 'sweet' melodic player, a cup mute is nice.

Muting my trombone


Given a set of n choose k sets, how many sets in a set of (n+1) choose k sets would include any of m elements and (n+1)?

Question: Thank you for your help. I'm hoping for a generalized formula or a pointer or two...
For example, given 5 choose 3:
[[1,2,3],[1,2,4],[1,3,4],[2,3,4],[1,2,5],[1,3,5],[2,3,5],[1,4,5],[2,4,5],[3,4,5]]

How many sets in 6 choose 3 would include 6 and any of m numbers?
The answer for m = 3 would be 9
[1,2,6],[1,3,6],[2,3,6],[1,4,6],[2,4,6],[3,4,6],[2,5,6],[3,5,6],[4,5,6]
[1,5,6] is the only set that would not include 6 and any of 2, 3 or 4

The answer for m = 2 would be 7
[1,2,6],[2,3,6],[1,4,6],[2,4,6],[3,4,6],[2,5,6],[4,5,6]
[1,3,6],[1,5,6],[3,5,6] are the sets that would not include 6 and either 2 or 4

I assume the total additional sets would be (n+1) choose k subtracted by n choose k but
could use some help to learn how to generalize the full answer if it is possible.
Answer: If I understand your question properly, what you are asking is: how many of the $\binom{n+1}{k}$ combinations of $n+1$ elements contain both $n+1$ and a given $m$-element subset of $\{1,2,\ldots, n\}$.
One way to think about this is that you want to pick $k$ elements from $\{1, 2, \ldots, n, n+1\}$, one of which must be $n+1$. So there are $k-1$ elements left to be chosen from $\{1, 2, \ldots, n\}$, and you want at least one of them to be from some $m$-element subset. The number of ways of choosing $k-1$ elements from $n$ such that none of them is from that subset is $\binom{n-m}{k-1}$, so the number of ways of choosing such that at least one of them is in that subset is  $\binom{n}{k-1}-\binom{n-m}{k-1}$.
In the example you give with $n=5$, $k=3$, $m=3$, we would get $\binom{5}{2}-\binom{2}{2} = 9$. In your other example, with $n=5$, $k=3$, $m=2$, we get $\binom{5}{2} - \binom{3}{2} = 7$.
Comment: Thank you for your instructive answer!


How to pass a variable to a specific html page in javascript and call that variable when needed on that page

Question: I am new to html and javascript coding. So i have encountered a problem where i have to send a variable to a specific page and call that function out when needed.

function submit() {
  firstname = document.getElementByName("firstname");
  document.write(firstname);
}

  <form>

firstname: <input type="text" name="firstname" />

    <input type="submit" onclick="submit()" />
    </from>

now what should i do if i want to display the first name on a specific html page in javascript. For example, if i want to display the person name on third page then what should i do.
Comment: Search for `javascript [create] query string`, here and elsewhere.
Answer: When you need to pass on an information from one page to another in the web, the general way you do is to use server side sessions. As I can see that there's no server side languages you are using, I believe you have only two options:

Using Query String Parameters (this works all the time).
Using Cookies (if the user has enabled it).
Using Local Storage (if your browser supports it).

For the first option, see How can I get query string values in JavaScript? For the second option, it's been answered a lot of times, so I'll leave the implementation with you: Set cookie and get cookie with JavaScript.
For the second one, you just need to use localStorage object this way:

function submit() {
  var firstname = document.getElementByName("firstname");
  document.getElementById("output").innerHTML = firstname;
  if (!!window.localStorage) {
    localStorage.setItem('firstname', firstname);
  }
  return false;
}
<form onsubmit="return submit();">

firstname: <input type="text" name="firstname" />

  <input type="submit" onclick="return submit();" value="Save" />
</form>

I have also made some changes in your form submission method. And in your new page, you just need to use this code to get the item.
function getname() {
  return localStorage.getItem('firstname');
}

Comment: I've been in the middle of writing it so just to not delete it, maybe will help :)

**Cookies** [W3Schools](https://www.w3schools.com/js/js_cookies.asp) Cookies are data, stored in small text files, on your computer. When a user visits a web page, his name can be stored in a cookie. Next time the user visits the page, the cookie "remembers" his name.

[JavaScript access using Document.cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies)
Comment: @robertgrzonka I would really recommend you to have a look at MDN than W3Schools. W3Schools are little bit outdated. [Aren't they?](http://w3fools.com)
Comment: Right, I found myself a lot of errors there, which is why I always search on more than one source :) I like to show W3S to others because their explanations are writen in more intuitive way that MDN, but of course you are totally right!
Answer: There are multiple ways to resolve this issue but it is based upon your requirements. Are you going to third or any other page via a server navigation or is it client-side navigation. In any case you can use localstorage which is supported by almost all latest browser.
On first page you can do localStorage.setItem('firstName', 'Tom'); localstorage is globally available keyword.
On any other page then you can get the value by
var name = localStorage.getItem('firstName');

Other options you can look at cookies, querystring and session storage
Answer: when redirecting to next page, bind parameters in redirecting url like this,
window.location.href = "http://yoursite.com/page?data1=one&data2=two";

And fetch them from retreiving end like below,
var url_string = "http://yoursite.com/page?data1=one&data2=two";
var url = new URL(url_string);
var parameter_1 = url.searchParams.get("data1"); //returns "one"
var parameter_2 = url.searchParams.get("data2"); //returns "two"


What is exactly $\int X_t\mathrm d B_t$?

Question: Can someone give me an intuition of what is the stochastique integral $\int_0^T X_s\mathrm d B_s$ where $(B_t)_t$ is the brownian motion or $\int_0^T X_s\mathrm d M_s$ when $(M_t)_t$ is a martingale ? I really don't see the intuition behind those stochastic integral. Be intuition, I mean, concretely what is this integral. For example, $\int_a^b f(x)dx$ in Riemann sense, is the area under the curve $y=f(x)$ between $a$ and $b$. Or $\int_\Gamma F\cdot d\gamma $, is the circulation of the vector field $F$ into the curve $\Gamma$, or $\iint_\Sigma F\cdot d\sigma $ is the flow of $F$ throuw the surface $\Sigma$...
Answer: If you have an integral of the form $\int_0^T f(t) dt$ the intuition is:
$$
\lim_{n\rightarrow \infty} \sum_{i = 0}^n f(t_i) \cdot (t_{i+1} - t_i),
$$
where $0 = t_0<\dots< t_{n+1} = T$ and $\Delta(t_0,\dots,t_{n+1}) := \max(|t_{i+1} - t_i|, i =0,\dots,n) \rightarrow 0$.
Now just replace this "time" by Brownian time $B_t$ to obtain something like:
$$
\lim_{n\rightarrow \infty} \sum_{i=0}^n f(t_i) \cdot (B_{t_{i+1}} - B_{t_i})
$$
so we take the same as for Rieman integrals but with the time scale replaced by a Brownian motion.
For a formal definition you can for example look at this course in particular lecture 15.
Comment: I don't need a definition ! Just to see concretely what it is. For example, with Riemann intégral, it's the area under the curve...
Comment: Oke, but why is it the "area under the curve" because your $x-$axis is $[0,T]$ and $t_0,\dots,t_{n+1}$ are all just points on the $x-$axis and we take the above sum. Now replace your $x-$axis by the $B_{t}$, then you can still kind of see it as the "area under the curve" but with an adapted $x-$axis
Comment: Also see http://mathoverflow.net/questions/29750/intuition-and-or-visualisation-of-ito-integral-itos-lemma


jQuery: Using a Time Delay in an Each Iterator?

Question: I'm trying to create a carousel effect that automatically cycles through each pictures every 3 seconds.
    $(".headline_img").each(function(intIndex){
        setTimeout($(this).show(),3000);
    });

The timeout delay is not working.
This shows all of the images instantly as soon as the dom loads. It's like its ignoring the setTimeout function.
Did I miss something?
Note: I'm calling this using $(document).ready, do you think that might effect it?
Answer: The setTimeout function takes a function reference or a string. Your code calls the show method for each element immediately. I'm not sure if this will work:

$(function () {
  var t = 3000, $debug = $('#result');
    $(".headline_img").each(function(){
      var $img = $(this);
        setTimeout($img.show.bind($img), t);
      t += 3000;
    });
});
.headline_img { display: none; }

One

Two

Three

but it's worth a try...
Comment: Didn't even notice that Mike, good call. Hopefully @dMix can confirm if that's the problem. The timeout will still need to be staggered for each element rather than being fixed at 3000.
Comment: True. My eyes went right to the parens since I've been bitten by that particular problem many times. ;-)
Comment: `$.fn.show()` will lose what its `this` should be, right?
Comment: Whoa, blast from the past :). It won't lose track of `this`, because we're passing a reference to a function already bound to `$(this)`. I've updated the code to make that clearer, although the `bind()` isn't strictly necessary. Good question though!
Answer: You need to change the timeout for each one. Right now, you're attaching the same timeout to all of them at the same time. Something like this should work without changing your code much:
$(".headline_img").each(function(intIndex){
    setTimeout($(this).show(),3000 * (intIndex +1));
});

Refactoring to use queue might be more robust in the long term.
Comment: thanks this helps for staging the shows in sequence. but it is still showing all of the images at once with no time delay.
Comment: Are the images hidden by default when the page loads and the jQuery doesn't run? Do you need to add a `$(this).hide();` before the `setTimeout`?
Answer: Or you can use jQuery's delay function.
$(".headline_img").each(function(intIndex){
    $(this).delay(3 * (intIndex + 1)).show();
});


Change Azure VM Update Policy

Question: I have multiple VMs running on Azure but noticed that the Windows update policy differs. Unfortunately, I cannot locate the setting in the Azure portal. Below is a screenshot from the first VM that has the option "Never check for updates" configured.

The other VM has the option "Install updates automatically using Windows Update" configured.

When I click on the it, it tells me that the settings are managed by our organization because of Azure. However, where do I change that? I cannot find anything in the portal and I have been searching for hours. I would appreciate some help.
Answer: I solved the problem by opening sconfig and the option 5 lets you select the windows update setting. Restart the virtual machine and then it takes some time until the changes are reflected in the server manager. For me it still showed the old option for quite some time but it will change, trust me.
Edit:
After running a manual update check, it reflected the changes in the server manager.
Answer:
I cannot locate the setting in the Azure portal.

There is no setting in the Azure Portal.
While Windows Update settings on the Server OS and Azure Update Management cooperate, they are effectively totally independent of one another.
All Azure Update Management really does is poke the operating system with a stick and tell it to install updates, how the OS goes about that can be effected by certain Windows Update settings on the OS.
See my answer to this post here to for more detail about how the local OS settings work, and suggestions for configuring them to work with Azure Update Management:
Windows Update showing "Some settings are managed by your organization" on Azure Windows Server 2019 VM

Change Azure VM Update Policy


XSD to SQL Server table

Question: I have a few XSD files that define a report, wondering if there's a way load this into a table that I can query.
The elements XSD defines the required fields, it looks like:
  <xs:simpleType name="NHSNumberStatusIndicatorCode_Withheld_Type">
    <xs:restriction base="ns:AlphaNumeric_Type">
        <xs:length value="2"/>
        <xs:enumeration value="01"/>
        <xs:enumeration value="02"/>
        <xs:enumeration value="03"/>
        <xs:enumeration value="04"/>
        <xs:enumeration value="05"/>
        <xs:enumeration value="06"/>
        <xs:enumeration value="07"/>
        <xs:enumeration value="08"/>
    </xs:restriction>
</xs:simpleType>

I need to convert it to
     Field_Name         Type                    Length        enumeration     MaxLen      MinLen
     NHSNumber...       AlphaNumeric_Type        2                 01
     NHSNumber...       AlphaNumeric_Type        2                 02
     NHSNumber...       AlphaNumeric_Type        2                 03

and so on
Some fields don't have enumeration, they might look like:
         <xs:simpleType name="CDSOrganisationIdentifier_Type">
    <xs:restriction base="ns:AlphaNumeric_Type">
        <xs:minLength value="3"/>
        <xs:maxLength value="5"/>
    </xs:restriction>
</xs:simpleType>

OR
   <xs:simpleType name="Number_Type">
    <xs:restriction base="xs:string">
        <xs:pattern value="[0-9]{10}"/>
    </xs:restriction>
</xs:simpleType>

This returns Null for all the fields:
Comment: What did you try? What is is working, what is not?
Comment: @YitzhakKhabinsky tried this one, doesn't work with my XSD file. change data with simpletype, still no luck
 https://stackoverflow.com/questions/34772503/dynamic-columns-and-records-from-openxml-in-sql
Comment: @YitzhakKhabinsky I added more details, appreciate it if you have a look
Answer: You can load it into an XML variable and then use various SQL Server XML methods to select the nodes of interest and extract the values. See xml Data Type Methods and Path Expressions (XQuery) for more information.
In the following, I wrapped your XSD fragment in a "schema" element that also defined the "xs:" namespace prefix.
DECLARE @xml XML = '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:simpleType name="NHSNumberStatusIndicatorCode_Withheld_Type">
    <xs:restriction base="ns:AlphaNumeric_Type">
        <xs:length value="2"/>
        <xs:enumeration value="01"/>
        <xs:enumeration value="02"/>
        <xs:enumeration value="03"/>
        <xs:enumeration value="04"/>
        <xs:enumeration value="05"/>
        <xs:enumeration value="06"/>
        <xs:enumeration value="07"/>
        <xs:enumeration value="08"/>
    </xs:restriction>
  </xs:simpleType>
</xs:schema >'

SELECT
    N.node.value('(../../@name)[1]', 'nvarchar(max)') AS Field_Name,
    N.node.value('(../@base)[1]', 'nvarchar(max)') AS Type,
    N.node.value('(../xs:length/@value)[1]', 'int') AS Length,
    N.node.value('@value[1]', 'nvarchar(max)') AS enumeration
FROM @xml.nodes('//xs:enumeration') N(node)

The .nodes() method selects all of the enumeration nodes from the supplied xml. The leading // selects nodes at any depth. The N(nodes) provide arbitrary table and column aliases to the selected results. The .value() method is then used to select attributes values from either the selected node, parent node, or sibling node in the case of Length. The @ prefix on a name refers to an attribute instead of a child node. Because many XPath selectors could potentially select more than one value, you often need to use [1] or (...)[1] to select just the first.
Result:

Field_Name
Type
Length
enumeration

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
01

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
02

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
03

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
04

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
05

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
06

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
07

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
08

See this db<>fiddle.
The XSD can also be loaded into an XSD typed column of a table and accessed in a manner similar to the above by replacing @xml with the column reference.
The above is coded for this specific enumeration type scenario. If your actual XSD contains other type definitions that don't follow this pattern, you may need to handle those cases separately.
UPDATE: To accommodate the following additional cases from your amended post ...
  <xs:simpleType name="CDSOrganisationIdentifier_Type">
    <xs:restriction base="ns:AlphaNumeric_Type">
        <xs:minLength value="3"/>
        <xs:maxLength value="5"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="Number_Type">
    <xs:restriction base="xs:string">
        <xs:pattern value="[0-9]{10}"/>
    </xs:restriction>
  </xs:simpleType>

a different approach is needed. After an initial .nodes() call to get the <xs:simpleType ...> nodes, additional calls are made to access selected subordinate nodes, some of which may or may not exist. Finally, the .value() calls in the select list have been updated to pull data relative to one of the several selected nodes.
SELECT
    S.Node.value('(@name)[1]', 'nvarchar(max)') AS Field_Name,
    R.Node.value('(@base)[1]', 'nvarchar(max)') AS Type,
    R.Node.value('(xs:length/@value)[1]', 'int') AS Length,
    E.Node.value('@value[1]', 'nvarchar(max)') AS enumeration,
    R.Node.value('(xs:maxLength/@value)[1]', 'int') AS MaxLength,
    R.Node.value('(xs:minLength/@value)[1]', 'int') AS MinLength,
    R.Node.value('(xs:pattern/@value)[1]', 'nvarchar(max)') AS Pattern
FROM @xml.nodes('//xs:simpleType') S(Node)
OUTER APPLY S.Node.nodes('xs:restriction') R(Node) -- Likely always one occurrence
OUTER APPLY R.Node.nodes('xs:enumeration') E(Node) -- Zero or more occurrences

An OUTER APPLY is like a LEFT JOIN to a subselect, except that no ON condition used.
The result is:

Field_Name
Type
Length
enumeration
MaxLength
MinLength
Pattern

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
01
null
null
null

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
02
null
null
null

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
03
null
null
null

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
04
null
null
null

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
05
null
null
null

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
06
null
null
null

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
07
null
null
null

NHSNumberStatusIndicatorCode_Withheld_Type
ns:AlphaNumeric_Type
2
08
null
null
null

CDSOrganisationIdentifier_Type
ns:AlphaNumeric_Type
null
null
5
3
null

Number_Type
xs:string
null
null
null
null
[0-9]{10}

See this updated db<>fiddle.
Comment: I revised my answer above with additional results and a more detailed explaination. It's worth learning XPath syntax so that you can code up similar cases, but I realized after my original post that the sibling lookup case for Length was a bit different from the rest.
Comment: Yes. That would likely be another OUTER APPLY using the .node() function similar to what was done with enumeration values.  Just we aware that mapping a nested multi-dimensional XML structure into a single 2D rows and columns result may not be an easy task. You might needs to redesign your results across multiple tables, such as one for the general type information and scalar constraints, and others for multi-valued properties such as enumeration values, patterns, and more. Even then, the XSD may have nested and recursive representations that complicate things further.
Comment: Great, thanks so much. Any idea How to add Type and Length? this is my first time dealing with XMLs and XSDs
Comment: Sorry to bug you, I found out not all fields follow the same pattern. some don't have enumeration and weren't picked up. I updated the question.
Comment: In the above example, what do you do if there are more than one  and you want to get all of them (we don't know how many might be)
Comment: Is there a way to say return all values instead of Value[1],Value[2], ..?
Comment: I am dealing with a similar situation, trying to flatten a structure file that has nested tags, there are multiple field groups, every group has few elements, some elements could be a group themselves. trying to flatten it all in one table getting null parent group names for elements are parent themselves.

XSD to SQL Server table


Múltiplos delimitadores no PHP dá erro, no PHPMyAdmin não

Question: Criei uma QUERY com vários delimitadores para executar apenas uma vez e realizar UPDATE em diferentes tabelas, porém dá erro de sintaxe quando executado no PHP, mas no PHPMyAdmin funciona normalmente.
Já verifiquei as permissões de usuários e está com as devidas.
UPDATE
  `fin_dry1`
SET
  `dr_status` = 'P'
WHERE
  `dr_token` = '894613';
UPDATE
  `fin_dry2`
SET
  `dr_status` = 'P'
WHERE
  `dr_token` = '894613';
UPDATE
  `fin_dry3`
SET
  `dr_status` = 'P'
WHERE
  `dr_token` = '894613';

You have an error in your SQL syntax; check the manual that
  corresponds to your MySQL server version for the right syntax to use
  near 'UPDATE fin_dry2 SET `dr_sta.

Descobri o uso de multi_query, então alterei o mysqli_query() para mysqli_multi_query() e aparece outro erro:

Commands out of sync; you can't run this command now.

Sobre o MySQL server version
Servidor: Localhost via UNIX socket.
Tipo de servidor: Percona Server.
Conexão com o servidor: SSL is not being used Documentação.
Versão do servidor: 5.6.41-84.1 - Percona Server (GPL), Release 84.1, Revision b308619.
Versão do protocolo: 10.
Answer: Utilizando o Mysqli, você pode utilizar o comando mysqli_multi_query(). Você deve passar as queries separadas por ponto e vírgula. Aqui tem um exemplo:

<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$sql = "SELECT Lastname FROM Persons ORDER BY LastName;";
$sql .= "SELECT Country FROM Customers";

// Execute multi query
if (mysqli_multi_query($con,$sql))
{
  do
    {
    // Store first result set
    if ($result=mysqli_store_result($con)) {
      // Fetch one and one row
      while ($row=mysqli_fetch_row($result))
        {
        printf("%s\n",$row[0]);
        }
      // Free result set
      mysqli_free_result($result);
      }
    }
  while (mysqli_next_result($con));
}

mysqli_close($con);
?>

Aqui tem mais informações:
https://www.php.net/manual/pt_BR/mysqli.multi-query.php
Comment: Strict Standards: mysqli_next_result(): There is no next result set.
Comment: Alterei mysqli_next_result() por mysqli_more_results() mas ficou lento, quase 15 segundos para executar.
Comment: Estou me orientando pelo link, obrigado.
Answer: Resolvi o problema com a ajuda da resposta de cima feita por @Bins, com algumas alterações devido à mensagens de erros com "Strict Standards" que a solução do companheiro apresentava, segue a solução em procedural.
Alterei o código que usava mysqli_query() por mysqli_multi_query().
$sql = "UPDATE
  `fin_dry1`
SET
  `dr_status` = 'P'
WHERE
  `dr_token` = '894613';
UPDATE
  `fin_dry2`
SET
  `dr_status` = 'P'
WHERE
  `dr_token` = '894613';
UPDATE
  `fin_dry3`
SET
  `dr_status` = 'P'
WHERE
  `dr_token` = '894613';"

if(mysqli_multi_query($dbconn,$sql)){
    do{
        $cumulative_rows+=mysqli_affected_rows($dbconn);
    } while(mysqli_more_results($dbconn) && mysqli_next_result($dbconn));
}
if (mysqli_error($dbconn)) {
    printf("Erro! Houve uma exceção.");
    exit();
}


Directories cease to exist while using tmux

Question: When I connect via ssh to a terminal at work I need to keep sessions alive to run various scripts. However, I often find that the scripts fail because some directory ceases to exist in the meantime.
For example, I get errors like sh: 0: getcwd() failed: No such file or directory after a few hours, or The folder you are executing pip from can no longer be found if I run pip.
How do I go about solving this issue?
Comment: why the downvote?
Comment: If you think tmux is responsible check your `~/.tmux.conf` to see if it is setting up some unusual config. In your shell `echo $PWD` should show the name of the current directory, even if it no longer exists. Perhaps the name of this dir may provide a clue.
Comment: Indeed why the downvote. This happens very regularly to me with tmux if I quit X and restart. But the directory the tmux hosted shell is in is still there,
Answer: Easy solution: Stay out of volatile directories
Better  solution: Built good error handling in your scripts. Plenty of if [ -d "$DIRECTORY" ]; then blocks etc.
Comment: I simply log into my account and launch python scripts from my home directory. It looks as if it's due to tmux, because the errors never occur when I run scripts while logged via ssh. But I don't know how to debug it.


Why is "text-align: center" striked through in Chrome "Inspect element"?

Question: I have 2 different webpages using DataTables to display and hide row details.
Both webpages have the following CSS in their headers:
h1, h2, h3, p, div, form {
    text-align: center;
}

This works in the webpage 1 and the green plus image in the first table  column (on the left) is centered (here fullscreen):

However in the webpage 2 the green plus image is not centered (here fullscreen):

What is please the reason for that and why does Google Chrome strikes through the text-align: center when I right-click at the green plus image and select "Inspect element"?
UPDATE:
Yes, I can see text-align: start in the "Computed" tab (here fullscreen):

But where does it come from? What is a "user agent stylesheet"?
And why doesn't it apply in the webpage 1?
Comment: You have a "text-align: start" on you're table.
Comment: Add table to that css: h1, h2, h3, p, div, form, table { text-align: center; }
Comment: it means there is another element of css had already declare the name attribute, you can see that there is two css with element `table`, and css choose the later, so the first will be ignore
Comment: Where does `text-align: start` for my table come from?
Comment: Take a look at the file misere.php on line 10
Comment: @Eric misere.php line 10 has `text-align: center` and not `text-align: start`.
Answer: It means that the rule "text-align:center" has been overwritten by another rule (i.e. "text-align: start").
There are three way to overwrite a rule:
1) The overwriting rule is present in the same css file of the overwritten rule, but in a lower position.
2) The overwriting rule is present in an another css file, linked after the css file containig the overwritten rule.
3) The overwriting rule is declared inside the html file throught the  tag or the style attribute.
Comment: 4) Some scripts that dinamically change the css property values. (ad es. http://api.jquery.com/css/ ).
Comment: I loaded yout page on my pc with chome browser. I don't see any "text-align: start" in the "Computed" tab., nor elsewhere. Maybe it is due to some browser plugin installed on your pc.
Comment: I have tried the webpage http://preferans.de/misere.php in Google Chrome incognito mode (i.e. with plugins disabled) and still have the issue: the green plus image in the left table column is not centered.
Comment: Inside your css definition there is

        div#header{
              .....
              text-color: #CCCCCC
              ......
             }

Text-color property does not exist. Remove it and it should fix the issue.
Comment: Thanks, but I removed the `text-color` and nothing changed.
Comment: Not really, I've added the `table` to `text-align: center` in my CSS
Comment: 5) In Django the css for a regular html file will be subordinate to and overruled by the rules that are set in the base.html file. Block tags can then be used to overwrite rules in base.html see: https://docs.djangoproject.com/en/3.2/ref/templates/language/


dynamically open boxes from right to left of container

Question: I have a container div inside of which i want to dynamically create other boxes(divs) using jquery. Each new box should be placed to the left side of other open boxes. Everything works fine except for the fact that boxes open to the right side of other open boxes. Here's how i've done it so far:
#container{

    overflow-y:hidden;
    white-space:nowrap;
    border:none;
    position:relative;
    z-index:998;
    overflow:hidden;
    float:left;
    display:table-row;
    vertical-align:bottom;
}
.box{

    z-index:997;
    vertical-align:bottom;
    width: 225px;
    position:static;
    border:1px solid #666666;
    /*next lines are added to force boxes go to bottom when minimized-cross browser solytion*/
    display:-moz-inline-stack;
    display:inline-block;
    zoom:1;
    *display:inline;
}

any suggestions?
Answer: Instead of appending them (i assume you are) use the prepend to add the new element at the start..
var newEl = $('
',{class:'box', text:'whatever..'});
$('#container').prepend( newEl );

demo at http://www.jsfiddle.net/gaby/acnNe/
Comment: thanks for the answer! I was stuck trying to do it through css, although it was that easy...
Answer: It's probably easiest to use .prepend():
$('#container').prepend( '
Some content
' );

This will insert the new box as the first child of the container - before any other boxes in the container.
Comment: thanks for the answer :) That worked - i thought i could do it through css and didn't even think about looking in my jQuery code
Answer: if you're using jQuery, you should use $.insertBefore() to insert new DIVs at the 'start' of a series.
http://api.jquery.com/insertBefore/
Answer: Have you thought about floating right:
#container{
float: right
}

Comment: that did the job until i added a "minimize" option to the boxes.
Then, if the container was floated right, the minimized boxes stayed on top off the container. Thanks for answering anyway!


Typescript error TS2583 Cannot find name 'Set'

Question: I have just started learning Typescript today and when I run tsc app.ts I get 11 errors but I thought I would start with the first. Tried updating tsconfig.json problems seem to be with node_modules.Any help would be appreciated. Thanks.
error states - ../../../node_modules/@types/react/index.d.ts:411:23 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
"compilerOptions": {
     "target": "es6",
     "module": "commonjs",
     "lib": ["es6"],
     "noImplicitAny": true,
     "declaration": true,
     "outDir": "./lib",
     "strict": false,
     "esModuleInterop": true,
     "skipLibCheck": true,
     "forceConsistentCasingInFileNames": true
},
"include": ["./src"],
"exclude": ["node_modules"]

Comment: Did you try what the error message suggests, changing 'lib' option to 'es2015'? Also, what's the context of your issue? Are you trying to run a React app with typescript or what else?
Comment: I am only running a basic
index.html
app.ts
package.json (with lock)
tsconfig.json
.gitignore
node_modules folder (none of the errors are for files in this folder)

Also: I tried es2015 no difference.

Thanks
Answer: In Visual Studio add the Microsoft.TypeScript.MSBuild package.
I also had this problem in a number of my SPAs in a .NET 5 core project. It seems like every time I added a Typescript file manually I would get these errors. I tried all of the different suggestions here on this site but nothing worked. So I paid attention the next time I added a typescript file maually. A pop up mentioned adding the Microsoft.TypeScript.MSBuild package. I did and all the errors went away.
Now, I don't use VSCode, so I don't know if it works the same or not but this worked in Visual Studio 2019.
Comment: Thanks. I'll try your suggestion. This is driving me nuts.
Answer: try npm install @types/node. Worked for me in VSCode.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Answer: I also used npm install @types/node and it worked.
By default, TypeScript doesn't have the type declarations for different libraries (for example lodash, or, in this case, Node.js) unless you explicitly install them.
So, the above command provides those type definitions for types specific to Node.js, including Set.
You can read more about it in the TypeScript documentation.


Sql query not retrieving the correct results

Question: I am trying to retrieve records from a movie database where the Type field is equal to "HOR" (for horror) but some of the records have more than one type (HOR,COM,ADV) and my query is only returning results where the record is equal exactly to "HOR". How can I retrieve all the records that has the "HOR" type?
My query:
selectCommand = "SELECT Type from DVDs WHERE Type = HOR";

Note:

The Type field in the database is a Short Text
I am coding in C# using Visual Studio 2015
Comment: Let me say that albeit the answers below work you still have a big problem in the design of your database. Instead of using a string with multiple codes you should create a table that represent the multiple film types. In such a table (FilmCategory) you should have the primary key of the film table and a second field representing the category. You then store three records for a file whose category is HOR, COM and ADV. Now you can query for films of category HOR and ADV. Try to do this with the proposed solutions.
Comment: Can you elaborate on the data and the results?  This query will most certainly *only* return records `WHERE Type = HOR`.  But this query also makes no sense, because you're querying back the exact data you already have... the Type.  It seems likely that something outside the scope of what you're showing us is wrong.
Comment: How are records with multiple types stored?  Can all three (HOR,COM,ADV) be stored in the same "cell" at the same time?
Answer: Assuming your types are all in the same column like "HOR,COM,ADV" then just change your = to LIKE and use wildcards % around the search string (HOR in this case).
selectCommand = "SELECT Type from DVDs WHERE Type LIKE '%HOR%'";

This will search for the string HOR anywhere within the columns value and not just those columns whose value is exactly HOR.
Comment: Glad I could help! If this worked for you then please click the green checkmark to the left of the answer. =)
Answer: While a "LIKE" match will work (and others rightfully explained it well), I would recommend considering restructuring your data. Using a text field the way you are is really not how SQL is designed to be used.
One issue is you really can't do input validation on it. Generally, you can have (and it is best-practice to have) the DB sanity-check the data you're entering. That way noone can enter something like HAR (rather than HOR) by mistake.
Second, you can't later have any option for that field that might contain one of the combinations you are looking for as a substring.
Third, depending on DB size and load you're going to put it under, it's not a very performant solution.
I'm sure there are reasons I'm forgetting, but at least for these reasons I would recommend creating a second table for associating the film with the genre, where a primary key is (filmid,genreid)
Answer: try
"SELECT Type from DVDs WHERE Type LIKE '%HOR%' ";


Am I able to populate an entity form text field with a value from a URL link on an external site

Question: I am trying to pass a url variable from an external 3rd party site and have that variable populate an entity form text field that I have on an entity form on my company's website.
Basically we have a "Request for Information" form on our drupal site that people can come to and fill out. We have some 3rd party companies that have links to our form on their websites. We are trying to be able to track which website the person filling out the form came from so we want to add a url variable to the links on their websites so that when a user clicks on the link on their site that it takes the url variable from that link and places it in a hidden field on our drupal entity form.
Is this at all possible?
Answer: Yes. Checkout the Field default token module. It lets you substitute tokens in place of a field's default value. In your case you want to use <code>[current-page:query:var]</code> for your field's default value. This will let you send someone to the URL http://example.com/my_entity_form?var=DEFAULT which will pre populate the field with DEFAULT.
Comment: This works like a charm!  Thanks Shawn for the help!!


Cannot execute multiple update queries in one statement

Question: I want to update multiple rows in one statement. I am using CodeIgniter framework. My code is given below.
<code>$query = "update students set id = 12 where id = 10; update students set id = 13 where id = 11;";
$this->db->query($query);
</code>
But it is giving me error, saying I have a syntax error near 'update students set id = 13 where id = 11;' I don't know what I am doing wrong.
Answer: You can use codeigniter Active record batch update :
<code>$data = array(
   array(
      'title' => 'My title' ,
      'name' => 'My Name 2' ,
      'date' => 'My date 2'
   ),
   array(
      'title' => 'Another title' ,
      'name' => 'Another Name 2' ,
      'date' => 'Another date 2'
   )
);

$this->db->update_batch('mytable', $data, 'title');
</code>
Answer: use batch query for this
<code>$data = array(
   array(
      'title' => 'My title' ,
      'name' => 'My Name 2' ,
      'date' => 'My date 2'
   ),
   array(
      'title' => 'Another title' ,
      'name' => 'Another Name 2' ,
      'date' => 'Another date 2'
   )
);

$this->db->update_batch('mytable', $data, 'title');

// Produces:
// UPDATE `mytable` SET `name` = CASE
// WHEN `title` = 'My title' THEN 'My Name 2'
// WHEN `title` = 'Another title' THEN 'Another Name 2'
// ELSE `name` END,
// `date` = CASE
// WHEN `title` = 'My title' THEN 'My date 2'
// WHEN `title` = 'Another title' THEN 'Another date 2'
// ELSE `date` END
// WHERE `title` IN ('My title','Another title')
</code>
for more info :- https://www.codeigniter.com/userguide2/database/active_record.html#update
Answer: the problem, quite likely, is that mysql_query only handles one query at a time.
https://www.php.net/mysql_query
Answer: Mysql_query() function can handle only one query at a time.  So you can use
<code>$this->db->update_batch('table_name', $data_array, 'unique_field');
</code>
Answer: If you are talking about mysql, then you can use mysqli::multi_query . This is basically used to executes one or multiple queries which are concatenated by a semicolon.


Which stats tests to use? Bee flight activity quantified during an eclipse

Question: I'm trying to perform a statistical analysis but not sure what test is most appropriate. The experiment and snippet of sample data are below:
Methods: Bee flights from a beehive were recorded, tracked, and quantified using some fancy software. 2 min recordings were made, every 15 min, over a span of 3 hours, on 2 consecutive days from the same hive. On Day 1 there was a solar eclipse peaking at 3:15 pm. Day 2 was a normal day. At each timepoint we calculated only 1 number. Assumptions are that the number of bees flying at each timepoint is variable, and not dependent on earlier/later times. The hypothesis is that during an eclipse bee flight activity will be different.
<code>Time    Day 1       Day 2
1:45    4.825986975 5.011309825
2:00    4.76436878  4.944759887
2:15    4.857806302 4.995020539
2:30    5.160417753 5.098229915
2:45    5.151340989 5.123143909
3:00    5.205157211 5.01482563
3:15    5.576328277 5.060712789
3:30    5.499265895 4.767659804
3:45    5.341123626 4.698898463
4:00    4.511481755 4.336670549
4:15    4.454618556 4.540783545
4:30    4.475789132 4.203964626
4:45    4.378358091 4.239819416
</code>
Results: Visually we saw more flights during the onset of the eclipse. When plotted the curves qualitatively show a difference during the eclipse.
QUESTIONS:

What stats test would be correct to run on the dataset to say whether there was a difference between Day 1 and 2 (in other words, did the eclipse meaningfully influence flight activity on Day 1)? I realize there are caveats to the whole setup but what I'm asking is about stats..
Can I use a test to see if there was a meaningful change just during the eclipse Day?
I know the sunlight intensity (irradiance) during the eclipse. Can I do a Pearson's to look for a correlation between intensity and flight activity?
Comment: What are these data points measuring? Velocity?
Comment: I love it when biological characteristics are measured with ten-digit precision!  (Two is probably as much as the data can realistically support...)
Comment: Thanks, Sue. They are measuring area of flight activity per region of interest. Basically an image with flight tracks superimposed for each recording period.
Answer: Here is a graph of the two days' data (Day 1, gold line with black markers, Day 2 black line with gold markers; I coded time in terms of minutes elapsed since the first measurement of the day):

The trouble with asking "whether there was a difference between Day 1 and 2" is that the answer is Yes. There are many differences:

At every time of measurement, the bees' area of flight activity is different (even during the period where there was no eclipse).
Within each day, there are differences in bees' area of flight activity: both Day 1 and Day 2 experience a dip and then something like an increase peaking, as it so happens, between 2:45 and 3:15 (90 minutes in), and then dropping in activity thereafter.
Bees area of flight activity at any point in time seems to be slightly different than its activity 15 minutes earlier, except from about 3:30 to 4:00 (105 to 120 minutes).
The peak measurement of bees' area of flight activity is at 3:15 on Day 1, and different by 30 minutes (earlier) on Day 2.
The mean bees' area of flight activity is 4.94 on Day 1, but 4.77 on Day 2; similarly the variance is a good bit different (greater) on Day 1 (0.0131) than Day 2 (0.00874).

There are probably lots more ways to conceive of "differences" between the two days.
So: statistics will be more useful to you when you can more precisely articulate which differences are important to you.
Here's another graphical take, but this time it's Day 1 activity minus Day 2 activity:

If both days were very similar, we might expect the curve to center vertically on 0. If we had the data for eclipse activity (inactivity?) for the same times of bee measurement, we could ask whether the curve of eclipsing over this time looks like the bee difference curve. Your question about the Pearson's correlation coefficient would be one way to do this. Regression would be another, and would give a bit more information. You could perform a test in such a circumstance (e.g., a test that Pearson's $\rho = 0$, or a test that the slope of the line, $\beta = 0$). But again, you might want to think carefully about what difference is meaningful to you.
Comment: @bryanh "I want to know if there was a difference imparted by the eclipse in general." Go back and read my answer about **many differences**. There is no "in general," there are only specifics.
Comment: Thanks, so much, Alexis. Great insight and lots to think about. I guess very simply I want to know if there was a difference imparted by the eclipse in general. The rightward shift in max activity, and different means, are interesting to note. However if I want to focus on the Day 1 vs 2 lines in general how would I test this? One factor ANOVA repeated measures -- all of D1 vs D2? Picking out timepoints for comparison isn't legit because I don't know the sample size (N bees) at each, right?


In iOS8 Safari, readonly inputs are handled incorrectly

Question: In Safari, iOS8, focusing in a date or a time input opens up the date or time picker and allows editing the content of the readonly input.
When focusing in a text input, a toolbar appears at the bottom with previous, next and Done buttons, and not going away until Done is tapped, or another input on the page is tapped.
When the input is focused programatically from Javascript, nothing is happening, but: if a touchstart event listener is added to some part of the page, touching anywhere will bring up the date, time picker, or the toolbar, even if the listener is empty.
Sample code:
<input id="test1" readonly />
<input id="test2" type="date" readonly />
<input id="test3" type="time" readonly />

Live example: http://jsfiddle.net/cw3hump4/embedded/result/
Any ideas or workarounds on how to avoid this?
UPDATE:
For usability/accessibility reasons I need focus management: tapping on the input opens up a dialog, when the dialog is closed, I put the focus back on the input. The input must be readonly, to prevent soft keyboard / date picker / time picker pop up, but cannot be disabled, so I can set a value, and  focus on it.
Comment: This issue still persists in iPadOS 17.0.1 with its Safari 17. ♂ Toggling `readonly` additionally with `touchstart` on the password input (and not only on `focus`) seems to work. (Of course, read-only elements should be focusable, but iOS Safari prematurely prevents firing.)
Answer: I think this is a bug in Safari iOS8
Here is the workaround with jQuery.
$(function() {
  $('input[readonly]').on('touchstart', function(ev) {
    return false;
  });
});

EDIT:
how about this?
$(function() {
  $('input[readonly]').on('focus', function(ev) {
    $(this).trigger('blur');
  });
});

Comment: There are 2 problems with that:
  (1) it kills page scroll if touch started from the input
  (2) it does not solve the problem if the input gets focus from Javascript (see http://jsfiddle.net/cw3hump4/1/, touch the screen anywhere and the datepicker pops up)
Comment: Thanks, but in my scenario I need focus management. Updated the question. I guess I have to live without focusing until the bug is fixed...
Answer: Try wrapping the input elements in a form elements, like
<form><input id="test1" readonly /></form>
<form><input id="test2" type="date" readonly /></form>
<form><input id="test3" type="time" readonly /></form>

Ios8 don't like input elements thats not wrapped in a form element, seems to be a bug in ios8.
Comment: I just tried it, but it behaves the same (on 8.0.2 and 8.1 as well)
Comment: You should try to avoid using multiple form fields on a page.


Orthonormalize subsets in a sequence of subsets of a Hilbert space

Question: Let $H$ be a infinite dimensional, separable hilbert space over the complex plane $\mathbb{C}$
Let $\{A_n\}_{n \in \mathbb{N}} \in H$ be a sequence of subsets of $H$ such that $\forall n \in \mathbb{N}:$
$A_n$ is linearly independent, infinite, countable.
Let $A= \bigcup_{n=1}^\infty A_n$ and $A$ is linearly independent.
Is it possibile orthonormalize $A_n$ getting $B_n$ such that $B= \bigcup_{n=1}^\infty B_n$ is orthonormal?
Thanks
Comment: Which relation between $A_n$ and $B_n$ do you want to have? Should they span the same space?
Comment: @gerw $B_n$ is the orthonormalization of $A_n$ or $span(A)=span(B)$
Answer: Together with the requirement of the comment, this cannot be achieved. Consider, e.g.,
$$A_1 = \{(1,0)\}, A_2 = \{(1,1)\}$$
in $\mathbb{R}^2$. Then, $A$ is linear independent
and by $span(A_n) = span(B_n)$, you can only scale the vectors in $A_1$ and $A_2$. Thus, they will never become orthogonal.
Comment: thanks for this counterexamples