How tightly should new snowboard boots fit?

Question: I recently bought my first pair of snowboard boots. They are Ride Riot snowboard boots, and I am not sure if I should take them back or not. I should probably mention that I have not yet worn them on the hill (once I do, I won't be able to return them).
They fit quite snugly. My toes are just millimeters from the end if I am sitting down or in my snowboard stance, but if I stand normally or walk around, my big toes hit the ends.
An immediate problem is that these boots are a men's size 13, and since these are larger sizes, it's highly unlikely that I'll find a size 13.5, so I'll probably have to jump up to a size 14. I wear a size 13 shoe, but I think I must work them in a little because according to the measurement I got at the store, my left foot is actually a size 13.5 (my right is a size 13).
So I guess what I want to know is, is it better to stick with these slightly small boots, or jump up to a size 14? For those more experienced in buying snowboard boots, do you find they get slightly larger after being worn on the hill a few times?
Answer: Snowboard boots should fit tight around your entire foot, ankle, and calf.  Ideally you should feel about the same pressure against all parts of the inside of the boot with laces tight.  The only exception to this is around your toes which should have relief both in the long direction and upward.  You need to be able to move your toes freely otherwise they'll likely go numb with your laces tight.
All boots will break in.  Whether they fit better or worse after break-in mostly depends on the quality of construction and how well your bindings fit your boot.  The heavier you are and the more aggressive your riding style, the more critical construction and fit will be.  Bad fit with the bindings and poor construction will result in distortion from break-in that causes pressure points and discomfort.
Answer: Whenever you go to buy boots, bring two of your thickest pairs of wool socks. Throw them on, get your foot inside the boot and shift around. I've found that if they fit me really well with that, they wind up fitting really well with a nicer snowboard sock or just wool socks. Enough room not to rub or be uncomfortable in a hard toe-side turn, but not so much room that you're sloshing around in them.


Como mostrar um vetor sem ir para outra pagina

Question: Bom estou fazendo um pagina que faz sorteios, eu já consegui fazer já metade do trabalho, porém quando eu vou mostrar o resultado do vetor ele vai para outra pagina, queria saber como poder mostrar o que tem no vetor na mesma pagina.
Meu html
 <!DOCTYPE html>

    <title>Gerador</title>
    <link rel="stylesheet" type="text/css" href="estilo.css">

    <meta charset="utf-8">

Gerador de apostas

 <hgroup id="menu">

Inicio

Gerador

Sobre

</hgroup>
<hgroup id="apostas">
    <button onclick="mega()">Mega-Sena</button>
    <button onclick="lotofacil()">Quina</button>
    <button onclick="quina()">Lotomania</button>
    <button onclick="lotomania()">LotoFácil</button>
</hgroup>

Meu javascript
function mega(void) {

   var numeros = [];
   var numero,verifica;
   for(var i=0;i<6;i++)
   {
      do
      {
           numero = Math.floor(Math.random()*61);
           verifica = false;
           for(var j=0; j < i;j++)
           {
              if (numeros[j]==numero) {
                verifica=true;
              }
            }

       }while(verifica);
       numeros.push(numero);
    }
    for(var i=0;i<6;i++)
    {
       document.write(numeros[i]);
    }

}
Comment: A minha resposta não resolve o problema?
Comment: Obrigado, eu tinha me esquecido de marcar como resolvido
Answer: Existem muitas formas de fazer isso, é possível criar elementos na mesma página e também é possível atualizar informações de elementos na página, que é o mais comum de se fazer. Eu achei que fica mais legal preenchendo os input's com os valores gerados:

function mega() {
  var mega = document.getElementsByClassName('mega');
  var numeros = [];
  var numero,verifica;
  for(var i=0;i<6;i++)
  {
    do
    {
      numero = Math.floor(Math.random()*61);
      verifica = false;
      for(var j=0; j < i;j++)
      {
        if (numeros[j]==numero) {
          verifica=true;
        }
      }
    }while(verifica);
    numeros.push(numero);
  }
  for(var i=0;i<6;i++)
  {
    mega[i].value=numeros[i];
  }
}
<button onclick="mega()">Mega-Sena</button>

  <input class="mega" type="text" style="width: 40px; text-align: center;" readonly>
  <input class="mega" type="text" style="width: 40px; text-align: center;" readonly>
  <input class="mega" type="text" style="width: 40px; text-align: center;" readonly>
  <input class="mega" type="text" style="width: 40px; text-align: center;" readonly>
  <input class="mega" type="text" style="width: 40px; text-align: center;" readonly>
  <input class="mega" type="text" style="width: 40px; text-align: center;" readonly>

O números da MEGA-SENA vai do 1 ao 60, a sua função pode atribuir zero na combinação, por isso a linha que gera os números deve ser: numero = Math.floor((Math.random() * 60) + 1);
  Veja: https://www.w3schools.com/jsref/jsref_random.asp


Why shouldn't you mix variable size inputs in the same minibatch?

Question: I am trying to build a CNN-LSTM architecure in tf.keras that classifies sequences of varying sizes. My training data is highly variable and I would have to crop/pad sequences in order to create similar sized minibatches of the same sequence length respectively.
Hence my question:
How important is it to have minibatches of sequences of the same length? Is this due to some inherent property of the way data the tensors are processed (i.e. will I get an error) or is it more a performance consideration (i.e. parallelizability) that can be discarded if needs be?
Many thanks!
Tom
Answer: This is definitely about performance. Without batching by length, you perform wasteful computation whose results you ignore anyway.
Remember that a tensor has to be rectangular—you can't have a ragged edge. (Generalize this to higher dimensions as needed.) But sequences are different lengths. Padding is used to remove the ragged edge, but computation on the padding is useless. We want to minimize wasted computation, which is why we group by length.

Consider the following dataset of six sequences. Each row is one sequence, and each X represents one item in the sequence:
X
XXXXX
XX
XX
XXX
X

Remember that our CNN runs along the time axis of our sequence. For batched sequences, we run to the length of our batch's longest sequence. When sequences are different lengths, we use padding. But batching the data differently can lead to different total lengths of batches.
Base amount of work (no padding, no batching)
Let's look at the work that needs to be done. We have to process 14 items across our 6 sequences. By batching, we can speed this up—but we might end up doing extra work.
Choice 1: No grouping by length
Let's just batch as-is, with a batch size of 2. I'll use . to represent padding.
X....
XXXXX

XX
XX

XXX
X..

If we run our CNN on this, we wind up doing 5+2+3=10 units of work walking along these sequences. That might not be optimal; look at all that unnecessary work we did on the first sequence!
Choice 2: Grouping by length
Let's group by length as best as possible, keeping the batch size 2.
X
X

XX
XX

XXXXX
XXX..

This time, we only do 1+2+5=8 units of work. The other option was 25% slower, wasting its time on computation we never needed to do. It ran on the padding, so we'd wind up throwing it away anyway.

This was obviously a toy example. For larger datasets the problem is more extreme—because the ratio between the longest and average sequence lengths in a batch can be larger.
Comment: Yep, you're right about that.
Comment: Awesome thanks!
Comment: Awesome thank you!

But just to be clear: During inference, there is no hard restriction to the length of my sequence (provided there is no expected format i.e. due to dense layers of a certain size) right?


What is the difference between the answers of the following 2 questions?

Question: The 2 questions are given below:

I already know an answer to this question using proof by contradiction.

And Also, I know a direct way of proving this question.
Can I say that the proof of question 619 follows directly from question 178?
EDIT:
I see that problem 619 preserves linear independence, but how it preserves that this is the maximum linearly independent set? Could anyone help me in this please?
Comment: You should write out explicitly how 178 implies 619.
Comment: Yes I will have a look at this question
Answer: You can "almost" apply the result of 178 to 619, as long as you can translate a statement about linear independence to a question about rank.
Lemma : Let $F \subset K$ be fields and $n > 0$ a positive integer. Let $S$ be a set of vectors in $F^n$. Let $V$ be the vector space spanned by $S$ over $F$. Now, consider $S$ as a subset of $K^n$, and let $W$ be the subspace spanned by $S$ over $K$. Then, $\dim_F V = \dim_K W$ i.e. the "rank" of $S$ doesn't change upon going to a larger subspace.
Proof : Note that $\dim_F V$ is the size of the largest $F$-linearly independent subset of $S$. Similarly, $\dim_K W$  is the size of the largest $K$-linearly independent subset of $S$.
Therefore, let $S' \subset S$ be any set of vectors.
Claim : $S'$ is $F$-linearly independent if and only if $S'$ is $K$-linearly independent.
One side of the proof ($K$-lin.ind implies $F$-lin ind.) is obvious from $F \subset K$. The other side is exercise $178$.
Therefore, it is clear, that the size of the maximal $F$-lin.ind subset of $S$ is equal to the size of the maximal $K$-lin.ind subset of $S$. Which shows the desired equality.

Once this is done, if $A$ is a rank $r$ matrix over $F$, then its row rank is $r$, so taking its row space as the set $S$ above, the "rank" doesn't change viewing $S$ as the row space of $A$ over $K$. Thus rank is preserved.


Problem creating a Salesforce User via SCIMv2 when specifying ContactId

Question: I am using the Salesforce REST APIs to create a Contact and then an associated User. If I allow the creation of a User (via SCIMv2) to create an Account and Contact automatically (as details at link), the creation works. Unfortunately, I need to populate a custom field in the Contact and must create it separately.
The link also states that I can include the AccountId and ContactId to prevent the auto-creation. To do this I include the specified Account and Contact in the SCIMv2 JSON as shown below.
<code>{
  "schemas" : [ "urn:ietf:params:scim:schemas:core:2.0:User", "urn:salesforce:schemas:extension:external:2.0", "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User" ],
  "userName" : "firstname.lastname@example.com",
  "name" : {
    "familyName" : "Bloggs",
    "givenName" : "Fred"
  },
  "emails" : [ {
    "type" : "work",
    "primary" : true,
    "value" : "firstname.lastname@example.com"
  } ],
  "preferredLanguage" : "en_US",
  "locale" : "en_AU",
  "timezone" : "Australia/Hobart",
  "active" : true,
  "entitlements" : [ {
    "value" : "00e5j000000md3VAAQ"
  } ],
  "urn:salesforce:schemas:extension:external:2.0" : {
    "contactId" : "0039D00000JBLfvQAH",
    "accountId" : "0019D00000OkFMYQA3"
  }
}
</code>
When I make this request I get an error response from Salesforce:
<code>Response Status:400 - Insert failed. First exception on row 0; first error: DUPLICATES_DETECTED, You're creating a duplicate record. We recommend you use an existing record instead.
</code>
Since there is definitely not a User object already in the system for this user, I am assuming it's trying to create the Contact again and failing.
Any help to understand what is happening and what I am doing wrong would be appreciated.
Answer: I have resolved this issue. Instead of using urn:salesforce:schemas:extension:external:2.0 Please use below code : urn:salesforce:schemas:extension:2.0:external I found this in response of schema api(get). Below points need to be taken care:
Do not provide the contactid with which already user is tagged.
First you can try simply by providing only accountid then it will create user with new contact but under same account.


Convert API URL to "data:image/png;base64" by PHP

Question: The following API URL has an output in PNG image:
http://qrfree.kaywa.com/?l=1&s=8&d=google.com
I want convert the API URL to "data:image/png;base64" (DATA URL / DATA URI) with the similar to the PHP code example below:
$image = ("<img src = http://qrfree.kaywa.com/?l=1&s=8&d=google.com"); // False! (only example!)
//or
$image = 'real-picture.png'; // True!

$imageData = base64_encode(file_get_contents($image));
$src = 'data:image/png;base64,'.$imageData;
echo '';

However, the above code works with a real picture which has specified format and if replaced with the API URL, cannot read image path.
How the code should be corrected?
Answer: Assuming a web request to http://qrfree.kaywa.com/?l=1&s=8&d=google.com returns an image of type image/png, you can do ...
$image = "http://qrfree.kaywa.com/?l=1&s=8&d=google.com";
echo '';

file_get_contents() expects either a valid file name or a valid http(s) request.  Your code was passing in something starting with some HTML <img ...

Convert API URL to “data:image/png;base64" by PHP


Sending strings over the net from C++ client to Java server

Question: I'm writing a client/server application in which, client is written in C++ and the server is Java. The communication between them is made by the UDP protocol.
They need to exchange string messages over the net.
Now, the communication works a lot, the client sends message and server receives it, but I noticed that the received string, on the Java side, is like trunked. I mean, if I try to display it onto the console, with the function:
System.out.println("This is the message received "
                           + message + " by the client just now");

the result I obtain is:
This is the message received *message*

with the string "by the client just now" trunked out.
I think it's due to some incompatibility between Java and C++, but I can't found out the solution.
edit:
here's the code of the receiver:
byte[] bytes = _packet.getData(); // Datagram Packet
hostName = getStringFromBytes(bytes, 0, 15);

(...)

private String getStringFromBytes (byte[] bytes, int lowerBound, int length)
{
    byte[] bufferBytes  = new byte[length];
    System.arraycopy(bytes, lowerBound, bufferBytes, 0, length);

    return new String(bufferBytes).trim();
}

and the sender:
 if(sendto(_socket, buffer, BUFFER_LEN, 0, (struct sockaddr*) &_serverAddress, addressLenght) == -1)
    cout << "Trasmission failed!\n" << endl;

where buffer is an array of char.
Comment: Possibly the message is 0-terminated?
Comment: My guess is that you are sending a null terminated char[] from c++ and your JAVA code isn't handling it properly.
Comment: String.trim removes leading and trailing characters that are, in ASCII, smaller than or equal to a space. So it works if the end bytes in your buffer are 32 (int) or less. If not, the end byte(s) could possibly represent some control character that trim will not catch.
Comment: Once it hits the wire it's not a java vs C++ thing.  Based on @BoBTFish you should try message.trim() to remove whitespace and ascii control characters.
Comment: I've updated the post, inserting code. The trim() is alreay done, but I still don't have a clue.
Comment: `trim()` doesn't say anything about non-printing characters like nul AFAICS, and you don't show how `buffer` is initialized. Try padding buffer with spaces (or any printable character) up to BUFFER_LEN (which I assume is 15?)
Comment: "I think it's due to some incompatibility between Java and C++" will never be the case unless you are using JNI. The problem is in your string processing.
Comment: How many bytes does _packet.getData() return? How do you get the string into the buffer on the sending end? What was the message supposed to be?
Comment: (sorry for the delayed answer, I've been sick for two long days!)
Yes, I knew trim() function was about printing characters, so I excluded it for first. The issue was about zero-termination chars, which I resolved with extra code in the server message handler, :)
Answer: if(sendto(_socket, buffer, BUFFER_LEN, 0, (struct sockaddr*) &_serverAddress, addressLenght) == -1)

This line seems to indicate that buffer is a c-string. If this is the case, you need to parse out the extra NULL character on your server end. The NULL character from the c-string is probably causing the JAVA code to stop processing the string as soon as it sees the NULL character--which is what it should do.
You could probably just trim the last character off of the string in your JAVA code. Remember that C-strings always have an extra character at the end--a NULL character.
Also, is BUFFER_LEN a macro? What is it defined as? Try just sending the actual buffer length, instead of a predefined length.
i.e.
std::string buffer = "Your Message";

if(sendto(_socket, buffer.c_str(), buffer.length(), ...)

And in general, in C++ , when at all possible use std::string, not char*.
Comment: Looking at this, is it possible BUFFER_LEN is some constant or macro being used to define the size of an array? Then you might be getting "Actual message\0somegarbage", in which case the \0 isn't trimmed off, but still ends the output.
Comment: @BoBTFish Absolutely! That is in all likelihood the problem.
Answer: One possibility is that you are not always receiving expected [length] in the buffer. As a result you have random bytes at the end of the buffer when you convert to string.  It's possible some of those bytes represent a control code that messes with your console output.
I think String.trim will remove NULL (\0) characters from a String, however, it will not remove characters with a value over '\u0020'.  (See javadoc: http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html#trim() )
If correct, then you need to check your String conversion and either:

Detect the string end somehow independent of your expected byte buffer length. Perhaps by searching for 1st NULL terminator character. Or,
Replace\remove all white-space characters in the String above and beyond what String.trim will do according to your expected string encoding.
Answer: You should try adding to the start of your message the actual size of your "message"
    std::string strMessage = "My Message";

    char* pBuffer = new char[sizeof(int) + strMessage.size()];

    int iSize = strMessage.size();
    memcpy(pBuffer, &iSize, sizeof(int));
    memcpy(pBuffer + sizeof(int), strMessage.c_str(), strMessage.size());

    if(sendto(_socket, pBuffer, sizeof(int) + iSize, 0, (struct sockaddr*) &_serverAddress, addressLenght) == -1)

...

delete pBuffer;

Then on the Java side, you read the first 4 bytes (assuming on both systems the sizeof int is 4) and then create the string with the number you have read.


How to prittyfy HTML and output files in same directory as exiting directory

Question: Hey guys i basically work as a junior front End developer and recently started using gulp ,Now i get alot of HTML files from other senior developers that have code thats not very well formatted or has too much white space and bad indents , so thing like the below:

Accounting

Training

See how much unnessasary whitespace is in there ., now if i use gulp these is this plugin HERE, Which can be used as following:
var prettify = require('gulp-html-prettify');
gulp.task('templates', function() {
  gulp.src('./lib/*.html')
    .pipe(prettify({indent_char: ' ', indent_size: 2}))
    .pipe(gulp.dest('./dist/'))
});

Now the problem is this does the job but the files are outputed in a differnet directory , what i want is not for new files to be created , but the existing files to be formatted in the directory they are itself , so how would i go about doing this in gulp then ?
Comment: Well, to start, you're piping the output to the directory `/dist`, and not `/lib`.
Comment: Your task is getting the file data (`gulp.src()`), prettifying the data (`.pip(prettify())`), and then outputting to a file with the same name in a directory you specify (`gulp.dest()`). The original file is not changed by the prettifying. If you output to the original location as @bjskistad recommends (and it does sound like this is what you want), you will lose your original unformatted file and will have formatted files at `./lib/`. You can see this by testing on a backup copy of the project.
Comment: Yes, just copy the directory using `cp` (If you're on 'nix), as @henry recommends.
Comment: @bjskistad i realised that yes ... but is the code formatting the exiting files or creting new ones ? i am afraid that if its creating new ones then something might get badly screwed up !
Answer: To me, it looks like you need to pipe() your result to the right directory.
Try this code
var prettify = require('gulp-html-prettify');

gulp.task('templates', function() {
  gulp.src('./lib/*.html')
    .pipe(prettify({indent_char: ' ', indent_size: 2}))
    .pipe(gulp.dest('./lib/'))
});


Why isn't the module shown as updated?

Question: I updated a module with Composer and it shows updated in the composer.json file.
However, on Available updates, it still shows the old version is installed. I ran update.php and nothing changed.
Drupal core is updated and the module needs to be updated to work with the core version.
Why isn't the module shown as updated? How can I fix this issue?
Comment: What commands did you use to update? Did you get any message back, maybe a dependency that is not met?
Answer: It's possible that you have multiple instances of the module in different places in your codebase. You may want to try a find . -type d -name MODULE_NAME from your project root and see what turns up.
Comment: I had to rebuild this site with composer because the group that built it at first did not use composer at all. There were modules in the modules/ folder and modules/contrib folder.

Why isn't the module shown as updated?


Continuous sample size determination based on the control group

Question: I am curious if and where the following reasoning breaks down.
Traditionally, sample size determination is done as part of the design phase. To this end, one has to have an understanding of the baseline performance, such as the mean and standard deviation of the metric in question. One might use recent historical data to obtain reasonable estimates.
Suppose we are not necessarily interested in knowing the minimal sample size ahead of time and simply launch the experiment. The control group is the baseline. Each day, we take the statistics of the control group and perform sample size determination. With each new day passed, we get a better and better understanding of when to stop.
Apart from the fact that one might launch an experiment that is doomed to fail, are there any other problems with the above logic?
Clarification 1: It should be noted that this question is not about whether it is sound to check some p-value on a daily basis and stop whenever it goes below a predefined level. The inadequacy of this procedure is well understood.
Clarification 2: Here we are not assuming any clinical or otherwise setting with serious implications and ethical concerns. Rather, one can imagine something trivial, such as an experiment with a webpage where the color of a button is subject to change.
Clarification 3: The question describes a specific stopping rule: every day, run a power analysis using the statistics of the data for the control group collected up to today and terminate the experiment as soon as the actual sample size exceeds the one given by the power analysis, potentially skipping a few first days to avoid pathological cases.
Comment: A major difficulty with doing such an undesigned sequential test, rejecting when the P-value first happens to stumble below 5%, is the risk of false discovery.
Comment: You can do optional stopping but need to adjust the p-value after each observation. See http://daniellakens.blogspot.com/2020/09/p-hacking-and-optional-stopping-have.html
Comment: @BruceET, I didn't mention any p-values. The question is not about whether it is sound to check p-values daily and stop whenever it goes below a predefined level. The inadequacy of this is well understood. Or am I missing some connection? Thank you!
Comment: Your modification leaves doubt what kind of sequential tampering with a non-sequential protocol you think might be OK. The only correct answer to that is **None.** I stand by my original Answer.
Comment: The question needs to define the need for the approach. What you are describing is doing an exploratory analysis and trying to retrospectively use it as confirmatory analysis.  To me you would be better accepting that it is exploratory and using the data to establish baseline behaviour to design confirmatory analysis. If you are using it in a low impact and risk scenario then acknowledging the uncertainty of unconfirmed exploratory analysis may allow some immediate response proportional to the risk. If the application is high impact and risk then more care is needed.
Comment: @ReneBt, I have added a clarification. It is indeed a low-impact study that is assumed. Another way to think about it could be that it is a situation in which one is determined to switch to the new procedure but decides to accompany with an experiment to keep en eye on unforeseen major problems.
Answer: A priori sample size calculations are only sensible if there is a fixed cost to sampling
This is an excellent question, and it raises some common-sense issues that are commonly misunderstood in sampling theory.  When we are considering sample size questions, the first thing we need to ask ourselves is what (if any) impediment, inconvenience, cost, etc., there is to just collecting all the data there is on the matter of interest.  If there is no cost to this (construed broadly as including time, money, etc.) then we might as well go out and collect all possible data on the matter and then we don't need statistical inference procedures at all.  Consequently, the idea of using a limited sample size that is less than what is possible only arises as a sensible procedure when there is some cost to sampling.
Once we have identified the costs of sampling (again, construed broadly to include more than just money), we need to decide if there are any fixed costs that accrue when we conduct a sampling "excursion", or not.  If there are no fixed costs then there is no need to limit our data collection by any a priori calculation --- we can just collect some data, decide if it is enough, collect some more, decide if it is enough, and so on.  So in this case, we can indeed do something like what you describe; sampling without any a prioiri sample size calculation and then stopping when we have enough data for the inferences we want to make.  (We need to be a bit careful with this method, because certain kinds of "stopping rules" combined with particular statistical procedures can bias analysis, but assuming we are cognisant of this, we should be able to formulate an appropriate "stopping rule" and stop when we have the data we need.)  Various statistical control processes operate in exactly this way --- they collect data as it is generated and update inferences with each new data point.
If there are fixed costs to sampling, but the fixed costs are quite low relative to the unit costs, it might still be useful to sample over more than one "excursion".  In such a case we might make an initial a priori sample size calculation for an initial "pilot" set of data, then use this data to make an updated sample size calculation for the next set of data, and so on.  In this case there might be a number of data collection excursions, but each will involve a sample size calculation.  This is also somewhat similar to what you describe.  Finally, if the fixed costs of sampling are quite substantial relative to the unit costs, then the "traditional" method of using only one sampling "excursion" is probably going to be optimal.  In this case the sample size is fully determined by a single a priori calculation.
So, in terms of where your reasoning breaks down, it is only in the possibly exaggerated claim that "[t]raditionally, sample size determination is done as part of the design phase."  This is only true if there are substantial fixed costs to sampling that make it desirable to sample "in one go" and thereby necessitate an a priori computation of the entire sample size.  Your observation that it can be sensible to collect data "as you go" is perfectly legitimate (under appropriate circumstances), and it is actually an underappreciated principle of sampling theory.
Comment: Thank you! After your response, I understand better what my own question is actually asking. Please see Clarification 3. Then the essence is in whether this stopping rule possesses the characteristics what would make it sound. When you said one has to be mindful about the method used, you were probably thinking about something like what Kruschke describes in "Bayesian estimation supersedes the t test," which gives another stopping rule.
Answer: Example:  Suppose you have $n = 67$ observations from a normal population with unknown population mean $\mu$ and standard deviation $\sigma.$ You wish to test $H_0: \mu = 106$ against $H_a: \mu \ne 106.$ and you want the power of a one sample t test at the 5% level to be about 90% when the true mean is $\mu = 100.$
Then a simple simulation in R
shows that $n = 67$ observations is sufficient to give
the desired power:
set.seed(2021)
pv = replicate(10^6, t.test(rnorm(67, 100, 15), mu = 106)$p.val)
mean(pv <= 0.05)
[1] 0.896917

However, the P-values corresponding to t statistics computed after $n = 2, 3, \dots, 67$ may be smaller than 5% for some values of $n$ smaller than $67.$
Below we plots of such 'intermediate' P-values for nine experiments with $n = 67.$ About 80% samples will show P-values below $0.05$ exactly at $n = 67.$
That may be the first step at which the value is small enough to reject, but that is typically not the case.
Clearly, it would not be appropriate to make a decision
based on the first step at which a P-value is smaller than 5%.

Of course, some of these P-value traces may never dip as
low as $0.05$ within $n = 67$ observations.
R code for one trace is shown below:
pv = numeric(67)
x = rnorm(67, 100, 15)
pv = numeric(67);  pv[1]= 1  # no t stat for n=1
for(i in 2:47)
 { pv[i] = t.test(x[1:i], mu=106)$p.val }
plot(pv, type="l", ylim=0:1)
 abline(h=.05, col="blue")
 m = min(which(pv < .05));m
 abline(v=m, col="red")

Comment: Thank you! I have added a paragraph to the question to clarify what I am after. It is not so much about running tests and stopping but about refining the sample size needed.
Comment: You retained "Each day, we take the statistics of the control group and perform sample size determination. With each new day passed, we get a better and better understanding of when to stop." That seems almost contradictory to the new last paragraph. // If contemplating a sequential procedure, you have to allow for that in advance. Otherwise establish a protocol based on info you have _before you have taken any data_ specifying the sample size to be used. As my demo shows, changing the sample size based on intermediate "analyses" can lead to misleading conclusions. That point remains relevant.
Answer: I feel that your statement about study design misrepresents what it is about.

Traditionally, sample size determination is done as part of the design phase. To this end, one has to have an understanding of the baseline performance, such as the mean and standard deviation of the metric in question. One might use recent historical data to obtain reasonable estimates.

Study Design Basics
Study design is all about risk management and should not be based on empirical data such as mean and standard deviation. Rather study design should be based on what is a minimally useful normalised effect size (inter-group difference over intra-group variation) balanced against maximum acceptable risk. If the effect size is useful you want to ensure your experiment detects it at a level of risk that is acceptable to stakeholders. To see why look at a basic sample size calculator:
$$n=\frac{2(Z_{\alpha} +Z_{ \beta})^2\sigma^2}{\Delta^2}$$
Basically we fix a constant by deciding alpha and beta based on stakeholder sensitivity to rejecting null when it is true vs accepting it when it is false. If we use empirical data to fill in $\sigma$ and $\Delta$, then our calculation will use the same information that we would use to calculate p values, e.g. the t-test calculates
$$ t = \frac{\Delta}{\sigma}$$
Which is then transformed into Z scores. You'll notice that t has the same variables, but inverted. I.e. using empirical data in a sample size calculator will simply tell us what we would already know by looking at the p value, albeit in a transformed way.
Proposed approach
The process described in the OP is performing exploratory data analysis and appears to be attempting to use it as confirmatory analysis. To manage risks it seeks to use statistical methods to provide respectability to the output.
One of the critical needs for confirmatory analysis is the concept of independence. Hypotheses need to be tested on data that is independent of the data used to originally generate them, otherwise you end up with familywise errors as the errors at later stages will be implicitly tied to the errors at the early stage since the variation in the early samples persists and influences all subsequent analyses.
The process in the OP cannot be used to provide falsification of the hypothesis that the experiment is itself generating.  If you look at the basic formula for sample size calculation above this becomes clear.

Apart from the fact that one might launch an experiment that is doomed to fail, are there any other problems with the above logic? Of course, we are not assuming a clinical setting but rather a service of some kind.

Launching an experiment doomed to fail is probably the most insignificant possible problem as all that is wasted is the resource put into the experiment. A much bigger risk is that the experiment leads to an inappropriately weighted decision that misunderstood the magnitude of risk and led to an overconfident response. Here the effect goes way beyond the resource associated with performing the experiment. A couple of examples of what it may lead to committal of:

new investment in something flawed that will fail
cancelling a product that could have made a positive impact
releasing a product or service that has a negative impact on users
fraud, if the risks were willfully not clearly detailed

Many proof of concepts start out life using informal or semi-formal processes similar to what is described in the OP. However, it must be clear to all stakeholders that it is exploratory in nature and unconfirmed by independent testing. It would be advisable to undertake a statistical design of the process to be sure you understand the risks, but to be honest this sounds like a much more difficult job than a standard study design approach based on first understanding stakeholder needs, risks and benefits. The amount of effort put into this should be proportional to the expected risk/benefits of the final use case of the research outputs. Changing the colour of a web site button probably warrants 2 minutes within a design meeting to establish these, whereas a medical device will require domain experts and a full benefit-risk analysis.
When presenting output of the analysis it must be qualified and the appropriate caveats must be attached to all downstream decisions and recommendations. All stakeholders (anyone affected by the decisions in any way) should be made fully aware of the risk associated with the data.
Conclusion
It would be difficult to see how to justify the approach without a much more robust defence and a mathematical/statistical proof of how it performs. This would be much more work than it is proposing to save.
Comment: Thank you! I am still trying to understand if I phrased the question correctly. Take, for instance, the formula you gave and assume a minimal effect size that is still of interest to detect. What remains for the calculation is the variance. One might just have a good estimate off the top of one's head or have to do a calculation. In the latter case, representative historical data might be used. What I am asking in the question, would it be sound to use the control group to estimate this variance, as it comes from the right context and at the right time, i.e., very much representative?
Comment: If the application is such low risk then why do you need a rigorous statistical design? Are there no rules of thumb used in the application area? The point is if you feed empirical results from your ongoing experiment back into a continuous sample size estimator you will end up propagating the errors collected in the experiment into your stopping decision, compounding the risks. This feedback loop is pointless and more likely to cause serious errors. If it is impossible to set parameters without empirical estimates, then do a small initial study then exclude that data from the next analysis.
Answer: The fundamental problem is the phrase "we get a better and better understanding of when to stop." On what basis do you decide "when to stop?"
What you propose is that each day (after you have collected some new data) "we take the statistics of the control group and perform sample size determination." But this doesn't seem to make sense, since "determining sample size" (power analysis) takes a certain error tolerance, standard deviation and alpha as inputs and gives you the N that you need to estimate a quantity within that tolerance. As you note this is obviously a useful analysis to run BEFORE You design the study. But in your case, each day you already KNOW whatever new, larger sample size you have as of that day. So if the output of the formula is already known, what exactly are you doing "each day?" What exactly do you put into this formula each day and what value are you expecting to get out?
My guess is that what you really meant to say is "each day I calculate confidence intervals around the control group using the data that I've collected up to that point, and when the confidence intervals get small enough I stop collecting new data."
But this is where you get into trouble, because what criteria could you use to decide if the confidence intervals are "small enough" to stop collecting new data?
If you are "running an experiment" then the goal is presumably to test a hypotheses: is the treatment group significantly different from the control group, with respect to some outcome (at a certain level of confidence). Obviously you could say "I'm going to keep collecting data until the confidence intervals around the control group no longer overlap with the estimate for the treatment group." which would obviously undermine the logic of significance testing for the reasons that others have described. But if you don't want to use this as your criteria then what else could you do?
If you just want to say "I'll stop collecting data when my Confidence intervals are less than X points wide" that's fine....but in that case you are back to where you started, since you could have done this before you started collecting data: that's what power analysis is for after all!
Here's the question you have to answer: what "new information" would you get each day that would help you decide "when to stop" that you didn't already know before hand, but which is also NOT related to the hypothesis you are trying to test?
Comment: Thank you! I am thinking as follows. Let us take ReneBt's formulae. To perform power analysis, one has to specify $\sigma^2$. One solution is to look at the data for, say, the month preceding the experiment and speculate it captures the metric's variability well enough for the analysis to be meaningful. Another solution is to calculate the variance on the control group. The benefit I see is that it would correspond to the right context and at the right time, compared to some arbitrary time interval in the past. I would like to understand why this is inadequate.
Comment: So you are saying that you keep collecting data until your estimate of the variance is "good enough?" How do you know when that is? What is the "cut off"? Also, one of the benefit of power analysis is that you can try a RANGE of variances and see how much it matters. It might show you that you will need 560 cases if the variance the lowest plausible value but 720 cases if the variance is the highest plausible value.  These are all things you should just consider before starting the study.
Comment: Also I think the underlying objection to your approach is is that, for statisticians the risk of (intentionally or unintentionally) biasing results by making ad hoc decisions about whether to keep collecting data during the study is FAR FAR FAR more dangerous than the risk of getting the variance "wrong" in a power analysis calculator.  If you just throw in a big variance guess the "worst" that can happen is you have an over powered study., which isn't actually that bad. But if you try to decide when to stop collecting data you might fatally bias your results.
Comment: Presumably the analyst could use a pre-specified "stopping rule" and that rule could be investigated to ensure it doesn't bias the analysis.


factorial Vs power sequence

Question: What sequence is dominant between
$ f(n) = n!$ and
$ g(n) = 2^n$ or (or $a^n$)
I mean
$ f/g \to 0 $ or $\infty$
Answer: The factorial grows faster because it consists of $n$ factors of increasing size, while the power $a^n$ consists of $n$ factors of constant size.
Comment: you could give a simple proof, something like n! > (n/4)^n for n>5 maybe
Comment: well I see your point n! is > a^n for n>a/2 right?
Comment: @caub, maybe you mean n/2 > a? Otherwise it would follow, for example, that 8! > 14^8 (because 8 > 14/2) which is obviously not true.
Answer: Stirling's approximation states that:
$$
\lim_{n \rightarrow \infty} {\frac{n!}{\sqrt{2\pi n}\, \left(\frac{n}{e}\right)^n}} = 1
$$
Or:
$$
n! \sim \sqrt{2 \pi n} \left(\frac{n}{e}\right)^n
$$
Which means that $n!$ grows faster that $a^n$. This is easy to see intuitively, given how $a^n$ consists of $n$ constant terms, whereas $n!$ consists of $n$ increasing terms. For large enough $n$, $n!$ will be larger.

factorial Vs power sequence


Como farzer uma autenficação no Laravel com outra view de login

Question: Eu estou trabalhando como uma banco de dados já povoado, ele já possui uma um usuário e uma senha padrão de admin.
O que eu quero e fazer uma autenticação desse admin com uma view de login que eu mesmo fiz.
Estou perdido na parte que eu já criei o "auth" não sei como prosseguir.
Essas foram as rotas que ele me gerou.
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');`

Comment: Você tem perguntas em aberto que não interage, fica complicado alguém responder
Answer: Você pode criar um método showLoginForm no seu LoginController, que retorne seu formulário de login.
Auth\LoginController.php
public function showLoginForm()
{
    return view('login.meuFormDeLogin');
}

Comment: Muito obrigada Pedro solucionou meu problema!


Why the boxes in an inline formating context was laid out vertically?

Question: Does the "div#wraper" create a BFC for its descendants?

Floats, absolutely positioned elements, block containers (such as inline-blocks, table-cells, and table-captions) that are not block boxes, and block boxes with 'overflow' other than 'visible' (except when that value has been propagated to the viewport) establish new block formatting contexts for their contents.

The 'overflow' of the "div#wraper" is 'visible', so it does not create a BFC but an inline formatting context.
However, the descendants was laid out one after the other, vertically, which meets the rule of BFC.
How to explain the contradiction, the boxes in an inline formating context was laid out vertically?
Comment: `display: visible` isn't valid css.
Comment: as the link showed `overflow:visible` doesn't create a BFC
Comment: try `display:inline-block` instead
Comment: No, has to have an overflow value other than visible
Comment: @ Evan Trimboli Already corrected.
Comment: A vertical layout doesn't define a [block formatting context](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context). A BFC is a region in which floated elements can affect one another
Comment: @prospector But why the descendants act sa in a BFC?
Comment: @Weapon I didn't know what BFC was, had to Google it and I quoted this link https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
Comment: @prospector I have modified the question. My confusion is that why the boxes in an inline formating context was laid out vertically?
Comment: Note that your text says >'overflow' _other than_ 'visible'< and you have your box set **as** `visible`
Comment: @4castle A BFC generates a vertical layout and an (IFC)Inline formatting context generates a horizontal layout.Can you tell me why the "div#wraper"    generates IFC, however in which the other two "div" laid out vertically.
Comment: @Jhecht My purpose is to create an IFC)Inline formatting context explicitly.
Comment: @prospector I kown "overflow:visible" doesn't create a BFC. My quetion is Why it behaves as a BFC.
Answer: The premise of your entire question is flawed. Assuming the inner divs retain their default styles, then they are block boxes, which means #wraper can't possibly establish an inline formatting context in that situation in the first place.
The inner divs participate in block layout, but they participate in whatever BFC that is already there (that #wraper itself also participates in). This can be from some ancestor that meets the criteria for establish a BFC; otherwise, it's the BFC of the root element.
Comment: Correct @BoltClock, I did some research and it is as you say, the flex elements and grid elements are not in the normal flow, what IS in the normal flow is simply the flex/grid container (this because there is `display: flex;` (block-level) or `display: inline-flex;` (inline-level), the same for the grid container).
Comment: You means the  #wraper establish a BFC in that situation?Obvious it's not.
Comment: @Weapon: It neither establishes a BFC nor an IFC.
Comment: So, the  #wraper is not a block containing box? the #wraper is not the containing block of the inner div? the containing block of the three div is the root element in this situation?
Comment: @Weapon: #wraper is a block container box and it serves as the containing block for the inner divs. But it does not establish a BFC. Not all boxes establish formatting contexts. Note that "box", "containing block" and "block formatting context" are three different things.
Comment: @Weapon: Yes. Just not one that's established by #wraper.
Comment: @BoltClock Why does the root element establish a BFC? I couldn't find that in the specs.
Comment: @jddxf: Actually, it does not - my wording was inaccurate there. The BFC in which the root element participates in is established by the initial containing block. The reason the initial containing block establishes a BFC is because *something* needs to start the ball rolling somehow.
Comment: @BoltClock I could totally understand that the initial containing block establishes a BFC. Still I couldn't find something relevant in the specs.
Comment: Hi @BoltClock I have a question about the BFC - do the flex and grid items stay in the Normal Flow? My doubt arises MAINLY because flex-direction: column stacks the flex items VERTICALLY like a Block Formatting Context does - Thanks in advance, I guess the comment doesn't really fit the question but I need someone amazing in CSS like you.
Comment: @Daniel: As far as I know the term "normal flow" does not apply to flex items and grid items as they participate in flex layout and grid layout respectively.


How to differentiate Map and string value in typescript?

Question: I am using a variable which has 2 types either string or Map. I want to check whether the variable is in type of string or Map. For that I have used the following code.
// description is like this description: string | Map<string, string>
if (description instanceof String) {
    return description;
}else {
  return description?.get('test');
}

But it gives me the following error.

Property 'get' does not exist on type 'string | Map'.
   Property 'get' does not exist on type 'string'

Please help me to solve the problem. Thanks.
Comment: have you tried writing: (description as Map).get('test')
Answer: instanceOf String will not do the right thing, but typeof description === 'string' will, or alternatively reverse it and use instanceof Map. Not every string is a String object. Most aren't.


email valid in j2me lwuit

Question: I am interested to know whether the email provided by user is validate or not ? I try to use Pattern and Regex , but these classes are not available in lwuit j2me so how can I valid email in such case?
Comment: possible duplicate of [Is there email validator code for Java ME  or BlackBerry?](http://stackoverflow.com/questions/6923834/is-there-email-validator-code-for-java-me-or-blackberry)
Answer: Check if there is exactly one @ symbol, and exactly one . symbol, that . is after the @ at least one letter or number in between, and the length of the trailing part after . is between 2 and 3 letters. Some letters or numbers should be before @.
Comment: There are email addresses that do not fit that scheme, firstname.lastname@example.com, firstname.lastname@example.com
Comment: thank dear gasan and Jens for reply and I am new this field so  could you provide me simple code for this purpose ?
Answer: The only way to validate an email address is to send an email and let the user tell you it arrived.
Email addresses can be very very complicated, so no easy check based on the address as a string will be correct in every case. As a sanity check, I'd check if it contains an @ sign, but nothing more.

email valid in j2me lwuit


Iframe/embedded YTvideo keeps playing when modal window closed

Question: I've added embedded videos on my website's 'Video' section. A weird thing's happening, though. If I play the video, then 'X' out the window while the video's playing, the audio still plays even though the window is closed.
So it seems like "closing" my window doesn't really close the video.  I've added "?enablejsapi=1" to the end of the YouTube URL to enable the YouTube API, but I'm not sure what my next step is.
How do I set up the iframe so the video stops playing when the modal window is closed/X'ed out?
Here's the code for that window + embedded iframe:

Our Work

Adipiscing magna ...

Nullam et orci ...

Answer: I don't think it's integrated in modals to stop vidoes when you press X. You have to explicitly include in the function that you want to stop the video using stopVideo command.
Comment: I've heard that it might be fixable using the YouTube IFrame API that you linked.  But honestly have no idea how to set up the API so that it responds to the modal.  Any thoughts?


How to index a 3-D tensor with 2-D tensor in Tensorflow?

Question: I am trying to use a 2-D tensor to index a 3-D tensor in Tensorflow. For example, I have x of shape [2, 3, 4]:
[[[ 0,  1,  2,  3],
  [ 4,  5,  6,  7],
  [ 8,  9, 10, 11]],

 [[12, 13, 14, 15],
  [16, 17, 18, 19],
  [20, 21, 22, 23]]]

and I want to index it with another tensor y of shape [2, 3], where each element of y index the last dimension of x. For example, if we have y like:
[[0, 2, 3],
 [1, 0, 2]]

The output should of shape [2, 3]:
[[0, 6, 11],
 [13, 16, 22]]

Answer: Create the indices using tf.meshgrid and then use tf.gather_nd to extract the elements:
# create a list of indices for except the last axis
idx_except_last = tf.meshgrid(*[tf.range(s) for s in x.shape[:-1]], indexing='ij')

# concatenate with last axis indices
idx = tf.stack(idx_except_last + [y], axis=-1)

# gather elements based on the indices
tf.gather_nd(x, idx).eval()

# array([[ 0,  6, 11],
#        [13, 16, 22]])

Comment: For dynamic shape, try `x.get_shape()` for `x.shape`.
Comment: What if the shape of x is unknown? For example, the first dimension of x and y are computed in the runtime and I do not know the value during graph construction. `tf.range` function will fail if the parameter is `Dimension(None)`.


UiAutomator 2.0 test from command line

Question: I'm trying to use Android UIAutomator for some simple tests, I'm aware of that it needs to be built by Gradle since UIAutomator 2.0, I can run my simple test which only presses home button via Android Studio or command line by "gradlew.bat cC", I was wondering how I can run it with adb command?
I tried
adb shell am instrument -w test.simple.uiatest/android.test.InstrumentationTestRunner

as suggested here , but I get
INSTRUMENTATION_STATUS: id=ActivityManagerService
INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{test.simple.uiatest/android.test.InstrumentationTestRunner}
INSTRUMENTATION_STATUS_CODE: -1
android.util.AndroidException: INSTRUMENTATION_FAILED: test.simple.uiatest/android.test.InstrumentationTestRunner
    at com.android.commands.am.Am.runInstrument(Am.java:951)
    at com.android.commands.am.Am.onRun(Am.java:316)
    at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
    at com.android.commands.am.Am.main(Am.java:99)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:250)

Below are my code snippet and build.gradle, what am I doing wrong?
package test.simple.uiatest;

import android.support.test.uiautomator.UiDevice;
import android.test.InstrumentationTestCase;

public class ApplicationTest extends InstrumentationTestCase {
    private UiDevice theDevice;

    @Override
    public void setUp() throws Exception {
        super.setUp();
        theDevice = UiDevice.getInstance(getInstrumentation());

        theDevice.pressHome();
    }

    public void testName() throws Exception {
        theDevice.pressHome();
    }
}

build.gradle
apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.0 rc2"

    defaultConfig {
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        applicationId "test.simple.uiatest"
        minSdkVersion 21
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'LICENSE.txt'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile 'com.android.support.test:runner:0.2'
    androidTestCompile 'com.android.support.test:rules:0.2'
    androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.0'
}

Answer: The error you're seeing will occur if the test APK is not installed, or if the <test_package>/<runner_class> in your am instrument ... command is wrong.
To list the instrumentation tests that are available on your device, you can run adb shell pm list instrumentation. You should see a line like:
instrumentation:test.simple.uiatest/android.test.InstrumentationTestRunner (target=simple.target.app)

If you don't see a line matching your test, then you need to install the test APK. If it is installed, double check that the test.simple.uiatest/android.test.InstrumentationTestRunner portion of the pm list instrumentation output matches your am instrument command.
Answer: As the build.gradle in your post, you should use "android.support.test.runner.AndroidJUnitRunner"
adb shell am instrument  -w test.simple.uiatest/android.support.test.runner.AndroidJUnitRunner

Answer: for your package, try this:
adb shell am instrument -w test.simple.uiatest.test/android.support.test.runner.AndroidJUnitRunner

use package test.simple.uiatest.test instead.

UiAutomator 2.0 test from command line


Removing duplicate TEXTS from large mysql table

Question: I have mysql table, which has structure
+------------+------------------+------+-----+---------+----------------+
| Field      | Type             | Null | Key | Default | Extra          |
+------------+------------------+------+-----+---------+----------------+
| id         | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| content    | longtext         | NO   |     | NULL    |                |
| valid      | tinyint(1)       | NO   |     | NULL    |                |
| created_at | timestamp        | YES  |     | NULL    |                |
| updated_at | timestamp        | YES  |     | NULL    |                |
+------------+------------------+------+-----+---------+----------------+

I need to remove duplicate entries by content column, everything would be easy if it wasn't longtext, the main issue is that entries in that column vary in length from 1 char to over 12,000 chars and more, and I have over 4,000,000 entries, simple query like select id from table where content like "%stackoverflow%"; takes 15s to execute, what would be best approach to remove duplicate entries and not wait 2 days on executing query?
Comment: Use select max(id) as max_id from yourtable group by content. Then all content will be unique and you can use max_id to get back all the columns in yourtable. Still this may take time to process.
Answer: md5 is your friend here. Make a separate hashvalues table (to avoid locking/contention with this table in production) with columns for the id and hash. The primary key for this table should actually be the hash column, rather than id.
Once the new empty table is created, use MySql's md5() function to populate the new table from your original data, with the original id and the md5(content) for the field values. If necessary you can even populate the table in batches, if it would take too long or slow things down too much to do it all at once.
When the new table is fully populated with data, you can JOIN it to itself like this:
SELECT h1.*
FROM hashvalues h1
INNER JOIN hashvalues h2 on h1.hash = h2.hash and h1.id <> h2.id

This should be MUCH faster than comparing the content directly, since the database only has to compare pre-computed hash values. I'd expect to run almost instantly. It will tell you which records are potential duplicates. There is still a potential for hash collisions, so you also need to compare this back to the original data to be sure, or include an originalcontent column in the new table you can use with the query above. That done, you will know which records to remove.
This system can be even better if you can add a column to the original table to keep the md5() hash of your content field up to date every time it changes. A Generated Column will work well for this if you have the right storage engine. Otherwise, you can use a trigger. This column will allow you to re-run your duplicates check as needed, without all the extra work with the separate table.
Finally, there are also Sha(), Sha1(), and Sha2() functions that might be more collision-resistant. However, the md5() will be much faster and the additional collision resistance isn't enough to avoid the need for also comparing the original data. This also isn't a security situation where collision potential will matter, and so md5() is the better choice here. These aren't passwords, after all.


Connect to Multiple EC2 Instances from Ubuntu without typing the IP everytime

Question: I wanted to connect my multiple Linux EC2 Instances from my Ubuntu desktop, without writing the IP of each server every time I take the SSH.
Just like in Windows you can use WinSCP, save the SSH key and IP's of all instances, and you can directly connect(using PuTTY) to the EC2 instances.
Comment: Noty sure about a UI like PuTTY but one line shell scripts named `thehostname1`, `machine2`, etc. would be very simple to put together.  Then you just type `machine2` and you're off to the races.
Answer: You can easily accomplish that in two ways. I would recommend option two. The IP addresses and hostnames used below are only examples and should be adopted by you. In both cases you can use the command as follows to connect to your EC2 instances.
ssh ec2-1
ssh ec2-2

add the IP addresses and hostnames into /etc/hosts
$cat /etc/hosts
127.0.0.1       localhost
10.0.0.1        ec2-1
10.0.0.2        ec2-2
...

add a configuration to SSH. On a per user basis, you can add entries in ~/.ssh/config. If that file does not exist, create it.
Host ec2-1
    HostName 10.0.0.1

Host ec2-2
    HostName 10.0.0.2
    Port 2222
    User my-ec2-user
    IdentityFile ~/.ssh/id_rsa_ec2-2
    ForwardX11 yes

As you can see, option two is a bit more flexible as you can configure further settings for your hosts like a non-standard SSH port, a different username or RSA key file for authentication and many more SSH options that you can find in man ssh_config.
Answer: a simpler way is aliases (which I personally use):
alias bastion='ssh user@ip'


Usar IP ou LOCAL que o usuário está (ou o mais perto disso), para enviar uma consulta

Question: Tenho o seguinte código:
function getpage($url, $postdata=''){
    $c = curl_init();

    curl_setopt($c, CURLOPT_URL, $url);
    curl_setopt($c, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($c, CURLOPT_SSL_VERIFYHOST,false);

    curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1)
    AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2');
    curl_setopt($c, CURLOPT_POST, 1);

    curl_setopt($c, CURLOPT_POSTFIELDS, $postdata);

O que acontece é que até consigo usar um proxy, mais não é bem isso que quero. Veja como ficaria com proxy:
   function getpage($url, $postdata=''){
   $proxy = 'UM-IP';
   $porta = 'A-PORTA';
   $c = curl_init();
   curl_setopt($c, CURLOPT_URL, $url);
   curl_setopt($c, CURLOPT_PROXY, $proxy);
   curl_setopt($c, CURLOPT_PROXYPORT, $porta);
   curl_setopt($c, CURLOPT_SSL_VERIFYPEER,false);
   curl_setopt($c, CURLOPT_SSL_VERIFYHOST,false);

   curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
   curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1)
   AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2');
   curl_setopt($c, CURLOPT_POST, 1);
   curl_setopt($c, CURLOPT_POSTFIELDS, $postdata);

O que eu desejo fazer é quando o usuário entrar na página do meu site, e inserir os dados que serão solicitados. que a consulta seja executada, e mostre que isso foi feito talvez pelo IP dele ou de um ponto perto dele.
Já tentei muitas formas, mas sem sucesso.
Tenho dúvida de porque não funciona quando eu coloco no proxy: $_SERVER['REMOTE_ADDR'] e na porta: $_SERVER['REMOTE_PORT']?
Ao meu ver isso estaria solicitando o ip dele mais a porta, só que quando tento usar, não funciona. Como posso conseguir isso?
Obrigado pelas respostas, mas essa função de descobrir o IP já consigo facilmente com esses códigos:
function getpage($url, $postdata='')
{
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
    $ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
    $ip = $_SERVER['REMOTE_ADDR'];
}
echo $ip;

O que preciso agora, não sei se é algo simples, mas estou procurando a tempo é como faço para implantar de forma correta no código que tenho:
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_PROXY, $proxy);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($c, CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1)   AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2');
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, $postdata);

Talvez essa linha:
curl_setopt($c, CURLOPT_PROXY, $proxy);

Mas mesmo eu trocando $proxy por $ip, ainda assim não da certo. Já li todos os links que foram passados também, e fiz muitos testes mais ainda sem sucesso.
Comment: Acredito que aquele site que você passou como exemplo vá contra as regras aceitas na comunidade. Removi da sua pergunta.
Answer: // Função para obter o IP PHP
function get_client_ip() {
    $ipaddress = '';
    if (getenv('HTTP_CLIENT_IP'))
        $ipaddress = getenv('HTTP_CLIENT_IP');
    else if(getenv('HTTP_X_FORWARDED_FOR'))
        $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
    else if(getenv('HTTP_X_FORWARDED'))
        $ipaddress = getenv('HTTP_X_FORWARDED');
    else if(getenv('HTTP_FORWARDED_FOR'))
        $ipaddress = getenv('HTTP_FORWARDED_FOR');
    else if(getenv('HTTP_FORWARDED'))
        $ipaddress = getenv('HTTP_FORWARDED');
    else if(getenv('REMOTE_ADDR'))
        $ipaddress = getenv('REMOTE_ADDR');
    else
        $ipaddress = 'UNKNOWN';
    return $ipaddress;
}

//Server para obter IP do Cliente
function get_client_ip() {
$ipaddress = '';
if (isset($_SERVER['HTTP_CLIENT_IP']))
    $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
    $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
else if(isset($_SERVER['HTTP_X_FORWARDED']))
    $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
else if(isset($_SERVER['HTTP_FORWARDED_FOR']))
    $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
else if(isset($_SERVER['HTTP_FORWARDED']))
    $ipaddress = $_SERVER['HTTP_FORWARDED'];
else if(isset($_SERVER['REMOTE_ADDR']))
    $ipaddress = $_SERVER['REMOTE_ADDR'];
else
    $ipaddress = 'UNKNOWN';
return $ipaddress;
}

Eu tinha esta funcção para uma situação idêntica e comigo funcionava, espero que consiga também
Comment: -1 Isso tem vulnerabilidades graves de segurança, permitindo IP Spoofing. Você confia no cabeçalho enviado pelo usuário, ou seja, se enviar `curl seusite.com -H "X-Forwarded-For: 18.104.22.168"` você vai pegar o IP falso. Fora que o `X_FORWARDED_FOR` (não sei o resto) pode ter vários IPs, ou seja `126.96.36.199, 220.127.116.11`, de qualquer maneira ele não é confiável.
Answer: É exatamente o mesmo dessa pergunta. O que estar querendo fazer não é possível, ao menos não é possível somente um um mero site. Além de haver falhas de segurança no código, mas vou ignorar isso.

Para que você utilize algum IP como proxy ele deve ser um proxy, ou seja ele deve ser um servidor de proxy. Inclusive, muitos malwares fazem isso justamente para que aquele dispositivo infectado sirva como proxy.
Em geral é o mesmo que eu pegar o seu IP e querer fazer http://(seu-ip) e esperar que um site abra, isso funcionará somente se seu IP tiver algum servidor HTTP ligado, no mais dará erro de conexão ao seu IP usando HTTP.
Se não fosse assim qualquer um poderia spoofar um IP simplesmente usando como proxy um IP alheio.

Como que eles fazem?
Simples, contrate servidores de proxy ao redor do mundo e utilize o proxy mais perto da localidade da pessoa ou contrate servidores e instale um Squid. Uma outra opção é criar um software instalável na maquina do cliente (um aplicativo para smartphone e um programa instalável no PC) que possa executar tal requisição, logicamente ela vai partir usando o IP do cliente.
Existem várias e várias empresas que vendem proxies ao redor do mundo, por exemplo:

http://blazingseollc.com/proxy/
http://www.anonymous-proxies.net/index.php?r=site/coverage
http://www.limeproxies.com/network-status.php
http://www.bestproxyandvpn.com/buy-proxies.html

Existem também serviços conhecido como "backconnect proxies", eles são IPs de redes residenciais, normalmente originado de botnet, não há como saber o origem desses IPs e desses servidores. Eles também mudam o IP a cada X minutos na maioria das vezes, são eles:

https://microleaves.com
https://buyproxies.io
https://5socks.net

Não tenho vinculo com qualquer site mencionado acima!

A outra solução, como mencionei, é ter o seu próprio servidor de proxy, por exemplo usando o Squid, dessa forma basta que contrate servidores dedicados ao redor do mundo e instale o software. Agora, no cURL você conseguirá conectar nele e usa-lo como proxy, logicamente requer algumas configurações.
Comment: Obrigado pelas respostas, foram de grande ajuda;


How can I show that $\frac{1}{\sigma^2}\sum^k_{i=1}n_i[(\bar{Y}_{i.}-\bar{\bar{Y}})-(\theta_i-\bar{\theta)}]^2 \sim \chi^2_{k-1}$?

Question: Define $\bar{\bar{Y}}=\sum n_i \bar{Y}_{i.}/\sum n_i$ and $\bar{\theta}=\sum n_i\theta_i / \sum n_i$, where $Y_i \sim N(\theta,\sigma^2)$. How does can I show that $\frac{1}{\sigma^2}\sum^k_{i=1}n_i[(\bar{Y}_{i.}-\bar{\bar{Y}})-(\theta_i-\bar{\theta)}]^2 \sim \chi^2_{k-1}$ under ANOVA assumptions?
my work:
Let $\bar{U}_i=\bar{Y}_{i.}-\theta_i$, for $i=1,...,n$. So, $\bar{U}_i \sim N(0,\frac{\sigma^2}{n_i})$.
Let $\bar{\bar{U}}=\bar{\bar{Y}}-\bar{\theta}$. So, $\bar{\bar{U}} \sim N(0,\frac{\sigma^2}{\sum n_i})$.
The linear combination $\bar{U}_i-\bar{\bar{U}} \sim N(0,\sigma^2(\frac{1}{n_i}+\frac{1}{\sum n_i}))$.
Hence we can rewrite the original expression as $\frac{1}{\sigma^2}\sum^k_{i=1}n_i(\bar{U}_{i}-\bar{\bar{U}})^2$.
I feel like my work is close, but I messed up somewhere, and I need help finding my error. Due to my variance term of the distribution given by $\bar{U}_{i}-\bar{\bar{U}}$, the given expression does not appear to follow a $\chi^2_{k-1}$ distribution. Where did I mess up?
updated work:
I have that $\frac{\sum n_i \bar{U}_i^2}{\sigma^2}=\frac{\sum n_i (\bar{U}_i-\bar{\bar{U}})^2}{\sigma^2}+\frac{\sum n_i \bar{\bar{U}}^2}{\sigma^2}$, where $\frac{\sum n_i \bar{U}_i^2}{\sigma^2} \sim \chi^2_k$ and $\frac{\sum n_i \bar{\bar{U}}^2}{\sigma^2}\sim \chi^2_1$
However, I need to show that the two added terms on the right-hand side of the inequality are independent. How may I go about this?
Comment: $\bar U_i$ and $\bar{\bar U}$ are not independent. // For simplicity, maybe begin with a balanced design with all $n_i = n.$
Then the sample mean of the $k$ group means $\bar U_i$ is $\bar{\bar U}.$ For a random sample $X_1, \dots, X_n,$ from $\mathsf{Norm}(\mu, \sigma),$ it is known that $\frac{(n-1)S^2}{\sigma^2} \sim \mathsf{Chisq}(\nu = n-1).$
Comment: @BruceET I added some updated work to the post, but I am stuck at showing independence again. Do you have any suggestions from here aside from finding the joint of $(U_1,...,U_{k-1})$ then using a Jacobian transformation to show that it factorizes?
Comment: @BruceET I see. I made a mistake in assuming that $\bar{U}_i$ and $\bar{\bar{U}}$ were independent.  Since $\bar{U}_i \sim N(0,\frac{\sigma^2}{n})$, then we know that $\frac{n_i\bar{U}_i}{\sigma^2} \sim \chi^2_{n_i-1}$. So, $\bar{\bar{U}}=\frac{\sum n_iU_i/\sigma^2}{\sum n_i / \sigma^2}$. Is this the direction that I should be pursuing?
Comment: @BruceET I also see that $s^2_k=n_1(\bar{U}_1-\bar{\bar{U}})^2+...+n_k(\bar{U}_k-\bar{\bar{U}})^2=\frac{(\bar{U}_1-...-\bar{U}_k)^2}{\frac{1}{n_1}+...+\frac{1}{n_k}}$ , where $\bar{U}_1-...-\bar{U}_k \sim N(0,\sigma^2(\frac{1}{n_1}+...+\frac{1}{n_k}))$. I just don't see how I can tie these facts together to show that the given expression follows a $\chi^2_{k-1}$ .
Answer: I assume the ANOVA model is
$$Y_{ij}=\theta_i+\varepsilon_{ij}\quad,\small\,i=1,2,\ldots,k\,;\,j=1,2,\ldots,n_i$$ where $\varepsilon_{ij}$'s are i.i.d $N(0,\sigma^2)$ for all $i,j$. In other words, $Y_{ij}\sim N(\theta_i,\sigma^2)$ independently $\forall\, i,j$.
Mean of the $i$th group is $$\overline {Y_{i\cdot}}=\frac1{n_i}\sum\limits_{j=1}^{n_i}Y_{ij}\quad,\, i=1,\ldots,k$$
The grand mean is then $$\overline Y=\frac{\sum_{i=1}^k n_i\overline {Y_{i\cdot}}}{\sum_{i=1}^k n_i}$$
You also defined $$\overline\theta=\frac{\sum_{i=1}^k n_i \theta_i}{\sum_{i=1}^k n_i}$$
Now $\overline {Y_{i\cdot}}\sim N\left(\theta_i,\frac{\sigma^2}{n_i}\right)$ independently for each $i$, so that
$$X_i=\overline {Y_{i\cdot}}-\theta_i\stackrel{\text{ ind.}}\sim N\left(0,\frac{\sigma^2}{n_i}\right)\quad,\,i=1,\ldots,k$$
We also have the weighted average
$$\overline X_w=\overline Y-\overline\theta=\frac{\sum_{i=1}^k n_i(\overline {Y_{i\cdot}}-\theta_i)/\sigma^2}{\sum_{i=1}^k n_i/\sigma^2}=\frac{\sum_{i=1}^k w_i X_i}{\sum_{i=1}^k w_i}\,,$$
where $w_i=\frac{n_i}{\sigma^2}$ are the weights.
As you said, the problem boils down to finding the distribution of the weighted sum of squares
$$S^2=\sum_{i=1}^k \frac{n_i}{\sigma^2}\left\{(\overline {Y_{i\cdot}}-\theta_i)-(\overline Y-\overline\theta)\right\}^2=\sum_{i=1}^k w_i(X_i-\overline X_w)^2$$
Using general facts about distributions of quadratic forms (like some form of Cochran's theorem) it can be shown that $S^2\sim \chi^2_{k-1}$, but for a more instructive derivation using orthogonal transformations you can refer to this post on Math.SE. The independence of $\overline X_w$ and $S^2$ can also be shown this way.
Comment: Thank you so much for providing this answer! This makes so much sense. I appreciate your detailed breakdown.
Comment: This can also be answered using [this](https://stats.stackexchange.com/q/188626/119261) theorem.


How to explode pandas column values that are a list into separate features

Question: So, I have a csv that I imported via terminal and it contains:

RIVER_ID (unique river id for the whole water body)
FEATURE_ID (unique ID for feature)
value (name)
count (count of name)

I had several values in a list of names as well as several FEATURE_ID values in a list grouped to a unique RIVER_ID. I managed to clean the value list and now I want to explode every FEATURE_ID into its own row and append RIVER_ID and value to it. But the explode() function is not giving me the expected results. It just explodes the list but keeps it as a string separated by ','. I am doing this because I was transferring names from linear to polygonal source and every polygonal river is made of several individual features (with unique FEATURE_IDs) but they have a RIVER_ID that marks all those individual features as one river. I managed to conflate the name only to some features so the idea is to group by RIVER_ID to transfer the name to all of the other features with the same RIVER_ID. So I want to keep the original geometry without dissolving and similar.
import pandas as pd
from sys import argv

input = argv[1]
# izlaz = argv[2]

df = pd.read_csv(input)
with pd.option_context('display.max_rows', None, 'display.max_columns', None):  # more options can be specified also
    df_g = df.groupby(["HIDRO_ID"], as_index=False)[ 'value', 'count', 'HY_DTM_ID'].agg(lambda x: list(x))
    df_g['count'] = df_g.apply(lambda x: df_g['count'].max())

    i = 0
    for i, red in zip(range(0, len(df_g['value'])), df_g['value']):
        # print(red[0])
        # print(red)
        if len(red) > 1:
            if type(red[0]) == float:
                # print("Success")
                red[0] = red[1]
                red = red[0]
                # print(red)
                df_g['value'][i] = red

            elif type(red[-1]) == float:
                red[-1] = red[0]
                red = red[0]
                df_g['value'][i] = red
            i += 1

    df_final = df_g[['HIDRO_ID', 'value', 'count', 'HY_DTM_ID']]
    print(df_final.head(20))
    # print(df_g.explode('HY_DTM_ID'))
    df_final = df_g.explode('HY_DTM_ID')
    print(df_final.head(20))
    #
    #
    df_final.to_csv("river_names_changed.csv")

Example:

RIVER_ID = 3
FEATURE_ID = [439823, 448765, 487654]
value = [nan, Danube, Danube]

After cleanup:

RIVER_ID = 3
FEATURE_ID = [439823, 448765, 487654]
value = [Danube]

After explode():

RIVER_ID = 3
FEATURE_ID = 439823, 448765, 487654
value = Danube

Desire after explode:

RIVER_ID = 3

FEATURE_ID = 439823

value = Danube

RIVER_ID = 3

FEATURE_ID = 448765

value = Danube

RIVER_ID = 3

FEATURE_ID = 487654

value = Danube

Hope this is making it clear enough.
Comment: It seems that it is a data problem. The HY_DTM_ID are read as string type since they come from csv and are separated by ',' so it can't read them as a list in csv. Not sure how to bypass this. What do you think? Should I try to reshape the input data and how or should I maybe explode and than again create lists of integers by separating with .split(",") and joining into a list again.
Comment: It seems some data related problem, is possible share rela data in dict in question? `d = df_final.head(20).to_dict('l')` and `print (d)` ?
Comment: exactly, try convert it to lists by split.
Comment: Hey, so I did manage to split it using the df.str.split(pat=",") but I don't know how to append it to the existing dataframe since I used """d= df_final['HY_DTM_ID'].str.split(pat=",")""" which just uses the HY_DTM_ID field. I know it is probably basic stuff but how to now use this newly created list as part of the original dataframe or create a new one with all of the needed fields.
Comment: Thanks, yes, that works :) You can put your answer as a solution and I'll accept it.
Answer: After some comment problem was data in column was strings, not lists, so solution is split them by separator and assign back:
df_final['HY_DTM_ID'] = df_final['HY_DTM_ID'].str.split(",")


Site works ok but composer complains about unmet requirements. Do I have a problem?

Question: UPDATE: I am not going to continue to troubleshoot this.  Composer is working OK in my local site, so I'm going to change my approach to deployment and stop running composer in my staging site.  Instead I will run composer locally, commit core & vendor to the git project, and deploy all code to staging with git.

I am trying to get my permissions right, so I don't have to run composer as root.  As part of this process, I deleted vendor, core and composer.lock and ran composer install with my non-root user.  The site appears to be working fine, despite this message composer displayed:
  Problem 1
    - drupal/core 8.2.x-dev requires symfony/psr-http-message-bridge v0.2 -> satisfiable by symfony/psr-http-message-bridge[v0.2] but these conflict with your requirements or minimum-stability.
    - don't install drupal/core-render 8.2.0|remove drupal/drupal dev-master
    - don't install drupal/core-render 8.2.0-beta1|remove drupal/drupal dev-master
    - don't install drupal/core-render 8.2.0-beta2|remove drupal/drupal dev-master
    - don't install drupal/core-render 8.2.0-beta3|remove drupal/drupal dev-master
    - don't install drupal/core-render 8.2.0-rc1|remove drupal/drupal dev-master
    - don't install drupal/core-render 8.2.0-rc2|remove drupal/drupal dev-master
    - don't install drupal/core-render 8.2.1|remove drupal/drupal dev-master
    - don't install drupal/core-render 8.2.2|remove drupal/drupal dev-master
    - don't install drupal/core-render 8.2.3|remove drupal/drupal dev-master
    - don't install drupal/core-render 8.2.4|remove drupal/drupal dev-master
    - don't install drupal/core-render 8.2.5|remove drupal/drupal dev-master
    - don't install drupal/core-render 8.2.6|remove drupal/drupal dev-master
    - don't install drupal/core-render 8.2.7|remove drupal/drupal dev-master

    etcetera

What does this mean?  Is my site OK, or did I take a wrong turn?
I'm not sure why the composer message references "drupal/core 8.2.x-dev".  Here is the "require" section of my composer.json:
"require": {
    "composer/installers": "^1.0.24",
    "wikimedia/composer-merge-plugin": "^1.4",
    "drupal/entity_clone": "^1.0@beta",
    "drupal/features": "^3.8",
    "drupal/metatag": "^1.8",
    "drupal/webform": "^5.1",
    "drupal/config_installer": "^1.8",
    "drupal/entity_browser": "^2.1",
    "drupal/media_entity_browser": "^1.0@beta",
    "drupal/entity_embed": "^1.0@beta",
    "drupal/file_browser": "^1.1",
    "drupal/admin_menu_search": "^1.0",
    "drupal/admin_toolbar": "^1.26",
    "drupal/backup_migrate": "^4.0",
    "drupal/block_field": "^1.0@alpha",
    "drupal/contact_block": "^1.4",
    "drupal/contribute": "^5.0@beta",
    "drupal/ctools": "^3.2",
    "drupal/entity_reference_revisions": "^1.6",
    "drupal/facets": "^1.3",
    "drupal/field_group": "^1.0",
    "drupal/form_placeholder": "^1.0",
    "drupal/formblock": "^1.0@beta",
    "drupal/glazed_helper": "^1.3",
    "drupal/google_analytics": "^3.0",
    "drupal/honeypot": "^1.29",
    "drupal/imce": "^1.7",
    "drupal/insert_block": "1.x-dev",
    "drupal/linkit": "^4.3",
    "drupal/login_emailusername": "^1.1",
    "drupal/material_admin": "^1.0@alpha",
    "drupal/menu_link_attributes": "^1.0",
    "drupal/minifyhtml": "^1.6",
    "drupal/paragraphs": "^1.6",
    "drupal/pathauto": "^1.3",
    "drupal/redirect": "^1.3",
    "drupal/require_login": "^2.0",
    "drupal/search_api": "^1.11",
    "drupal/simple_sitemap": "^3.0",
    "drupal/simplenews": "^1.0@alpha",
    "drupal/tfa": "^1.0@alpha",
    "drupal/token": "^1.5",
    "drupal/video_embed_field": "^2.0",
    "drupal/view_unpublished": "^1.0@alpha",
    "drupal/viewport": "^1.1",
    "drupal/viewsreference": "^1.4",
    "drupal/workflow_state_config": "^1.0@alpha",
    "drupal/xmlsitemap": "^1.0@alpha",
    "drupal/allowed_formats": "^1.1",
    "drupal/asset_injector": "^2.4",
    "drupal/taxonomy_access_fix": "^2.6",
    "drupal/text_summary_options": "^1.0",
    "drupal/migrate_source_csv": "^2.2",
    "drupal/migrate_plus": "^4.1",
    "drupal/migrate_tools": "^4.1",
    "drupal/migrate_file": "^1.1",
    "drupal/entityqueue": "^1.0@alpha",
    "drupal/module_missing_message_fixer": "^1.0@beta",
    "drupal/rules": "^3.0@alpha",
    "ckeditor/autogrow": "^4.8",
    "ckeditor/codemirror": "^1.17",
    "ckeditor/fakeobjects": "^4.8",
    "ckeditor/image": "^4.8",
    "ckeditor/link": "^4.8",
    "codemirror/codemirror": "^5.36",
    "jquery/geocomplete": "^1.7",
    "jquery/icheck": "^1.0",
    "jquery/image-picker": "^0.3.0",
    "jquery/inputmask": "^3.3",
    "jquery/intl-tel-input": "^12.1",
    "jquery/rateit": "^1.1",
    "jquery/select2": "^4.0",
    "jquery/timepicker": "^1.11",
    "jquery/toggles": "^4.0",
    "jquery/word-and-character-counter": "^2.5",
    "progress-tracker/progress-tracker": "^1.4",
    "signature_pad/signature_pad": "^2.3",
    "drupal/image_widget_crop": "^2.2",
    "drupal/crop": "^1.5",
    "drupal/advagg": "^3.5",
    "drupal/advagg_js_minify": "^3.5",
    "drupal/advagg_css_minify": "^3.5",
    "drupal/better_exposed_filters": "^3.0@alpha",
    "drupal/block_visibility_groups_admin": "^1.3",
    "drupal/chosen": "^2.6",
    "drupal/chosen_field": "^2.6",
    "drupal/content_export_csv": "^3.0@beta",
    "drupal/contentimport": "^4.1",
    "drupal/event": "1.x-dev",
    "drupal/entity_reference_views_select": "^1.3",
    "drupal/imce_search_plugin": "^1.0",
    "drupal/inline_entity_form": "^1.0@RC",
    "drupal/job": "^3.0@alpha",
    "drupal/media_bulk_upload": "^1.0@alpha",
    "drupal/memcache": "^2.0",
    "drupal/purge_ui": "^3.0@beta",
    "drupal/purge_processor_lateruntime": "^3.0@beta",
    "drupal/purge_tokens": "^3.0@beta",
    "drupal/twig_tweak": "^2.1",
    "drupal/views_bulk_operations": "^2.5",
    "drupal/block_visibility_groups": "^1.3",
    "drush/drush": "^9.5",
    "drupal/we_megamenu": "^1.5",
    "drupal/views_infinite_scroll": "^1.5",
    "drupal/embed": "^1.0",
    "drupal/dropzonejs": "^2.0@alpha",
    "drupal/purge": "^3.0@beta",
    "drupal/address": "^1.4",
    "drupal/acquia_connector": "^1.16",
    "drupal/purge_purger_http": "^1.0@beta",
    "drupal/smtp": "^1.0@beta",
    "drupal/content_sync": "^2.1",
    "drupal/console": "~1.0",
    "drupal/devel": "^2.0",
    "drupal/core": "8.6.13"
},

Comment: What version are you upgrading from?
Comment: @mpdonadio  It was an upgrade from Drupal 8.6.10 to 8.6.13.
Comment: Can you show what `composer why-not drupal/core:8.6.13` lists?  This may narrow the problem down better.  As a side note, I suspect there is a Symfony related dependency problem.  Personally I always use `webflo/drupal-core-strict`, pinned top the same version as core, which tends to prevent dependency problems.
Comment: Temporarily removing drush and drupal console can also help.
Comment: Does anyone know what this part means: "remove drupal/drupal dev-master".  In a literal sense, what is that telling me?  What is "drupal/drupal dev-master"?
Comment: @mpdonadio  The output from that why-not command is 'There is no installed package depending on "drupal/core" in versions not matching 8.6.13'.
Comment: @mpdonadio  I tried adding "webflo/drupal-core-strict": "8.6.13" to the require section of my composer.json, and then removed composer.lock, core and vendor and ran composer update.  The output is exactly the same as it is in my question, unfortunately: "drupal/core 8.2.x-dev requires symfony/psr-http-message-bridge ..."
Comment: Very odd.  How about `composer why drupal/core:8.2.x-dev`?  Since it isn't in your main composer.json, `drupal/core:8.2.x-dev` is somewhere in the dependency tree.  You can also read the lockfile and search for that and see what section / package is listing it.
Comment: @mpdonadio That command gives the same result, unfortunately.  I don't see anything in the composer.lock that seems relevant.  Here is the composer.lock: https://pastebin.com/eGBV99Ae
Answer: This looks like a composer issue. Sometimes composer isn't that great at handling complex dependencies. If you want to get rid of the error, many people have success going "nuclear":

Back up your site completely
Remove core folder, vendor folder and composer.lock - E.g. if you are on linux $ sudo rm -rf docroot/core vendor composer.lock
Run composer update $ composer update
Comment: "Sometimes composer isn't that great at handling complex dependencies."  Which is its one job.  This is kind of like saying sometimes Chrome isn't great at browsing websites.  In any case, it sounds like you think there is no real problem, just a false positive error message?
Comment: @arnoldbird The number of dependencies that core brings in can expose bugs and other quirks in composer.
Comment: @100pic I completed the three steps you suggested, but I get the exact same output as I included in my question.  It's the same "drupal/core 8.2.x-dev requires symfony/psr-http-message-bridge ..."
Comment: @arnoldbird hmm, maybe try deleting the composer.lock file and then `composer update drupal/core --with-dependencies` ? Just a stab in the dark. Not sure why updating drupal with composer is so troublesome!
Comment: @100pic  Same result, unfortunately.


Right handed drummer on left handed drum set?

Question: I have a two-part question.
Is there any advantage playing a left handed drum set if I'm a right handed drummer?
And we all know about famous left handeds drummers playing right handed drum sets, but what about the oposite?
Comment: Given that around 85% of the population is right-handed, and a lot of lefties play that way also, there's probably less than 5% chance of coming across a situation where the kit is set up left-handed. At that point, it's simple to swap it round ! All drummers ought to be able to *lead* with either hand, although that's not what you ask. I'd say no advantage - feet swap too-  but this is hardly an answer. Thus, a comment. Interesting question, though...
Answer: My band's drummer is left-handed, and I am right-handed. If our drummer can't make a practice or a gig, I will sit in for him. Playing on his lefty set opened my playing a little bit, but I could have reaped the same benefits on righty sets if I knew what to look for. I'd argue that it's good to be able to do just from the perspective of being a more all-around capable musician, but it's mostly a party trick.
I tend to play open-hand on a lefty set so I can use my right-hand leading patterns, and I found myself using the toms and cymbals for accents more than when I played cross-hand. It's inspired me to play more open-hand on righty kits, as well, and to learn how to transition smoothly between cross- and open-hand. This, of course, means that I play left-hand leading patterns regularly now, which I had never bothered to learn before.
I will note that it was bloody irritating to learn how to play the bass drum with my left foot and control the hi-hat with my right. But you get used to it. Now, about a year in, I don't notice the difference at all.
Answer: Well, I'm right handed and left footed. I had some issues when I started playing the drums, I had some issues regarding the way I'd build my set. I could play either on a right-handed set and use my dominant hand or play on a left handed set and use my dominant leg. I struggled, a lot, on a right handed set, so I decided to play on a left handed one. The issue was, playing open handed was really hard. I felt like nothing was working.
So I decided to try and play leading with my left hand on a leftie set. It worked. Really well. So I'm a right handed playing on a left handed set.
Answer: For me, it was the other way around :)
As a left-handed drummer myself, I played left-hand drumset for a long time.
Switching to right-handed drum set made me think and unlearn any habits which had inhibited my progress before. (For example, my grip was sub-par, but because I essentially had to re-learn basic drumset technique, this was quickly fixed)
It also opened my mind, in the same way that drumming in, say, 3/4 is a good experience for someone who has only played set in 4/4.
I have never really gone back to lefty set, but I have noticed some improvements in my drumming.
Answer: I think anytime you take your playing out of its comfort zone you are going to learn something and improve.
If you want to give this a try just take your right handed drum set and play it as is with your left hand on the hi-hat and the right on the snare. this allows you to open up your snare hand and move it around the kit without it being "crossed up". depending on how long have been playing you will probably pick the coordination up fairly quickly but it will take a really long time to get the feel right. all those years of playing accent patterns on the hi-hat and ghost notes on the snare are going to make things really awkward at first.
If you get some benefit from this exercise maybe you can also benefit from rearranging the kit to play full lefty. this will just compound the fact that you are dealing with your hands feeling out of place and now your feet will too.
Even though i don't love Dave Matthews band you can see some of the possibilities in the playing of Carter Beauford who seems to be able to play the set fully ambidextrously.

Note that he has a ride set up above his hi-hat and plays the ride and hat with his left hand for the most part but his kick is being played with his right foot. i think he also has a hat on his right side but don't think it used in this video.
by the way the nice thing about drums is that you can set them up how you feel comfortable so if you want to try it, rearrange your kit and give it a try. doesn't cost anything other than a few hours and a bunch of frustration.  good luck!
Answer:
Is there any advantage playing a left handed drum set if I'm a right
  handed drummer?

This would depend on your current skill level. If you are a beginner or intermediate drummer, then there would be no possible advantage (other than being a party trick as Babu says) considering that you still need to build your skills and technique playing with the standard right-handed set-up first. If you are an advanced drummer, then perhaps you could possibly get some fringe benefits from attempting to play a left-handed set-up as b3ko and iPhoenix suggest... but to be honest, I feel like that is a bit of a stretch and you are still better off continuing to simply practice, learn even more advanced techniques (like open-hand technique on a right-handed set-up,) and add drums to and tighten up your right-handed set-up.

And we all know about famous left handeds drummers playing right
  handed drum sets, but what about the opposite?

See this list from wikipedia. Note that there are a mixture of righties playing leftie and vice versa, however. And, the reason we do not see righties playing leftie as often is because the sheer volume of left-handed people is so much less than that of right-handed people:

Finally, I will leave you with the same sign-off that I just gave on this question:

The instruments we use today are modern technology. They are
  manufactured and set-up the way that they are in order to be used as
  efficiently as possible. There may always be some novelty to seeing
  someone performing in some strange way; like playing piano while
  standing on your head. However, if anyone is playing an instrument in
  any way other than the way in which it was 'meant to be played,' then
  that person will LIKELY NEVER achieve the full potential of skill on
  said instrument (despite there always being exceptions to the rule.)
Answer: Answer: yes.
A so-called left handed drum set enables a right handed player to play with more skill on the hi hat when playing open handed. For me this is a huge advantage as I love playing "fancy stuff" on the hats.
It takes very little time to learn to play the hat pedal with the right foot. Likewise to use a single bass drum pedal with the left foot - I never play double pedal.
You can also keep a second high hat stand (or remote hats) on the left - which I do - for added versatility.
I suspect most righty drummers would play better with a lefty set up - playing open handed is wonderful compared to the old fashioned method.
(The idea that the old way is the most common because it has been found to be the best way is an unfounded belief.)


Chord Progression "Time" - Hans Zimmer

Question: I was taking a look at the soundtrack for the Inception movie:"Time" by Hans Zimmer.
Does anyone understand what kind of a weird progression he uses?
I tried everything from cadential to sequential but I can't seem to find an explanation.
The Track is in Gmajor/Eminor and the progression goes as follows:
Amin-Emin-G-D
Check this for the score:https://analysemusic.files.wordpress.com/2015/03/musical-analysis-time-hans-zimmer-page-0012.jpg
Hans Zimmer started out in pop music so he just repeats this progression, the production is the best part though, take a listen if you haven't yet.
Answer: You list G major and E minor as possible tonics, but I'm going to go a different direction: I hear this in A! As such, with one sharp in the key signature, it's really more of an A Dorian. Thus the progression is i v VII IV.
(Perhaps the very ambiguity of tonic was intentional, considering what takes place in the movie and the title of the piece.)
The i moving to v is clear enough, I think; it's just tonic moving to dominant. The only odd part is that the v is minor, but this is standard in the Dorian mode.
The VII is really a dominant substitute in Dorian, so that chord makes sense as well. At that point, Zimmer just moves around the circle of fourths to get back to tonic: VII moves down a fourth (=up a fifth) to IV, which then moves down a fourth (up a fifth) to i.
Note that that's different from the typical circle of fifths which goes down a fifth (=up a fourth). This may be Zimmer's popular music influence, since the circle of descending fourths is very common in that repertoire.
Another, perhaps simpler, explanation is as two related perfect fifths: i moves to v, and that ascending fifth is moved down a second to create VII moving to IV.
We can extend this further theoretically, if we want to, by saying that the upper fifth is just an extension of the original chord. In other words, the v is just an extension of i, and IV is just an extension of VII, so we can reduce this progression to just i VII, which is a very common move.
Comment: Hate to be nit-picky here but the circle of 5ths goes "up" while the circle of 4ths goes "down". Shapes of tetrachords and all that.
Comment: Thanks, definetly the best explanation I've heard yet :)
Comment: But it isn't an explanation, just a description.
Comment: is 'extension' another word for prolongation?
Comment: and how do you 'hear' something in dorian?

Chord Progression "Time" - Hans Zimmer