Soma Coluna Tabela HTML

Question: como realizar a soma automática de uma coluna específica? Tentei com o script abaixo usando Jquery, mas sem sucesso. O valor total na coluna a ser preenchido está no último . (espaço tá em branco).
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Minha Vida</title>
    <link rel="stylesheet" type="text/css" href="css/style.css">

                Corretora
                Ação
                Qtde
                Valor

                ODPV3
                100
                2.000

                WEGE3
                100
                1.800

                    Total Investido

Answer: Boa tarde, eu fiz algumas modificações no html e no javascript e funcionou. No HTML eu acrescentei thead e tbody, e no js eu deixei tudo na função ready:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Minha Vida</title>
    <link rel="stylesheet" type="text/css" href="css/style.css">

                    Corretora
                    Ação
                    Qtde
                    Valor

                    ODPV3
                    100
                    2.000

                    WEGE3
                    100
                    1.800

                    Total Investido

Soma Coluna Tabela HTML


Como alterar com VBA o e-mail do remetente e inserir a assinatura para disparo de e-mail do outlook?

Question: Tenho enviar um relatório onde preciso inserir uma tabela no corpo do e-mail, porém preciso enviar de um outro e-mail (MBX) do outlook e não do meu pessoal, não estou conseguindo, tentei com o .from mas mesmo assim não funciona.
Além disso preciso inserir a assinatura ao final do e-mail e também não estou conseguindo.
Alguém consegue me ajudar?
Sub Envia_Email_Tabela()

Application.DisplayAlerts = False

Sheets("Tabela").Select

Dim email_envio As Variant

email_envio = ThisWorkbook.Sheets("E-MAIL").Cells(3, 2) 'e-mail para qual será enviado

Range("A7").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select

ActiveWorkbook.EnvelopeVisible = True

With ActiveSheet.MailEnvelope
    '.Item.From = ThisWorkbook.Sheets("E-MAIL").Cells(1, 9)
    .Introduction = ThisWorkbook.Sheets("E-MAIL").Cells(3, 4)
    .Item.To = ThisWorkbook.Sheets("E-MAIL").Cells(3, 2)
    .Item.CC = ThisWorkbook.Sheets("E-MAIL").Cells(3, 3)
    .Item.Subject = ThisWorkbook.Sheets("E-MAIL").Cells(3, 5) & "  " & ThisWorkbook.Sheets("E-MAIL").Cells(1, 3) & " " & ThisWorkbook.Sheets("E-MAIL").Cells(3, 6) 'Assunto do e-mail
    .Item.Send

End With

End Sub

Answer: Enviar do usuário Outlook desejado
Para isso, o .SendUsingAccount deve ser utilizado e como parâmetro de entrada uma conta do seu Outlook.
Neste exemplo a conta está sendo inserida manualmente ou fixa com OApp.Session.Accounts.item(2), mas um exemplo de loop em Accounts = OApp.Session.Accounts está mostrando que há outras maneiras de realizar isso, inclusive criando um Userform para selecionar a conta desejada.
Em algumas versões o .SendUsingAccount é um objeto e em outras não, portanto, dependendo da versão fica Set .SendUsingAccount = OApp.Session.Accounts.item(2) e em outras .SendUsingAccount = OApp.Session.Accounts.item(2)
Referência
A referência do Outlook deve ser habilitada em Ferramentas -> Referências...
E habilitar o item "Microsoft Outlook 16.0 Object Library"

Código
Dim OApp As Object, OMail As Object, Accounts As Object
Set OApp = CreateObject("Outlook.Application")

Dim oAccount As Outlook.Account
Dim i As Long

Set Accounts = OApp.Session.Accounts

'Verificar as contas do seu Outlook
For Each oAccount In Accounts
    Debug.Print vbCr & "oAccount: " & oAccount
Next
For i = 1 To OApp.Session.Accounts.Count
    Debug.Print OApp.Session.Accounts.item(i)
Next i

Set OMail = OApp.CreateItem(0)
With OMail
    .Display
End With

'https://www.rondebruin.nl/win/s1/outlook/bmail2.htm
HtmlContent = RangetoHTML(Selection)

With OMail
    'Alterar o número em OApp.Session.Accounts.item(2) para a conta desejada
    .SentOnBehalfOfName = OApp.Session.Accounts.item(2)
    Set .SendUsingAccount = OApp.Session.Accounts.item(2) 'Em algumas versões não é um objeto e o Set deve ser retirado
    Introducao = "Prezado, bom dia!.
Seguem os dados:
" 'Texto Intro Corpo do e-mail
    Signature = OMail.HTMLbody
    .To = email_envio
    .Cc = "firstname.lastname@example.com"               'Quem será copiado
    .Subject = "Teste "                      'Assunto do e-mail
    '.Attachments.Add 'Anexos
    .HTMLbody = Introducao & "
" & HtmlContent & "
" & Signature
    .Send
End With
Set OMail = Nothing
Set OApp = Nothing

A função RangetoHTML() do Ron de Bruin deve ser adicionada ao código. Para mais detalhes veja esta resposta

Outra forma é o envio por CDO, para mais informações ver Sending mail from Excel with CDO, que enviará por SMTP e então é possível enviar por qualquer e-mail, não necessitando de um Outlook configurado (caso não seja um usuário do Office Outlook).
Comment: Muito obrigada!! Funcionou perfeitamente com os ajustes


how to find the dtmf tones - asterisk?

Question: I am working with Ubuntu 9.10 and asterisk 1.8. I am working on invinting sip clients in a conference room. I know I have to write call files and put them in the outgoing foder for each client.
Here is a call file:
Channel: SIP/1002
MaxRetries: 2
RetryTime: 60
WaitTime: 30
Context: confnr
Extension: 1234         //THIS IS THE CONFERENCE ROOM

in extensions.conf i have:
[internal]

exten => confno,1,MeetMe(,Mpc)

[confnr]

exten => 1234,1,MeetMe(1234,vMAqd)

Now I have a problem. If there are multiple conference rooms in meetme.conf how can i know (how to set the dialplan) what is the room number that a sip client selected?
A sip client calls confno@domain and than selects a conference number. How can I know what is that conf number and how to add it in the call file? Need some advices.
THX APPRECIATE
Answer: Answer on all your question availible here:
http://www.voip-info.org/wiki/view/Asterisk+cmd+MeetMe
Comment: i read that link. I didn't find anything about ending a call in x minutes
Comment: use dial via Local channel to limit call length. no, you can't force conference to be ended at X minutes. to do that use external scripting(expert level required) and asterisk AMI interface.

how to find the dtmf tones - asterisk?


Electron auto-updater not relaunching the app

Question: I am trying to set auto update in my electron mac app.
I am using the following code:
const autoUpdater = electron.autoUpdater;

autoUpdater.setFeedURL('https://server_url?v=' + appVersion);

autoUpdater.checkForUpdates();

autoUpdater.on('update-downloaded', function(){

    autoUpdater.quitAndInstall();

});

But I think this statement autoUpdater.quitAndInstall() is not working. The app is not getting quit and relaunching. But if I manually quit the app and reopen, it opens the updated app.
In the app I have a window which is not closable. Is that causing the issue here?
Answer: Yes. The non-closable window was causing the issue. I got the solution from electron documentation itself. I used the following code to solve the issue:
autoUpdater.on('update-downloaded', function(){

    mainWindow.setClosable(true);
    autoUpdater.quitAndInstall();

});

Comment: I still have the same problem. I added the setClosable one but it did not help.


let $f:X \rightarrow Y$ be such that $f^{-1}(y)$ is a countable set for each $y \in Y$. Supposed Y is countable. Show X is countable.

Question: let $f:X \rightarrow Y$ be such that $f^{-1}(y)$ is a countable set for each $y \in Y$. Supposed Y is countable. Show X is countable.
$\cup f^{-1}(y)$ is countable since it is a countable union of countable sets.
This shows some subset of X is countable. It doesn't show that X is countable, so how can I fix that?
Comment: _Which_ subset of $X$ is $\bigcup f^{-1}(y)$?
Comment: I have no idea.
Comment: Definition time. What is $f^{-1}(y)$ for $y\in Y$?
Comment: $\cup f^{-1}(y)=X$. Don't know how I missed that. thanks
Answer: HINT: Note that the domain of $f$ is $X$.
Comment: if f is a bijection that would solve the problem, but f isn't given to be a bijection so the inverse is a subset of X but not necessarily all of X. correct?
Comment: You're overthinking this.
Comment: $\cup f^{-1}(y)=X$. Don't know how I missed that. thanks
Answer: Note that for any $x\in X$ we have $f(x)=y\in Y$, so $x\in f^{-1}(y)$.
Can you tell what $\bigcup\limits_{y\in Y} f^{-1}(y)$ is now?


Is it considered a dig when receiving a block attempt ball in volleyball?

Question: Team A hits the volleyball on an attack. Team B attempts to block, sending the ball back across the net to Team A. Team A receives the ball. Is this considered a dig?
Also if Team A attacks the ball and Team B attempts to block causing the ball to remain on Team B's side. Team B then receives the ball. Is this still considered a dig even if it was first touched by the blocker?
Comment: "Dig" is not actually a term which is used in the official volleyball rules. Why do you think it is important that something may or may not be considered a dig?
Answer: There is no single official worldwide volleyball statistics definition. But we can take a look at a representative comprehensive source for definitions of volleyball statistics: 2015 NCAA Official Volleyball Statistics Rules. Their definition of "dig" is the following (in "Section 4—Digs"):

A dig (D) is awarded when a player passes the ball that has been attacked by the opposition. Digs are given only when players receive an attacked ball and it is kept in play, not when a ball is brought up off a "put back" (blocked ball).

Also, it contains the following approved ruling which perfectly answers both your questions:

Team White player No. 1 attacks the ball. The ball goes off Team Blue player No. 1 and (a) is returned to Team White and passed by Team White player No. 2 or (b) goes to Team Blue player No. 2 who keeps the ball in play.
RULING: In (a), Team Blue player No. 1 is not awarded a block nor is Team White player No. 2 awarded a dig. A block is not considered an attack and therefore a player cannot be given a dig off a block attempt. In (b), Team Blue player No. 1 is not awarded a block but team Blue player No. 2 is awarded a dig.

Which means the answer for your first question is no, this is not a dig. And the answer for your second question is yes, this is still a dig, even though the attack was slowed by the block.
Other official bodies or specific competitions might use a different definition, but I believe the basic principles would be the same.
Answer: great description concerning tips and blocks as to whether it is a dig.  A very misconceived and poorly recorded stats by many assistance and coaches that keep stats.  In fact, unless your coach or one of them is/was a defensive artist, and it is an art; the instinct, reflex, unconscious ability to fly and do anything to touch something that may be going faster than the eye can track!
Basically any touched ball by your teammate trying to block can be dug and if upped and played by the next player in a playable way, the statistician can rule that first up a "dig".
The free ball is a tougher one.  When a direct attack is not possible for whatever reason, poor pass, great dig, the player may not be in a good high percentage place or have the ability or role to attack.  When a player uses underhand technique to return the ball to the opponent and reset for another try, this looping return is called a "Free ball" meaning, the team gave their opponent and easy ball to set up, essentially a "free" try to return it again without the team hitting the freeball using an attempt to make a kill.
However; there are many beach players who either play both sports or have turned back to indoor exclusively.  With them comes a gambit of tricky underhand shots that is, perhaps, considered a surrending "free ball", but, in point, is an attack to get a point, or, in the very least make their opponent work to get the ball and set it up.  In my opinion, when the opponent returns, typically the third hit, as a "free ball" meaning an underhand or slow looping overhand hit, giving up their attack, but at the same time goes deep to a corner, or directs hit harder and lower in hopes of catching someone in the front off-guard, this is no longer a "free ball" but a deliberate attack and the return, if successful, is a dig.  correct? I have no problem with all free balls being digs in high school, but should a true "free ball" controlled pass be considered a dig?
Comment: Welcome to Sports Stack Exchange. It's currently not clear how exactly this post is answering the question. Can you add some resources or definitions, and give a directed response to what was asked?


