Why does high frequency have high energy?

Question: The electromagnetic spectrum's wavelengths all travel at the same speed, $c$. Also, the wavelength $\lambda$ and frequency $\nu$ are related by $c = \lambda \cdot \nu$. Since all moving particles here would have the same speed, why would higher frequencies have more energy?
Comment: Photons carry energy equal to Planck's constant $h$ multiplied by their frequency $f$. In other words: $E=hf$ for all photons, regardless of frequency. This was elucidated by Einstein in his description of the "photoelectric effect," for which he won the Nobel prize in 1921. The experiments that first proved this were based on the ejection of *electrons* from a metal when the metal was bombarded with *photons*, hence the term "photoelectric" effect. There is no reason "why," it just happens to be a fact about the physical world.
Comment: It may help to think of the frequency merely the way the energy information is stored in a particle. Think about this: If you had a single particle in front of you, how would you know about its energy state except by how fast it moves back and forth?
Comment: OP, could you please clarify something: Are you asking about photons and the energy of photons in relation to, say, the photoelectric effect? Or are you asking about something classical?
Comment: @hft i am concerned about photons energy specifically in radio waves range of spectrum. But the information should be general and true for entire emr spectrum
Comment: Note: electromagnetic waves only travel at $c$ in vacuum. Not through media with various refractive indices.
Comment: How is this not a duplicate after [more than 12 years](https://physics.stackexchange.com/questions/1/what-is-spin-as-it-relates-to-subatomic-particles)?
Answer: This was a big surprise when it was discovered. The answer is that when we construct models they agree with experiment if we assume the Planck relation. The phenomena (black body radiation, photoelectric effect, ...) demand it. That's how physics works: the phenomena are in charge.
Answer: The individual photons have more energy, but this does not mean the total energy in the wave has a higher energy. There are many examples of a high frequency, but a lower amplitude.
Answer: Planck's constant is a conversion factor which changes the units of energy from a classical basis (as joules, for example) to a quantum basis which has wavelength (and therefore frequency) in it: E = hc/(lambda).
Note that if we write the laws of physics in natural units then energy has units of 1/(seconds) or "per second", which also gives you the tie-in to frequency i.e., "cycles per second*.
Answer: Massless and massive particles (like photons and electrons respectively) have different dispersion relations, i.e., the relations between the particle momentum and its energy, $\epsilon(p)$. Thus, for electrons we have
$$
\epsilon(\mathbf{p})=\frac{\mathbf{p}^2}{2m}
$$
whereas for photons
$$
\epsilon(\mathbf{p})=c|\mathbf{p}|
$$
The velocity is then defined as the derivative of the dispersion relation in respect to the momentum (in E&M momentum and velocity are usually referred to as phase velocity and group velocity):
$$
\mathbf{v}(p)=\nabla\cdot\epsilon(\mathbf{p})
$$
We thus obtain $\mathbf{v}=\mathbf{p}/m$ for electrons and $\mathbf{v}=c\frac{\mathbf{p}}{|\mathbf{p}|}$ for photons (with magnitude $c$.)
Answer: The relation just means that the wave can be decomposed (very roughly said) into quanta that have certain energy. For higher frequency waves the individual quanta have bigger energy than for the lower frequency waves.  That is an experimental fact - many phenomena can only be explained by this. But the wave itself may contain almost an arbitrary amount of energy (provided it is much more than the energy of the individual quantum). It would just be decomposed into fewer or more quanta.

Since the light is completely relativistic and massless, it is better to not think about the speed of the particle when arguing about the energy. The correct relativistic energy-momentum relation is
$$
E^2 = (pc)^2 + (mc^2)^2,
$$
and since the light quanta are massless, the energy is just $E=pc$. The momentum is universally related to the wavenumber ($k=2 \pi /\lambda$) by $p=\hbar k$. This also holds for massive particles according to the  the de-Broglie hypothesis. This relation is central to the wave-partical duality in quantum mechanics. The energy of a massless particle is then $E = \hbar k c = h \nu$.
All this does not explain why nature works like that, that must be showed by experiment. It just connects the experimental facts using some theory.
Comment: The post is obviously simplified and ignores  whether the state is an eigenstate  of this or that and which operators commute.
Answer: I want to give an intuitive explanation, but I have to start with several points that others have made.
First, any intuitive explanation is just suggestive. Ultimately, experiment is the final arbiter.
Second, this is really about energy per photon, not energy per time. So the fact that waving an electron faster takes more energy for the same period of time isn't the whole story.
Third, and this gets back to experiment being the arbiter, I have no intuition to give you on why light comes in packets with a specific energy depending on frequency. That was a big surprise and is connected to the other strange properties of quantum mechanics.
But, if you accept that light does come in photons with energy depending on frequency, then imagine what it would be like if lower frequency photons had the higher energy. If you wiggled a charged object very slowly, then you couldn't produce a single photon for a long time because you wouldn't have put in enough energy. That would mean no transmission, so a sensor at some distance wouldn't be able to detect the oscillation. But what if you moved it back and forth far enough so that another charged object ought to be pulled in visibly different directions? The change in direction of the electric field is an electromagnetic wave, and there's lots of evidence that you can have very low-energy low-frequency waves. This is a handwaving reference to the "classical limit" - if you do experiments at ordinary sizes and speeds, you need to get the results that classical physics says.
Answer: Energy and momentum obey the Einstein relation $E^2-|\vec{p}|^2=m^2$, $m$ is mass and I have set $c=1$. In spacetime diagrams, the energy-momentum four-vector $(E, \vec{p}) $ is aligned with the direction of movement of the particle.
For massive particles, if you increase the momentum $\vec{p}$, the four vector $(E,\vec{p})=(\sqrt{p^2+m^2}, \vec{p})$ becomes steeper and steeper. The slope of the trajectory of the particle increases. An increase in momentum corresponds to an increase in speed, and vice-versa
For massless particles,  the energy-momentum relation is simply $E=p$. So, regardless of the momentum of the particle, the slope of its trajectory is always $\frac{E}{p}=1$. The slope of the trajectory, i. e. the speed, is not correlated with momentum or energy
So, you should not try to draw inferences about the momentum or energy of massless particles from their speed.
Then, how do we define the momentum or energy of massless particles if not in terms of their speeds?
Classiclally, light is a field whose equations of motion are Maxwell's equations. The solutions of Maxwell's equations can be expanded as:
$$\sum_r \int \frac{1}{\sqrt{2\omega_p}}( a_r (\vec{k}) \epsilon_r ^{\mu}(\vec{k}) e^{-ikx}+
 a^*_r (\vec{k}) \epsilon_r ^{\mu}(\vec{k})e^{ikx})d^3p $$
Turns out, Maxwell's equations mathematicaly describe a system of an infinite number of Harmonic oscillators.
So, the total energy of the field is the just the total energy of the oscillators:
$$\sum_r\int \omega _{k} a_r^*(\vec{k}) a_r (\vec{k}) d^3k$$
Corresponding to each $(\vec{k}, r) $, $\vec{k}\in R^3$ and $r=1,2$, there is an oscillator. The mode variables $a$ and $a^*$ determine the initial condition of each oscillator. $\omega_k$ is the frequency of the oscillator. You can see that, assuming the mode variables have a fixed value, the energy of the oscillator increases with frequency.
This has nothing to do with Quantum Mechanics or Photons. The energy of a classical electromagnetic wave increases with increasing frequency, assuming the mode variable has a fixed value.
Coming to photons, they are definite-energy states (eigenstates) of the Quantum Electromagnetic field.
The relation between the frequency and the energy of an energy eigenstate is a consequence of the Schrodinger equation:
$$i\hbar \frac{d}{dt} |E\rangle =E|E\rangle$$
This is a general feauture of quantum theories. It relates the frequency, i. e. the time derivative of the wavefunction, to the energy.
Comment: "The energy of a classical electromagnetic wave increases with decreasing wavelength, assuming amplitude is fixed" - this is incorrect. The energy density of a classical EM field is independent of the wavelength, and exclusively dependent on the amplitude.
Comment: @EmilioPisanty hmm what about the formula in terms of the mode variables : $E=\int \omega_p a_p a_p^* d^3p$? This depends on $\omega _p$, assuming $a_p$ is constant.
Comment: @EmilioPisanty By same amplitude, I only meant "same maximum displacement". Two waves $A_0\cos (\omega ^{\mu}x_{\mu})$ can have the same $A_0$ but differ in frequency. They will not have the same total energy. Assume that it's not an ideal plane wave but dies off at infinity.
Comment: I don't know what else to add. If the energy density is the same, and the spatial extent is the same, then the total energy is the same. This depends only on the amplitude ($A_0$) and *not* on the frequency. This answer is wrong.
Comment: @EmilioPisanty I have fixed that error now. I replaced "fixed amplitude" with "fixed mode variable"
Comment: @EmilioPisanty do you think that my answer is still wrong?
Answer: This is not necessarily a good answer, but it might reduce the uneasiness with how energy of light changes with its frequency by showing that we do not have many choices anyway.
For a massive particle, speed $v$ and mass $m$ are parameters, so you can expect a function of them for energy in general grounds: $E=E(m,v)$.
For a massless particle, $m=0$ and $v=c$, so energy clearly should depend on something else. It is hard to guess what that would be for a massless particle, but we can do the next best thing and focus on radiation instead, which has four experimental parameters: intensity $I$, polarization $\epsilon$, phase $p$, and frequency $f$. The observed polarization $\epsilon$ and phase $p$ depend on the relative orientation and location of the observer, so we discard them: this leaves us with the relation $E=E(I,f)$ for radiation.
When we go from the field radiation to the massless particle photon, we can assume that energy is additive: this is not strictly speaking correct as $$E(n\text{ photons})=nE(\text{one photon})+E(\text{interaction between photons})$$
but clasically electromagnetic field does not self-interact, and we can suppress quantum effects. Therefore, the fact that $E=(I,f)$ for the field and the fact that "the intensity of the light is linearly proportional to the number of photons" lead to the conclusion $$E=E(f)\quad\text{for individual photons}$$
As the frequency goes to zero, the field becomes static: no energy is propagating, hence $E\rightarrow 0$ as $f\rightarrow 0$. Therefore, we can Taylor expand $E(f)$ at $f=0$: $$E(f)=c_1f+c_2f^2+c_3f^3+\cdots$$ Clearly, $c_i$ are universal constants, and the dimensional analysis dictates $[c_i]=\text{kg m}^2\text{s}^{i-2}$. Historically, Planck proposed a value for $c_1$ (and dropped all other $c_i$), which matched the experiments rather well; today, we denote it as a universal constant $h$ and call it Planck's constant. To my knowledge, we do not have any experimental motivation to come up with any other universal constant with the appropriate dimensions to change the above formula with nonzero $c_i$, so we are left with the conclusion that energy of the massless particles linearly change with their frequency.


Which is more secure a full disk or file encryption?

Question: There are probably two ways to encrypt your computer full disk encryption which completely locks down the computer between when it is off and when it has booted but after everything loads you computer is not encrypted anymore and then there is something like a file encryption which it only encrypt files in a virtual hard drive or a folder or something like that and even if the computer is booted the file or folder is still encryption so which is more secure a full disk or a file encryption?
Comment: @HenryWHHack Yes it is.  You've asked the same question in a slightly different way.  The same answers apply.
Comment: Depends what you are protecting
Comment: What is your threat model?  For some threats, file encryption is better.  For other threats, full disk encryption is better.
Comment: With file/folder encryption, multiple users may use the disk (with their individual passwords, or saved certificates).
Answer: You can't compare Full Disk Encryption to File Encryption as they are both different things. One encrypts the entire drive, the other only affects targeted files. If you want to be more secure, you could use both.

This Wikipedia article should assist in choosing encryption software that suits your needs:
en.wikipedia.org/wiki/Comparison_of_disk_encryption_software
Answer: Using full disk encryption is very much recommended, but it all depends on what you are protecting and the impact level, full disk encryption would protect you as long as your device is not on active state(after you entered the key),for example it wouldn't protect you if someone on the same network had accessed your files since you have already entered the key, but you could use here as an additional precaution file encryption, and encrypt also the files which are important for you to not be accessed by anyone, and decrypt them only while you are using them.
So use both if neccesary.
Comment: First you encrypt your hard disk. Then you encrypt the files you want to encrypt.
Comment: what operating system you are willing to use?
Comment: There are so many options that it is not feasible to provide them all in a post. Your best bet is to do some research and choose one that suits you best. There's a good link over at Wikipedia - https://en.wikipedia.org/wiki/Comparison_of_disk_encryption_software


Was adi shankara the first one to believe in advaita philosophy?

Question: Did any one before adi shankara believe that only Brahman exist and the world is an illusion. Or adi shankara was the first one to bring this doctrine of non dualism.
Comment: narayana samarambham vyasa sankara madhyamam asmad acarya paryantam vande guru paramparaam http://www.hindupedia.com/en/Guru-Sishya_parampara
Comment: No. Even Mahahharatha has numerous verses saying the same.
Comment: Bhisma, Pandavas never preached or practiced advaita mahabharata scripture itself is reference
Comment: @hanugm you can answer with that link as the source.
Comment: Okay @Rickross ........
Answer: Prof Chandradhar Sharma in "Advaita Tradition in Indian Philosophy" Page 124-125 writes

References to some ancient teachers of Vedanta are found in the
Vedanta literature, but their works, if they composed any, are not
extant. Badarayana in his Brahma-sutra names some teachers of old
citing their views. They are: Jaimini, Ashmarathya, Badari, Audulomi,
Kashakrtsna, Karsnajini and Atreya. Of these Jaimini  is the famous
author of Purva-Mimamsa-Sutra. Kashkrtsna probably was an
Advaitin, because Shankara refers to his view as agreeing with the
Shruti. Dravidacharya and Tanka are claimed as Advaitan by their
tradition. Shankara refers to Upavarsa and Ramanuja to Bodhayana as
'vrtttikara.' Brahmadatta and Sundara Pandya were also leading
teachers of their time and from the references to their views it is
very probable that they were inclined towards Advaita.
Bhartrhari, whose Vakyapadiya, the famous work on the philosophy of grammar and language, is available was a renowned
Shabdadvaitavadin. Though he was an uncompromising Advaitin and a
supporter of vivartavada, he is primarily a philosopher of grammar and
language and his Advaita is different from that of Shankara. There are
two works on Vedanta, the Paramdrtha-sara attributed to Adi-Shesa
(later on adapted and expanded under the same name by Abhinavagupta
into a handbook of Pratyabhijhd-darshana)and the Yogavasistha
attributed to the sage Vasistha, which bear some doctrinal and
terminological similarities with Gaudapada's Karika.

Also King Yayati in Mahabharata(Much before Shankaracharya) held a similar view.

Yayati answered "The wise, with the help of the Vedas, and of
Knowledge, having ascertained the visible universe to be illusory,
instantly realises the Supreme Spirit as the sole existent independent
essence." (Mahabharata Adi Parva Section XCII )
Comment: Thanks for the answer
Comment: ...and Gaudapada (Gaudapada's Karika of the Mandukya Upanishad) who in the modern age is identified as the first Vedantic philosopher of the post-Upanishadic age. He was the guru of Govindapada, Sankara's guru.


Where can I find an Amulet of Akatosh?

Question: I'm trying to build all the shrines in my houses in the in Skyrim's Hearthfire expansion.
I've been able to find every amulet and build all the shrines so far, except for Akatosh.
Where can I find an Amulet of Akatosh?
Answer: The Amulet of Akatosh is a random drop item.
Some people have reported being able to buy it at Radiant Raiment in Solitude. Other sources claim it can be found in a chest aboard the Orphan's Tear.
Comment: +1, thanks.  I've been trying Radiant Rainment over and over (that is how I got 3x of all the rest of the amulets that are not easy to find), but maybe I have just been unlucky since I have never seen Akatosh there.
Comment: After many more visits, confirmed that you can find amulet of Akatosh at Radiant Raiment.
Answer: I married Ysolda from Whiterun and she randomly had it a few times when I was buying/selling with her.
Comment: Always marry Ysolda. =]
Answer: The amulet of Akatosh can be found in caves, forts , can be sold by your wife or husband, and can be found in jewelry / apparel stores.
Answer: You know that Draugr at the end of Bleak Falls Barrow? I got mine off of him, and sometimes other draugr. After I decapitated a Stormcloak, I found one on his body. Pickpocket guards to see if they have them. But it's random and will not always be guaranteed to find them. Radient Rements almost never has them with me... just Julianos todos los días.
Answer: I just wait 48 hours in Radiant Raiment continously until it pops up. Helps when you're building the shrine in your home. I always find myself needing Akatosh and Zenithar
Answer: Go dungeon diving (although there might not be too many dungeons with amulets), attack Forsworn camps, defeat forts owned by Bandits, (usually one of the best places is around the middle of the map, Falkreath and Bleak Falls Barrow, on my first account I encountered an EXTREMELY hard fort to conquer. I was a level 36 Orc with Heavy Armor, Two-Handed and Bow with Ebony arrows. There was a Pyromancer or something and he kept spamming Fireball (not FireBOLT) and I wasted all my Ebony arrows (like around 63) with an Ebony, refined, enchanted bow and he didnt even get to half health and kept healing and killed me in 3 shots (the only reason why i was hiding in the mountains to kill him was because i had 100% weakness to fire because i was a vampire) I forgot what it was called, but it was just below winterhold in the mountains), etc. There is a LOT of places where you can find amulets.
(lol this is a lot of writing for how to find an Amulet of Akatosh)
Comment: "There is a LOT of places where you can find amulets" is because ["The Amulet of Akatosh is a random drop item."](http://gaming.stackexchange.com/a/92107/4163)

Where can I find an Amulet of Akatosh?


How can you burn your hunger bar the fastest in minecraft?

Question: I have a TON of food and I want to eat it all but I need to deplete my hunger bar first. How can I burn my hunger bar down in the shortest time possible?
Comment: Out of curiosity, why do you want to get rid of your food instead of saving it for when you need it?
Comment: Or rather, why not just throw it in some lava and accomplish the same thing as purposely exhausting yourself and eating food just to eat it?
Comment: And if disposal is absolutely necessary, why isn't throwing it into lava or down a pit easier?
Answer: In my experience, sprinting while jumping around depletes the hunger bar more rapidly than anything else I do. This is confirmed by this Exhaustion Level chart taken from the wiki:

NOTE: Any action not listed here will not increase exhaustion level. For example, the player can travel several days by boat and the food bar will not decrease.
Food poisoning seems to work rather effectively as well, so chow down on all the Rotten Flesh and Raw Chicken you can find for additional exhaustion while you sprint and jump around like a madman.
Comment: It's worth-noting that food poisoning effect does not stack. Chewing poisoning food one after another is more effective.
Comment: Note that spider eyes and poison potatoes don't give food poisoning, they give actual poisoning.
Comment: @Alex Remember to do the food poisoned sprintjumping in a downhill slope with a suitable angle of declination, so that you take half a heart of fall damage each time you land.
Comment: You can poison yourself and then do sprinting jumps. Efficiency!
Comment: @Random832: Oops, missed that. Fixed now.
Answer: If you want to get rid of your food, i would sugest getting a wolf and then feed him all the food (wolves don't get full). But if you actually need to EAT it, try sprinting, jumping, mining, and also climb up a little hill and jump down so you take like 3 hearts of damage. In my opinion, feeding it to your wolves is best. Hope it helps!
Comment: Does damage make you hungrier? I haven't noticed that.
Comment: @SevenSidedDie I believe that it does, it just does so little that you barely notice it.
Answer: One of the fastest and easiest ways is to stand under a block right above you and then tap the spacebar as fast as you can. It would go faster if you could sprint while doing it.
Comment: "It would go faster if you could sprint while doing it." - if only there were some arrangement of blocks that could be used for this and also be useful for something. Maybe some kind of tunnel, that's exactly two blocks tall.
Comment: @Random832: Don't be daft, man; that kind of thing is pure sci-fi. Why, that would only be possible if you could remove and rearrange blocks, somehow. I don't know about you, but *I'm* certainly not holding my breath.
Comment: @Random832 A tunnel of ice with trapdoors on top will rapidly deplete a hunger bar while sprint-jumping down it.
Answer: You should first eat rotting zombie flesh, sprint and jump in the same time while attacking a monster. Also, if you just want space in your inventory, throw some of your food in the lava. This way helps you save time and score.
Comment: Are you seriously just restating another answer? Come on, there's enough [unanswered questions](http://gaming.stackexchange.com/unanswered) where your help is actually required


Shouldn't the Beta badge be retired like the Analytical badge?

Question: On Stack Overflow, the Analytical badge was retired when the help center rolled out. However, although the site is long out of beta, the Beta badge is still on the badges page. Shouldn't the Beta badge be retired the same way?
Answer: Not exactly. The Beta badge can still be awarded on other sites (as they're created), just not this site. The difference between the Beta badge and the Analytical badge is that the features required to award the Analytical badge no longer exist, anywhere, and it is not possible to gain the Analytical badge at all now. Theoretically, it would make sense to just remove the badge, but rather than take away a bunch of bronze badges, they opted to just label it as retired and let users keep it.
Comment: @Mooseman Because it's not retired. The Beta process still exists, you just can't participate in it on Stack Overflow anymore. If the Beta process were completely gotten rid of, *then* it would make sense to retire the badge, since the features that relate to the badge would no longer exist.
Comment: Think of it like the job market. You work at one job for 5 years, and they lay you off to cut costs. You're not *retired*, but you can't go back to work for that same company either. You need to get a new job. -- The Beta badge isn't retired, you just need to go to a different site to get it.
Comment: I understand it's possible to earn the badge on other SE sites, but why couldn't it be retired on SO only?
Comment: @animuson even if the beta process were no longer relevant, I would still like to keep that beta badge, especially on Stack Overflow, as some kind of "badge of honor" ;)
Answer: Not entirely true.  The Analytical badge was retired when I made this suggestion.  I also requested other badges be marked as Retired as well (i.e. the Precognitive badge, as it's no longer possible to earn it). Only the Analytical badge was marked as Retired as a result of that post.


Thom's first isotopy lemma

Question: Thom's first isotopy lemma says that given $f:M\to P$ a smooth map between smooth manifolds and a closed Whitney stratified subset $S$ of $M$, such that
$f|_S:S\to P$ is proper and $f|_X:X\to P$ is a submersion for any stratum $X$ of $S$, then $f|_S:S\to f(S)$ is a locally trivial fibration. Does this imply that $f|_X:X\to f(X)$ is a locally trivial fibration, for any stratum $X$ of $S$?
Edit (Jan 03, 2024): Reviving this post. Kindly refer me to some works where the above lemma is used to prove fibrations in some concrete examples, which are not proven using some other method.
Comment: The notation is clear.
Comment: I must admit, I'm struggling a bit with your notation. ...
Comment: Instead of editing in a new question to an old post, you should post the new question separately.
Answer: Yes. Notice that since $f|_S: S \to S$ is proper, so is $f|_X$ (because $X$ is closed). Furthermore, $f|_X$ is a submersion and is surjective onto its image.  So by a direct application of Ehresmann's fibration lemma you get your result.
Comment: I can use Ehresmann's fibration theorem if X is compact...
Comment: You don't need X to be compact to use Ehresmann's fibration theorem. You need $f|_X$ to be a submersion (which is by hypothesis) and you need $f|_X$ to be proper (have a look at the link in the answer). Equivalently, you need that $f|_{S}^{-1}(p) \cap X= f|_X^{-1}(p)$ is a compact for all $p$ in $f(X)$. But this is true because $f|_S$ is proper, so $f|_S^{-1}(p)$ is a compact in $S$ and the intersection of a compact set with a closed set is a compact set.
Answer: Also note that because any fibration is also a compactification of a subset of all strata, we can always divide any subsets of these strata into an infinite number of compactified stratified and homotopically self similar spaces. Also note that the isotopy from strata 1 to strata 2 is a homotopy as well.

Thom's first isotopy lemma


Does it matter what edit review reject reason I pick?

Question: I saw a post that was borderline-vandalism.  It was an attempt at grammar/spelling improvement and left the post in about the same state.  In particular an "I" was changed to an "i."  I often write custom edits and did for this one, explaining...  not to do that.  From a review improvement standpoint custom edits are almost always preferable, since more explanatory.  However, I'm wondering if there is additional business logic tied to other reasons, e.g. since vandalism is so harsh, perhaps it would revoke the OP's edit privileges sooner, etc.
Comment: Not an answer, but during peak times, I try to avoid leaving custom reject messages because it is possible that someone will swoop in and approve the edit before I finish typing (has happened before)
Comment: @psubsee2003 You mean, all the time. ;)
Comment: I (mistakenly) chose "spam/vandalism" instead of "too minor" once, and the editor said he'd quit the site because he was now "branded as a spammer".
Comment: @J.Steen not all the time.  I recall it not happening once maybe about a year ago :-)
Comment: You guys must type more slowly.
Comment: With more detail.
Comment: @djechlin: Don't forget not everyone is a native English speaker. I for one type about half-speed in English, compared to my native language, even though I'm (reasonably) fluent. ;-)
Answer:
However, I'm wondering if there is additional business logic tied to other reasons, e.g. since vandalism is so harsh, perhaps it would revoke the OP's edit privileges sooner, etc.

If three users select vandalism as rejection reason, the privilege of suggesting edits is not revoked earlier. Whatever reason you choose, users will not be able to suggest further edits for the next 7 days, after X suggestions of theirs are rejected.
The reason for rejecting the suggested edit is only important for the user who suggested it. Moderators generally don't suspend a user for suggesting bad edits. That could eventually happen for a user vandalizing posts written by others; even in that case, moderators don't normally check the number of suggested edits rejected as vandalism, except in the case a post in this very site or a flag points out the behavior of a user who, for example, keeps suggesting edits that change posts in non sense. In that case, marking a suggested edit as vandalism when it is effectively vandalism helps the moderators.
Answer:
Does it matter what edit review reject reason I pick?

Mainly if the user who performed the edit is aware, and was genuinely trying to help. I'd like to think that's usually the case.
When I was a low reputation user in SO not too long ago, I used to check how my edits went (much like I do now with flags being a new 10K user, still learning!). Getting feedback, especially hand tailored feedback was really useful.
One feature request that (I think was already made) is to notify users when an edit they made was reject, leading to the edit screen when they can read why it was rejected.
If I feel that the user was just editing to rep, and no genuine attempt was made, or that one of the fixed reasons fits why I reject the edit perfectly, I don't bother writing a custom message.


Are steroids on topic?

Question: Are illegal steroids/SARMs and other substances which are sport related and illegal to ingest on topic? Can't see many questions on them.
Comment: In the light of the votes the two answers had received so far, I think you should unaccept the answer you had accepted.
Answer: Generally this topic is not something that this community has encouraged or endorsed and to err on the side of caution. You can read through the meta questions below for reference.
Should we allow academic questions about drug use and other obviously poor health choices?
What to do with dangerous answers?
How does this site handle drug use
Comment: In three links you provide, I don't see a clear consensus to exclude questions pertaining to this topic.
Answer: Though not strictly a answer to your question but i believe they should be on topic.
Reason
Those who are looking for easy way out needs to know reward vs risk.
Background
I believe the main cause of steroid abuse related complication is apathy of doctors.
When ever i tried consulting a doctor or health professional regarding steroids they always made me feel that one cycle will ensure my death or cancer or heart attack or what ever. But when i enter gym i see the pinning guys lifting and S**t this always used to leave me in lurch without info. Instead of explaining shutdown and difficult to keep gains they some how always use authority.
It will be great if people provide info and experience regarding them and prevent abuse and related complication.

Are steroids on topic?


What are Dirichlet characters?

Question: What are Dirichlet characters? I don't really understand the definitions given by wikipedia or wolframalpha, are they defined to be partially multiplitictive just because that gives them, an euler product representation? Or is there some other reason?
Comment: See **Section 6.2, Dirichlet characters** and specifically the examples at [**Introduction to Analytic Number Theory**](http://www.math.uiuc.edu/~hildebr/ant/main6.pdf) by A.J. Hildebrand. Regards.
Answer: Your question seems to be about both the definition and the motivation behind it.  Here is a brief discussion of both.
The definition:
A Dirichet character modulo $N$ is a multiplicative homomorphism $\chi$ from $(\mathbb Z/N\mathbb Z)^{\times}$ (the group of units in the ring of integers modulo $N$) to $\mathbb C^{\times}$ (the group of non-zero complex numbers).
It can also be regarded as a function on the set of integers that are coprime to $N$ by defining $\chi(a) := \chi(\text{residue class of } a \bmod N),$
and then its defining properties are that $\chi(a b) = \chi(a)\chi(b)$ and that
$\chi$ is of period $N$ (so that $\chi(a)$ really does only depend on the class of $a$ mod $N$).
Sometimes $\chi$ is extended to a function $\mathbb Z/N\mathbb Z \to \mathbb C$ (or $\mathbb Z \to \mathbb C$) by defining $\chi(a) = 0$ if $a$ is not a unit mod $N$ (i.e. if $a$ is not coprime to $N$).   This is just done mainly as a technical convenience, so that one can write down formulas (like the formula for the Dirichlet $L$-series of $\chi$) in such a way as to not have to specifically restrict to integers that are coprime to $N$.  Note that with this extension of
the domain of $\chi$, one still has that $\chi(ab) = \chi(a)\chi(b)$ and that $\chi$ is periodic of period $N$.  (Actually, to be precise, one should say that the period divides $N$; if it exactly equals $N$, we say that $\chi$ is primitive.)
The motivation:
As you note, because $\chi$ is multiplicative, the $L$-series of $\chi$ admits  an Euler product.  This is certainly the fundamental reason for singling out the Dirichlet characters.
But another key point is that, by Fourier theory for finite abelian groups, any function on $(\mathbb Z/N\mathbb Z)^{\times}$ (for example, the function $\delta_a$ which is one on the coset of some fixed integer $a$ coprime to $N$ and zero on all other cosets) can be written as a linear combination of characters.  So one can use Dirichlet characters to study any function on $(\mathbb Z/N\mathbb Z)^{\times}$.  This is how they get used in the proof of Dirichlet's Theorem on primes in arithmetic progression (where the function $\delta_a$ is the one we need to understand).
Combining these two points, one sees that one can use the $L$-series of Dirichlet characters to analyze the behaviour of mod $N$ functions (such as $\delta_a$) on primes, and this is what is done in the proof of Dirichlet's Theorem.
Comment: @reuns $(-1)^{(n-1)/2}1_{\gcd(n,6) = 1}$ has period $12$. (Your point is of course valid.)
Comment: Great answer, I wasn't even really expecting one sense I put out such a broad question.
Comment: $(-1)^{(n-1)/2} 1_{\gcd(n,6)=1}$ is $6$-periodic but non-primitive. Primitive means not of the form $\chi(n) 1_{\gcd(n,q)=1}$ for some $\chi$ modulo $Q < q$.

What are Dirichlet characters?


Growth of functions

Question: Does somebody know if Mathematica can be used to calculate the growth of functions, that is in Big O, Theta, and Omega and find proper $n_{0}$ and $c_{1}$, $c_{2}$ respectively?
Comment: One way that often works to get basic info is to take a series expansion at infinity, say, Series[f[x],{x,Infinity,1}]
Comment: Hi JanosAudron, and welcome to Mathematica StackExchange! I'm afraid that while quantities such as $n_0$, $c_1$ and $c_2$ typically appear in formal definitions of the big-O (and related) notations, one most often does not calculate them explicitly to prove domination relations between functions…
Answer: Yes, Mathematica can be used to characterize the asymptotic behaviour of functions, but maybe not in the straightforward way you intended. Let's see a few examples (I'll focus on asymptotic behaviour as $x\rightarrow\infty$, but behaviour around any other point works the same) of what we can do by looking at limits (using the Limit function):

How to check if $f(x) \in o(g(x))$, or $g(x) \in \omega(f(x))$
There, the question we can ask Mathematica is: what is the limit of $f(x)/g(x)$:

If the limit is zero, then $f$ is dominated by $g$, as in the example below, where
$$f(x)=x^2e^{-\sqrt x}\ \ \text{  and }\ \ g(x)=e^{-x}$$
In[1]:= Limit[(x^2*Exp[-Sqrt[x]])/Exp[x], x -> ∞]
Out[1]= 0

If the limit exists, but is not zero (it can be a finite number, an infinity, or an Interval): $f$ is not dominated by $g$ (and if the limit is $\infty$, then in fact $g$ is dominated by $f$). Three examples:
In[2]:= Limit[(3*x^2 + x + 1)/x^2, x -> ∞]
Out[2]= 3

In[3]:= Limit[Gamma[x]/Exp[x], x -> ∞]
Out[3]= ∞

In[4]:= Limit[x*Sin[x]/Sqrt[x], x -> ∞]
Out[4]= Interval[{0, ∞}]

If the limit is unknown to Mathematica, then you haven't learnt anything.

How to check if $f(x) \in O(g(x))$
$f(x) \in O(g(x))$ means that, for large enough $x$, $\left\vert f(x)/g(x)\right\vert$ is bounded. So, our options are as such:

If $\left|f(x)/g(x)\right|$ converges to a finite number (including zero, but not $\infty$), then that's it: $f(x) \in O(g(x))$
In[5]:= Limit[(3*x^2 + x + 1)/(Erf[x]*x^2), x -> ∞]
Out[5]= 3

If $|f(x)/g(x)|$ converges to an interval which does not include any infinity, the same is true:
In[6]:= Limit[Abs[Sin[x]/(2 + Cos[x])], x -> ∞]
Out[6]= Interval[{0, 1}]

If $\left|f(x)/g(x)\right|$ converges to $\infty$ or to an interval containing $\infty$, then $f(x) \not\in O(g(x))$.
Otherwise, you have learnt nothing.

The fine print: in many examples above, I calculate $f/g$ instead of $|f/g|$ because I know that the functions both have positive values. Also, if $g(x)$ takes zero as a value in more than a finite number of points, you need to be a little bit more careful than just calculating $f/g$.
Answer: Here's a function bigOSimplify that takes an expression and tries to simplify the O(expr) as a function of n:
maxBigO[l_, n_] := Switch[Length@l,
    1, First@l,
    2, If[Limit[Abs[First@l / Last@l], n -> Infinity] === 0, Last@l, First@l],
    _, maxBigO[{maxBigO[Take[l, 2], n], maxBigO[Drop[l, 2], n]}, n]
];
bigOSimplify[expr_, n_] := 1 /; FreeQ[expr, n];
bigOSimplify[expr_Plus, n_] := bigOSimplify[maxBigO[expr, n], n];
bigOSimplify[expr_Times, n_] := (If[FreeQ[#, n], 1, bigOSimplify[#, n]] &) /@ expr;
bigOSimplify[a_Plus ^ b_, n_] := maxBigO[a, n] ^ b;
bigOSimplify[expr_, n_] := bigOSimplify[FunctionExpand@expr, n] /; expr =!= FunctionExpand@expr;
bigOSimplify[expr_, n_] := expr;

Examples:
bigOSimplify[2 n^4 + Log[n] + n ^ 2, n] (* => n^4 *)
bigOSimplify[Fibonacci[n], n] (* => (1/2 (1+Sqrt[5]))^n *)

It might give wrong answers for complex expressions, so check the result with F'x's answer.

Growth of functions


Ionic Reflection

Question: I finally went and got my Ham Radio licence. I've been reading about how radio operators use the ionosphere for long distance communication through ionic reflections of transmitted/received EM waves. I'm trying to visualize how this happens, so that I have more intuition into what frequencies to use under various conditions of the ionosphere. Can someone give an illustration of how EM waves are reflected by ions in the ionosphere, to help convey pictorially why wavelength matters?
Comment: Interesting that you got a license without being made aware of the ARRL handbook.  Perhaps you are in a different country, but even so the information there would be a great reference on this and many other topics.
Comment: Depends what you mean by illustration. You could have a look at http://radiojove.gsfc.nasa.gov/education/educ/radio/tran-rec/exerc/iono.htm
Answer: The way I look at it is as follows:
Flat surfaces reflect waves well.  Jagged, rough surfaces scatter them.  The ionosphere is not a well defined area but a diffuse region - roughly the same altitude over a very large area, but jagged at any specific point.
Now, imagine a rugged surface like an well played-upon sports field with lots of cleat-marks.  Then zoom out.  The further away you are, the flatter the surface will appear.  The closer it is, the more irregular it will appear.  The longer the wavelength (lower the frequency) the more smooth it appears, and thus the better reflector it will become.
Thus lower frequencies generally provide better skywave (reflected from the ionosphere) performance.  But since everyone wants to use those lower frequencies and because of pink (skewed towards the lower end of the spectrum) noise from electronics and other man-made devices, there is a tradeoff to be made.
Comment: No, it is not the *irregularity*.  Rather it is a question if the charge *density* causes sufficient dispersion at a given frequency  to achieve reflection.  In cases of actual irregularity - for example intense ionization trails left by meteors - VHF & UHF frequencies become usable.

Ionic Reflection


What does MEDIA_ERROR_SERVER_DIED mean?

Question: In the Android docs, there is a constant defined MEDIA_ERROR_SERVER_DIED which is described as:

Media server died. In this case, the application must release the MediaPlayer object and instantiate a new one.

This seems very vague. What does it mean that the Media server died? Why would it die? And is it proper to handle it by immediately trying to play again afterwards?
Answer: In Android, most of media activity (decoding/encoding) happens in the mediaserver, except in limited cases, such as local file playback using software codec.  Android mediaserver routinely crashes (aborts) on hardware errors, incorrectly formatted files or data.  Yeah, sorry!
Since many activities share a common mediaserver, an error in any of the activities can crash mediaserver.  This most commonly happens when a background activity, such as media scanner or Google+ Auto-Awesome Movies tries to scan a corrupt or just unsupported file.  When this happens, the remaining processes that used mediaserver receive a notification.  This notification is passed to the app in case of MediaPlayer or MediaRecorder.
When mediaserver dies, it is immediately restarted.  Even though the server dies, the proxy object on the application is still alive and is using resources.  Hence the need to release the object.  It should be safe to create a new one immediately after the notification.
Answer: One condition that causes this is when the MediaPlayer doesn't receive or stops receiving the video stream from the server. If the error consistently occurs immediately (i.e. if none of the video is received at all), you may want to ensure that nothing (firewall, VPN, etc.) is blocking your route to the server.
Answer: It means the server from where you are streaming unexpectedly ended the connection. It can happen, usually it's related to a "Connection reset by peer" error.
You could try to reconnect yes, maybe after waiting a bit.

What does MEDIA_ERROR_SERVER_DIED mean?


D'Alembert Solution to 1+1D wave equation - integration step

Question: I am working through d'Alembert's solution to the 1+1D wave equation using the substitution of canonical coordinates. I have an initial condition of: $$u_{t}(x,0) = g(x) $$ with a general solution containing the following two arbitrary functions: $$u(x,t) = \phi(x-ct) + \psi(x+ct)$$ These two functions are composite functions. I know I am supposed to take the partial derivative with respect to $t$ and set it equal to $g(x)$ to get the following: $$-c\phi'(x) + c\psi'(x) = g(x)$$ The book provides the above prime notation and does not specify what $\phi$ & $\psi$ are being differentiated by. The issue is the next step in the solution states to carry out the integration from $x_0$ to $x$ to obtain: $$ -c\phi(x) + c\psi(x) = \int^{x}_{x_0}g(\xi)d\xi +K$$ I believe my issue comes from correctly differentiating the composite function. At first I tried to just take the partial derivative with respect to $t$, setting $t=0$, and got the following: $$-c\frac{\partial{\phi(x)}}{\partial{t}} +c\frac{\partial{\psi(x)}}{\partial{t}} = g(x)$$ When I then integrate with respect to $x$ (the only way to make the integral of $g(\xi)$ make sense), I get the following: $$-c\int\frac{\partial{\phi(x)}}{\partial{t}}d(x) + ...$$ which doesn't make sense to me. So I then looked into if I was doing the partial derivative of the composite function incorrectly. I found some general texts online about derivatives of composite functions and got this: $$ h = g(f(x_1,x_2)) = g(u_1(x_1,x_2),u_2(x_1,x_2))$$ And using the chain rule for composite functions: $$\frac{\partial h}{\partial x_1} = \frac{\partial h}{\partial u_1} * \frac{\partial u_1}{\partial x_1} + \frac{\partial h}{\partial u_2} * \frac{\partial u_2}{\partial x_1} $$ When I try to apply it to the problem, I get the following: $$ u(x,t) = g(f(x,t)) = g(\phi(x,t),\psi(x,t))$$ with the following derivative with respect to $t$: $$ \frac{\partial u}{\partial t} = \frac{\partial u}{\partial \phi} * \frac{\partial \phi}{\partial t} + \frac{\partial u}{\partial \psi} * \frac{\partial \psi}{\partial t}$$ which simplifies to (might be incorrect): $$ \frac{\partial u}{\partial t} = -c * \frac{\partial u}{\partial \phi} + c * \frac{\partial u}{\partial \psi}$$ I don't know how to find $ \frac{\partial u}{\partial \phi}$ or $ \frac{\partial u}{\partial \psi}$ and those derivatives don't make sense when I try to integrate with respect to $x$: $$-c\int\frac{\partial{u}}{\partial{\phi}}d(x) + ...$$ Can anyone show me where I am making a mistake in my understanding, and how to correctly differentiate $u(x,t) = \phi(x-ct) + \psi(x+ct)$ to get it into the correct form to where I can integrate with respect to $x$? Thank you!
Comment: > "The book provides the above prime notation and does not specify what $\phi$ & $\psi$ are being differentiated by."

No, you are misunderstanding this very much. Both functions are 1-variable functions; it just so happens that the one variable that they are functions thereof, are themselves a linear function of two variables.
Comment: The [wiki](https://en.wikipedia.org/wiki/D%27Alembert%27s_formula) does a better job of defining new variables so that $x$ isn't of questionable identity.
Comment: Thank you everyone for your comments. I understand now!
Answer: It is possible to understand $\phi (x-ct)=\phi (\xi (t))$ and $\psi(x+ct)=\psi (\xi (t))$, where $\xi(t)=x-ct$; to get:$$u_t(x,0)={\partial\over\partial t}\phi (\xi(t))\bigg |_{t=0}+{\partial\over\partial t}\psi(\xi(t))\bigg |_{t=0}=g(\xi(t))\bigg |_{t=0}.$$Applying the chain rule one gets:
$${\partial\over\partial t}\phi (\xi(t))+{\partial\over\partial t}\psi (\xi(t))={\partial\phi\over\partial \xi}{\partial\xi\over\partial t}+{\partial\psi\over\partial\xi}{\partial\xi\over\partial t}$$
Hence,
$$u_t(x,0)=-c{\partial\phi\over\partial\xi}+c{\partial\psi\over\partial\xi}=g(\xi)$$ Integrating with respect to $\xi$ gives:$$-c\phi (\xi)+c\psi (\xi)=\int_{x_0}^xg(\xi)\;d\xi\;+K.$$ Where $K$ is a constant of integration from the right hand side that has been moved over. Now since we have set $t=0$ it is clear that $\xi(0)=x$ which when substituted into the above expression gives the result as per the textbook you have been consulting.


How would stocks devalue if majority holders were to sell all their stock?

Question: If an uber-rich person, say the CEO of certain online retail company or the ex CEO of certain Redmond based technology company suddenly were to sell ALL of their shares, would it be possible to estimate how much the stock price would change based on the huge surplus in supply?
Answer: You could speculate about the size of the price change but it would be no more than an inaccurate  guess.
The  buy side size and depth would be listed in the order book.  That would be the starting point of how much stock offered by buyers that has to be taken out.  The problem with that assumption is that there are many hidden orders.  Such orders display only a portion of the size that the buyers are after (iceberg orders).
The second problem is that as price drops due to 'Redmond selling', new orders would enter the market to buy at lower prices.  There's no way to estimate how many of those will occur.
Last of all, the rate of selling affects the speed of descent.  Dumb money places a huge order and price gaps.  A smart seller, disguises intent and sells at a slower rate, one at which the buyers can absorb without driving price down quickly.
Comment: Likely not only robots wanting that juicy arbitrage but even regular daytraders would join in on such a frenzy. Since the CEO is most assuredly an insider, they would have no choice to alert the market to their intent, so disguise and individual orders would be of little use.
Comment: There's a lag between insider purchases and sales and the filing.
Answer: Once word gets out that a key member of a large company is selling their shares, then it doesn't matter if they were selling slow or selling fast. The news of the sales will be what drives the market.
Because of SEC regulations even if they are able to discretely sell a significant number of shares without being noticed, when they file the required SEC paperwork, it will be noticed and then things could get interesting.


What was the cause of the decline in remittances sent to Pakistan between 1982 and 2000?

Question:
I am trying to find out what caused the 2-decade long decline in remittances as a % of GDP. I have spent an hour trying to search for explanations but haven't found anything. I know its a long shoot and thought it won't hurt to ask here to see if anyone can explain the cause
Answer: Perhaps more enlightening would be the reason why Remittances increased so much from 1976 to 1982, and then cooled off.
1977 was the year of a military coup in Pakistan (and the imposition of Martial Law), that was also, it appears, the beginning of deep structural socioeconomic changes. In such situation it is not uncommon to see a wave of emigration, among those that do not "fit well" in the new situation. But this rarely means that the emigrants severe all ties with the country back home, usually some family is left behind. Hence, increased Remittances.
In 1985 Martial Law was lifted and elections were held, and this could explain the downward trend.
So I would look into the emigration/repatrization flows in Pakistan during that era, coupled with the political situation and any economic reforms.
Comment: It may have been a demand effect, a response to oil prices in the economies of the Middle East, which peaked in 1980, then slowly declined before collapsing in 1986; they did not really start to recover until 2002.
Comment: @Henry This is indeed a very reasonable explanation, probably more solid than my thought. Why don't you beef it up to an answer?
Comment: Because I have no idea whether it is true
Comment: @Henry Are you implying that _I_ do have an idea whether _my_ suggestion is true?


Why is Karila's uniform different from the other girls'?

Question: Most of the girls in Stella Jogakuin Koutou-ka C³-bu have pink uniforms, but Hatsuse Karila (right) has a blue uniform. Is there any reason why her uniform is a different color from everyone else's?
Comment: I have a feeling it's related to her being blonde/blue-eyed; #makes future prediction# - she's American, and a transfer student, hence her love of machine guns.
Answer: As Clockwork-Muse mentions, it's likely this is just an example of the "Transfer Student Uniforms" trope. This is a visual reminder of her character being "different", the stereotypical blonde hair and blue eyes of a foreigner adding to the effect.
It is not a grade uniform as another member in the club is also in second grade.
She is not actually a foreigner, having been born in Japan, though she is only part-Japanese which is enough for the trope it seems.


Difference between app.all('*') and app.use('/')

Question: Is there a useful difference between app.all("*", … ) and app.use("/", … ) in Express.js running on Node.js?
Answer: In most cases they would work equivalently. The biggest difference is the order in which middleware would be applied:

app.all() attaches to the application's router, so it's used whenever the app.router middleware is reached (which handles all the method routes... GET, POST, etc).

NOTICE: app.router has been deprecated in express 4.x

app.use() attaches to the application's main middleware stack, so it's used in the order specified by middleware, e.g., if you put it first, it will be the first thing to run. If you put it last, (after the router), it usually won't be run at all.

Usually, if you want to do something globally to all routes, app.use() is the better option. Also, it has less chance of future bugs, since express 0.4 will probably drop the implicit router (meaning, the position of the router in middleware will be more important than it is right now, since you technically don't even have to use it right now).
Comment: Does this still apply after Express 4.x? app.router was removed.
Comment: You can use `next("route")` with `app.all`, but not with `app.use`.
Comment: @musicin3d I researched further and found this [GitHub issue](https://github.com/expressjs/express/issues/3133), that confirms that "next() and next('route') have no difference to app.use" (quote). They should change the docs.
Comment: @JozefMikusinec Documentation seems to suggest otherwise... https://expressjs.com/en/guide/writing-middleware.html
Comment: Your link doesn't mention next('route'), but I looked at the API, you are right.
Comment: @JozefMikusinec My apologies. I was in a rush and didn't notice you had specified a route in your first comment. TIL! Thanks looking into this. :)
Comment: Would be awesome to update this answer, since it initially warned against future updates
Answer: app.use takes only one callback function and it's meant for Middleware. Middleware usually doesn't handle request and response, (technically they can) they just process input data, and hand over it to next handler in queue.
app.use([path], function)

app.all takes multiple callbacks, and meant for routing. with multiple callbacks you can filter requests and send responses. Its explained in Filters on express.js
app.all(path, [callback...], callback)

app.use only sees whether url starts with the specified path
app.use( "/product" , mymiddleware);
// will match /product
// will match /product/cool
// will match /product/foo

app.all will match complete path
app.all( "/product" , handler);
// will match /product
// won't match /product/cool   <-- important
// won't match /product/foo    <-- important

app.all( "/product/*" , handler);
// won't match /product        <-- Important
// will match /product/
// will match /product/cool
// will match /product/foo

Comment: At least in [v4, app.use](http://expressjs.com/4x/api.html#app.use) takes one *or more* middleware functions, not "only one".
Comment: app.use only see whether url starts with specified path;app.all will match complete path. this is main difference.
Comment: @frogcjn no it should not as it ignores the * and / in my question.
Answer:
app.use:

inject middlware to your front controller configuring for instance: header, cookies, sessions, etc.
must be written before app[http_method] otherwise there will be not executed.
several calls are processed in the order of writing

app.all:

(like app[http_method]) is used for configuring routes' controllers
"all" means it applies on all http methods.
several calls are processed in the order of writing

Look at this expressJs code sample:
var express = require('express');
var app = express();

app.use(function frontControllerMiddlewareExecuted(req, res, next){
  console.log('(1) this frontControllerMiddlewareExecuted is executed');
  next();
});

app.all('*', function(req, res, next){
  console.log('(2) route middleware for all method and path pattern "*", executed first and can do stuff before going next');
  next();
});

app.all('/hello', function(req, res, next){
  console.log('(3) route middleware for all method and path pattern "/hello", executed second and can do stuff before going next');
  next();
});

app.use(function frontControllerMiddlewareNotExecuted(req, res, next){
  console.log('(4) this frontControllerMiddlewareNotExecuted is not executed');
  next();
});

app.get('/hello', function(req, res){
  console.log('(5) route middleware for method GET and path patter "/hello", executed last and I do my stuff sending response');
  res.send('Hello World');
});

app.listen(80);

Here is the log when accessing route '/hello':
(1) this frontControllerMiddlewareExecuted is executed
(2) route middleware for all method and path pattern "*", executed first and can do stuff before going next
(3) route middleware for all method and path pattern "/hello", executed second and can do stuff before going next
(5) route middleware for method GET and path patter "/hello", executed last and I do my stuff sending response

Comment: After running this example verbatim on express 4.x, it actually runs all 5 in order.  This is likely due to changes in express in the almost 3 years since this was written, but I just thought I would add this for clarity.
Answer: With app.use(), the "mount" path is stripped and is not visible to the middleware function:
app.use('/static', express.static(__dirname + '/public'));

Mounted middleware functions(express.static) are not invoked unless the req.url contains this prefix (/static), at which point it is stripped when the function is invoked.
With app.all(), there is no that behavior.
Comment: This is the correct answer to the question which still is true in 2018! A middleware can be mounted with all() too ... the only difference is that the mount path is stripped when executing the middleware.
Comment: The question explicitly ask about app.use('/', ...) only.
Answer: Yes, app.all() gets called when a particular URI is requested with any type of request method (POST, GET, PUT, or DELETE)
On other hand app.use() is used for any middleware you might have and it mounts onto a path prefix, and will be called anytime a URI under that route is requested.
Here is the documentation for app.all & app.use.
Comment: thanks but I think you missed the app.all wildcard and app.use root path which make them pretty much exactly the same thing don't they? Except that app.all can take an array of callbacks and app.use can only take one - right?
Answer: Two differences all above answers don't mention.
The first one:
app.all accepts a regex as its path parameter. app.use does NOT accept a regex.
The second one:
app.all(path, handler) or app[method](path, handler) handlers' path must be same to all path. This is, app[method] path is complete.
app.use(path, handler), if use's path is complete, the handler's path must be /. If the use's path is the start of the complete path, the handler path must be the rest of the complete path.
app.use("/users", users);

//users.js: the handler will be called when matchs `/user/` path
router.get("/", function (req, res, next) {
    res.send("respond with a resource");
});

// others.js: the handler will be called when matches `/users/users` path
router.get("/users", function (req, res, next) {
    res.send("respond with a resource");
});

app.all("/users", users);

//others.js: the handler will be called when matches `/`path
router.get("/", function (req, res, next) {
    res.send("respond with a resource");
});
//users.js: the handler will be called when matches `/users` path
router.get("/users", function (req, res, next) {
    res.send("respond with a resource");
});

Answer: There are two main differences:
1. pattern matching (answer given by Palani)
2. next(route) won't work inside the function body of middleware loaded using app.use . This is stated in the link from the docs:

NOTE: next('route') will work only in middleware functions that were loaded by using the app.METHOD() or router.METHOD() functions.

Link: http://expressjs.com/en/guide/using-middleware.html

The working effect of next('route') can be seen from the following example:
app.get('/',
(req,res,next)=>{console.log("1");
next(route); //The code here skips ALL the following middlewares
}
(req,res,next)=>{next();}, //skipped
(req,res,next)=>{next();}  //skipped
);

//Not skipped
app.get('/',function(req,res,next){console.log("2");next();});


Why must I press Enter twice for cin statements using Netbeans 7.3.1 and the latest MinGW toolset?

Question: I have recently upgraded to Netbeans 7.3.1 and have switched my compilation tools from Cygwin to MinGW, and something I noticed, is that when I build and run my project within Netbeans 7.3.1 and it runs within the Netbeans terminal, I have to press Enter twice for every cin statement I have in my code; whereas with the Cygwin tools and Netbeans 7.3, I never had to double enter within the terminal.  I also have noticed that my input no longer shows up in the terminal as it did with 7.3 and Cygwin, so I can no longer see what I have typed into the cin statement while I'm typing it, as I was able to with 7.3 and Cygwin tools.
I do not understand why I have to press enter twice in the Netbeans terminal compiled using Netbeans 7.3.1 and MinGW, whereas in Netbeans 7.3 and using Cygwin I did not have to do so; and also, why my cin input does not show up as it did in Netbeans 7.3 and Cygwin.
Does this have to do with settings for Netbeans 7.3.1?  Is this normal when using MinGW?  In my days of Visual C++ 6.0 and Windows programming in the early 2000s (2003ish), I noticed that if there was not a 'system(PAUSE)' or a 'cin' or something to catch input before the return 0 of the main() function, it would immediately close out and you couldn't even see the console; is this the same kind of problem/issue when using MinGW?
I have recently been working on creating a .h file out of the many .h files I had, for a TxtRPG engine I have decided to work on, that you may find here:
.h and .cpp source
At first I was concerned that the above might be the issue, but, even after making the basic C++ application in Netbeans 7.3.1 and doing a simple 'hello world' program with some cin statements, the double enter problem still remains. . .
I am concerned about the double enter because this has never happened to me ever, in all of my years of my self-taught programming, and I'm kind of a perfectionist.  If the other 'text doesn't show up as I type it' is a normal thing with the MinGW tools, I can deal with that; but this double enter has to go.
Thank you all for your time!!
Answer: Right click on your project -> properties
Go to Run
Set Console type to Standard Output


Mac Air 13" Wi-Fi Hardware Issue

Question: I have a MacBook and the other day i spilled a little bit of water on to it, nothing big or anything i soaked it up with the towel. The next day it would not turn on but eventually i managed to turn it on. However, the wifi started displaying stating that it had no hardware installed. I tried the shift+ctrl+option+power button restart and it started working again. However, after 20/30 mins it stopped working and it continuesly said wifi off and it would not let me turn it on. I spoke to an apple worker and they said it is a hardware problem, they did a diagnostic on it. Everything else works perfectly, i just wanted to know if this could be due to the water spillage (so i can prepare myself for a big bill) or is it just a general hardware problem (also have looked into the settings and it says Thunderbolt 1 inactive). If anyone could help i would appreciate it so much. Thanks
Comment: I managed to "resurrect" a mac that had water spilled into it by drying it out after taking out components etc But the one that had had beer split in it did not ressurrect... even after cleaning everything...
Answer: In a word, yes.
If I may 'esplain. While it is possible that a board level repair shop might be able to resurrect the system to full functioning. Cleaning, drying and the like.
You didn't specify the model year of your MBAir but in this case I am not sure it matters as MBAirs are famous for being small and light and generally not upgradable. I believe (not sure but pretty sure) that the WiFi radio is likely integrated into the system board and not replaceable. Or not easily replaceable unless you find someone to do board level repair and have them replace the damaged components.
If a new Mac is not currently affordable you might find a USB WiFI adapter that is Mac compatible and that would give you WiFi at the expense of having a USB stick sticking out of your MBAir all the time.
Comment: The Mac is technically brand new, I bought it 4 months ago for my uni studies and ive been told they last quiet a while as long as you look after them, which i clearly havent. I was worried that might have been the answer. Thank you for answering and explaining
Answer: The problems are almost certainly related to the water spill, and not just some other concurrent problems.
Even a light spill can cause 'fatal' damage, and even if the Mac works initially, it may fail in some way a short time after.
You may want to check if you have insurance that covers this. Household contents policies can cover accidental damage. Some credit cards also offer insurance on recent purchases.
Answer: I feel for you! I knocked a glass of water onto my beloved 11" MacBook Air years ago and completely ruined it. My solution, ultimately, was to get a data recovery company to extract an image of my data off of the SSD and (eventually) get a new laptop.
Steve's suggestion of using a USB wi-fi dongle is a great one! Some of the new ones are very small, so I don't think you'll feel your laptop is too bulky:
https://www.amazon.com/TP-Link-TL-WN725N-wireless-network-Adapter/dp/B008IFXQFU/
I haven't tried this one, but it claims Mac compatibility.
Comment: Its the worst feeling , i dont think spending £950 on a new laptop again is an option for me . I will have a look into it, thank you.
Comment: Welcome to Ask Different! Please refrain from adding comments in the Answer section, this is for answers to the questions. Once you have sufficient [reputation](http://apple.stackexchange.com/help/whats-reputation) you'll be able to add [comments](http://apple.stackexchange.com/help/privileges/comment) and ask follow-up questions. To gain reputation, [answer questions that are clear and concise](http://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead).

Mac Air 13” Wi-Fi Hardware Issue


Transform a lat/lon coordinate to x/y pixel on a Google Earth screen

Question: For a given Google Earth URL
(for example https://firstname.lastname@example.com,-117.89835255,51.77456494a,140.84823168d,35y,0h,0t,0r)
I want to find the lat/lng coordinates of the corners of the screen, so that I can calculate any pixel location on the screen given the lat/lon. The screenshot of this Google Earth page would look like this:

For example in the above link the screen size is 1280 × 720. The coordinates 33.83405747,-117.89835255 would be the exact center, so the pixel coordinates would be (640,360). Now I want to calculate these coordinates for any given lat/lon(Of course, assuming they will lie on this field of view.)
The breakdown of a Google Earth URL would be this:

33.83405747 is latitude
-117.89835255 is longitude
51.77456494a is the altitude of the center from sea level(I think it includes the building height too, if there is any at the center. It is in meters).
140.84823168d is apparently the distance of the viewer from the center(not sure what the units are and apparently it is not from the sea level).
35y is the field of view.
0h is the heading
0t is the tilt
0r is the rotation of the view

I'm assuming that I'll keep heading, tilt and rotation always 0.
Answer: If the FOV is 35°, and the height is 193m, try:
<code>X = h tan(35°) = 135.14 m
dX = X/1280    = 10.56 cm
</code>
The numbers look reasonable, based on the image given.


What does a Vietnamese citizen with a green card need for a closed-loop cruise?

Question: The cruise is to Cozumel and Mahogany Bay out of a port in Florida (sorry I don't know which one). I assume having a green card doesn't actually get them an advantage over residents of Vietnam. I see that neither Mexico nor Honduras permit entry to Vietnamese passport holders without a visa. Is  there, by chance, an exception for cruises? If getting the visas is indeed required, is it difficult or just a matter of filling out a couple of forms?
Answer: The Permanent Resident Card only lets them back into the United States.
Non US Citizens will be traveling on their home Passport like any other trip, that it's a cruise doesn't matter so much.  They will need tourist or similar visas for any Ports of Call.
Example: Required Travel Documentation
Barring any unusual circumstances, getting Visas is usually just a bureaucratic procedure, some forms, some time, and a check.  You should visit the website of the Mexican and Honduran consulate for all the details.  (Note, the US PRC allows visa free entry to Mexico, but not Honduras.)
You might want to consider an itinerary that includes only countries that allow Visa-free entry to PRC holders.  Countries that Offer a Visa Waiver for US Green Card Holders
Also, the major cruise lines partner with Visa agencies that can facilitate the process.  The link will be on your line's Travel Documents page.
You will occasionally find exotic itineraries where if specific Visas cannot be arranged, the passenger will just not be allowed off the ship.  The country where the ship makes port has to allow this.  On a Caribbean milk-run, the cruise line itself might not want to deal with this.
Comment: The green card qualifies its bearer for a visa exemption in Mexico.  See https://consulmex.sre.gob.mx/sanfrancisco/index.php/visas-traveling-to-mexico.
Comment: @phoog Canada as well, but...neither NCL or RCI mention this detail.
Comment: @Johns-305 Is the word "not" missing from the clause "the passenger will just be allowed off the ship."?


How to create the other admin account in magento 2

Question: How to create the other Admin account in Magento 2.
How to give the customer account to Admin right?.
Answer: Create New Admin User
Step 1: Configure User Information
Step 2: Determine User Role
Step 1: Configure User Information
On the Admin panel, click system.  In the permission section, select add new user.
Step 2: Determine User Role
In the panel on the left, choose user role . The grid lists all the existing roles. Initially, the only role available is Administrators.
Answer: Procedure
The procedure involves two steps: adding the user role, then adding the user.
1: Add user role
If you wish to grant complete admin access to the user, you may skip to 2: Add user instead of creating a specific role. This will, however, involve granting the new user complete admin access and therefore access to all of your store's most critical areas. Use care when assigning the Administrator role.
Log in to your Magento Dashboard.
On the left, click System > User Roles (Figure 1).
Figure 1. Magento Dashboard; System > User Roles.
Click Add New Role (Figure 2).
Figure 2. Roles page; Add New Role button.
On the New Role page, enter the desired name in the Role Name field and your current password in the Current Admin Password field (Figure 3).
Figure 3. New Role page; Role Name and Current Admin Password fields.
On the left, click Role Resources (Figure 4).
Figure 4. New Role Page; Role Resources selection.
Attention: In Step 6, you will choose which permissions to assign to the new role. If you are unsure, consult with your developer. As always, take care when assigning permissions, as many grant secure access to critical areas of your store.
From the Resource Access drop-down list, select Custom if not already selected. Assign permissions as desired.
Figure 5. Resource Access drop-down list; Custom selection with associated check boxes.
Click Save Role (Figure 6).
Figure 6. Save Role button.
2: Add user
On the left, click System > All Users (Figure 7).
Figure 7. System > All Users.
Click Add New User (Figure 8).
Figure 8. Add New User button.
On the New User page, fill all fields in the Account Information and Current User Identity Verification sections (Figure 9).
Figure 9. New User page and relevant fields.
In the User Information section, click User Role (Figure 10).
Figure 10. User Information section; User Role selection.
Attention: In Step 5 below, if you assign the default Administrators role instead of a custom role, that user will have complete access to all of your store's most critical areas. Use care when assigning this role.
In the Assigned column, select the check box corresponding to the role you created in the "1: Add user role" section (Figure 11).  If you want to grant complete admin access, select the Administrators check box.
Figure 11. Sample new_role check box.
Click Save User. If the procedure was successful, you will now see the admin user represented in User list on the User page (Figure 12).
Figure 12. Newly created sample user on User Page.


Difference between constant and value in AngularJS

Question: What is difference between constant and value? we are able to change both values.
var app = angular.module('myApp',[]);
app.constant('appName','My App');
app.value('applicationName','Sample');

Comment: Possible duplicate of [AngularJS: Constants vs Values](http://stackoverflow.com/questions/30327651/angularjs-constants-vs-values)
Answer: 1) constant's value can not be change
2) value's data can be change
1) constant can be injected any where
2) value can be injected in controller, service, factory but can't be injected in config.
sample
var app = angular.module('app', []);

app.value('greeting', 'Hello');

app.config(function(greeting){
    var radius = 4;
    //PI can be injected here in the config block
    var perimeter = 2 * PI * radius;
});

the below code will give error because trying to inject value into config.
Answer: Constants can put anywhere whereas Values cannot be added anywhere. Also constants cannot be intercepted by decorators whereas values can be intercepted by decorators.
Also refer: Value and Constants

The difference between a value and a constant service is that the
  former can only be injected (and thus be used) in a service or a
  controller while the latter can also be injected into a module
  configuration function.. (I will discuss the module configuration
  function in a future post).
Answer: good explain is here:

Constants are great for values that never change. If you need to access values within config function calls to configure routes or anything else when your application first starts, constants are what you should use.
Values are great for pieces of data that can and will change. As shown above user data or anything else where you simply want to keep a reference to a changing value stored globally without creating a messy global variable.

full article: Constants & Values: Global Variables In AngularJS The Right Way


Linear regression intercept proofs

Question: Consider that $b_{0} = Y_1 - b_1X_1$ where $Y_1$ and $X_1$ here are the mean values for each.  How would I derive the variance and other properties for $b_0$?
I'm not very good at doing proofs in statistics.  Thanks in advance.
Answer: Disclaimer: I realize now, that you might be looking for a sketch of a simpler proof. I thought about not submitting this (partial) proof as an answer, but I guess someone else might find it useful. I'll try to add a simpler proof for the K=2 case (simple linear regression) later, if someone else doesn't do it.
How to derive the variance for the OLS parameter estimates
There are many ways to derive the variance-covariance matrix for the problem you are stating. What you are actually missing are explicit assumptions about your model. Since you have not stated anything, I will make a harsh but popular assumption: homoscedasticity of the error term:
$$
E(u^2x'x)=\sigma^2E(x'x)
$$
Given this assumption (along with your standard assumptions: linearity, random sample, population orthogonality $E(x'u)=0$ and rank $E(x'x)=K$) you can derive the variance-covariance matrix for $\beta=(\beta_0,\beta_1)$.
There are many ways to do this, and this is just one. It is as presented in Wooldridge (2010), but you could find variations of this depending on your textbook. First off let os consider the following:
$$
\sqrt{N}(\hat\beta-\beta)=\left(N^{-1}\sum^N_{i=1}x_i'x_i^{\,}\right)^{-1}\left(N^{-1/2}\sum^N_{i=1}x_i'u_i^{\,}\right)
$$
If you can derive $\hat\beta$ you should be able to show this result. We are not quite done, though. There are two things to consider here. The first factor can be shown to fulfill the following:
$$
\left(N^{-1}\sum^N_{i=1}x_i'x_i^{\,}\right)^{-1}-A^{-1}=o_p (1)
$$
where $A=E(x'x)$.  For the second factor we have that the sequence $(x'_iu_i^{\,})_{i=1,...,N}$ is i.i.d. with mean zero. If we assume each element has finite variance, a Central Limit Theorem applies and thus:
$$
U=N^{-1/2}\sum^N_{i=1}x_i'u_i^{\,}\overset{d}{\to} \text{Normal}(0,E(u^2x'x)).
$$
Where are we then? Basically we can express $\sqrt{N}(\hat\beta-\beta)$ as a product of a non-random matrix $A^{-1}$ and a factor we know the assymptotic distribution of ($U$), because:
$$
\sqrt{N}(\hat\beta-\beta)=\left(N^{-1}\sum^N_{i=1}x_i'x_i^{\,}\right)^{-1}\left(N^{-1/2}\sum^N_{i=1}x_i'u_i^{\,}\right) \\
=(A^{-1}+o_p (1))\left(N^{-1/2}\sum^N_{i=1}x_i'u_i^{\,}\right) \\
=A^{-1}\left(N^{-1/2}\sum^N_{i=1}x_i'u_i^{\,}\right)+o_p(1)\cdot O_p(1) \\
=A^{-1}\left(N^{-1/2}\sum^N_{i=1}x_i'u_i^{\,}\right)+o_p(1)\\
=A^{-1}U+o_p(1)
$$
Now remember $A=E(x'x)$, our homoskedasticity assumption and our assymptotic distribution of U. These three things (and the above derivation) give us:
$$
\sqrt{N}(\hat\beta-\beta)\overset{a}{\sim} \text{Normal}(0,E(x'x)^{-1}\sigma^2 E(x'x) E(x'x)^{-1})\\
\sqrt{N}(\hat\beta-\beta)\overset{a}{\sim} \text{Normal}(0,E(x'x)^{-1}\sigma^2)
$$
You can find your $Avar(\hat\beta)$ from this. In your case you will end up with a 2x2 diagonal matrix, and your variance estimate for the first parameter will be the first diagonal element.
Answer: Start by assuming all the classical OLS properties to hold, in addition to a stochastic interpretation of your RHS variables. First, simply take the variance of your expression (notice the conditioning on $X$)*:
\begin{align}
{\rm Var}(b_0|X) &= {\rm Var}(Y_1 -b_1 X_1|X)  \\
           &= {\rm Var}(Y_1|X)+X_{1}^{2}{\rm Var}(b_1|X)-2X_1{\rm Cov}(Y_1,b_1|X)
\end{align}
Now plug in
${\rm Var}(Y_1|X)=\frac{\sigma^2}{n}$ (if you have assumed IID data)
${\rm Var}(b_1|X)={\rm Var}(M_{XY}/M_{XX}|X)=\frac{\sigma^2}{n\hat{\sigma}_{X}^2} $ (Proof is straightforward, but cumbersome in notation, so I'm omitting it since you asked about $b_0$)
${\rm Cov}(Y_1,b_1|X)=0$. The only proof I know of this is somewhat long. Maybe someone else knows a short and handy one?
Combining this, you get: ${\rm Var}(b_0|X)=\frac{\sigma^2}{n}+X_{1}^{2}\frac{\sigma^2}{n\hat{\sigma}_{X}^2}
$
*I assume you are interested in the $\hat{b}_0$, so please read the above as such.

Linear regression intercept proofs


Order Replacement Trade-off for a Market Maker

Question: Whenever we replace an order, we lost priority since we are added to the end of the queue. If we dont replace an order, there is an obvious chance that we might get picked. There are other situations possible, when we replace deeper back and forth in the book and keep losing priority. Is there any literature which discusses this trade off and what is an optimal way of replacing orders?
Comment: > we might get picked Can you elaborate? If the order reflects your intention to buy, why is it bad if a counter order is matched? Also, some exchanges support ORDER_MOVE which can be used to speed-up price changes.
Comment: as a market maker, i need to replace my order if the market moves, else i will be picked and traded at the wrong price.
Comment: I'd be curios to learn more about this topic as well, but the simple solution is to cancel all orders in periods of volatility, unless the data feed for the underlying runs on microwave from the rooftop tower.
Answer: they are now plenty of academic resources to address the point of interacting with liquidity via limit orders:

Stochastic control is the best way (it's optimal!) but you need a model of liquidity dynamics: Charles-Albert Lehalle, Othmane Mounjid, and Mathieu Rosenbaum. "Optimal liquidity-based trading tactics." Stochastic Systems 11, no. 4 (2021): 368-390.
the Queue Reactive Model is probable the best suited that for: Huang, Weibing, Charles-Albert Lehalle, and Mathieu Rosenbaum. "Simulating and analyzing order book data: The queue-reactive model." Journal of the American Statistical Association 110, no. 509 (2015): 107-122.
if you want a model free version, use Reinforcement Learning (RL) and look in the examples of this paper: Mounjid, Othmane, and Charles‐Albert Lehalle. "Improving reinforcement learning algorithms: towards optimal learning rate policies." Mathematical Finance (2019).

If you want to focus more on the price at which you post than on the queuing strategy, you may have a look at this paper: Laruelle, Sophie, Charles-Albert Lehalle, and Gilles Pagès. "Optimal posting price of limit orders: learning by trading." Mathematics and Financial Economics 7, no. 3 (2013): 359-403.
It is a RL approach to guess the best price by trial and error.
And if the most important for you is the sequence of quotes you will offer during the day, having in mind to finish the day with zero inventory, this one is for you: Guéant, Olivier, Charles-Albert Lehalle, and Joaquin Fernandez-Tapia. "Dealing with the inventory risk: a solution to the market making problem." Mathematics and financial economics 7 (2013): 477-507.
Answer:
An order loses time priority when its replace size is higher than current size at same price.
An order does not lose time priority when replace size is lower or equal to earlier size at same price.

Build a probabilistic model of order being filled at various price depths and sizes.
Doing this for a single instrument uncorrelated is comparatively simpler, however for correlated instruments like options of same underlying is harder.
You may refer to the following -
Guo, Xin, Zhao Ruan, and Lingjiong Zhu. "Dynamics of order positions and related queues in a limit order book." arXiv preprint arXiv:1505.04810 (2015).
Moallemi, Ciamac C., and Kai Yuan. "A model for queue position valuation in a limit order book." Columbia Business School Research Paper 17-70 (2016).
Comment: different exchanges and different products have different prioritisation algorithms. Also how orders are programatically interfaced with the exchange may affect their priority.
Comment: thats absolutely true - CME itself supports multiple matching algorithms for different products - https://www.cmegroup.com/confluence/display/EPICSANDBOX/Supported+Matching+Algorithms
Answer: There is no easy answer when it comes to deciding whether or not to replace an order. Each situation is unique and must be evaluated on its own merits. However, there are some general guidelines that can be followed in order to make the best decision possible.
Whenever possible, try to avoid replacing an order. This is because each time an order is replaced, you lose your place in line and are added to the end of the queue. This can obviously have a negative impact on your chances of getting picked.
There are other situations where replacing an order may be beneficial, such as when you are deeper in the book and have a better chance of getting picked. In these cases, it is important to weigh the pros and cons of replacing an order before making a decision.
The best way to evaluate whether or not to replace an order is to consult with literature on the subject. This will help you to understand the trade-offs involved and make the best decision possible.


Dyson air blade principle as a propulsion system for an autonomous underwater vehicle?

Question: Any thoughts on applying this principle to an AUV (autonomous underwater vehicle) ?
if the power source is a battery, would its efficiency be beneficial to that of a propulsion system?
Comment: This is more of an engineering question.  It may be possible and the efficiency would depend heavily on the design so there is no straightforward, objective way to really answer this question.  Primary losses in underwater propulsion come from friction losses (moving propellor through water) and rotation losses (swirling water does not contribute to propulsion).  The Dyson configuration might eliminate the latter, but the friction losses incured to generate the laminar stream in this way may completely consume those profits.  The only answer here can really be a full design and analysis.
Comment: Take note, also, that the link above talks about generating *lift*, while your question is more about *thrust*.  Some of the arguments won't apply.  The critical differences here are that : 1) air is compressible and water is not; pumping water through a tight, circuitous path is likely going to be very inefficient - and 2) water is dense and viscous; again, squeezing and squirting it around is not what you want to be doing.  Look up, for example, ring thrusters as examples of propulsion optimized for water : http://tinyurl.com/k3t2ovf
Comment: There is nothing special about dyson air blades other than clever marketing and a nice mechanical package.
Comment: also : http://physics.stackexchange.com/q/82127/44080
Comment: I suppose the final take is that anything you would end up deriving from this idea to adapt to water would end up needing so many modifications to work efficiently that you would end up with something that looked nothing like the Dyson fan you started out with.
Answer: Dyson fans are NOT efficient (despite claiming otherwise). They emit about 1 gram of high-speed air for every 10 grams of air accelerated. Sounds efficient, right? No!
The Dyson fan is analogous to throwing a 1kg dart at 10 m/s toward at a 9kg target sitting on ice. The resulting dart+target has a velocity of 1 m/s (momentum conservation). However, the dart contained 0.5*1*10^2 = 50J of kinetic energy, but the ensemble ends up with only 0.5*10*1^2 = 5J of energy. The "missing energy" went into making a hole in the board and heat.
Your boat have the same issue. In fact, using a "multiplier" does not increase the thrust over a simple jet, since the momentum is the same. Thus it's better to push more water at a lower speed. When a boat is traveling at a constant speed, the propellors don't actually push the water backward all that quickly. There is no wasteful high speed jet.
However, regular fans are probably inefficient also because they use low quality parts. At $200, Dyson makes up for the mechanical inefficiency with better motors, etc.


Update giveaway quantities in Google forms

Question: I am in charge of giving away a number of T-shirts which come in different sizes and colors, but they are limited in quantity. I wanted to create a Google Form for giving the T-shirts away, but I do not want people to fill out the form thinking that they would get a T-shirt color/size combination that other people have claimed already. Is it possible to show the number of T-shirts left in Google Forms, if the user chooses a color/size combination, and decrement this number if the user has chosen it?
Answer: Yes, it's possible. You should use an add-on or Google Apps Script to update the remaining quantity.
Maybe the best option is to do the update on on each submission but this will depend on how often you get a submission. Also, the remaining quantity will not be precise all the time.


iAds not showing in released iPhone app

Question: I just my app got approved and when I downloaded the app ,iAds are not showing up, when I saw the status of iAds it says"You have enabled at least one application for iAd, but you will not be able to view the iAd Network module or set your ad preferences until you have an iAd Network Contract in effect.", Although I have setup all my contacts informations for setting iAds and it also show effective date.If anyone get the same thing please let me know the solution.
Comment: You might be missing some configurations into your itunesconnect app details for iAd
Answer: Looks like you are missing a contract agreement. Login to itunesconnect.apple.com, go to the Contracts, Tax and Banking section and fill in the contact info and bank info for iAd network.
If you have them in place, it might be that Apple is verifying the info. As soon as it is verified, your ads should start working.
Answer: I have solved my problem by mailing and contacting apple. Its look like they have forget to enable the iAds, when I contacted them, my iADs are started running live next day.

iAds not showing in released iPhone app


Questions/answers marked as spam

Question: How can I mark a question or an answer as spam and where can I find the list of Q/A marked as spam? I had an answer marked as spam, and, if I saw the list, I would probably delete it avoiding the penalty of 100 reputation points.
Comment: In this specific case, Maurizio, several people commented on the poor quality of that answer, which you dismissed, somewhat rudely, in later comments.  A later comment, which you might or might not have read, mentioned that the answer was being marked as spam.  I find your comments here somewhat disingenuous.
Comment: @Michael: I don't understand what you mean with: "which you dismissed, somewhat rudely, in later comments". What comments are you referring to?
Comment: @Maurizio, I'm referring to your comment "If you are so frustrated by my answer, ignore it without increase my reputation."
Comment: @Michael: I answered in that manner because I think that the first comment (You've got over 50 reps. You can just leave a comment.) was so rudely too. After doing that, I didn't see that page again and this evening I found my reputation decreased and I asked here what's happened.
Comment: So, to recap, you were aware your answer was unnecessary ("Ok, pheraps a duplicate, but not a spam"), you don't care about it being marked as spam ("And I didn't care about penalties for spam, because my answer was not a spam"), and other users had warned you about the way things were headed ("@Maurizo: you should probably be aware that there is a -100 penalty for spam. This post is at the top of the flagged-as-spam list and is about to reach the number of votes necessary to be penalized.").  You're not putting yourself in the best light here.
Comment: @Michael: I agree with everything you're saying, but remember he almost certainly didn't see the last comment regarding existing flags. (I happened to notice the MSO post as it was happening, he'd have had to been watching for it. http://meta.stackexchange.com/questions/43183/what-should-be-done-with-i-agree-with-x-answers)
Comment: @Gnome: you're right about that.  I think what bothers me here is the OP's reluctance to delete what he knew was a poor answer unless there was a penalty to be avoided.
Comment: Pheraps my poor english doesn't help me, or pheraps you like offending people (comments disingenuous, best light, ...). With I didn't care about penalties, I mean that I didn't consider it as a spam. I think that it is better to close here the discussion to avoid boring other people. Bye, have a good evening.
Comment: @Maurizio: Don't take it the wrong way, we're just describing what happened.  You might find the answers on the post I linked to just above useful to see *why* your answer shouldn't have been an answer, or you could ask about it in another meta question if you are still confused.  It's not about taking offense, as such.
Comment: @Gnome: Thank you for your answer and for your link. I didn't read that before. I am happy because there I find some people that thought that my post was not a spam.
Answer: You can only see flag votes if you have over 10k reputation.
10k rep users have a list of all questions/answers marked as spam, along with the counts for each.
Comment: The flag-queue no longer exists in the 10K tools so for us mortals we don't see those posts and flags anymore.
Answer: There isn't a list. Human beans use their judgement to decide when a post is spam. I flag spam when it seems to me that the post is primarily flogging traffic somewhere or pushing a product without either asking or answering a question.

Questions/answers marked as spam


Should the Canon EOS 6D get hot when connected to Wi-Fi?

Question: I just got a Canon EOS 6D. When it is connected to a Wi-Fi network and used for remote shooting and transferring files to a smartphone, after barely 5 minutes the camera becomes hot. Is this normal?
Comment: How hot does it get? What's the temperature of the surrounding environment? Ae you constantly transferring photos during these five minutes?'
Answer: No, it is not normal for a Canon 6D to get hot while transferring images via Wi-Fi.
I do this all of the time for 10-15min intervals and have never noticed the camera even warming a bit, while the camera is sitting in my lap. The images themselves are extremely lightweight for the transfer, its not like it is maxing out a Wi-Fi connection in the least.
I would be interested to know if you have Live-View on during this activity or not, as I do not when transferring files(because I'm using my mobile device to download the images and view).


Why would GradientBoostClassifier do better than XGBoostClassifier?

Question: I am working on the Kaggle home loan model and interestingly enough, the GradientBoostClassifier has a considerably better score than XGBClassifier. At the same time it seems to not overfit as much. (note, I am running both algos with default settings).
From what I've been reading XGBClassifier is the same as GradientBoostClassifier, just much faster and more robust. Therefore I am now confused on why would XGB overfit so much more than GradientBoostClassifier, when it should do the contrary? What would be a good reason why this is happening?
Comment: Well, not really, I know what the differences are. I am more interested in what context GBM can have a higher score and overfit at a lesser degree than XGBoost. Knowing the difference, it's a bit strange for this to happen. Which is what I am observing.
Comment: It does not make sense to compare such algos without tuning.
Comment: I think it makes a lot of sense, you can see from the beginning what is worth spending time on hyper parameter tuning and what is not worth spending time on
Answer: GradientBoostClassifier is slower but more precise. In your case, it could be finding a better model without suffering from overfitting.
Here are some of the main differences you are looking for.
XGBClassifier was designed to be faster. However, XGBClassifier takes a few shortcuts in order to run faster. For example, to save time, XGBClassifier will use an approximation on the splits, not spend so much time on calculating and evaluating the best splits. Usually XGB results will be close and you won't see much difference, but your case could be an exception.
If you are still curious, you can try changing some parameters in the XGBClassifier model, such as the tree_method='exact' or you can modify the sketch_eps parameter in XGBClassifier to more closely match the GradientBoostClassifier results. Of course, this will slow down the XGBClassifier model as a result.
sketch_eps [default=0.03]
Only used for tree_method=approx.
This roughly translates into O(1 / sketch_eps) number of bins. Compared to directly select number of bins, this comes with theoretical guarantee with sketch accuracy.
Usually user does not have to tune this. But consider setting to a lower number for more accurate enumeration of split candidates.
range: (0, 1)
Comment: ya, this answer helps. Also, if I Grid Search, then XGBoost does do better than GB. However, as you said, it takes a bit longer, though in the same time it's easier to use a GPU on XGBoost.


Book about a pair of siblings that had powers, the younger brother had powers to control people but concealed it the whole time?

Question: I think the book had dragon in the title not too sure. The older sister I think had ability to control fire I think. They somehow ended up in a castle. I can't remember much of it.
Comment: About when did you read it and/or about how old was it when you did read it ?  Children's, Young Adult or Adult oriented ?
Comment: I see no indication that the answer here was accepted by user42894, so we can't mark it as a duplicate.
Comment: @FuzzyBoots There is a comment on Trish's answer which was unfortunately deleted: "*Thanks! I'm pretty sure that its! – user42894 Mar 12 '15 at 20:28*"
Comment: @Randal'Thor: Is it possible to restore that comment?
Comment: @FuzzyBoots No :-( It was deleted by a user flag and can't be mod-undeleted.
Answer: I want to say The Secret of Dragonhome by John Peel, published in 1998.

Melayne and her young brother Sarrow are Talents, hunted by the King's
  relentless Seekers. If their Talent is discovered, they will be sent
  to their death. So they must hide...or die.
Melayne and Sarrow find refuge at Dragonhome, the mysterious estate
  (read: castle) of the shadowy Lord Sander. Lord Sander also has something to hide--a dark and fantastical secret that haunts his every
  move. In order to save herself and her brother, Melayne must confront
  forces much stronger than her talent--tempests of magic, desire, and
  betrayal. If Melayne is not careful, her truth will be revealed.
Melayne must unlock the secrets of Dragonhome. As danger approaches,
  it will be her only hope.

Melayne has the ability to talk to animals and Sarrow isn't quite sure what his is yet for most of the book. I haven't read the book in a really long time, but I do believe it's revealed that he has the Talent to influence/control and  he may or may not have been controlling his sister.
Edit: I just pulled my copy off the shelf and indeed near the end of the book Sarrow's Talent is revealed:

"Your brother has a Talent all right...One of the strongest and rarest I've ever seen. He has the gift of Persuasion...He plays innocent, but he's aware of his Talent...But now that you're aware of what he can do, it won't work on you. He can only Suggest, not Control, thank the good God."

Sarrow betrays his sister and joins the people hunting them. In his words:

"I can control humans simply enough, but Talents are harder. You slipped out of my control without even knowing it. I can't chance more Talents being born."

"
book cover:
Comment: @user42894 Don't forget to click that checkmark to accept it!