What are the stipulations for a twelve-tone row to create a matrix with two consistent diagonals?

Question: Consider the tone row for Chen Yi's "Near Distance" (C, D♭, B♭, E♭, E, G♭, A♭, A, B, F, G, D). The matrix for this row form is:

Notice that the NW–SE diagonal is all the same pitch/integer (here, 0). This is true for all properly constructed twelve-tone matrices. But notice that there is no such consistency in the NE–SW diagonal.
Now consider the row from the "Wittgenstein" Motet by Elisabeth Lutyens (C, B, E♭, G, A♭, E, D, G♭, F, D♭, A, B♭).
This row form is almost symmetrical; the intervals moving forwards are the exact same as the intervals moving backwards, with only one exception: the interval between the sixth and seventh members of the row is a descending major second moving forward but an ascending major second moving backwards. Because of this symmetry, which ends exactly halfway through the row form, notice that the matrix has a NE–SW diagonal that is "t" for the first half and "2" for the second half:

Thus my question: under what stipulations will a twelve-tone matrix have both of these diagonals using only their own pitch? (By "twelve tone" I mean a row that uses all twelve pitch classes once and only once.) Does this occur only when the row form is completely symmetrical, or are there outside possibilities that would also create such a matrix?
By the way, I'm using musictheory.net's matrix calculator for these matrices.
Comment: I think you have a typo in the Chen Yi row, the second note is C♯ rather than C♭, right? Also, when you describe the Wittgenstein row you say "descending major second" for the middle in both directions, but I think you meant "ascending" for the reverse.
Comment: I followed the link and used the matrix calculator and the grid contained letter names not numbers.  Ah - just spotted the buttons to change the representation from letter name to numeric.
Comment: Thanks, Pat; fixed. And I was so hoping you'd answer!
Answer: This is a very interesting question and ended up being a fun maths puzzle to solve. I solved numerically and found 3840 matrices which satisfy this condition.
Here is one of them:

Pat Muchmore pretty much hit the nail on the head with the necessary conditions in his answer. But I thought I'd walk through how you'd solve this mathematically.
Firstly, instead of putting note values in the 12-TET matrix, let's put interval values above the root.
So instead of the first row looking like:
1, 3, 6, 10, 4, ...
We can write it as:
1, 1+2, 1+2+3, 1+2+3+4, 1+2+3+4+6, ...
(Note that we are working in a mod12 system, so the last element of the second list here 1+2+3+4+6=16. But 16 mod 12 is 4, which is the last element of the first list.)
Also, let's write it more formally, and make no assumptions about values. If we start on x, in 12-TET we have the first row:

It's starts out ugly, but the general strategy is to figure out relations between these intervals to try to reduce them down. From this first row we can construct a full matrix. Here it is (with only 1st row, 1st column, and diagonals completed).

If you follow down the NE-SW diagonal from the top, a pattern emerges that when you move down you must remove the latest interval added (k), and when you move left you remove the earliest interval added (a). In other words, remove intervals in pairs: (a,k); (b,j); etc. Our goal is that every value in this diagonal is the same, so the only way to remove a pair of intervals and not change the value is if their sum is 12.
Therefore: a+k=12, b+j=12, etc. If you play around with some values, you'll see that this is exactly the palindrome behaviour observed. In fact, I rather say the condition is not that there must be a palindrome, but that pairs of outer intervals must sum to 12.
When we get to the center, we have x+f and x-f, which must be equal. The only way these can be equal in a mod12 system is when f=6. Great, now we know this interval, and we know for certain the diagonal must only contain x+6 in each cell.
We can also infer what the first element of the first row is. The top right cell is x+a+b+...+k, and this =x+6. The bottom left cell is x-a-a-...-k, and this =x+6. So we have the relation:
x+a+b+c+d+e+f+g+h+i+j+k = x-a-b-c-d-e-f-g-h-i-j-k. But we already know a+k=12, which = 0 in mod12. We can remove. Similarly for -a-k=-12=0. In fact we can do this for all out interval pairs until we have x+f = x-f = 6. This is only true when x = 0.
Once we have this, we know our diagonal contains x+f=0+6=6 in each cell. One last little bit of notation to improve on; instead of holding onto a,b,c,d,e,f,g,h,i,j and k. Let's use our knowledge of how the pairs must sum to 12 to rename each interval a,b,c,d,e,6,12-e,12-d,12-c,12-b,12-a.
The problem is now reduced to five parameters, and the current matrix row looks like:

This is ugly, until we realize we can cancel a lot of stuff (a-a=0, 12=0, etc), so we can simplify to:

Where we are now is very close to the end. These are the minimum required conditions to find a 12-TET matrix with a both diagonals constant. The goal from here is to construct a row such that each tone only appears once, and the intervalic relationships provided are observed. So long as the first interval is, for example, a=7, then the second last row element must be 6+7=1, and so on.
I couldn't come up with any further parameterizations that helped, or any more tricks. From here I brute forced it by constructing all possible rows that satisfied all the conditions.
This all moved very far away form music, but I had fun so thanks for the problem!
Comment: Nice! This gets much closer to clarifying the other conditions that must be in place. One thing: you write "hexadecimal" throughout, but that's base 16, not base 12. But it doesn't really matter since the issue here is that we're in *mod*-12 rather than base-12. Some theorists do use base-12 also, by using t and e or A and B instead of 10 and 11, but 16 isn't equivalent to 4 in a system that's merely base 12.
Comment: Ah thank you, my bad! I'll edit it throughout!
Comment: Thank you, Alan. I need to read and think on this a bit; you've given us a lot to consider here!
Answer: This is a fascinating problem, and there are still a few questions I hope to explore further.
In short, yes, most definitely it requires the retrograde to be a palindrome with, potentially, a reversed "seam" in the middle (more on that in a bit.)
Here's my reasoning. Without losing generality, we can assume that the northwest corner is PC 0, and that will always fill the NW–SE diagonal. For now, let's call the final PC of the first row x—and this is the value we want to have go down at least the first part of the NE–SW diagonal. So far, our first two rows are:
0 _ _ _ _ _ _ _ _ _ _ x
_ 0 _ _ _ _ _ _ _ _ x _
So let's be quite general about the second note of our P0 and call it y. Here's the thing: we know that the second row will be exactly y less than the top row. Let's fill some of that in:
0 y _ _ _ _ _ _ _ _ _ x
-y 0 _ _ _ _ _ _ _ _ x (x-y)
Thus, the second to last note of our P0 row needs to be y larger than x. Right, because everything in the second row needs to be y less than the top row? So we have:
0 y _ _ _ _ _ _ _ _ (x+y) x
-y 0 _ _ _ _ _ _ _ _ x (x-y)
Thus, the penultimate note is precisely as much bigger than the last note as the second note was bigger than the first (and remember, we're in a mod-12 universe, so it is perfectly general to talk about adding numbers, since any subtracting is the same as addition by the mod-12 complement).
This logic will continue the whole way through, the third note of the row will be precisely as much bigger than the first as the third-to-last will be bigger than the last. Etc.
Now, another thing I realized is that there is a way to make the NE–SW diagonal the same the whole way, but only with 6 as the pitch class. This is because the value has to be its own complement (note how, in your Lutyens example, the two PCs that form the other diagonal are t and 2—complements. This will always be the case), and only 0 and 6 have the property of being self-complementary. Additionally, (and maybe relatedly) this is also the only way to make (any) tone row a true palindrome. Since the prime order move from the sixth to seventh note has to be the same as the the retrograde move from the seventh to the sixth while somehow being an "increase" in one direction while being a "decrease" in the other. The only interval that goes to the same pitch class either up or down is 6.
Unanswered questions that I hope to revisit:
What other restrictions are there in the note content? You definitely can't use any row that starts in 0 and ends on 6 and get this effect.
How related is this to all-combinatorial hexachords? I have some wondering that there might be a relation.
The fact that the true palindrome version must have a tritone relation between the first and last notes, and a tritone relation in the middle definitely calls all-interval rows to mind. Coincidence?
Anyway, let me know if I need to clarify.


Reconciling Different Schools of Thought in Piano Technique

Question: I am a mostly self-taught pianist who has recently begun to take lessons from a teacher who learned her technique by the Russian piano school method.
I have previously studied technique on my own by googling online sources before I started lessons with my teacher. Through my studying, I came across the "Taubman Approach" to piano technique, which I based most of my technique on.
In my lessons with my teacher, it has become apparent that these different schools of technique have contradicting ideas on what the ideal technique is.
For example, my teacher tells me that I should move my wrist minimally and most of the movement used to hit a key should come from my fingers alone. On the other hand, the Taubman approach emphasizes a rotational movement coming mostly from the wrist to hit keys.
My question is how I should reconcile these differences in teachings between the piano schools. Should I give up on following one in favor of the other, or try to combine elements from each school somehow?
Answer: Both concepts have their place, along with several other ideals. It depends a lot on what the music is, where it originated, what you want to do with it, how you make it play most effectively - all for starters.
As a teacher, I welcome other methods of playing/learning to play, and quite like it when a challenge such as this arises. It affords a different angle on technique, and provided the student is willing, it makes lessons and approaches, both basic and advanced, to have more value. I will always fight my corner, but if there's a better way that I get introduced to, well, why not?!
If your teacher is at all bothered, maybe s/he is too entrenched, or 'programmed' but if willing to discover more, that's great.
As for yourself, it sounds like you're old enough to be realistic, so give everything a try, and make your own decisions. If teacher convinces you, then maybe that's the job done!
Answer: You need to realize that pianists and piano teachers are sometimes judged more by reputation and "genealogy" than anything else. If you were a pupil of a pupil of a pupil of a pupil of Liszt, that automatically makes you a minor deity, whether or not you can actually play or teach. The same applies to having studied at Juilliard (or name your favourite non-USA conservatoire), etc.
Also, in any activity that requires physical ability, the leading practitioners have the natural ability to do what is the right thing for them, regardless of what they are being taught. But the fact that it is the right thing for them doesn't mean it is the right thing for everyone else.
So to summarize: IMO both you teacher and Taubmann are most likely wrong, but you can still learn something from both of them :)
Comment: While you are right that in music we often look to people like Liszt (or contemporary celebrities) for guidance, whereas they are probably incredible exceptions and hardly comparable to the average pupil, the matter being discussed (the extent to which you should use the various elements of the playing apparatus) has a very sound anatomical foundation and is not something Taubmann or the teacher in question invented. Modern day piano technique has been developed over the course of the last two centuries.
Answer: Preamble
The other answers don't really discuss the technical part, they just give advice on how to deal with varying opinions. This is very valuable, but I thought discussing technique would still be an important addition. (After all, that's what the question is about.)
Now I am not familiar with Dorothy Taubman, but looking at the Wikipedia article you linked to it seems I am familiar with the concepts she proposes: most of them are widely taught nowadays, she just integrated many of them in a comprehensive model. (And the 8 principles listed are hard to disagree with.)
I don't think your new teacher disagrees with Taubman's work. Not least because the concepts Taubman proposes are (nowadays) not controversial save the forearm rotation.

General technical considerations
You can play the piano using many different muscle groups. Not only the fingers and the wrists are involved, but so are the arms and shoulders and certain muscles in the back. Additionally, posture also has a considerable influence on your technique.
Usually, a distinction is made between the (very broad) categories of finger playing, hand playing and arm playing. These three are all valid playing techniques and necessary to play certain things. You almost always need a combination.
Finger playing is the easiest to teach to beginners. Although arm playing is not very difficult to teach either, finger playing immediately gives more control to the player so it is often taught first for motivational reasons. (Personally, I see no reason to pick either, you can develop both in parallel. Only combining them is difficult.) For this reason, we often see people who have very developed finger playing, but don't involve the rest of their playing apparatus.
Because beginning students often only use their fingers while playing, piano teachers often (have to) stress the wrist motion. This is compensatory since in ideal technique, you use a combination of all muscle groups, in other words, the whole playing apparatus; sometimes a bit more of this, sometimes a bit more of that, but it occurs very rarely (never say never) that you would use only one element. (Cf. also Taubman.)
If you use only your fingers, usually your wrists "lock up"; you fix them in place by flexing all kinds of surrounding muscles. All this tension is of course a hindrance in playing. Training specific wrist motions requires these muscles to relax and frees up the wrists. This is important because locked wrists cut the connection with the arm and therefore prevent use of the arm in piano playing. Hand playing is mostly a hinging motion in the wrists so if you lock those it's completely impossible.
(This is where Taubman's controversial forearm rotation comes in. She says it should be minimal and in my opinion maybe to the onlooker imperceptibly so, it just serves to keep the wrist free. If you make this rotation large enough to be clearly visible it obviously becomes a hindrance – this is why I think people take issue with it.)
What I think happened to you
For whatever reason, you avoided the trap of playing only with the fingers while locking the wrists in your self-taught piano journey. (Kudos!) However, since finger playing is mostly assumed to be overdeveloped, it never really came up in the materials you used so naturally you never really trained it. Now, your teacher sees that your arm playing is very developed but your fingers are lagging behind. She is now trying to get you to compensate for this gap in your technique.
I think this is the case because of multiple reasons:

"most of the movement to hit a key should come from the fingers alone" nobody who plays on a professional level can seriously believe this as a general policy: in certain contexts it can be true, but please try and play a large chord with the fingers alone for example. Since the nineteenth century nobody has made serious claims that the wrists should not be involved at all.
On the other hand, if I had to teach a pupil whose finger playing was underdeveloped (relative to the rest of their technique) this is exactly what I would tell them to do. Not because that is ideal technique, but to train the parts that are lagging behind. If your left leg is substantially stronger than your right and you are limping, would it perhaps be a good idea to do some additional strength training for the weaker leg? Or would you just keep on trying to run as close to in perfect form as you could? (Strength is part only of the analogy; I'm not saying finger strength is the problem – without seeing you play what I have said before is going out on a limb already.)
The Russian school actually starts with and stresses arm playing, as does Taubman apparently. So the fact that your teacher was trained in the Russian tradition supports my hypothesis. Yes, the Russians also talk about "perlé" playing but that is only useful on a thorough foundation which includes a flexible wrist. ("Perlé" actually comes from the French school but it's all the rage in Russia now while the French have moved past it.)

Taubman vs. the USSR
If there is actual disagreement between Taubman and your new teacher at all, I think the most plausible difference would be the mental model used to combine the various elements of the playing apparatus.
One way to look at it is to let the fingers lead the wrists. If the wrists are free, they will follow the fingers comfortably and conveniently and support the fingers in striking the keys.
Another way to look at it is to place the fingers using an organic and effortless wrist motion. If the finger playing is developed enough they will fall into place as an extension of the wrists.
That you need both wrists and fingers is a fact. The importance of either element depends on the notes to be played, the hands you are stuck with, the sound you want to produce and personal opinion. I hope you can imagine that the two approaches above become equivalent if the importance of the two components vary independently of the mental model used.
Personally, I need both: in some passages I can't get my fingers to the right place without consciously correcting the motion of my wrist, in other passages I am hindering my fingers by excessive wrist flailing which I can only solve by relaxing the wrist and letting the fingers lead it to the right place.
Important advice
You write

In my lessons with my teacher, it has become apparent ...

This doesn't sound like you actually talked about your concerns with her. I highly recommend you do; clearly she is in a much better position to give advice about your technique than anyone on this site is, since she actually knows you and how you play.
If my above answer is right, the root cause of your problem is a lack of communication between the two of you: you think she is teaching you what ideal technique looks like, but actually she is making you fix a hole in your technique through some targeted exercise, neither realising what the other is thinking.
If you feel like you can't talk about this with her this is a separate, highly important, issue you should solve first and as soon as possible.
Answer: I agree with the other answers there are as many ways playing piano, learning and teaching the piano as there are ways to Rome.
We don't have to change our teachers (and doctors, coaches, political leaders etc. as far they are not doctrinaire, intolerant, tyrannical and as long they show their respect to as as we are respecting them.
I had piano teachers, trombone teachers, profs without these qualities but I had no other choose.
On the other side we can imagine how difficult it is for all these pedagogues and physicians when parents and patients know everything better as they google and bring their diagnoses with them and children have home schooling. What we need is more trust, respect and the will, to give them all a chance.
Answer: I don't beleive in methods but I do beleive in the laws of physics, ergonomics and our biology.   Our fingers have no muscle so we use the muscles of the arm to play. Your tendons are bundles of bundles of bundles of bundles of fibers. Each of the bundles or fibers are responsible for the fine tuned movement of the fingers. The key is not to use the same fibers twice in a row so this requires up, down, in, out, forward, gravity, moving the arm, rotations from the pronator and supinators and other movements which give us effortlessness.
Watch this video of Adam Makowicz. Notice his elbow. Notice up and down. Notice him moving in and out. Notice him lifting up. Notice him forward shifting. Notice his hand rotating left and right (from the elbow). When everything is combined, it is effortless.  He doesn't move his wrist but, his wrist takes on the fulcrum shape required to be the conduit between the arm and fingers.  He also groups patterns so the rotations and arm directions can be utilized for more effortlessness. Your hand can only move in one direction at a time so grouping facilitates this. This is science, biology, ergonomics and physics.  Some would call the compilation of the laws of physics a method but, it is just the laws of physics.

More important than what he is doing is what he is not doing which is abduction, pressing, playing from the fingers, curling, twisting, equalizing, trying to be "still and quiet," or not using his whole body to place the hand.


What is the best WAV encoding and why?

Question: I'm using Audacity to export a track, and there are just too many options to encode a .wav export:

Signed 16/24/32-bit PCM
Unsigned 8-bit PCM
32/64-bit float
U-Law, A-Law
IMA ADPCM, Microsoft ADPCM
GSM 6.10
32kbs G721
ADPCM 16/24/32, NMS ADPCM

Which is the best and why? Where can I learn more about these?
I've been exporting in 64-bit float for the past months, and I'm pretty happy with it (the file sizes are huge!). However, some streaming and distributing services (DistroKid, for example) won't take it and instead I used Signed 32-bit PCM.
But this causes a problem: for some reason, exported tracks that wouldn't have distortion with clipping (using 64-bit float), now do and I get a lot of clipping sounds when using Signed 32-bit PCM. The solution I found is to simply lower the volume of the track before exporting. This didn't happen in my previous laptop, so I wonder what is going on and if you have any suggestions to make the most of a .wav export.
By the way, this is the options I have (is there a better format than WAV?):
Comment: I believe this question is probably more fitted for https://sound.stackexchange.com. In any case, you're getting distorsions probably due to the playback backend that uses a wrong reference. Frankly, unless you're doing some high-end mastering, there's really no need to use 64bit. Nowadays, using 32bit float is pretty standard. For obvious reasons, avoid 8bit. 32bit signed doesn't provide better benefits than the float counterpart. Gsm should be avoided, as g721. In any case, remember that "WAV" is actually a container, while most .wav files are uncompressed, it is technically not "a format".
Comment: I didn't suggest to export in 16-bit, I only said that using 32bit *integer* is pointless, and you should prefer 32bit *float* instead (at least, you'd get actual benefit from such size/length ratio). Flac is just a *data* compression algorithm, it doesn't alter the audio content: in fact, if you convert a flac file created from a wave file back to wave again, you'll get the exact same data of the original (unless you used some custom settings for the conversion). As long as you're using uncompressed (as in *lossless*) formats, there's no difference; what matters are bit depth and frequency.
Comment: It could be a playback problem, if the player's audio decoder isn't correctly programmed, but generally speaking integer based wave samples have higher dynamic range (which often results in "louder" sound, for physical reasons, but also depending on the decoder). To simplify, with 16bit, the range for each sample is -32768/32767, while in 32bit it's -2^31/(2^31-1), and since most decoders/DA converters are not really used to that sampling, the result is that they often sound louder (and close to distortion). Float sampling is more coherent, due to the nature of its sampling and precision.
Comment: What do you mean by "playback backend that uses a wrong reference"? Why do I get distortion on the signed 32-bit PCM and not on the 64-bit float?
Comment: Note that this is a **huge** oversimplification. As said, you should move to sound.SE. In any case, using 32bit *integer* is really pointless, especially with nowadays technology and standards. See [32 bit float files explained](https://www.sounddevices.com/32-bit-float-files-explained/), it doesn't cover all formats, but it's a good start.
Comment: Thank you so much! This is quite interesting. I might just lower the track volume and export it in 16-bit as you suggest. Will definitely post it on sound.SE
Also, this is definitely a question for other discussion, but if I may ask your opinion, what about .flac? This seemed to handle the clipping pretty well too, at a much lower file size. I would have to define what I mean quality of course, but should I favor .wav over .flac?
Comment: As far as I know, the only formats here that are commonly used in music production are 16 bit int (PCM), 24 bit int (PCM), and 32 bit float.  I'll be very surprised if there isn't already a detailed answer comparing these on either this stack or sound.stackexchange.com .  "Bit depth" is the relevant search term.
Comment: Please don't cross-post to multiple SE sites. Pick one & stick to it, or flag for migration. https://sound.stackexchange.com/questions/50548/what-is-the-best-wav-encoding-and-why
Comment: I'm voting to close this question because it has already been opened on Sound.SE.
Answer: This is expected behaviour. There is a fundamental difference between integer and floating formats:

Integer represents always a fixed amplitude range, generally interpreted as [-1, 1], uniformly covering this interval with e.g. 65536 equal steps in case of 16-bit. that means that any value outside of the range cannot be represented at all, because there simply aren't any more 16-bit values available. As a result, it's imperative that you keep within the 0 dB headroom.
Floating point gives you an effectively unlimited amplitude range: peaks of > 0 dB can still be represented, it merely results in less resolution (but that's hardly an issue, because the signal strength will then mask the resulting quantisation noise). That's why DAWs, which nowadays all use floats internally, have no problem cranking up a track to +30 dB or something, as long as the master is scaled down again.

Even if exporting to float, it is good practice to limit the master amplitude to 0 dB. Do this by selecting a suitable master level (most DAWs give you an option to automatically normalise the level, i.e. scaling the level such that the highest peak it just at -0 dB).You probably also want to use compressor / limiter / soft-clip plugins, to not have all your headroom eaten up by a few freak transients. (But don't overdo it.)
If you did everything right, then it hardly matters at all whether you export as 64- or 32-bit float, or 24-bit integer. I would generally pick the latter, because it's the smallest that has essentially perfect quality. Only use float formats if you don't want to bother with normalising/limiting, can afford the extra space, and know that the file will never need to be played on consumer devices.
16 bit integer has a significantly lower optimal SNR than the former formats, but it's still good enough for most purposes, provided you use proper dithering.
All the other formats are basically obsolete. E.g. μ-Law (here misspelled as U-law) is a nonlinear encoding that's more or less a poor man's floating-point, but these kind of formats are only relevant for old embedded devices – essentially, telephony. Ok for live speech, rubbish for rendered music.

What is the best WAV encoding and why?


Send email to customers after particular period of time?

Question: I am using the Drupal Commerce module and I have a product type service for license to be sold on site. I have different licences (products) like 1 year license, 2 year license, 6 months license and many more.
I need to send an email to customers 1 month prior to their license expiration date. Like if customer purchased a license for 1 year, then the email should be sent 11 months after date of purchase. Similarly with other products like after 5 months if license is for 6 months.
How can I achieve this using the Rules module?
Comment: What did you try? What happened?
Answer: Answering my own question.
I have finally done this using hook_default_rules_configuration()
I have created a test rule with static values, then exported it and used the hook mentioned above to modify the values on run time.
This worked best for my requirements.
Answer: Use the Rules Scheduler (a sub-module of the rules module) for sending such eMails.
You would have to create a Rules Component (to actually send an appropriate eMail) and a rule (which schedules that Rules Component), which is similar to the exported rules shown in my answer to "How to send an email to an author on a specific date using date field specified in a node?". Just replace the "field_weaning_date" by what corresponds to your "1 month before expiration date".
If you don't have an expiration date, you could also use something like "order creation date", and combine that with (eg) "after 5 months from now" (for a license of 6 months). And if in the same rule you'd want to combine this logic for licenses that expire after 6 months, or 1 year, or 2 years, you can do so by using either the Conditional Rules module, or a Rules Component (in which you include Rules Conditions about the expiration date).
Obviously, you'd want to use some Rules Event that corresponds to something like your "Customer purchases license".
PS: I'm assuming this question is about D7.
Comment: I don't have License expiration date, expiration date is only dependent on Order creation date, what needs to be calculated from order creation date is date to send the reminder, which can be different, particularly there is not expiration date, I only have order creation date and product of type service.
Comment: Your answer was useful to me but it did not fixed the issue, I have done this programmatically using hook_default_rules_configuration().

Thank you for your help.


Fix QObject: Cannot create children for a parent that is in a different thread

Question: I have noticed this message in my Application Output in Qt Creator:
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QUdpSocket(0x557d126bb830), parent's thread is QThread(0x557d11d1d680), current thread is QThread(0x557d126c64d0)

I use:

GCC 13.2.1 as a compiler.
Qt 5.15.11.
Qt Creator 11.0.3.

My project is a little larger, so I am providing minimal reproducible example. It contains class UDPClient for sending UDP packets and class MyProcessing that is for preparing UDP packets.
main.cpp:
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QMainWindow w;
    w.show();

    UDPClient c(&w, QHostAddress("192.168.1.255"), 5001);
    MyProcessing p(NULL, "Hi!");

    QTimer timer;
    timer.setInterval(1000);
    timer.setTimerType(Qt::TimerType::PreciseTimer);

    QObject::connect(&timer, SIGNAL(timeout()), &p, SLOT(onTimeout()));
    QObject::connect(&p, SIGNAL(sigNewDataReady(QByteArray)),
                     &c, SLOT(onNewUDPDataReceived(QByteArray)),
                     Qt::DirectConnection);

    p.start();
    timer.start();

    return a.exec();
}

udpclient.h:
#ifndef UDPCLIENT_H
#define UDPCLIENT_H

#include <QObject>
#include <QThread>
#include <QUdpSocket>

class UDPClient : public QObject
{
    Q_OBJECT
public:
    explicit UDPClient(QObject *parent = nullptr,
                       QHostAddress aAddr = QHostAddress("192.168.0.20"),
                       quint16 aPortNum = 0);
public slots:
    void onNewUDPDataReceived(QByteArray data);

private:
    QUdpSocket  *udpSocket;
    quint16      portNum;
    QHostAddress addr;
};

#endif // UDPCLIENT_H

udpclient.cpp:
#include "udpclient.h"

UDPClient::UDPClient(QObject *parent, QHostAddress aAddr, quint16 aPortNum)
    : QObject{parent}
{
    portNum = aPortNum;
    addr    = aAddr;
    udpSocket = new QUdpSocket();
}

void UDPClient::onNewUDPDataReceived(QByteArray data)
{
    udpSocket->writeDatagram(data, addr, portNum);
}

myprocessing.h:
#ifndef MYPROCESSING_H
#define MYPROCESSING_H

#include <QObject>
#include <QThread>

class MyProcessing : public QObject {
    Q_OBJECT
public:
    MyProcessing(QObject *parent = nullptr, QByteArray text = "text");

    void start() { mThread->start(); }

signals:
    void sigNewDataReady(QByteArray);

public slots:
    void onTimeout() {emit sigNewDataReady(QByteArray(mText)); }

private:
    QByteArray mText;
    QThread *mThread;
};

#endif // MYPROCESSING_H

myprocessing.cpp:
#include "myprocessing.h"

MyProcessing::MyProcessing(QObject *parent, QByteArray text)
    : QObject{parent}
{
    mText = text;
    mThread = new QThread;
    this->moveToThread(mThread);
}

Other questions on similar Application Output suggest to not inherit from QThread class, and suggest using similar way as I did here.
Comment: Please [edit] your question to provide a [mcve].  Also note that if you wish to know on which thread your `onUDPServerThreadStarted` method is being called you can check/compare the output of [`QThread::currentThreadId`](https://doc.qt.io/qt-5/qthread.html#currentThreadId).
Comment: @G.M. Thanks to your suggestion to use `QThread::currentThreadId` I found why error occured I solved it. I am omw to edit this question so I can show error in [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) and what solved it.
Comment: Change to `new QUdpSocket(this)`
Comment: I tried... Same result
Comment: `onUDPServerThreadStarted` is running in main thread, is that your intention?
Comment: My intention was to use this slot (`onUDPServerThreadStarted`) as an initialization when I start `udpThread`, but I want it to be in `udpThread`. From _main_ _thread_ I am just calling `start()` method, when I want to start `udpThread` execution. I do not understand your comment fully, I am sorry. Did you mean `onUDPServerThreadStarted` is in _main_ _thread_? Can you elaborate?
Answer: Following @G.M suggestion to use QThread::currentThreadId I found error to be caused by Qt::DirectConnection in main.cpp. Qt::DirectConnection is causing SLOT(onNewUDPDataReceived(QByteArray)) to be runned in p's thread.
Look at this link for more explanation.
Simply removing Qt::DirectConnection solves the problem.


$\arctan(x)\frac{x^2}{2}$ vs $(\arctan(x))\frac{x^2}{2}$

Question: While I was doing a math on paper today, I wrote
$$\arctan x\ \frac{x^2}{2}$$
As the expression is ambiguous, I tried to make it less so by writing
$$\arctan(x)\frac{x^2}{2}\tag{1}$$
Is $(1)$ clear enough or should I write the following:
$$(\arctan(x))\frac{x^2}{2}\tag{2}$$
$(2)$ seems redundant in my opinion.
Comment: I like Misha's approach if you are set on avoiding parentheses entirely.  If you want to be clear but sparing of parentheses and keeping your expression in the same "order", then $(\arctan x)\frac{x^2}{2}$.
Answer: Why not write $\frac{x^2}{2} \arctan x$? Something like $\arctan(x)\frac{x^2}{2}$ seems clear to me, but still slightly unusual, and usually people put trig-style functions at the end of every term, just to avoid this sort of problem.
Answer: Expression $(1)$ is clear enough in my opinion, in the sense that you can read it as "everything I use as an input is between the parentheses."
Expression $(2)$, while cumbersome, is completely unambiguous. There is a degree of redundancy there, but making things unambiguous tends to make the notation more cumbersome -- it's a tradeoff.
However, I second Misha's suggestion of writing
$$\frac{x^2}{2} \arctan(x)$$
Usually whenever I have a function like that in a term -- be it $f(x)$, $\sin(x)$, $\exp(x)$, $\zeta(x)$, who knows -- it feels more natural to put everything that is not like that to the left of the function. That way there is no still ambiguity as to what is and isn't an argument of the function.


Why does the favicon sometimes not show up and generate "page not found" errors, and other times does show up

Question: As the question implies, on occasion Drupal's log is showing that the favicon is not found. Indeed, it does not show in the browser tab or address bar. At other times, even within the same surfing session, it does show up.
Why does it do this and how can I prevent it so that the favicon will always show?
I am using version Drupal 7.22. with a custom subtheme and an admin theme (Stark).
My favicon is set in the subtheme theme configuration at sites/default/files/images/favicon.ico and that is located there as I have checked via FTP.
The log shows the browser is looking in example.com/favicon.ico.
The custom subtheme I use has <link rel="shortcut icon" href="http://example.com/sites/default/files/images/favicon.ico"; type="image/vnd.microsoft.icon" /> in the source code and the admin theme (Stark) uses <link type="image/vnd.microsoft.icon" href="http://example.com/misc/favicon.ico"; rel="shortcut icon"> and this file also exists in that location (not actually using example.com, of course).
Drupal is using clean URLs.
The web server is Apache on Debian Linux.
Thank you.
Comment: Can you edit in the log message to show the path, what webserver you are using, as well as whether mod_rewrite works (ie, clean URLs)?
Comment: Might help if you would provide referer for these errors, should be in log.
Comment: @Molot The referrer field is either blank or another page in the site in all cases I have checked in the log.
Answer: Some browsers search for favicon under http://example.com/favicon.ico without checking. But they are minority now.
Most respect:
<link rel="icon" href="http://example.com/img/icon.png">

as described by W3C.
If your site tries to use <link> approach but fails on some pages, like admin pages rendered using different template, and you do not have favicon.ico in default location, you will get exactly described effects.
If browser is looking for  http://example.com/favicon.ico when you have proper <link rel="shortcut icon"> it is a browser problem, not yours. It means browser (or at least that part of it's code) is outdated, unless it looked under correct URI first and got another error, but then you would see two errors in log, one for right place, second for outdated one. In Mozilla's queue there is a number of reports about improper favicon detection by FireFox - in example this one. It shows how even modern browsers can sometimes fall back to old methods.
Comment: @authentictech Firefox has numerous open bug reports about improper favicon handling. Like [this one](https://bugzilla.mozilla.org/show_bug.cgi?id=855910) for example. Parts of it's code are old, sad but true. If you want to handle that, you can add rewrite to your .htaccess, but it *will* be hacking around a browser bug, not fixing site bug.
Comment: @MPD It might not be served by Apache; Pantheon's nginx config omits that rule for example (if I remember rightly)
Comment: Yes the log shows the browser is looking in http://example.com/favicon.ico. The custom subtheme I use for the site does give  in the source code (not actually example.com) which is the correct location. If I turn off the overlay, the admin theme is using  and this file also exists in that location.
Comment: Everything seems correct as it should be. So is this a browser problem or website problem? Where would I go to fix it? Thanks.
Comment: @authentictech if browser is looking for  example.com/favicon.ico when you have proper `` it is a browser problem, not yours. It means browser is outdated, unless it looked under correct place first and got another error, but then you would see it in logs just before this one. I'll update my question.
Comment: Actually, the last paragraph here isn't totally accurate.  The default .htaccess with Drupal 7 has a rule to prevent Drupal from handling the /favicon.ico path (it's line 112 in 7.22).  Something odd is happening here.
Comment: @Mołot If we are talking about the same line, `RewriteCond %{REQUEST_URI} !=/favicon.ico` prevents Drupal from handling that path, so the user gets a "fast" 404.  I don't get a Drupal 404 on any site I have tested this on.
Comment: @MPD oh, my mistake, my Drupal has it "hacked". Either way, browser should not look there at all if it's defined properly as a ``.
Comment: @Mołot I always use the latest Firefox browser (currently 22) and I know that the "favicon not found" log shows when it is me connecting to the site. Perhaps that part of your answer is wrong?
Comment: @Mołot, yes that seems to be the explanation then. Do you want to add a little bit about the Firefox bug to your answer? Then I will mark it as the accepted answer. Thanks.
Answer: Quick and easy fix for this pain, is to use the Redirect module and make a redirect for it.
Once the module is enabled, go to admin/config/search/redirect/add and use favicon.ico under from and to should be the actual location of your theme's favicon.ico.
Comment: Yes it does make it to Drupal. Otherwise how would it be logged in the Drupal log? I have used this approach successfully in production.
Comment: You are right, i just tested this. Edited your original answer so that I can switch my downvote to an upvote.
Comment: This file is automatically handled by .htaccess so the request never makes it to Drupal for the Redirect module to handle it.
Answer: If you're using Apache, the best way I found to fix it is to put:
<Location /favicon.ico>
  ErrorDocument 404 "No favicon"
</Location>

This code should work in your vhost file or should also work in the .htaccess file, see http://httpd.apache.org/docs/2.4/sections.html for more details
Answer: You can try https://www.drupal.org/project/favicon
It to make requests to http://example.com/favicon.ico forward to the actual site's true favicon.


Dismiss 10 players in an over in unique ways without conceding a run

Question: I read a problem in the newspaper around 10 years back. Here is the problem
Team A scored 250 runs for 9 wickets in 50 overs. Team B was 250 for 0 in 49 overs. Eventually Team A won the match by virtue of losing fewer wickets. Hence Team B to lost 10 wickets in 1 over.
The main part of this question was no two players were dismissed in the same way. How is it possible to dismiss 10 players in an over such that all the dismissals are unique.
Partial Solution 9 players dismissed in an over
At the beginning of the over the following sequence of events takes place.

Batsman 1 decides to get dismissed as Retired Out (different from Retired Hurt).
Batsman 2 is Timed Out as he delays coming to the crease.
The runner on the non-strikers end is dismissed via Run Out as he was backing up too much. Also called Mankading.

Effectively at this point we have dismissed three players without a single ball being bowled.
The next six balls allow for the following dismissals.

Bowled
Caught
Leg Before Wicket
Stumped
Hit Wicket
Handled the Ball

I am unable to find a way of dismissing the tenth batsman as we are now out of balls.
The only other option that I believe is Obstructing the field, though I am not sure if it is possible to be given out for obstructing the field before a ball is bowled.
Comment: Has this situation ever happened in real time cricket? :D
Answer: Some possibilities are there:

If you are looking at not losing a match and making every batsmen out in unique ways without any extras, it is not possible:

If the batting team requires more than 1 run:

First three batsmen out, as you described, without facing a ball. The next batsman is Stumped out in wide ball so the wicket is fallen and still remain 6 balls to bowl and at least 1 run to win. Then next six batsmen is out as below:

Bowled
Caught
Leg Before Wicket
Hit the ball twice
Hit Wicket
Handled the Ball

If you are looking at not losing a match when only 1 run is required to win and making every batsmen out in unique ways with extras are allowed:

First three batsmen out, as you described, without facing a ball. While the next ball is going to be faced by the next batsman, the batsman attempting to steal a run during the bowlers run up. The umpire intervene and awards 5 runs penalty to fielding side for this unfair act. (here the ball is considered a dead ball - Law 42.16). Still the first delivery is to be bowled. The next batsman is Stumped out in wide ball so the wicket is fallen and still remain 6 balls to bowl and at least 1 run to win. Then next six batsmen is out as below:

Bowled
Caught
Leg Before Wicket
Hit the ball twice
Hit Wicket
Handled the Ball
Answer: Law 22.5(a) can provide the missing piece in your puzzle.

Umpire miscounting

(a) If the umpire miscounts the number of valid balls, the over as counted by the umpire shall stand.

The last over becomes a 7-ball over due to the umpire miscounting.1 The 10th dismissal could be either (a) Hitting the Ball Twice or (b) Obstructing the Field.
The answer to your other sub-question on Obstructing the Field is that it is not possible before the ball is bowled, as covered in Law 37.1:

...
   In particular, but not solely, it shall be regarded as obstruction
  and either batsman will be out Obstructing the field if while the ball
  is in play and after the striker has completed the act of playing the
  ball,

  ...

1 To make this more realistic, spread out the Retired Out, Timed Out, and Mankad Run Out between the other dismissals off legitimate deliveries instead of lumping them together before the start of the over, and add some drama.
For example, one batsman picks up a fight with the fielders, which leads to aggressive arguing and swearing for a prolonged duration. The batsman then storms off and is declared Retired Out.
A couple of balls later, someone is dismissed in a controversial manner, and the tension flares up again leading to more ugly scenes on the field. This spills over to the dressing room where members of the batting side (and maybe the reserve players and support staff of both teams) keep arguing loudly. Amidst the commotion, the next batsman forgets to step out and is declared Timed Out.
One or two balls later, with both sides brimming with rage, a Mankad Run Out happens! You can imagine what happens next. :-)
In this scenario, it is easy to imagine the Umpire miscounting the over.
Comment: Law 37 does not require an _Obstructing the field_ dismissal to take place while the ball in in play - note the words "but not solely". (Even if it were required for the ball to be in play, under [Law 23.5](https://www.lords.org/mcc/laws-of-cricket/laws/law-23-dead-ball/) the ball is in play as soon as the bowler starts his run up.) The first line of the Law is the most important one here: "Either batsman is out Obstructing the field if he wilfully attempts to obstruct or distract the fielding side by word or action." The second line merely highlights a possible application of the Law.
Answer: If the non-striker unsuccessfully attempts to stop the fielder taking the catch then he could be given out for obstructing the field on the same ball that the batsman is caught out.
Comment: You cannot have both batsman out on the same ball and if a catch is prevented by the words or actions of the non striker the striker is out. see law 37.3 (https://www.lords.org/mcc/laws-of-cricket/laws/law-37-obstructing-the-field/)
Answer: I have a complete solution, but the key part is that the title of this question has a wrong assumption.
Core Puzzle:

Team A scored 250 runs for 9 wickets in 50 overs. Team B was 250 for 0
  in 49 overs. Eventually Team A won the match by virtue of losing fewer
  wickets. Hence Team B lost 10 wickets in 1 over. The main part of
  this question was no two players were dismissed in the same way. How
  is it possible to dismiss 10 players in an over such that all the
  dismissals are unique.

Title:

Dismiss 10 players in an over in unique ways without conceding a run

The title is not part of the original problem ; It is a wrong assumption that no runs have to be conceded.
Along the lines of your partial solution:
Wicket 1 is "Retired Out"
Wicket 2 is "Timed Out"
Wicket 3 is "Run Out (Mankading)"
Now the batsmen can do 3 things which give 5 penalty runs to fielding side :
Waste time (ball not even bowled), Damage the Pitch (ball not even bowled), Steal a run (may be one ball bowled)
Let us select the possibility of Wasting time.
After this happens, the fielding side score will be 255, the batting side will require 6 runs to win, with 6 balls remaining, with 7 wickets remaining.
Bowler gives a 4 wide balls, which wicketkeeper blocks : 2 runs to win, 6 balls remaining, 7 wickets remaining.
Now bowler gives another wide ball and wicketkeeper fumbles, so batsmen try to take a run. When wicketkeeper tries to throw the ball to the bowler, the batsman obstructs his way, hence Wicket 4 is "Out obstructing the field".
Status : 1 run to win, 6 balls remaining, 6 wickets remaining.
Wicket 5 is "Bowled"
Wicket 6 is "Caught"
Wicket 7 is "Leg Before Wicket"
Wicket 8 is "Hit the ball twice"
Wicket 9 is "Hit Wicket"
Wicket 10 is "Handled the Ball"
Status : Team A 255 for 9 wickets, Team B 255 all out, Team A won the match by virtue of losing fewer wickets.
[[ Penalty Runs for fielding side : http://www.rulesofcricket.co.uk/the_rules_of_cricket/the_rules_of_cricket_law_42.htm ]]
[[ 10 Ways to get out : https://www.quora.com/How-can-you-get-out-in-cricket ]]
Answer: Based on the links provided on the following websites with regards to Obstructing the field, it is possible to be given out based on words, so technically you can be given out before the ball is bowled for Obstructing the field.
Here are some links
http://www.sportingpulse.com/get_file.cgi?id=955417
http://www.cricketforworld.com/2010/01/ways-of-batsman-dismissal-in-cricket.html
http://en.wikipedia.org/wiki/Obstructing_the_field
If it is possible to given out before the delivery is bowled, based on the words said by the guilty party, then we can indeed have 10 unique dismissals in an over without any extra balls being bowled.
Comment: There is no provision in the Laws for a batsman to be dismissed Obstructing the Field before the striker has played the ball. If a non-striker interferes with the bowler before the ball is bowled, I think it will be handled by Law 42.10 (Batsman wasting time).
Comment: If I am not wrong the obstruction (either by a word or an action) only apply while *the ball is in play*. In other words he can not be given out when the ball is dead.
Comment: Assume this scenario, the bowler is coming in to ball and the runner is standing outside the crease. Now the bowler warns the runner. When the bowler runs in again the runner is still outside, so the bowler decides to run him out (Mankading) but as he is in the process of doing it the runner throws his bat at the bowler to prevent him from doing it. Would it then be out as Obstructing the field, even though a ball has not been bowled.
Comment: Your scenario may be possible but still I am not sure if it is true as [Law 37](http://www.lords.org/mcc/laws-of-cricket/laws/law-37-obstructing-the-field/) says *while the ball is in play and after the striker has completed the act of playing the ball*.
Comment: But here the runner prevented the baller from dismissing him.
Comment: The law applies for either batsman. (both)
Comment: Yes I understand that, but in this case it would be more appropriate to apply it to the runner because we want him to be dismissed as he avoids his own run out by Mankading.
Comment: Law 37.1 (https://www.lords.org/mcc/laws-of-cricket/laws/law-37-obstructing-the-field/) explicitly mentions the ball must be in play


n-th Term of this sequence?

Question: I've been trying to find the n-th term for this sequence for a little while now, and I just keep coming up short.
$$S=1,0,1,0,0,1,0,0,0,1,0,0,0,0,1,...$$
All I can see is that every triangular ordinal is $1$, if not, then it must be $0$
I feel like this shouldn't be too too hard, but maybe I'm wrong? Any thoughts?
Comment: You seem to be correct. This is the indicator function for the triangular numbers as a subset of the natural numbers. Hence the function will be $f(n) = 1$ if $\exists k \in \mathbb N, n = \frac{k(k+1)}{2}$, and $0$ otherwise.
Answer: Yes, you are right. We can write our function as: $$f (n) = \begin {cases} 1 \, \, \text { if } n = \frac {k (k+1)}{2} \,\,; k \in \mathbb N\\ 0 \,\, \text { otherwise }\end {cases} $$
Hope it helps.
Comment: Yeah, I see that.
I guess I was trying to find another way to write it as opposed to defining a new function.

For the sequence $$S= 1,0,1,0,1,0...$$
I had written $$\lceil {\frac{(-1)^{n+1}}{2}} \rceil$$
Comment: Even though that may be overkill.

Is there anyway to write the previous in terms of known functions?
Comment: @RyanGoulden There are lots of ways. I'd probably go with the Indicator function.
Comment: Okay, I think I understand.
But what happens if I made all of those zeros 1, and then all of the $1$'s be the next natural.
$$S=1,1,2,1,1,3,1,1,1,4,1,1,1,1,5...$$
You would have that it is always zero when it's not in the form of a triangular number, but how do you denote the changes?
Comment: @RyanGoulden In that case, we have $$f (n) = \begin {cases} k\,\, \text {if}\,\,n= \frac {k (k+1)}{2}\,\,;k \in \mathbb N\\ 1\,\, \text {otherwise}\end {cases} $$

n-th Term of this sequence?


Abrir imagens na mesma página com Fancybox no CakePHP impossiblitada

Question: Estou a tentar fazer uma galeria, que consiste numa listagem de miniaturas, que ao clicar nos items eventualmente faria aparecer uma janela popup como no primeiro exemplo aqui.
Após várias tentativas falhadas, onde até as miniaturas não apareciam, por sugestão de outras pessoas, procurei resolver este problema com o plugin CakePHP-Fancybox, que me resolveu parcialmente o problema. No entanto ao clicar nas miniaturas o utilizador é redireccionado para outra página que mostra a imagem original, em vez de a fazer flutuar sobre a página das miniaturas.
Após resolver os vários erros relacionados com o não encontrar o javascript e ter reinstalado o Fancybox Plugin para o CakePHP, a lightbox não aparece. Como se pode resolver estas situações?
Action do Controller:
     public function ShowImages(){
        $this->layout = 'default';
        $this->loadModel('GalleryImage');
        $gallery_images = $this->GalleryImage->find('all');
        $this->set('gallery_images', $gallery_images);
    //$image_display = $gallery_image['path']
    }

View:

Galeria

    <?php
        $i=0;
        foreach( $gallery_images as $gallery_image ):?>

    <?php
        $src3 =$this->webroot. 'img/gallery/' .$gallery_image['GalleryImage']['path'];
        //$src3 = 'img/gallery/' .$gallery_image['GalleryImage']['path'];
        $this->Fancybox->setProperties( array(
            'class' => 'fancybox3',
            'className' => 'fancybox.image',
            'title'=>'Single Image',
            'rel' => 'gallery1'
            )
        );
        $this->Fancybox->setPreviewContent($this->Timthumb->image('/img/gallery/' . $gallery_image['GalleryImage']['path'] , array('width' => 267, 'height' => 189)));

        $this->Fancybox->setMainContent($src3);
        echo $this->Fancybox->output();
    ?>

    <?php $i++;
        if($i==4){
            echo "

";
            $i=0;
        }
    ?>
<?php endforeach ?>

Layout (head):

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title><?php echo $title_for_layout;//titulo dinamico da página?></title>
    <?php
    echo $this->Html->meta('icon');
    //echo $this->Html->css('cake.generic');
    echo $this->fetch('meta');
    echo $this->fetch('css');
    echo $this->Html->script('jquery-1.11.0.min');

    echo $this->Html->script('main');
    echo $this->Html->css('main');

    echo $this->Html->script('modernizr-2.6.2-respond-1.1.0.min');

    echo $this->Html->css('bootstrap-theme.min');
    echo $this->Html->css('bootstrap.min');
    echo $this->Html->css('bootstrap');

    echo $this->Html->script('bootstrap.min');
    echo $this->Html->script('bootstrap');
    echo $this->Html->script('dropdown');
    echo $this->Html->script('collapse');
    ?>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">

Comment: Enquanto esta editando a indentação, pude constatar os seguintes problemas: `<?php $i++;` não esta fechado, na classe `GalleryController`  tem uma `}` a mais, não retirei para não alterar o codigo postado, mas vale apena voce revisar =).
Comment: Peço desculpa, foram erros ao copiar o código, já os corrigi.
Comment: posta o output do seu html
Comment: Ok obrigado, é a primeira vez que utilizo algo como o Stack, peço desculpa.
Comment: @IgorMartins já o postei.
Answer: De acordo com as suas informações, parece que nem o js, nem o css estão sendo carregados corretamente.
No seu layout substitua:
<link rel="stylesheet" href="/fancybox/source/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />


Searching for a specifc item in array

Question: I have an array of objects and I need to find the last element that matches a specific condition. I tried to do it with each_reverse, but it ended up with too much of a code:
matching_item = nil

items.reverse_each do |item|
  if (item.type_id == 10)
    matching_item = item
    break
  end
end

Is it possible to make it shorter?
Answer: Try:
matching_item = items.reverse.find{ |i| i.type_id == 10 }

Answer: I would probably use Array#select and return the last match:
matching_item = items.select {|i| i.type_id == 10}.last

Leave off the .last if you decide you want all matches:
matching_items = items.select {|i| i.type_id == 10}

Comment: There are nice, though they search all the array and don't stop when the find the fitst matching element. Any way to to this?
Answer: items.reverse_each.detect{|item| iterm.type_id == 10}
#or
items[items.rindex{|item| item.type_id == 10}]

Searching for a specifc item in array


Does Mean and Variance Stationary need to be applied to all kinds of forecast models in time series data?

Question: I am in need of Clarification about the Mean & Variance Stationary for time series data..
I was reading this discussion about the importance of Stationary https://stats.stackexchange.com/questions/253917/why-use-differencing-and-box-cox-in-time-series.. that @Michael R. Chernick clarify atmost that ARIMA model may need to model a Clean time series from Nonstationary in every aspects (which is Differencing and Box-Cox Transformations),
and later I want to apply forecasting with Prophet and ETS (Exponential Smoothing Space Model).. which this article helps give insight to do it https://mode.com/example-gallery/forecasting_prophet_r_cookbook/
I noticed that the article did apply only Box-Cox Transformation on data, and then do a inverse Box-Cox Transformation after the forecast applied.
So my question:
1) I recall using UKgas data from datasets library, this is the results of Dickey Fuller test after Box Cox Transformation
library(tseries)
library(forecast)
library(prophet)
library(datasets)
data(UKgas)
lambda <- BoxCox.lambda(na.contiguous(UKgas))
print(paste("Lambda = ", lambda))
"Lambda =  -0.445702282821823"

UKgas_transform_1 <- BoxCox(UKgas,lambda)
adf.test(UKgas_transform_1)

Augmented Dickey-Fuller Test

data:  UKgas_transform_1
Dickey-Fuller = -1.0813, Lag order = 4, p-value = 0.9218
alternative hypothesis: stationary

with high of p-values, the test implies that it may have unit root in the data after Box-Cox Transformations. So can this data be applied to other kind of forecast instead ARIMA?
2) if it cannot be applied, I may need to Difference the data again right? after the prediction done, so how to revert back the forecast data to actual data if I use both Differences and Box Cox Transformations?
Thank You in advance, Correct me also if my understanding are incorrect :)
Answer: You need to take difference of the transformed data, 'UKgas_transform_1' and then forecast.
After forecasting, you would get the stationary data. Since you took the difference of the transformed data, you have to do a cumulative sum of the forecast data
forecast_csum<- cumsum(forecast_data)

On the cumulative sum of the forecast data, you need to perform an Inverse Box-Cox Transform. The procedure for inverse Box-Cox transform is available in the same article that you have referred.
Comment: what if I have a 2x difference on the dataset? should it be cumsum(cumsum(forecast_data))?


I want to use mail@mydomain, but user mail already exists (Debian 6)

Question: I'm trying to create a user "mail" in my fresh VPS (Debian 6), so I can use the email address mail@mydomain, but I receive the error
useradd: user 'mail' already exists

Indeed, /etc/passwd contains the line
mail:x:8:8:mail:/var/mail:/bin/sh

Can I set the password, login and use it for my personal email?
Comment: Why would you set your *personal* email name to "mail"? Why wouldn't you use your own username?
Comment: Because mydomain is already my name.
Comment: The user "mail" exists. Make your username email@example.com for email, not "mail."
Answer: Because "mail" refers to a server application on the system and is already in the system as a component in your mail system, I'd highly advise against using it. Even if you were to alias the incoming mail, it would add unnecessary complication to your setup.
Use your actual username, or pick another name like "email" or "contact" and use that instead. Otherwise you're asking for trouble down the road.
Comment: Thanks. As I'm clearly a beginner, could anybody point me to documentation that explains why those components need to be users in a UNIX system?
Comment: Because your mail system needs access to the mail spool, most likely (depending on setup) and the mail spool will be owned by that user. The program is running as itself for security purposes because if it is compromised and running with root privileges it would allow an attacker root access. Instead it's limited to just the email system.
Comment: Nonsense. Mail is a user - and by default most MTAs will map mailbox names directly to usernames - but it doesn't have to. In this instance 'mail' *only* refers to user as which some of the mail components *may* run as. It's not a "server application"
Comment: @symcbean - Not nonsense. I have a binary called mail no my system, and on some I've used it's a component to the mail system, while other parts of the mail system also use that username. I wasn't going to turn this into a whole HOWTO just to answer his question, I was trying to give a brief overview of why it would be done without delving into every MTA and distro permutation on the planet. Why would they need to be users? Because your mail server and mail subsystem needs to work as a user with permissions to its own logs, spool, etc. without compromising security.
Comment: If he'd like to post what his specific distro and MTA are, then someone else can get into a specific diagram of how exactly his precise system works with that configuration, as there are many cases where someone else's configuration won't match mine.
Answer: If you want to receive email addressed to mail@yourdomain then you just need to tell your email system to deliver it to your mailbox and not to that of the user 'mail'
Most MTAs will allow you to change the map a mailbox name to a different username without much effort - indeed, its possible on every MTA but difficult to do on some. Also, nearly every MTA (and MDA) provides a mechanism for forwarding email to a different mailbox.
However you've provided no details of what MTA nor MDA is deployed.

Can I set the password, login and use it for my personal email?

This is not the way to solve the problem. Server processes uses run under discreate uids for a very good reason - privilege seperation - and a an account used for running a server process should never be used for other purposes.
Answer: In case anybody is interested in this topic, I have found (in Debian) a way to make things work, in my eyes, quite elegantly. Since accounts are internally referenced by UIDs, the names are in a sense mere aliases. Just as root always has UID 0, mail generally has UID 8 (the actual UID we don't need to know). We can change the name of the user account with UID 8 thus:
usermod -l smail mail

All in all, something like this works:
usermod -l smail mail
groupmod -n smail mail
groupadd mail
useradd -m -s /bin/bash -g mail -c 'Your Name' mail

(Again in Debian, /etc/default/useradd ought to have the line # CREATE_MAIL_SPOOL=yes uncommented.)
If I find some crazy unexpected behavior as a result I will update this old post. Cheers!
Side note: In general it is not necessary to do groupadd user manually in order to useradd user: you simply omit the -g option. However, this gives an error. Indeed, there is something special about the name/alias mail, so... be careful if you feel like trying this!


Execute Drupal function in background, maybe with cron, for the duration of a user session

Question: It was too complicated description of the task, so let me edit it and simplify: I need a Drupal 7 function (data collection function) to be periodically triggered in the background but only a while a logged in.
Use case is that we need bunch of data from the remote server to display to the user and it takes long time for all the data to be (1) copied from the remote server, (2) upload to local Drupal database and (3) finally to display to the user. So we don't want the user to wait, but to do some other staff and display the data little bit later when it is ready.
So scenario is like this:

User logs in to Drupal 7 website and start browsing pages without any delay.
At the moment when he/she log's in we need to trigger a Drupal function in a custom module that starts to perform steps (1) and (2) in the background. So user again doesn't feel any delays.
When the data is pulled and uploaded to the local Drupal 7 database, the system starts displaying it to the user.

Is it so difficult or impossible for Drupal to trigger a function in the background independently of whatever user is doing on the website only for the period of time while he/she is in the session?
Comment: maybe you need a batch job? https://www.drupal.org/node/180528
Comment: batch job won't do in our case, but https://www.drupal.org/project/background_process where I found a link on drupal.org/node/180528 could do. researching this...
Comment: Unfortunately, background_process also triggers the function at the same time as node loads thus slowing it down significantly. So my question is still not answered.
Comment: I think you should provide more information and clarification. How is the background task handled? is it NodeJS? or some remote server? to check if user is still browsing you have to send heartbeats using javascript. In response to each heartbeat the server should answer if data is ready. But what should happen when it is ready? the user should be redirected? a popup should tell user about it? if it's a heavily loaded website I wouldn't suggest handling the heartbeats using Drupal itself. there was some module specific to Ajax request... can't remember the name.
Comment: I assumed you are not handling the heavy function in Drupal because of PHP's max execution time limit. if it is Drupal I can't think of a performance friendly way of stopping it. But if it's an external service and you set your cron to 5 minutes (and install elysia-cron too!) if the user has not sent a heartbeat for 5 minutes (checked during cron) you send an stop signal to external service.
Answer: Preface
While doing web development, if user is browsing can only be measured with two methods: 1. User last access time is less than A_PRE_DEFINED_AMOUNT (say 5 minutes) or (more accurately in some cases, as the user might be just reading the same page without refreshing) user's last heartbeat time is less than A_PRE_DEFINED_AMOUNT or or the most accurate, combination of both (js might be disabled on some browsers).
And while doing Drupal development, running a task periodically, means a cron task. but sometimes these tasks are better handled outside of Drupal.
The problem originates from the fact that Drupal does not have an always running server. Usually NodeJS is used in combination for such tasks, and it performs better (usually when resources on the server is limited). When the NodeJS has the data ready, it uploads it to drupal by calling a URL which you have previously defined in a custom module, say http://example.com/my/module/upload/data. It will use HTTP POST to authenticate and send data.
But anyway, here is the pure Drupal solution:
The custom module part:

Create a custom module.
Define a new entity type in your module (recommended) using a project like entityspice, model or plain entity api.
OR just use hook_schema() and define a table for your module in database (though entity is recommended).
Define a custom rule action in your module, when called it should write the current user id (uid) in the table you just defined. If you have created a new entity type you can use the already existing rule create a new entity.
Or just use nodes or a field in user profile but be careful about access checks. It's your call.
Create another rule action, triggered on cron (using rules_scheduler), in this action: fetch user's last access time, if it's more than 5 minutes, fetch the entity we talked about just above and remove it (more explanation on this later).
OR instead of rule action, define a cron task in your module. it should: check user's last access time, if it is more than 5 minutes, remove his/her uid from your custom table.
Or instead of checking user last access time, create a custom JS loaded on every page for logged in users which sends a heartbeat. It is simply done by defining a custom path in your module such as example.com/my/heartbeat/path and fetching that URL using HTTP GET (using ajax) on the server in your custom path's handler function, you should check current user's UID who is sending the heartbeat and update the last access time of the user. (or perhaps create your own entity/table/field for storing last heartbeat time).

Congrats! first part done. now you know if you should process data or stop processing data for user. You know you should while their UID is in your custom table.
The processing of data:
Still this part of question is unclear: who will fetch data? is there a large amount of data, or does it take long for data to become ready? if the former, you might face PHP execution time outs, if the later, you might be fine. Any way, to do it in Drupal, you should create a custom cron task which is again, possible in rules. in this cron task, check every uid which is in the custom entity/table we talked about above and fetch data for, and upload it to local database.
Your cron task should check two conditions: 1. is user uid still in table? 2. is data ready? if 1 is false, cancel fetching data. If 2 is false, just pass for now.
If there is a large amount of data being fetched and user has left the site, you probably won't be able to cancel it as there is no true multi-threading in PHP. how ever there is a register_tick_function which might do the job: if the uid of current task is removed, call die(). I don't know if die() in registered tick function works, however if data is being fetched for other users too, they will be canceled!!
final note:
DO Install Elysia Cron (optional but highly recommended). If you are planning to run cron on short periods it will take the load off of your server drastically.
Comment: Thank you. This answer is the most detailed and most relevant one, so I have to mark it as accepted even though it's not implemented yet. @loolooyyyy, are you available for hire? Your website http://koosha.cc, btw, doesn't work.
Comment: @Sasha It's an honor to work with you but unfortunately I do not have free time. and yes there is no webserver running on koosha.cc :)
Answer: Cron won't help you, it executes the jobs in system(machine) level, at specified time, it doesn't care about someone is viewing the website, how many minutes he/she sits.. You should look for client side solutions, which interact with browser (JavaScript, or it's framework JQuery...), may be setTimeout or setInterval can help you..
Some thoughts:
function MYMODULE_menu()
{
  $items['PATH'] = [
    'title' => 'TITLE',
    'page callback' => 'myCallback',
    'page arguments' => [],
    'access callback' => TRUE, // Bad idea,
    'type' => MENU_CALLBACK
  ];

  return $items;
}

function myCallback()
{
  // buildTheLogic();
}

javascript:
function someName()
{
  // buildTheLogicHere();
  // may be you call ajax request to that PATH, display the result...
}

setTimeout(someName, 60000);

you can also use self-executing anonymous functions with setTimeout if you want to repeat the process.
Comment: Tried this approach, unfortunately it won't run in the background.
Comment: @Sasha are you sure it's not working? may be error is in your code?
Comment: @Sasha your task is simple, either my code (snippet)... You should post what you did that we may find what's going wrong..


Right and left hand limits.

Question: $$ \lim_{x\to2^+} \frac{x-3}{(x-2)(x+2)}=-\infty$$
But when the same limit is evaluated with $x\to2^-$ answer comes out to be (as per book) $+\infty$.
Please list the steps and tell how.
Answer: $x \rightarrow 2^+ \text{ means } x>2 \text{ or } x-2>0. \text{ so what about the other factors } \\ \text{ So we have that } x>2 \text{ subtracting 3 on both sides gives } x-3>-1 \\ \text{ this means the factor } (x-3) \text{ is near } -1 \text{ for values of } x \text{ near } 2 \text{ from the right}. \\ \text{ The factor } (x-3) \text{ is therefore negative for values of } x \text{ near } 2 \text{ from the right } . \\ \text{ Now let's look at the factor } (x+2). \\ \text{ So remember } x>2 \text{ adding 2 on both sides gives } x+2>4 \text{ which means the factor } (x+2) \\ \text{ is positive since 4 is positive for values to the near right of 2 }. \\ \text{ So we have this } \\ \frac{(\text{negative})}{(\text{positive})(\text{positive})} \infty =- \infty . \\ \text{ So doing the other way } x \rightarrow 2^- \text{ we have } x<2. \text{ you give it a try}$
Answer: Maybe a graph will help you visualize the limits better.

Can you see now what happens when you approach $2$ from the left and what happens when you approach $2$ from the right?

Right and left hand limits.


How do I create dynamically named folders with Maven Archetype?

Question: I'm trying to build an archetype structure like this, a webapp with some custom folders for our web framework. Especially some dynamic folders which also will contain some files brought by the archetype.
└───src
    └───main
        └───webapp
            └───WEB-INF
                ├───cfg
                │   ├───log4j
                │   └───resources
                │       └───extensions
                │           ├───${shortName}-business
                │           └───${shortName}-layout
                └───lib

I added a required property to my archetype-metadata.xml to have an short name for the project, which is used among other things for generating unique folders.
<requiredProperties>
  <requiredProperty key="shortName" />
</requiredProperties>

The property shortName I use in a fileSet:
<fileSet>
  <directory>[..]/resources/extensions/${shortName}-business</directory>
</fileSet>

<fileSet>
  <directory>[..]/resources/extensions/${shortName}-layout</directory>
</fileSet>

The command to generate the archetype:
mvn archetype:generate -B \
       -DgroupId=com.stackoverflow \
       -DartifactId=stackoverflow-question -DarchetypeGroupId=com.stackoverflow \
       -DarchetypeArtifactId=stackoverflow-archetype -DarchetypeVersion=1.0 \
       -DshortName=soq

I assume to get the following folder structure:
..\
   ├───soq-business
   └───soq-layout

But I get this name ${shortName}-business as folder, without  it being replaced with the property.
..\
   ├───${shortName}-business
   └───${shortName}-layout

How can I achieve this? How can I place files below soq-business without knowing the folder name at this time?
Answer: I figured the exact same problem today...
I found some blog entry by Adam Leggett which describes using placeholders in paths: have a look at https://mikeciblogs.wordpress.com/2010/01/14/working-with-custom-maven-archetypes-part-1/ (Step 4).
The trick seems to be to use doubled underscores instead of the curly braces syntax, so ${shortName} becomes __shortName__.
However, I haven't tried the solution yet. If you do so, please let us know if it works. Thanks!
HTH!
Comment: The Blog is not available. Maybe the link is broken, could someone update it please!
Answer: As Vivian has kindly pointed out, my blog entry provides some hints on how to do this.
However, one thing to watch out for (which isn't explicitly mentioned in the blog) is that this feature only works with the archetype plugin 2.x


Centralizar um elemento com css

Question: Estou tentando fazer um pop-up com uma tela de login, porém a div de class="form-login-div" não está sendo centralizada automaticamente de jeito nenhum.
Alguma ideia?
CSS:
.form-login-div-parent{
  width: 100vw;
  position: relative;
  bottom:0;
}
.form-login-div {
  width: 35rem;
  height:auto;
  position:absolute;
  z-index:1;
  border-radius:0.5rem;
  padding:1rem;
  background-color:#0374D6;
}

.home-container{
    width:30rem;
    z-index: 1;
    position: relative;
    border-radius: 5px;
}

HTML:

        <form action="" method="post">

            Endereço de e-mail
            <input type="email" class="form-control" name="email" placeholder="Insira o seu e-mail">

            Senha
            <input type="password" class="form-control" name="senha" placeholder="Insira a sua senha">

              {% if view_bag["erro"] == true %}

{{ view_bag["mensagem"] }}

            {% endif %}

              <button type="submit">Entrar</button>

        </form>

    <picture>
      <source class="imagem-fundo" media="(max-width: 1140px )" srcset="/static/img/imagemestudante-smartphones-blur.png"
        type="image/png">

    </picture>

Comment: relacionadas https://pt.stackoverflow.com/questions/58614/centralizar-horizontalmente e https://pt.stackoverflow.com/questions/33495/como-centralizar-uma-div-com-positionfixed
dá uma pesquisa no site tem muitas perguntas sobre isso
Comment: eu pesquisei nos "perguntas parecidas" mas não encontrei
Answer: Não entendi muito bem, aonde que tu tá mandando centralizar essa div?
Ali no .form-login-div, adiciona essas 2 linhas:
margin-left: 50%;
transform: translateX(-50%);

Não sei se é só isso que tu precisa.
Comment: Nesse código em especifico eu já apaguei todas as tentativas, mas vou tentar seu jeito!
Comment: nunca experimentei nem ouvi falar desse transform, obrigado! Funcionou!
Answer: Olá! Você pode usar display: flex e justify-content: center no .form-login-div-parent para centralizar na horizontal.
Se quiser na vertical também acrescente o align-items: center, e force a altura do parent para 100vh com um height: 100vh.
Fiz um exemplo rápido: https://codepen.io/paulofdaniel/pen/abJjpqq
Abraço!

Centralizar um elemento com css


How to simplify $\sin^4 x+\cos^4 x$ using trigonometrical identities?

Question: $\sin^{4}x+\cos^{4}x$
I should rewrite this expression into a new form to plot the function.
\begin{align}
& = (\sin^2x)(\sin^2x) - (\cos^2x)(\cos^2x) \\
& = (\sin^2x)^2 - (\cos^2x)^2 \\
& = (\sin^2x - \cos^2x)(\sin^2x + \cos^2x) \\
& = (\sin^2x - \cos^2x)(1) \longrightarrow\,
= \sin^2x - \cos^2x
\end{align}
Is that true?
Comment: Seems like you simplified $\sin^4 x - \cos^4 x$, not $\sin^4 x + \cos^4 x$.
Comment: that's true, omg...
Comment: You can see one possible simplification here: [Deriving an expression for $\cos^4 x + \sin^4 x$](https://math.stackexchange.com/q/1153131).
Answer: \begin{align}
\sin^4 x +\cos^4 x&=\sin^4 x +2\sin^2x\cos^2 x+\cos^4 x - 2\sin^2x\cos^2 x\\
&=(\sin^2x+\cos^2 x)^2-2\sin^2x\cos^2 x\\
&=1^2-\frac{1}{2}(2\sin x\cos x)^2\\
&=1-\frac{1}{2}\sin^2 (2x)\\
&=1-\frac{1}{2}\left(\frac{1-\cos 4x}{2}\right)\\
&=\frac{3}{4}+\frac{1}{4}\cos 4x
\end{align}
Answer: Let $$\displaystyle y=\sin^4 x+\cos^4 x = \left(\sin^2 x+\cos^2 x\right)^2-2\sin^2 x\cdot \cos^2 x = 1-\frac{1}{2}\left(2\sin x\cdot \cos x\right)^2$$
Now using $$ \sin 2A = 2\sin A\cos A$$
So, we get $$\displaystyle y=1-\frac{1}{2}\sin^2 2x$$
Answer: Expand in terms of complex exponentials.
$$\sin^4 x + \cos^4 x = \left( \frac{e^{ix} - e^{-ix}}{2i} \right)^4 + \left( \frac{e^{ix} + e^{-ix}}{2} \right)^4$$
Notice that $i^4 = +1$, so we get
$$\sin^4 x + \cos^4 x = \frac{1}{16} \left( 2e^{4ix} + 2 e^{-4ix} + 12 \right)$$
where we use the relation $(a+b)^4 = a^4 + 4 a^3 b + 6 a^2 b^2 + 4 ab^3 + b^4$. The terms of the form $a^3 b$ and $ab^3$ all cancel by addition.
This leaves us with a final result:
$$\sin^4 x + \cos^4 x = \frac{4}{16} \left(\frac{e^{4ix} + e^{-4ix}}{2} \right) + \frac{12}{16} = \frac{3}{4} + \frac{1}{4} \cos 4x$$
Answer: Note that $a^2 + b^2 = (a+b)^2 - 2ab$
$$(\sin^2 x)^2 + (\cos^2 x)^2 = (\sin^2 x + \cos^2 x)^2 - 2\sin^2 x\cos^2 x =(\sin^2 x + \cos^2 x)^2 - 2(\sin x\cos x)^2 = \\ 1 -\frac{ \sin^2 2x}{2}$$
Note the following results:
$$ \sin^2 x + \cos^2 x = 1$$
$$ \sin x \cos x = \frac{\sin 2x}{2}$$
Answer: If you want to express in functions of higher frequencies like this $$\sum_{k=0}^N \sin(kx) + \cos(kx)$$ Then you can use the Fourier transform together with convolution theorem. This will work out for any sum of powers of cos and sin, even $\sin^{666}(x)$.


Blow up of mean curvature of volume preserving mean curvature flow

Question: Picture below is from Huisken's The volume preserving mean curvature flow.
$h_{ij}$ is second fundamental form. $H=g^{ij}h_{ij}$, and $|A|^2=g^{ij}g^{kl}h_{ik}h_{jl}$. How 2.1.Theorem equal to the red line ?
Besides, what is come close together ? It means $h_{ij}-h_{kl}\rightarrow 0$ ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comment: Is that the only Theorem in the Section?
Comment: @Thompson   I think so, I have add the web above .
Answer: If we let $\kappa_i$ denote the eigenvalues of the second fundamental form, then $|A|^2 = \sum_i \kappa_i^2$ and $H = \sum_i \kappa_i$. Some algebraic manipulation should then convince you that $$Q := |A|^2 - \frac 1n H^2 = C_n \left(\sum_{i \ne j} (\kappa_i - \kappa_j)^2\right),$$
so $Q$ is some kind of total measurement of the distance between the eigenvalues. Dividing it by $H^2$ we get a scale-invariant measurement, and the theorem then states that
$$ \frac Q {H^2} \lesssim H^{-\delta};$$
so if $H \to \infty$ then $Q / H^2 \to 0$, i.e. the relative difference between the eigenvalues approaches zero.
As an aside, maybe compare this to Hamilton's original paper on Ricci Flow for Ricci-positive 3-manifolds, where an almost identical estimate is shown for the eigenvalues of $\rm Rc$.


Computing the matrix for a linear transformation

Question:
For a point $(x, y)$ in the plane $\mathbb{R}^{2}$, define $T(x, y)$
  to be the point on the line $\ell = \{(x, y) \in \mathbb{R}^{2} \mid y
= 2x\}$ that is closest to $(x, y)$. Show that the mapping is linear, and find the $2\times 2$ matrix associated with this mapping.

I know how to prove a function is linear, but I'm not sure about how to find this matrix. I tried plugging in "test points" to determine values of the function. For example, $(0, 0)$ should map to $(0, 0)$. Can someone help me please?
Comment: You find the closest point on the line by dropping a perpendicular from the given point to the line $y=2x.$  The perpendicular has slope $-\frac12$ so you can find its equation.
Answer: Hint: You are given a point $(x,y)$ and you want to find the point $(w,2w)$ closest to it.
In other words, you want to pick $w$ such that
$$
\left\Vert (w,2w)-(x,y)\right\Vert ^{2}
=\left(w-x\right)^{2}+\left(2w-y\right)^{2}
$$
is minimized.
To do so, take the derivative of the above with respect to $w$, set it to zero, and solve for $w$. What do you see?
Answer: From your description, I think every point $\left( x, y \right)$ in $\mathbb{R}^2$ is mapped to the point $\left( \dfrac{x + 2y}{5}, \dfrac{2x + 4y}{5} \right)$ on the line $l$. So, $\left( 1, 0 \right)$ is mapped to $\left( \dfrac{1}{5}, \dfrac{2}{5} \right)$ and the point $\left( 0, 1 \right)$ is mapped to $\left( \dfrac{2}{5}, \dfrac{4}{5} \right)$.
Therefore, the required matrix would be $\left[ \begin{matrix} \frac{1}{5} & \frac{2}{5} \\ \frac{2}{5} & \frac{4}{5} \end{matrix} \right]$.
To obtain the formula for $T$
Let $\left( x_1, y_1 \right) \in \mathbb{R}^2$ be given. We wish to find a point $\left( x, 2x \right)$ on the line $l$ such that the distance between $\left( x_1, y_1 \right)$ and $\left( x, 2x \right)$ is minimum. It is same as saying that we have to minimize the function $f \left( x \right) = \left( x - x_1 \right)^2 + \left( 2x - y_1 \right)^2$. To find a stationary point, we use $f' \left( x \right) = 0$. This gives, $x = \dfrac{x_1 + 2y_1}{5}$. Now, $f'' \left( x \right) = 10 > 0$. Hence, $f$ is minimum at $\dfrac{x_1 + 2y_1}{5}$. Thus, the point $\left( x_1, y_1 \right)$ in the plane $\mathbb{R}^2$ is mapped to the point $\left( \dfrac{x_1 + 2y_1}{5}, \dfrac{2x_1 + 4y_1}{5} \right)$. Hence,
$$T \left( x, y \right) = \left( \dfrac{x + 2y}{5}, \dfrac{2x + 4y}{5} \right)$$
Comment: Simply substitute in the formula $T \left( x, y \right) = \left( \dfrac{x + 2y}{5}, \dfrac{2x + 4y}{5} \right)$.
Comment: I have made an edit showing how to obtain a formula for $T$.