series of the integrals converges then the series converges almost surely

Question: I know this was asked but I want a proof of this without using Fubini theorem. Anyway the first part of the problem can't be concluded using Fubini. I don't know how to do it :/
Let $f_k:\mathbb R \to \mathbb R$ be a sequence lebesgue measurable and integrable functions such that:
$$\sum{\int{|f_k|}dm}<\infty $$
Prove that $\sum{f_k}$ converges almost surely and:
$$\sum{\int{|f_k|}}<\infty= \int{\sum{|f_k|}} $$
My proof:
Given $\varepsilon >0$ there exist $N$ such that
$$ \sum_{k=N}^{\infty}{\int{|f_k|dm}}<\varepsilon $$
Then:
$$ \sum_{k=1}^{\infty}{\int{|f_k|dm}}= \sum_{k=1}^{N-1}{\int{|f_k|dm}}+\sum_{k=N}^{\infty}{\int{|f_k|dm}}=\int{\sum_{k=1}^{N-1}{|f_k|dm}}+\sum_{k=N}^{\infty}{\int{|f_k|dm}}
\le \int{\sum_{k=1}^{\infty}{|f_k|dm}}+\sum_{k=N}^{\infty}{\int{|f_k|dm}}
\le \int{\sum_{k=1}^{\infty}{|f_k|dm}}+ \varepsilon
 $$
This holds for each $\varepsilon >0$ therefore
$$ \sum_{k=1}^{\infty}{\int{|f_k|dm}} \le \int{\sum_{k=1}^{\infty}{|f_k|dm}} $$
Similarly:
$$ \int{\sum_{k=1}^{\infty}{|f_k|}}= \int{\sum_{k=1}^{N-1}{|f_k|}}+\int{\sum_{k=N}^{\infty}{|f_k|}}=\sum_{k=1}^{N-1}{\int{|f_k|}}+\int{\sum_{k=N}^{\infty}{|f_k|}}$$
If I prove this I'm done:
$$\lim_{N\to \infty }\int{\sum_{k=N}^{\infty}{|f_k|}}=0$$
Therefore it's enough to prove that $\sum_{k=1}^{\infty}{|f_k|}$ converges almost surely.
Comment: You can cite a proof of your problem in a well known book of Walter Rudin: Real and Complex analysis (1987). You read Theorem 1.38, page 29.
Answer: Hint: Consider $f\colon {\bf R}\times {\bf N}\to {\bf R}$ given by $f(x,k):=f_k(x)$.


How can I have a custom 7Zip batch script work like the "add to archive..." context menu action of 7Zip?

Question: I am trying to figure out a way to select several files and folders in Windows Explorer and add them to a password protected .zip archive using a batch script, 7zip and a custom context menu item.
Currently I have a .bat file that looks like this:
pushd %~f1
"%programfiles%\7-zip\7z.exe" a Archive.zip  -pPASSWORD %1

(pushd is necessary because I am using a UNC path)
I have added this file to the right click context menu and it can be executed on all filetypes and folders.
My problem is that if I have the %1 at the end of the batch script (see above) it only adds the  file I actually right-clicked on (regardless of how many files and folder I have selected), and if I leave out the %1 it adds all files and sub-folders in the current folder, not just those I selected.
Is there any way I could get this batch script to work like the "add to archive..." option of 7Zip (adding only the selected files and folder to an archive and nothing else)?
Thank you very much in advance!
Answer: Try replacing %1 with %* which will add all selected.


Uncertainty principle and measurement of the mass of Virtual particles

Question:
We can have real photons as well as virtual photons. However, I think we can have only virtual weak gauge bosons $W^{\pm},Z$. Is that correct?
If virtual particles are just a manner of interpreting the S-matrix elements at various orders, why something as physical as energy-time uncertainty principle is invoked to explain their fleeting existence? The mathematics of quantum field theory, as far as I know, doesn't give any such picture to take seriously.
Since, the virtual particles do not obey dispersion relations, how justified is the measurement of Z-boson mass using the four-momentum conservation as explained in the maximum voted answer here?
Comment: @AccidentalFourierTransform W or Z boson always appear in the propagator such as in the $e^+e^-\rightarrow \mu^+\mu^-$ scattering. Aren't they? And their masses are measured from such scattering events. Am I wrong?
Comment: @AccidentalFourierTransform- What do you think about the measurement of Z boson as answered in the link I have suggested? It appears to me that it assumes dispersion relation to be valid for the Virtual Z boson.
Comment: General comment: Since voting can at least in principle change the order of answers, it is preferred not to refer to SE answers by their popularity.
Comment: I think virtual refers to how closely a particle adheres to the mass-shell relation, i.e the longer it exists, the more it will tend to obey this relation.
Answer:
There are both virtual and real $W^{\pm}$, $Z$ bosons. Just as with photons (and for any other case), virtual $W^\pm$ and $Z$ bosons are some internal lines on Feynman diagrams and real $W^\pm$ and $Z$ bosons are some states of the electroweak theory.
The time-energy uncertainty principle is a specially tricky version of the uncertainty principle (see this question, for example). Some people might use it to give intuition about virtual particles. This kind of analogies are not to be taken too seriously.
The $Z$ boson mass was measured at LEP using electron-positron collisions. The cross section for the process that was used can be computed as a function of the center of mass energy $E$ of the final (or, equivalently, the initial) state. Around $E\sim M_Z$ this function has a bell shape peaked at $E=M_Z$ (in this kind of processes, the cross section is a Breit-Wigner distribution). By measuring many events at different $E$, the peak of the cross section can be found and the mass of the $Z$ boson is obtained.


Stream Ciphers clarification

Question: I am confused about stream ciphers a little so I just wanted to clarify. We have a key that's lets say 2 bits. I have a message that's 8 bits. I used a pseudorandom generator that would add 6 bits to my key. Those 6 bits are deterministic and public. Hence why it's called pseudorandom, it looks random but because the 6 bits are deterministic, it's not. So that makes my keystream, regardless of the key, those 6 bits will be added. Now I simply XOR with my original message?
Answer: That is one instantiation of an additive stream cipher over the binary alphabet under the assumptions:

The $k$ bit key is random and uniformly distributed
The pseudorandom generator takes the key as input and generates $n$ keystream bits. Sometimes it is iterated not $n-k$ times but more to remove the initial condition (i.e., the key) from the pseudorandom generator's state and to obtain enough mixing of the entropy from the key
the keystream bits are added modulo 2 to the original message stream and the resulting encrypted stream is transmitted.

Of course keylengths of $80-128$ bits (at least) are needed for security.
Nowadays, IV's and nonces are used in more complex ways for more security in modern stream ciphers.
See the following questions for more details on stream ciphers and their links to other primitives:
difference between stream cipher and block cipher
what is the difference between a stream cipher and a one time pad
what is the significance of iv in stream ciphers like trivium
Comment: Thank you very much.
Comment: if your question was satisfactorily answered you can accept the answer

Stream Ciphers clarification


He has cigarettes every day. = He smokes cigarettes every day.?

Question: He has cigarettes every day. =  He smokes cigarettes every day.  ??
Do these two sentences have the same meaning?
Thank you very much!
Comment: They do not have the same meaning. We can use 'have' to mean 'consume' about food and drink, e.g. he has meat every day, he has beer every day, but not about cigarettes.
Answer: They are pretty much the same, though "smokes" is far better.
I'd probably omit "cigarettes" - since that would be assumed, or irrelevant: "He smokes every day"
"He has cigarettes" does sound odd, but "He has a cigarette every morning" would be fine.
Answer: They do not mean the same.
We say 'He smokes cigarettes every day'. (NOT He has cigarettes every day)
We can say-
He has tea everyday. (=He drinks tea everyday.)
He has rice everyday.(=He eats rice everyday.)
(take medicine, breathe air, smoke cigarettes/a cigarette, have tea, have lunch etc.)
Answer: There is a [very] small possibility of misinterpretation, so just to run you through some of the options:
"I have cigarettes every day" could just mean I keep some in my pocket; even though I stopped smoking months ago, just in case I ever break down, lose my willpower completely, and just have to smoke one.
"I smoke cigarettes every day" is more precise. It's probably a little too precise. "I smoke every day", though it could imply cigars, or even that I stand too close to the fireplace until my clothing starts to smoulder… no-one is going to confuse it with that interpretation.
So, they are not identical. I doubt anyone would really care which you used, but the simplest "He smokes every day" would convey the intent quite adequately.
You could go the whole way and just tell us "He's a smoker."
That covers the entire concept in three [and a bit] words.


In Docker Swarm mode is there any point in replicating a service more than the number of hosts available?

Question: I have been looking into the new Docker Swarm mode that will be available in Docker 1.12. In this Docker Swarm Mode Walkthrough video, they create a simple Nginx service that is composed of a single Nginx container. In the video, they have 4 nodes in the Swarm cluster. During the scaling demonstration, they increase the replication factor to 10, thus creating 10 copies of the Nginx container across all 4 machines in the cluster.
I get that the video is just a demonstration, but in the real world, what is the point of creating more replicas of a container (or service) than there are nodes in the Swarm cluster? It seems to be pointless since two containers on the same machine would be sharing that machines finite computing resources anyway. I don't get what the benefit is.
So my question is, is there any real world benefit to replicating a Docker service or container beyond the number of nodes in the Swarm cluster?
Thanks
Answer: It depends on how the application handles threading and multiple requests. A single threaded application, or job that only handles one request at a time, may use a fraction of the OS resources and benefit from running multiple instances on a single host. An application that's been tuned to process requests concurrently and which fully utilizes the OS will see no benefit and will in fact incur a penalty of taking away resources to run multiple instances of the application.
Answer: One advantage can be performing live zero-downtime software updates. See the Docker 0.12rc2 Swarm tutorial on rolling updates
Answer: You have a RabbitMQ or other Queue System with a high load on data. You can start more Containers with workers than nodes to handle the high data load on your RabbitMQ.
Comment: Can you explain why RabbitMQ would benefit from this? Is this because RabbitMQ (and other queue systems perhaps) are single threaded?
Answer: Hardware resource constrain is not the only thing one needs to consider when you have your services replicated.
A simple example would be if you are having a service to provide security details. The resource consumption by this service will be low (read a record from Db/Cache and send it out). However if there are 20 or 30 requests to be handled by the same service the requests will be queued up.
Yes there are better ways to implement my example but I believe  is good enough to illustrate why one might replicate a service on the same host/node.


Remove the [.net] tag?

Question: There is a newly created tag .net with two closed questions using the tag. Since User Experience doesn't relate to specific frameworks, should we delete it or post a DO NOT USE in the Tag Wiki Excerpts?
Answer: Both questions were totally off topic and had no answers and no UX-relevant information, I just deleted the posts. The tag will disappear from the system soon as it's no longer on any questions.
Comment: Maybe we should do the same with the closed question having [tag:airplane] and [tag:aircraft]?
Comment: @BennySkogberg poof. Though note closed questions scoring -1 or lower with no answers are auto-deleted after a month
Comment: Cool, auto-cleanup on *.SO
Comment: I just did similarly to the [tag:backgound-images] tag (note the typo), but it didn't remove it from [the list](http://ux.stackexchange.com/tags?tab=name) for me (perhaps there's just a lag).
Comment: @KitGrose yeah, everything is cached for widely varying periods of time. Tag related stuff seems to take 5-10 minutes. It's fun when you mix up a tag synonym and do it twice and have no idea what the final result was for several minutes...
Comment: I'm still seeing it now (it's been there empty for 12+ hours). Worried I've missed a step!
Comment: @KitGrose do you mean the tag page or the list? Only the properly spelled version shows in the list for me. The /questions/tagged/ page always shows up even if the tag doesn't "exist", it just shows 0 questions
Comment: @BenBrocka it's now not showing in the list for me anymore. No worries!

Remove the [.net] tag?


Right campagolo gears slipping

Question: I have a set of Campagolo Athena 11 levels and the right one is slipping when changing down.  What is the problem and which part do I need to replace, please
Comment: Generally, just spraying the insides (squeeze the brake to gain access) with a good spray lube will do the job, without the need to disassemble everything.  But they can get to a point where this doesn't work and removal and cleaning is required.  Note that disassembly of the shifter itself is not always recommended, since there are lots of little parts that don't want to go back together.
Comment: Do you mean "levers"?  This symptom is generally due to gunked up lube in the levers, and they can be cleaned through one of several techniques.  Can also be due to sticky cables.
Comment: I mean the gearing within the brake/shifter (I refuse to call them brifters:).  Okay so if we degrease and relube that may work?
Comment: Yeah, that is not cutting it.  I think the dissaembly is on the cards.  Pretty okay with this sort of thing (got a sturmey archer back together okay!).  Do you know of any exploded views available online?  Thanks for the help.
Answer: There's a few different reasons for this. Without knowing the exact method of cable routing for your brifters (yeah, I went there) then the instructions could me re-wrapping the bars or fishing cables out of your frame, but i'll order them in least amount of work first (and re-suggest above already failed instructions for reference)
Make sure it is actually the brifters not malfunctioning and not the derailleur getting caught on something or chain having a stiff link.
1. Cleaning the shifter while on the bike
The best method of going this is properly giving the insides a de-grease and re-grease.

Get some water soluble de-greaser in a spray can. Gain access to the mechanism by going from underneath or pressing the brakes.
Spray all up inside the shifters, break down the grease and crap stuck to it.
Flush out the inside with water. A jet-wash is probably too powerful for this, it can bend metal, but a hose with a directional powerful spray will probably work.
Dry the insides. Use an air compressor, or what WD-40 was intended for (water displacement!) and wait for it to properly dry
Spray in a medium heavy grease, white lithium grease is available in a can. Spray a little in and move/shift a few times, then a little more. Don't overpack it, but you want a reasonable amount.

If this doesn't work:
2. Replacing gear cable inners
Sometimes water and other debris can get into the inside of the cable, or the wires can fray, causing drag or slip from not properly engaging.

Shift into 11th gear (assuming regular derailure pull) so the cable is slack
Remove the access caps for the cable, losen the pinch bolt on the derailleur and pull the cable all the way out through the brifter
Replace with a good quality inner cable. Standard is 4mm.

If that doesn't work:
3. Replacing gear cable outers
The inner coating of the outer cables can wear away and make shifting slugish or stick. Once this happens they can catastrophically fail and no shifting is possible.
 - After removing the inner cable (above)
 - Replace the outer cables (you can reuse the ferrules if they're not damaged) by cutting them to the same length with as old a dremel or proper cable cutter so you don't crush the ends.
 - Re-insert inners as above
If that doesn't work:
4. Removing brifters for proper cleaning/disassembly
Looks like you've ruled out everything else and you need to get aggressive on these before you bin them.

Get them off your bars
Soak the whole thing in white/mineral spirits for a while. Give them an agitate them and see how much dirt/grease comes out.
Brifters are super-hard to disassemble and there aren't normally guides from the manufacturer; they expect you to buy new ones. If you do attempt it: take loads of pictures, keep parts/springs grouped together and be prepared to have to re-make any small parts that have failed, it's doubtful you'll be able to get them from the manufacturer.

Final thoughts
I've got pretty in-depth here, but I think I've written down some of my experiences for cleaning. I've never taken apart a brifter before more than replacing a front-cap so I can't say if that's likely to fix it.
If you go ahead with any of it, let us know which methods were more effective for you.
Comment: Sorry i never reported back.  I took the whole thing apart using the Zinn book.  It was very detailed and managed it rather easily.  There is a metal and plastic interface (a manufacturing mistake I would say) and it had worn away.  Anyway not easily fixable.  So ended up buying a new one.  But I would now happily take apart [brifters]

Right campagolo gears slipping


Earth curvature refraction for dummies

Question: I keep being presented with 'earth curvature experiment' videos recently, by flat/concave earth advocates.  It seems to be their favorite "evidence" that Earth is not spherical.   Debunking this gets into math which I stink at, regarding refraction.   I would like to be sure I have considered all the factors.   And I keep looking for a simple rule of thumb, 'for each mile, the line of sight drops this amount, due to refraction' value.
So for example,  this '20 mile laser' experiment - https://www.youtube.com/watch?v=O8auPtlRTyM proposes to defy Earth curvature.   It is a sloppy experiment, but assuming they are not cheating, and their horizontal line of sight is 65 feet above sea level as indicated, does it make scientific sense to be able to see the laser from 20 miles, when the geographic distance to sea level is 10 miles?  And how to explain why it does, in simplest terms?
I am also wondering if the laser could be "skipping" over the surface, kinda like a skipping rock, but in a few, long arcs.  So the laser grazes the water near the sea level peak say around 10 miles, then is reflected back upward, and arcs over the 'hump' due to refraction.   Thus it covers even more distance than if it were traveling over level ground that does not reflect like water.
Sites explaining refraction calculation are too mathy for me.  And I seem to be reading conflicting rules and I am getting different end results.   I understand there are several variables, but this video indicates that surveyers use a standard 7% rule- https://www.youtube.com/watch?v=4LPcNxYwhQo    But that does not seem to account for the 20 mile laser example.  And I understand that the closer to the water, and the greater the distance, the more the laser will refract, or 'super refract.'
WikiP entry on "horizon- effects of refraction- says something about a 4/3 ratio, and 15% beyond geometrical horizon.  And 'standard' atmospheric refraction is 8%, although that is not 'super' refraction as I assume would apply to the laser example.   But this does not match the 7% rule, and I dont get how all the values are used to get a definitive refraction value.
I see a simple 'Distance to horizon calculator' (this forum wont allow me to post the link, will try to post in another comment) but does not figure refraction.
And another one is suppose to calculate refraction 'lapse rate' , but no matter what I enter, the lapse rate always comes out "0."  Doesnt seem to work.
Any clarification is much appreciated.
Comment: [Where exactly in videos?](http://meta.physics.stackexchange.com/q/4918/2451)
Comment: A neat experiment to go with Olin's answer is to train a telescope - preferably with an *x-y* graticule - on some faraway object, putting the object at the "origin". Then check, without disturbing the telescope, where the object sits from day to day. With a high power telescope, you'll see a considerable shift up and down of your field of view.
Answer: It seems your question comes down to "Why does light at least somewhat follow the curvature of the earth?".
The answer is indeed refraction.  Light has different speeds in different transparent substances, always slower than in vacuum.  From this differing speed, you can show that a light beam is bent at the boundary between substances with different index of refraction, which is the ratio of how much light slows down in the substance compared to vacuum.  Camera lenses, eyeglasses, etc, harness this principle deliberately.
The speed of light in air is close to that in vacuum, but not exactly the same.  Put another way, the index of refraction of air is almost 1, but not quite.  Furthermore this index of refraction varies with the density of the air.  To convince yourself of this, imagine the limiting case where you measure index of refraction of air as the pressure is gradually lowered.  When it gets to 0, the index of refraction must be 1 by definition.  The index of refraction of air therefore varies smoothly as a function of pressure.
Now think of the air envelope around the earth.  Obviously there is a pressure gradient with altitude.  When you get high enough, the atmosphere is gone and you have only the vacuum (almost) of space.  In this case there isn't a sharp boundary like there is when light enters a glass lens.  However, the gradient still bends light, in this case smoothly over some distance, as apposed to abruptly at the air/glass boundary in the lens example.  This vertical pressure gradient, and therefore index of refraction gradient, causes light to bend a little when shot horizontally thru the atmosphere.
However, there is more to it than this general effect.  The atmosphere is not uniform at any one altitude.  As you know, there is wind, pockets of hot and cold air, rising thermals, cold downdrafts, and lots of phenomena that are much more significant locally than the general decrease in pressure vertically.  The air can have different layers at different temperatures, and the interface between layers can be much more abrupt than the general trend of decreased pressure with altitude.
Shooting a light beam with the right atmospheric conditions can exhibit much more bending than in the general average case.  A mirage is a good example of this.  Light from the horizon is refracted by the relatively sharp boundary at the top of a thin hot layer of air warmed by the ground.  From far enough away to that the light is at a very glancing angle, you "see" sky light reflected off of what looks like the ground.  This gives the visual impression of a lake, since a lake would similarly reflect sky light in normal cases even when there are no special atmospheric effects.
In the case of a mirage, light is actually bent upward.  Light can just as well be bent downward using similar boundaries of layers in the atmosphere.  It depends on the position of the emitter and receiver relative to the index of refraction gradients in the atmosphere.
If you were to carry out these experiments on the moon, which has no practical atmosphere for this purpose, light beams would indeed go "straight".  You won't see mirages on the moon, for example.
Comment: @David: I don't know if just the normal vertical pressure drop is enough to account for that, but together with specific atmospheric effects it sounds possible. It would help to define the geometry of your particular test case better, how high each of receiver and transmitter were locally, how high the intermediate terrain, etc. Then we can compute how much deflection is actually required to explain it.  The data should be in your question.  No, I'm not going to watch some video you linked to.
Comment: Thanks Olin.  But my question is, does it make sense to be able to see the laser from 20 miles away, when the geographic line of sight would prevent the laser from traveling more than 10 miles at a height of 65 feet above sea level?   Does refraction normally account for the laser distance doubling?
Comment: The laser (transmitter) is 45 ft above sea level, in Benicia CA.  The camera (receiver) is 20 miles away, at 15 ft above sea level, in Antioch, CA.  The water "bulge" height halfway between, is estimated at 66.7 ft.
This is from the experimenter-
h = 6371 - 6371 cos(16.1 / 6371)
.02034 km = 6371 cos (16.1 / 6371)
h (km) = r - r cos(b / r)
b = half of distance in KM (10 miles = 16.1 km)
r = approximate radius of Earth at sea level (6371 km)
Comment: The formatting limitations of the forum comments is frustrating.  But here also is a still image containing the data from the experimenter, it is the same as what I typed above.  [link]https://app.box.com/shared/static/c49o23bemrjvd79w8ita17nfyeh1xsgj.jpg
Comment: Olin you might like to add (since it's not on topic enough for a separate answer) that a neat experiment to go with your answer is to train a telescope - preferably with an *x-y* graticule - on some faraway object, putting the object at the "origin". Then check, without disturbing the telescope, where the object sits from day to day. With a high power telescope, you'll see a considerable shift up and down of your field of view.
Comment: I would really like an answer that could help debunk videos like this one: https://www.youtube.com/watch?v=XwCFMIdI4c4

Earth curvature refraction for dummies


Are deore rear derailleurs compatible with 9 speed cassettes and shifters?

Question: I have replaced my Alivio rear derailleur with a new Deore M610 but it doesn't shift properly. The casette is a 9 speed Shimano Alivio CS-HG400-9 11-32T and the shifter is an Altus. Do you think this combination would be operating well if set correctly?
Answer: The M610 is a 10-speed rear derailleur and is not compatible with 9-speed cassettes and shifters (different pull ratios between 9-speed and 10-speed).
If you want to stay in 9-speeds and Deore, compatible derailleurs are RD-M591 and RD-M592, but they are getting hard to get. You also have other options from other brands.
If you want to keep the derailleur, you'll need a new shifter, cassette and chain. 1-speed deviations are OK for the chainrings and front derailleurs. You can find the compatibility chart here.
Answer: 10 speed Shimano mountain rear derailleurs are not compatible with 9 speed cassettes and shifters.  However 10 speed Shimano road derailleurs are compatible with the 9 speed cassettes and shifters.
I have been using a Shimano RD-5701-GS 10 speed mid-cage rear derailleur on a 9 speed touring bike for some years now because I couldn't source a RD-M591.
Going from 9 to 10 cogs, Shimano changed the pull ratio for 10 speed mountain bike derailleurs, but not for the road derailleurs.
The one exception is Tiagra 10 speed, which has the same pull ratio as the other Shimano road 11 speed shifters.
Unfortunately the Sutherland manual that professional mechanics use as a resource didn't pick up on this point.
Comment: Hi, welcome to bicycles.  The question. Is specifically about Deore; are you saying that road groupsets are compatible with Deore?


Are there any books written using dialogues?

Question: Last year I read Questions And Answers In School Physics. The book is based on a dialogue between a student and a teacher. A lot of concepts and ideas are seamlessly driven by the dialogue. I found the presentation to be lucid and pedagogical.
I am wondering if there is books with a similar style but for mathematics.
Answer: Donald Knuth's Surreal Numbers: How two ex-students turned on to pure mathematics and found total happiness  is an introduction to Conway's construction of real numbers as positions in certain two-player games.  It's very readable and it's written as a series of dialogues between the titular characters.
An unpublished French translation is available online.
Answer: Lakatos' Proofs and Refutations is a set of dialogues about increasingly general versions of Euler's formula.  Most people read it for the philosophy, not the mathematics, but I don't see why one couldn't go the other way.
Also, there are a large number of texts that exposit via pedagogically-motivated exercises, but don't involve multiple interlocutors.  I don't know if you consider these to be "generalized dialogues," but if you do, then consider Arnol'd and Alekseev's The Abel Theorem in Problems.
Comment: The dialogue in the Arnol'd-Alekseev book isn't between two characters in the book. It's between the authors and you.
Comment: Thanks for the recommendations! By the way, what do you mean by "generalized dialogues" ?
Answer: Conics by Keith Kendig is written as a series of dialogues between three characters : Student, Teacher and Philosopher. Student with fresh curiosity, Teacher with an open mind and ability to make connections and Philosopher picking on subtle ideas - these three personalities together develop and explore the content.
There are lots of examples covered and several exercises are given at the end of each chapter.
Answer: The series Math Girls by Hiroshi Yuki is both amusing and instructive. We explore together with at first two later three female students some highlights in mathematics like Fermat's last theorem or Gödel's incompleteness theorems.
Currently there are four volumes in this series, the first  with this MAA review.
Answer: There's always Philip J. Davis and Reuben Hersh's, "The Mathematical Experience".
Answer: Géométrie plane by Delessert has dialogues between the author and a character named Zosime, in which Zosime challenges the author on various points.
Answer: The popular mathematics book Dialogues on Mathematics (original title: Dialoge über Mathematik) by Alfréd Rényi is a set of fictional dialogues about the nature of mathematics between some historical characters (Socrates and Hippocratis in the first chapter, Archimedes and Hieron in the second one, and Torricelli, Niccolini and Galileo in the last chapter).
Answer: The book The Square Root of 2: A Dialogue Concerning a Number and a Sequence by David Flannery is, as the title would suggest, written as a dialogue between a teacher and a student. It is quite well done in that it is easy to follow and covers a broad range of mathematical ideas.
Answer: The Number Devil: A Mathematical Adventure is for younger readers, ages 11–16 or so.  The main character, Robert, has a series of twelve dialogues about mathematics with the titular Number Devil.  They discuss prime numbers, infinity, the fibonacci numbers, and many other topics.
Answer: Game Theory and Mutual Misunderstanding: Scientific Dialogues in Five Acts by Mamoru Kaneko.

This book consists of five acts and two interludes, which are all
written as dialogues between three main characters and other
supporting characters. Each act discusses the epistemological,
institutional and methodological foundations of game theory and
economics, while using various stories and examples. A featured aspect
of those discussions is that many forms of mutual misunderstanding are
involved in social situations as well as in those fields themselves.
One Japanese traditional comic story called the Konnyaku Mondo is
representative and gives hints of how our thought is constrained by
incorrect beliefs. Each dialogue critically examines extant theories
and common misunderstanding in game theory and economics in order to
find possible future developments of those fields.
Answer: Michael Negnevitsky - Artificial Intelligence. A Guide to Intelligent Systems.
It is written in the form of questions and answers. In my opinion, it is one of the best books on the topic.
Answer: I don't think if it suits the needs, but Logicomix by Apostolos Doxiadis and Christos Papadimitriou seems to me to be a great comics book dealing about the history and some concepts of Logic.
Answer: Lev Tarasov's Calculus: Basic Concepts for High School is a Soviet classic.


How should I write a feasibility study report?

Question: I may be called upon to write a feasibility study report for consumer hardware (to be manufactured) and/or a service to be offered to clients in the near term. What is the proper technique here? Google says I need to start by suggesting alternate solutions and talking about how my solution is the best one; however my instructors say that I should just stick to my solution. Anybody have an outline maybe?
Answer: Make a breakdown of the task in separate sub-problems and explain for each of them how you solve them. Make cost calculations. Comparing with alternate solutions you've studied is a good way to take away the wind from the client's sails: if you don't come up with alternatives (which you dismiss with good arguments) he might, and may come up with a better solution than yours.
Answer: Tackle the situation in a organized manner.
For example, your not going to say "my idea is: your information here."
You want to come clear as possible with your claim as possible, but acknowledge the fact that there is other solutions, but yours is more outstanding because ( insert evidence here ).


Textbook recommendation for computational physics

Question: Can anyone recommend some good textbooks for undergraduate level computational physics course? I am using numerical recipe but find it not a very good textbook.
Comment: Numerical Recipes is more of a reference text. Is there a particular area of Computational Physics you're wanting to study? Algorithms? Molecular simulation? Statistical mechanics? Fluids? Thijssen is full of nice examples.
Comment: It would be helpful if you could mention what it is about Numerical Recipes that you find unsatisfactory.
Comment: Just some basic topics like numerical integration, solving ODEs, PDEs, linear systems, etc.
Answer: I like Bill Gibbs' book Computation In Modern Physics for a couple of reasons (aside from having taken the course from the author):

After introducing basic tools (difference approximations to differential equations, numeric quadratures (i.e. integrals), and eigenvalue problems in a matrix form) it moves right on to problems of interest to me. The examples are all taken from nuclear and particle physics, so there neutron transport models and toy tomography problems and multi-electron atoms to solve and so on. Good stuff.
It is at once a small book, and provides deep coverage of the problems that it spends time on.
The sections on Monte Carlo methods are very good.

That said, it suffers from two issues that prospective users might want to know about:

Bill is a Fortran 77 guy.
All the code in the book is in that language, and he uses some deep magic array slicing tricks that (1) will take considerable study for students to comprehend and (2) may set a bad example in the modern era where programming clarity is to be preferred over "optimization" until you've proven that the compiler can't optimize it enough.
The level might be a little steep.
The course was taught to seniors and grad-students, but I would guess that it was conceived of as a graduate course. So the move from basic principles to problems is pretty demanding and the problems assume that the students know a fair amount of modern physics.
Answer: I am using this.(freely available)
http://farside.ph.utexas.edu/teaching/329/329.html
A complete set of lecture notes for an upper-division undergraduate computational physics course. Topics covered include scientific programming in C, the numerical solution of ordinary and partial differential equations, particle-in-cell codes, and Montecarlo methods.
Answer: I am using a computation book with very specific procedures of derivation and I find it very helpful with my daily study,but it focuses on the quantum computation methods, the writers are Nielsen & Chuang.
this is the free access to this book:
http://pan.baidu.com/share/link?shareid=3745380098&uk=2049226949
Comment: But that's a book on quantum information theory, not computational physics.


Is there a way to "uncheck" songs on my iphone?

Question: I have many audiobooks in my itunes, some of which are in their appropriate place, but some of which are categorized as songs. I've moved them all to playlists and unchecked them in itunes so that they do not play on my computer, but they still appear in my songs on the iphone, so that when I shuffle my songs, I often get random book chapters. It's not a huge deal (I just skip them), but it is annoying, especially when I'm driving. Can anyone help?
Answer:
Select an Audiobook file in your library that has been categorised as a song.
Right click on it and select "Get Info."
Open the Options tab.
In the "Media Kind" field, select Audiobook.

These files will no longer appear in the Music library. To see them again, open the Books library.


How routing protocols deal with malicious or faulty routers?

Question: I know very little about Internet Protocol or networking in general but my understanding is that, at a very high level, the routing works by routers telling other routers how "fast" they can reach other destinations. What if there is a malicious (or faulty) router that advertises itself as a fast node but actually slows (or even drops) packets?
Comment: Routers don't "advertise" themselves. [BGP](https://en.wikipedia.org/wiki/Border_Gateway_Protocol) is used to exchange routing information. The very simple version is: If your router is faulty, others will eventually realize and not send to you anymore.
Comment: @MechMK1 what about https://en.wikipedia.org/wiki/BGP_hijacking
Comment: @schroeder thank you. That link has plenty of helpful information.
Comment: @schroeder BGP hijacking involves a malicious router and is a serious issue because of the complete lack of security in the protocol. A router that is merely faulty will be quickly ignored by the rest.
Answer: The Routing protocol used on the public internet (BGP) does not care about bandwith at all. That information is not exchanged between two routers, because it is unknown: I can connect two BGP speaking routers with 10Gbps ports through a series of switches, one of them having only 100Mbps ports, and the routers would never be able to detect that, they'd think they have 10Gbps capacity, even though there's a 100Mbps bottleneck on the link.
Many networks have tooling which can monitor link availability, latency, bandwidth used, and other aspects of links and their network to determine which routes they prefer. This tooling interacts with routers to change configurations, especially routing preferences. It's not part of the routing protocols used by the routers.
What routers DO exchange, is what IP ranges (prefixes) can be reached via that router, so the receiving router can decide to add routes for the prefixes received via the sending router if it thinks it's the best path available.
A router could of course unintentionally or on purpose advertise prefixes that it shouldn't, and if another router would accept them and install them in their routing table as best route, send traffic for those prefixes there. This is often called a 'BGP Hijack' and can result into:

traffic towards the hijacked prefixes from networks accepting the hijacked prefix as best route ends up in some other network. If it's an unintentional hijack, the prefix could be unreachable, if it's with malicious intent, the hijacker could try to impersonate services in the destination network to their benefit (for example for harvesting credentials).

traffic towards the hijacked prefix is forwarded to the router doing the hijack, which then forwards traffic to the destination. Everything works as designed as long as the network which hijacks the prefix has sufficient bandwidth to forward all the traffic (which it in most cases doesn't). If such a hijack is intentional, malicious actors may be trying to eavesdrop on traffic towards destinations in the hijacked network.

To prevent that from happening (though it happens a lot, take a look at bgpstream.com for example), a router can do a few things:

prefix filtering: the receiving router keeps a list of prefixes it expects to receive. Any prefix received not on the list is ignored. The downside here is that these lists grow very large and need to be updated regularly. If you don't do that, you may miss routes to part of the internet.
RPKI: for a (growing) number of prefixes, routers are able to do a lookup to verify if the network originating the prefix is allowed to do so. Wikipedia and this page have some more info on how this works. There are a few downsides to RPKI. It doesn't solve everything (to be specific, it validates only if the destination network and prefix match (so I can't claim that prefixes belonging to for example Google are mine), it does not validate if a routing path ("you can reach Google via my network, I'll forward traffic for you") is valid.

So in practice, networks often implement both of these to handle advertisement of incorrect routes.


Fighting wild fires with sub zero air

Question: I understand this is probably too costly to be practical, but was intrigued how one might use the mechanism of fire combustion against itself. Fires produce their own retardants (water and carbon dioxide). If you could cool this with quantities of subzero air (e.g. from above) would the dense air attack the flow mechanism that feeds the fire (the oxygen intake at ground requires the upward escape of combustion products). If you had a mobile store of liquid nitrogen and a high-throughput turbine & heat exchanger, using the heat of vaporisation and heat capacity of liquid N2, could you 'hose' down a fire using subzero air?
Answer: I think the heat produced by the combustion is far and away greater than the heat you'd absorb using the cold air. So dumping cold air on a fire would only stoke it even more.
I could back this assertion up with some thermodynamics, or we could just watch this video of what happens when you pour liquid oxygen on a fire:
https://www.youtube.com/watch?v=9Floi2gQEb4
Comment: Say you used just nitrogen gas just above evaporation, its density would be a multiple of the air at combustion and would quantitatively reduce temperature if you directed it near actual combustion
Comment: No, I suppose the combustion drives the air flow cycle and thats too powerful to 'reverse' .
Comment: @JKB Nitrogen would put it out. So would any not-very-reactive gas. Fire needs three things: fuel, $O_2$ and ignition temp. You first have to cut off the oxygen to stop the combustion reaction and then cool the fuel below the ignition point so that it doesn't flare up again when the $O_2$ comes back. That's how $CO_2$ extinguishers work.

Fighting wild fires with sub zero air


Why is the work done by the tension in a pendulum string zero?

Question: Isn't the string pulling the ball upwards, and, therefore, doing work on the ball, like when someone lifts weights. I understand that the force is perpendicular but can I get an intuitive answer as to why it pulls the ball up, yet is doing zero work?
Comment: Ah, the sweet sweet smell of homework. What happens to the total energy of the ball as it moves?
Comment: Exactly for the same reason why Lorentz force does no work: https://physics.stackexchange.com/q/274459/226902 https://physics.stackexchange.com/a/566528/226902
Comment: The OG of caveats : "Newton's first law states that every object will remain at rest or in uniform motion in a straight line *unless compelled to change its state by the action of an external force*." ... *force* : "the quantities causing an acceleration of a body". ... *work* : "The product of the force on an object and the displacement the object undergoes along the direction of the force." - A pebble in a river is under considerable *forces*, but until it washes away, no *work* is being done to it or by it.
Answer: Your intuition seems to conflate work with force. But just because a force is present, that doesn't necessarily mean that it does any work.
Just like when you push hard on a wall - great force but no work was done (nothing was changed by your efforts).
Work requires two components to be present: force and displacement. The formula (in case of constant force) is $$W=\mathbf F\cdot \mathbf r\,.$$ Think of pushing on a train cart rolling on tracks:

When you push along with the tracks, then your force causes a displacement of the cart (it moves). You (your force) have now done work on the cart (added energy to the cart, in this case converted to kinetic/motion energy).

But if you push sideways to the tracks, then the cart isn't moving and no displacement happens. So no work is done. Even if any displacement is taking place while you are pushing, then it certainly is not a result of your force. Because your force is perpendicular to this displacement. Whatever energy you may have spent on producing your force is just lost (as heat or work to the surroundings or internally within your body) - nothing was transfered as work to the cart.

In the same way, the string in your scenario pulls always perpendicular in the pendulum and so never pulls along with the displacement direction and thus does not work.
The concept of work can often be confusing to get the intuitive sense of. But think of it as mechanical energy transfer which requires a position change (in contrast to heat which is thermodynamic energy transfer and in general requires a temperature change). Then it might be easier to intuitively grasp.
Comment: @chasly-supportsMonica Sure, this *is* work being done. But it is being done *within the body*, not on the wall. And the goal was to do work on the wall. In the answer I mention that such energy spent to produce the force is just wasted if it does no work on the object. The human body is indeed a special case that spends energy in order to produce a pushing force. In contrast, no energy is spent when a ladder is leaning up against and thus pushing on the wall. The fact that energy is spent in one case but not the other, is not about the applied force, but about how this force is produced.
Comment: @chasly-supportsMonica Feynman, in sect 14-1 of his physics lectures call this "physiological work" to distinguish it from physics work which, in the case of pushing on a wall or simply holding on to a (and not moving) weight is zero. The energy expended is all internal to the body.
Comment: Yes because the muscle is bag of small proteins that interact weakly and need to be held together by constantly running chemical reactions. A string is held together by stronger chemical bonds so no chemical energy is spent by just holding. The two links in my answer below might be interesting for you
Comment: comments like chasly's (which is spot-on!) are why using people pushing/holding/carrying things make bad examples when discussing work. Much more intuitive are objects on a table, or in this case, hanging from a rope. It's obvious there's not energy expenditure for an object hanging from a rope at rest
Comment: When someone presses hard on a wall, their muscles will expend energy and they will eventually become tired. Is this not work? Similarly with holding one's arms horizontally - at right-angles to the body..
Comment: I think a lot of the confusion is because the way 'work' is defined depends on what question you are trying to answer.  For example, in a lot of basic physics problem, the work done is defined by change in height.  This perfect for e.g.: calculating the efficiency of a pump.  If you use that same definition for an airplane that files across the country and lands at the same height above sea level, it has done no work at all. That's not a useful definition for that scenario. Moreover, without making this distinction, the whole concept of efficiency is meaningless.
Answer: The mathematical reason:
The work done by tension is zero because the force by the string and the displacement on the ball are perpendicular to each other.
The intuitive reason:
Any change in the speed of the ball is caused by gravity. The ball goes upwards with a decreasing speed because it gains gravitational potential energy at the cost of its kinetic energy. The string is a one-dimensional object and hence can't push or pull the ball along its curved path. All the string does is pull the ball towards the center of the curved path, thereby changing the direction of motion of the ball, not its speed. Since the speed (and therefore kinetic energy) of the ball is unaffected by the string, no work is done by the string's tension force.
Answer: Work is force times displacement in the direction of the force or $W=Fd\cos\theta$ where $\theta$ is the angle between the force and displacement. The pendulum tension is a centripetal force which acts perpendicular (at right angles) to the displacement. Thus $\cos \theta =0$, and $W=0$.
Hope this helps.
Answer: @Steven already notes in his answer that you may think intuitively that holding a force/tension needs work.
That might come from the experience that excerting a force with your body spends energy, e.g. when holding up a weight. And indeed chemical energy is spent in this special case, because the filaments of the muscle cells are not one long band but consist of many proteins that basically need to be held together by continuously running chemical reactions. But in your case, there is no muscle, but a string.
That is further explained for example in this Stack Overflow question: Why does holding something up cost energy while no work is being done?
A visual idea of how muscles have to spend energy to maintain tension might be found in this video about the cross-bridge cycle: https://youtu.be/99R-XCGme8Q?t=62
But in your example the string holds the ball, not the body
Answer: In a very intuitive way, doing work requires some energy source. Work is the transfer of energy, you can't perform work without the energy coming from somewhere. That energy source could be in the form of chemical bonds like in gasoline that powers an engine or in food that powers your body, or in a physical form like elastic potential stored in a spring or gravitational potential stored in a weight placed on a tall shelf, or in other forms. You have to ask, if the string is in fact doing work, where does that energy come from?
The problem is, a massless, inelastic string has no power source, and no way of storing energy. Therefore, it is impossible for the string to ever do any work at all, no matter what you do with it. For the string to do work on the pendulum bob, energy would have to move from the string to the bob, but the string cannot store any energy in the first place. Even if you were to tie the string to a weight and pull directly upwards, it would be you performing work on string + weight system, but not really the string performing work on the weight.
Answer: The string doing no work at any moment. Lets pick one moment to think about - say when the ball is moving away from the centre to the right and about half way up.
At that point the string is pulling the ball up and to the left - so we can think of it as doing two things at once - pulling the ball left, so slowing the its rightward motion, and pulling it upwards. Pulling it upwards would be doing positive work, adding energy, and pulling left, slowing its motion is doing negative work, removing energy.
Add these two together and you find that the string is doing doing zero total work at any moment. Other answers go into the maths, but whenever we have a diagonal force it can be easier to analyse if we think of it as a combination of an up/down force and a right/left force.
And of course the same argument applies for every moment as the pendulum swings.
Answer: The length of the string does not change, so the tension in the string does no work.
Work is force times displacement of the point of application of the force in the direction of the force (or directly opposite to it, which can represented with a minus sign.)
It's like when an object orbits the earth in a circle. The distance to the center of the earth doesn't change, and so no work is done. And the force is always perpendicular the direction that the object is moving. Note that it has to be a circular orbit.
It's not like someone lifting a weight in a gym, rather it is like someone holding a weight with his arm hanging straight down and then swinging it back and forth slightly. Effortless. Or at least no harder than supporting it in a stationary position.
Or consider a mass moving in a circle, e.g. a bob on the end of a massless, fixed-length string that is attached to a point that cannot move. The string exerts a force on the bob that makes it move in a circle. It does not do any work because the bob does not change speed, only direction. This is related to the fact that the force on the bob is always perpendicular to the direction of the bob's motion. The string constrains the bob to move along a particular path, but it doesn't add or remove any energy from the bob.
Going back to the pendulum, imagine that instead of a string constraining the bob to move to and fro along a part of a circle, you have half a hemisphere made of rigid material that is fixed immovably to the earth. The bob slides about frictionlessly inside the bowl, moving to and fro along a part of a circle, exactly as it did with the pendulum. Let's consider the bob to be a point mass, to keep things simple.
It is intuitively obvious, I hope, that the bowl does not do any work on the bob. The bowl is rigid and immovable. The total energy of the bob is constant. All that changes is the fraction of the bob's energy that is kinetic energy, and the fraction that is gravitational potential energy.
Just as a mass in free fall has kinetic energy and potential energy, and the gravitational field only transforms one form of energy to the other, with the total being constant, so it is with the pendulum and with the point mass sliding in the bowl frictionlessly. There is work being done, but only by the gravitational field.
Consider a point mass sliding up an inclined plain, slowing down as it does so, due to the gravitational field. If there is a sense in which your pendulum string is pulling the bob upwards, in the same way, the inclined plane is pushing the mass up. This is especially clear if you imagine an inclined plane that is at very small angle away from horizontal. It should be intuitive now that inclined plane is passive, unmoving, rigid, and indeed immovable, and is not doing any work. If anything, the bob is doing work on the gravitational field. But since this is equivalent to storing potential energy in the bob, the total energy of the bob remains the same.
Answer: Let me give you an example for a field which exerts a force on the particle but doesn't do any work. Consider the magnetic Lorentz force $$\vec{F} = q(\vec{v} \times \vec{B})$$.
where $\vec{B}$ is the external magnetic field which is present in the region.
Now consider the work done by this force. $$W = \int \vec{F} \cdot \vec{dl}$$. This could be further be written as $$W = \int q(\vec{v} \times \vec{B}) \vec{dl}$$.
We can also write $\vec{dl} = \vec{v} dt$ which after substitution would be
$$W = \int q(\vec{v} \times \vec{B}) \cdot \vec{v}dt$$
We can immediately notice that the term $$(\vec{v} \times \vec{B}) \cdot (\vec{v} dt) = 0$$
This is because $\vec{v} \times \vec{B}$ is always perpendicular to $\vec{v}$. Therefore
$$W = 0$$ for magnetic fields.
Therefore, you can see that although there is force on the charged particle due to the magnetic field, it doesn't necessarily mean that the the field is doing work on the particle. It's the $$\vec{F} \cdot d\vec{l}$$ that matters when we are concerned about the work done by something.
Answer: You already have some good answers, but I would like to take a different angle.
The work done by the tension in an ideal pendulum string is zero because of the standard assumptions, including that the "string" is really a massless, non-elastic rod.
If you would like the string to do some work, change it to a non-ideal material.  For example, use a real rod or string with some non-ideal elasticity that can convert longitudinal force to heat by internal friction.  When the force along the string reaches its maximum (the low point of each swing), the rod reaches maximum extension.  Since the elasticity is not ideal, the rod doesn't return all the energy to the motion of the bob on the upswing.  It's doing work at each oscillation.
Because the tension in a real pendulum made of real materials does non-zero work, it loses energy and the pendulum motion eventually decays.
Comment: Even if the string is lossless but elastic there would still be energy being transferred into and out of the string periodically.
Comment: @TimWescott True, but passing work back and forth between two ideal objects *ad infinitum* is no fun, and not in the spirit of my answer.
Comment: Granted, but I felt that someone coming to the subject cold might read your answer and think that _any_ string with "give" would lead to dissipation.
Answer: Only if the target force has a component force in the direction of movement, the force does work to the object.
Here no component of tension acts in the direction of movement of pendulum, so the work done by tension is $0$.


Can t test be used for comparing groups with a sample size of 3?

Question: I'm wondering if t test maybe used for a really small sample size. I have a set of data with only 3 entries for each group and I need to compare whether the two groups are significantly different.
Comment: Conceptually, the permutation test is much simpler than the t-test.  It might be the better pedagogical choice.  You needn't feel obliged to test at a 5% level, either.  If you could accept 10% as the standard of significance, then a permutation test can be a nice illustration.
Comment: see the links at https://stats.stackexchange.com/questions/294682/t-test-using-a-sample-less-than-30 . In R try `t.test(x=c(4.5,4.6),y=5.7, var.equal=TRUE)` (sample sizes 2 and 1). It works. However, power may be quite low.
Comment: With three cases per group I wouldn't be conducting any test, but rather conduct a qualitative analysis (i.e. describe the groups and the differences in your report, case by case). Check: https://stats.stackexchange.com/questions/121852/how-to-choose-between-t-test-or-non-parametric-test-e-g-wilcoxon-in-small-sampl
Comment: Thanks. I read somewhere though that I can use a permutation test, but I am sort of looking for something that is a bit simpler and may be used by middle school students. Gathering more data though is not feasible.
Comment: You can still do it, but it's not very accurate.
Comment: Thanks. I never actually considered permutation test to be simpler, but I guess it really is now that I think of it. It's just that t test is more commonly used than permutation test.
Answer: The permutation test will have insufficient power.  (There just aren't enough different ways to split six samples into two groups of three.)  But If the assumptions of the t-test hold, then its results are valid.
Many thoughtful readers will question whether such a situation could actually arise.  Let me share a real story.  It concerns cleaning up lead contamination in a field: for years, a farmer accepted "recycled" batteries and dumped them behind his house.  Eventually the environmental regulators caught up with him.  They caused the "responsible party" to go through three phases of cleanup work: (1) sample the soils to estimate the amount and extent of lead contamination; (2) remove the soils in thin layers, taking samples in the process, until it was clear that clean soils had been reached; (3) independently sample all remaining soil and formally test whether the mean lead concentration is below the environmental standard.
The procedure for (3) was designed and approved before the cleanup began.  It called for random sampling of all soils exposed during the excavation, analysis of the samples by a certified laboratory, and applying a Student t test.
 Equivalently, to demonstrate success, a suitable upper confidence limit (UCL) of the mean had to be less than the standard.  It did not specify how many samples to take: that would be up to the responsible party to decide.
Almost a thousand samples were obtained and analyzed during the first two phases.  Although these allowed the (univariate and spatial) distributions of the lead concentrations to be characterized reliably, they of course did not represent the remaining concentrations.  However, they did suggest the shape of the (univariate) distribution of the remaining concentrations.  Physical and chemical theory, soils science, and experience with remediating lead in soils elsewhere all provided support for this statistical characterization.
The cleanup was so thorough and successful that the likely mean concentration was negligible--more than an order of magnitude less than the standard.  Power analyses, based on pessimistic (high) estimates of the standard deviation, all suggested that a random sample of only two or three would be needed.
There were many potential complications: for instance, any areas that might have been overlooked during the excavation could introduce large outlying values.  To detect these, a large number of samples were obtained at random locations, and then composited in groups to produce just five physical samples for laboratory testing.  All the values were low.  As expected, a t-test of any two of those samples would still have demonstrated attainment.
Sprinkled within this brief case study are examples of various ways in which we might be assured that a t-test is appropriate even with tiny samples: experience; theory; preliminary related sampling; making pessimistic assumptions; and sample compositing all played a role--and any one of them might have sufficed to justify the t-test.

Incidentally, there are versions of the t-test that work with just a single observation.  They are based on obtaining independent estimates of the variance or, lacking that, mathematical theory.  Could this ever make sense in reality?  The classic situation of compositing the blood from hundreds of soldiers to test for venereal disease provides one possible application.


Cookie Clicker- [Last chance to see] and [All natural sugar cane] shadow achievements

Question: Are the [All-natural sugar cane] and [Last chance to see] achievements just luck-based or is there a specific way to get them? to get the [All-natural sugars cane] achievement you need to harvest a golden sugar lump and to get the [Last chance to see] achievement you need to burst the near-extinct shiny wrinkler. is there any specific way to do those things or is it just luck.
Answer: It is just luck. The golden wrinkler for [Last chance to see] appears 0.01% times and [All-natural sugar cane] has a chance of 0.06-0.11% of a golden sugar lump.
Although you have to trigger the Grandmapocalypse for wrinklers to spawn. If you want to know how to trigger it go here:
https://cookieclicker.fandom.com/wiki/Grandmapocalypse
Answer: The odds of getting each type are exceedingly low, which is why those are shadow achievements that don't give milk or count towards "completion percentage."  There are minor ways that you can improve your odds however.
[Last Chance to See] - there is no way to improve the odds of spawning a shiny wrinker which appears at a 0.01% chance or 1 in 10,000.  The best way of obtaining one is by popping wrinklers as soon as they spawn in order to roll those dice as many times as possible.  If you have all research upgrades purchased and are in the final stage of the grandmapocalypse with no elder pledge (Angered), wrinklers will spawn the fastest.  There are also ascension upgrades to increase the speed at which wrinklers spawn at any level of the grandmapocalypse.  Unholy Bait causes wrinklers to appear 5 times as fast, and Elder Spice increases your maximum wrinklers to 12 so you can get 20% more RNG calls per game tick.
[All Natural Sugar Cane] - The base chance to get a golden sugar lump is 0.075% or about 1 in 1333.  This however can be improved with the aura Dragon's Curve which almost doubles the chances to 0.1466% or about 1 in 682.  This is still extremely low, and you'll only get one chance per day at the base growth rate.  However, there are several ways of decreasing the time that it takes for sugar lumps to mature, including the temple worship Rigidel and some ascension upgrades.  The shortest possible time sugar lumps can take to fall and collect automatically is around 20 hours which means you can get an extra lump every 5 days or so.  You can shorten this time by an extra few hours per day by collecting the lump when it's ripe or even when it's mature but unripe (if you don't care about losing the lump 50% of the time).
Comment: To alleviate the risk of losing the lump, you can always just export your save before attempting, and then try to harvest it. If you don't get the max return on the harvest, you import the save and try again. Repeat until you get maximum return on the lump.


At which set point (frequency) will a VFD dissipate the most heat?

Question: On a typical application for a variable speed centrifugal pump, at which percentage speed setting will the VFD dissipate the most heat, in other words have the highest losses?
Comment: 11 ------------
Comment: This is probably a good question to ask a mechanical engineer. Try asking on the [Engineering Stackexchange](https://engineering.stackexchange.com/)... yes, there's a different Stackexchange for all engineers and engineering students, not just electricals.
Comment: Welcome to EE.SE. Your question is 20% of the way to being closed as "unclear what you are asking". Edit your question to give some context, what your research has shown and where you are stuck.
Comment: 0 Hz is my guess.
Comment: heat loss is I²R, with10% no load excitation current, I ≈ Load Torque, while backEMF rises with RPM so V/f is a ramp for increasing RPM for no load constant current, so max heat depends on load profile vs speed , DCR of pump and drivers, applied Voltage.  So if drivers are overheating on initial DC at some reasonable starting torque then driver ESR is too high. If it occurs later then ramp acceleration is too high. But if at full speed , rated V/f, then compare pump energy with RPM  and pressure squared+? order with electrical energy and shoot for 50% efficiency. Got water cooling?
Answer: Since the torque required to drive a centrifugal pump is approximately proportional to to the square of speed and the power is approximately proportional to the cube of speed, the VFD will almost certainly dissipate the most heat at the maximum speed.
Most VFDs that are available today are essentially a 3-phase rectifier supplying a constant DC voltage input to a 3-phase PWM inverter.
The output current of a VFD is approximately proportional to motor torque. The losses due to forward voltage drop in the switching devices is proportional to current. The switching losses are proportional to speed unless the VFD has a design feature that changes the PWM strategy over the operating range. The input current of a VFD is proportional to output power. The losses due to forward drop in the input rectifier will therefore be proportional to output power.
The many VFD designs that are available or have been available in the past have different loss characteristics over their operating ranges, but it is very likely that all of them will experience the highest losses when driving a centrifugal pump at maximum speed as compared to any lower speed.


Docker runs on getting started dashboard but not on PS Terminal (or any other)

Question: When I first install docker I can choose to go to the Quick Start Guide interactive window (or once done the quick start guide I can also go there again by right clicking on docker icon and selecting Quick Start Guide on the menu). As you can see I can do anything docker in this windows/environment as shown:

as you can see I can pull containers, run containers right there on that quick start guide command line, however, when I open a terminal (be it PS or Git or normal windows CMD) I can't seem to run docker there as shown:

So not so sure what am I missing. Thanks for any feedback!
Answer: I found the solution at least to my situation, problem is that there was this environment variable DOCKER_HOST (left over from Docker Tools) that was being set, which is not set when I do the quick start guide. Solution was to remove this environment variable from system/user settings and voila I could run docker on the terminal.


How to use icons in stead of text in Android tabs

Question: I have been using text in my menu tabs since I built my application. But now I want to change the text into icons. The problem is, my application 'knows' which tab is selected, by the string of the tab. But now I changed the texts in icons, it cannot use tab.getText() anymore.
Any ideas how to solve this? I tried .getIcon() but it returns a different string every time.
Greetings
Answer: Forgot about getPosition()! It's the solution for my problem.


Install using Anaconda not working

Question: I tried installing PyFerret on my Macbook through the terminal.
I got into my user directory with the terminal and gave it the following commands from this website https://anaconda.org/conda-forge/pyferret:
conda install -c conda-forge pyferret
conda install -c conda-forge/label/broken pyferret
conda install -c conda-forge/label/cf201901 pyferret

However, I noted that I only needed to download just one of them. I tried removing the files using
conda remove
conda uninstall

but they did not work. Later I tried following the instructions from this website
https://github.com/NOAA-PMEL/PyFerret/blob/master/README.md
which instructs to type the following command
conda create -n FERRET -c conda-forge pyferret ferret_datasets --yes

then it says you can use PyFerret by calling it in the terminal as
conda activate FERRET

but the response I got was
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.

I tried using
conda init -bash

and it sort of worked after that, I could use the command to activate PyFerret but it would only say PyFerrer on the name of my command line and I did not really know what was going on.
Could you please instruct me in how to uninstall everything?
 and if possible I would like to be instructed on how to get PyFerret to work as well.
Answer: It seems that Conda can only install one version of a package at a time,thus whatever installing command you use it will replace whatever other build you might have installed. So I reinstalled it using conda create -n FERRET -c conda-forge pyferret ferret_datasets --yes. After that I was able to activate the environment with conda activate FERRET If the terminal complains and asks you to initialize a shell, conda init bash should suffice to allow you to activate the environment.

Install using Anaconda not working


Is there a way for a user to assign another user to a group on the frontend?

Question: So, I'm trying to build a dashboard where the partner of the company I work for can edit users. And I want him to be able to have like a drop down to assign the user's group on the frontend. Is there a way to do this with just a form and input fields? Or does this have to be done with a custom plugin?
Answer: Assuming you're using the core users/save-user action to edit users (as per the official User Profile form example) you can add a form input named groups to save group assignments from the frontend form.
Note that this only works when editing an existing user's profile, i.e. not when registering new users.
Before saving the user, Craft will handle permission checking for you (again, assuming you're posting the form to the core users/save-user action). Still, it's probably a good idea to make sure that only groups that the current user is able to save assignments for, are exposed as options in the form. Here's one way to achieve that – first pulling all user groups via the craft.app.userGroups service, and then filtering those groups, using the currentUser.can() method to check that the current user has the necessary assignUserGroup:[UserGroupUID] permission for each group:
{% set userGroups = craft.app.userGroups.allGroups()|filter(group => currentUser.can("assignUserGroup:#{group.uid}")) %}

Once you have your userGroups array, you can build a dropdown:
<form method="post" accept-charset="UTF-8" enctype="multipart/form-data">
    ...
    User group
    <select id="group" name="groups[]">
        {% for userGroup in userGroups %}
            <option value="{{ userGroup.id }}"{% if user.isInGroup(userGroup) %} selected{% endif %}>{{ userGroup.name }}</option>
        {% endfor %}
    </select>
    ...
</form>

Or if you prefer, checkboxes. Notice the hidden input name="groups" above the actual checkbox inputs – that's there to make it possible to submit the form without any groups checked:
<input type="hidden" name="groups" value/>
<fieldset>
    <legend>User groups</legend>
    {% for userGroup in userGroups %}

            <input type="checkbox" name="groups[]" value="{{ userGroup.id }}"{% if user.isInGroup(userGroup) %} checked{% endif %} />
            {{ userGroup.name }}

    {% endfor %}
</fieldset>

Or radio buttons:
<fieldset>
    <legend>User group</legend>
    {% for userGroup in userGroups %}

            <input type="radio" name="groups[]" value="{{ userGroup.id }}"{% if user.isInGroup(userGroup) %} checked{% endif %} />
            {{ userGroup.name }}

    {% endfor %}
</fieldset>

Comment: Great answer! Are you sure that `users/save-user` supports setting user groups though? It's not listed as a [supported parameter](https://craftcms.com/docs/3.x/dev/controller-actions.html#supported-params-3) in the documentation – but maybe it's just missing?
Comment: @MoritzLost I did test it and it works. Maybe the reason why it's not mentioned in the docs is that assigning groups via `users/save-user` only works conditonally, specifically if the request is not a "public registration" – see https://github.com/craftcms/cms/blob/develop/src/controllers/UsersController.php#L1335. In the case where the form is used to edit existing users' profiles (which is how I interpreted the OP) `$isPublicRegistration`  should always be `false`, and hence assigning user groups should work.
Comment: Thanks for the research – good to know!
Comment: I appreciate this so much, exactly what I was looking for! Thank you!
Comment: I'll make a note that the above only works when editing existing users and not when registering new ones, though – an important caveat :)
Answer: Why not just provide them with access to the backend, with only the permissions they need?
Anyway, if you need to provide a custom form in the frontend, you can write a form similar to the example in the knowledge base article on front-end user accounts. In particular the part about user profile forms.
As far as I know, the users/save-user controller action doesn't allow you to edit user groups for a given user. Maybe check if there's another controller action that does that you can use. If there isn't, you're gonna have to write your own, making sure to include safeguards to prevent privilege escalation vulnerabilities. Then you can just point your custom form to the custom controller endpoint. See the documentation on controllers for details.
Edit: The users/save-user controller does support editing groups for existing users, it's just not documented. See the answer by Mats Mikkel Rummelhoff for details.
Comment: They will still have access to the backend, but I wanted them to have a nice user interface to easily change things to what they need to. But thanks for the response!


Molecule identification

Question: I'd really like to know what compound this formula is and don't know if there's any software for that matter, if anyone could help me :)
(With a sw suggestion or the compound identification)
Answer: Many software, both online and downloadable executables, are available for identifying a molecular structure - either by giving the official IUPAC name, or matching up the structure to a large database and returning IUPAC/trade names/properties/etc...
Online: NIST, Pubchem, ChemSpyder, Reaxys
Download: ChemBioOffice Software
A variety of options are available to search for structures such as by molecular formula, structure, identification values, etc... Easiest for most approaches is using any of the software's "Draw" features, to draw the exact structure and then search the database for it. Online options may have difficulty with the exact structure searches on molecules as large as yours above, so as much detail as possible if useful (stereochemistry, for instance, using dashes and wedges).
ChemBioOffice (specifically ChemDraw) is able to give you the IUPAC name, which would then let you look it up in any of the online databases.
If the drawing of the structures is causing you difficulty, you can also search with molecular formulas, but it may take some trial and error to identify the actual structure you want as you look for larger or more complex molecules this way. NIST is a great choice for this approach.
Outside these options, if you have any interest or experience coding, you may be interested in using RDkit (Python module), which has a large array of functions for molecular data interaction. For instance, if you use those above structure "Draw" features online, most will also show a SMILES code which is a way of shorthanding a molecular structure's features; place a SMILES code into a script that accesses RDkit and you can request it to draw the structure, look up information related to it (if it can find the SMILES code in its databases), etc... Warning - it is mostly just development manuals, no tutorials last I checked, so perusing the module can be rather arduous.
As an aside, your molecule in particular gave those online database structure searches a bit of difficulty when I attempted it, so you may need to find a way of giving it more structural information, or perhaps searching for sub structures first (such as just the fused and linked cyclohexanes without the Chlorines or amine group).
However, I found one very similar to your structure, but with aromatics instead for two of the rings: 1,1-dichloroheptadecane
Answer: Maybe you have drawn the structure incorrectly (some unsaturation/aromaticity missing), and meant rather

Which belongs to sertraline.
(No software used, just the experience/expertise/memory :) )
Comment: The double ring could also be naphthalene which to me seems more likely, then the compound would be a  methyl amino  dichloro phenyl naphthalene.
Comment: @porphyrin right, if the original structure was drawn incorrectly, there are more possibilities what is could be, but I guess your compound, properly named 4-(3,4-dichlorophenyl)-*N*-methylnaphthalene-1-amine, is much less notorious.
Comment: mykhal and @porphyrin: I agree, and I'm glad I wasn't the only one thinking this. On top of instinct and for the purposes of the question, I also found that the only "matching" structures were the ones you've both mentioned here.

Molecule identification


Extending the automatically generated JPA controller (Netbeans 7.x)

Question: Netbeans 7.x offers the possibility to generate entities (POJOs) from an existing relational database (ex: CustomerEntity, OrderEntity, etc.)
Also, it generates automatically a controller for each entity (ex: CustomerJpaController, OrderJpaController, etc.).
The generated controllers contains many ready-to-use methods (findAll, create, delete, etc.). The advantage using this controllers' generator is the possibility to recreate/update them once an entity (or table) is modified (adding new constraints, new fields, etc.).
Unlike the "partial class" concept offered by .NET, it is not possible to extend these controllers with user-defined methods in separate classes.
What do you suggest (in terms of best practices or design patterns) to take advantage of these automatically generated controllers?
Answer: I use the generated controller classes in self-created DAO classes.


Is there an implicit default constructor in C++?

Question: In the book I'm reading at the moment (C++ Without Fear) it says that if you don't declare a default constructor for a class, the compiler supplies one for you, which "zeroes out each data member". I've experimented with this, and I'm not seeing any zeroing -out behaviour. I also can't find anything that mentions this on Google. Is this just an error or a quirk of a specific compiler?
Comment: Sounds like you need a better book. ;)
Comment: Yup. Unforgiveable error, if the "zeroes each data mamber" is indeed a literal quote.
Comment: I think this is a common c misconception. I thought the same thing until I visited this page. I'm *sure* I read it somewhere or I learned in a class.
Comment: I suspect this confusion arises when people learn that global objects are guaranteed to be zeroed, although it's really best not to rely on that either.
Answer: If you do not define a constructor, the compiler will define a default constructor for you.
Construction
The implementation of this
default constructor is:

default construct the base class (if the base class does not have a default constructor, this is a compilation failure)
default construct each member variable in the order of declaration. (If a member does not have a default constructor, this is a compilation failure).

Note:
The POD data (int,float,pointer, etc.) do not have an explicit constructor but the default action is to do nothing (in the vane of C++ philosophy; we do not want to pay for something unless we explicitly ask for it).
Copy
If no destructor/copy Constructor/Copy Assignment operator is defined the compiler builds one of those for you (so a class always has a destructor/Copy Constructor/Assignment Operator (unless you cheat and explicitly declare one but don't define it)).
The default implementation is:
Destructor:

If user-defined destructor is defined, execute the code provided.
Call the destructor of each member in reverse order of declaration
Call the destructor of the base class.

Copy Constructor:

Call the Base class Copy Constructor.
Call the copy constructor for each member variable in the order of declaration.

Copy Assignment Operator:

Call the base class assignment operator
Call the copy assignment operator of each member variable in the order of declaration.
Return a reference to this.

Note Copy Construction/Assignment operator of POD Data is just copying the data (Hence the shallow copy problem associated with RAW pointers).
Move
If no destructor/copy Constructor/Copy Assignment/Move Constructor/Move Assignment operator is defined the compiler builds the move operators for you one of those for you.
The default implementation is:
Implicitly-declared move constructor
If no user-defined move constructors are provided for a class type (struct, class, or union), and all of the following is true:
Move Constructor:

Call the Base class Copy Constructor.
Call the move constructor for each member variable in the order of declaration.

Move Assignment Operator:

Call the base class assignment operator
Call the move assignment operator of each member variable in the order of declaration.
Return a reference to this.
Comment: @wilhelmtell: That is when you __explicitly__ use the default initialized. In the above situation the POD types are not explicitly default initialized so there values are undefined. This is why I use the slightly more ambiguous term of default constructor.
Comment: From section 8.5 item 5 in the standard: _"To default-initialize an object of type T means: ... [if the T is POD] the object is zero-initialized."_ and from item 4 of the same section: _"To zero-initialize an object of type T means: if T is a scalar type, the object is set to the value 0 (zero), taken as an integral constant expression, converted to T"_ .  For POD, if I am not mistaken, this means `int i = int();` concludes with `i == 0`
Comment: @JorgeLuque Added a section for Move. Yes. **BUT** only if you don't define the copy operations or the destructor. You can force the creation of the default version by using `Class(Class&&) = default;`. If you define either move operator you must define both.
Comment: Does the compiler also define a move constructor if I don't define one?
Answer: I think it's worth pointing out that the default constructor will only be created by the compiler if you provide no constructor whatsoever.  That means if you only provide one constructor that takes an argument, the compiler will not create the default no-arg constructor for you.
The zeroing-out behavior that your book talks about is probably specific to a particular compiler.  I've always assumed that it can vary and that you should explicitly initialize any data members.
Answer:

Does the compiler automatically generate a default constructor?
Does the implicitly generated default constructor perform zero
initialization?

If you legalistically parse the language of the 2003 standard, then the answers are yes, and no.  However, this isn't the whole story because unlike a user-defined default constructor, an implicitly defined default constructor is not always used when creating an object from scratch -- there are two other scenarios: no construction and member-wise value-initialization.
The "no construction" case is really just a technicality because it is functionally no different than calling the trivial default constructor.  The other case is more interesting:  member-wise value-initialization is invoked by using "()" [as if explicitly invoking a constructor that has no arguments] and it bypasses what is technically referred to as the default constructor.  Instead it recursively performs value-initialization on each data member, and for primitive data types, this ultimately resolves to zero-initialization.
So in effect, the compiler provides two different implicitly defined default constructors.  One of which does perform zero initialization of primitive member data and the other of which does not.  Here are some examples of how you can invoke each type of constructor:
    MyClass a; // default-construction or no construction
    MyClass b = MyClass(); // member-wise value-initialization

and
    new MyClass; // default-construction or no construction
    new MyClass(); // member-wise value-initialization

Note: If a user-declared default constructor does exist, then member-wise value-initialization simply calls that and stops.

Here's a somewhat detailed breakdown of what the standard says about this...

If you don't declare a constructor, the compiler implicitly creates a default constructor [12.1-5]

The default constructor does not initialize primitive types [12.1-7]
  MyClass() {} // implicitly defined constructor

If you initialize an object with "()", this does not directly invoke the default constructor.  Instead, it instigates a long sequence of rules called value-initialization [8.5-7]

The net effect of value initialization is that the implicitly declared default constructor is never called.  Instead, a recursive member-wise value initialization is invoked which will ultimately zero-initialize any primitive members and calls the default constructor on any members which have a user-declared constructor [8.5-5]

Value-initialization applies even to primitive types -- they will be zero-initialized. [8.5-5]
  int a = int(); // equivalent to int a = 0;

All of this is really moot for most purposes.  The writer of a class cannot generally assume that data members will be zeroed out during an implicit initialization sequence -- so any self-managing class should define its own constructor if it has any primitive data members that require initialization.
So when does this matter?

There may be circumstances where generic code wants to force initialization of unknown types.  Value-initialization provides a way to do this.  Just remember that implicit zero-initialization does not occur if the user has provided a constructor.

By default, data contained by std::vector is value-initialized.  This can prevent memory debuggers from identifying logic errors associated with otherwise uninitialized memory buffers.
  vector::resize( size_type sz, T c=T() ); // default c is "value-initialized"

Entire arrays of primitives type or "plain-old-data" (POD)-type structures can be zero-initialized by using value-initialization syntax.
  new int[100]();

This post has more details about variations between versions of the standard, and it also notes a case where the standard is applied differently in major compilers.
Comment: This is by far the best answer - unfortunately, I can upvote it only once. So everybody else should upvote, too!
Comment: Related -- value-initialization for structs: http://stackoverflow.com/a/1069634/86967
Comment: This should be the accepted answer. The actual accepted answer just listed a bunch of extra (too much irrelevant) stuff but did not answer the question.
Answer: C++ does generate a default constructor but only if you don't provide one of your own.  The standard says nothing about zeroing out data members.  By default when you first construct any object, they're undefined.
This might be confusing because most of the C++ primitive types DO have default "constructors" that init them to zero (int(), bool(), double(), long(), etc.), but the compiler doesn't call them to init POD members like it does for object members.
It's worth noting that the STL does use these constructors to default-construct the contents of containers that hold primitive types.  You can take a look at this question for more details on how things in STL containers get inited.
Answer: The default constructor created for a class will not initialize built-in types, but it will call the default constructor on all user-defined members:
class Foo
{
public:
     int x;
     Foo() : x(1) {}
};

class Bar
{
public:
     int y;
     Foo f;
     Foo *fp;
};

int main()
{

    Bar b1;
    ASSERT(b1.f.x == 1);
    // We know nothing about what b1.y is set to, or what b1.fp is set to.

    // The class members' initialization parallels normal stack initialization.
    int y;
    Foo f;
    Foo *fp;
    ASSERT(f.x == 1);
    // We know nothing about what y is set to, or what fp is set to.

}

Answer: The compiler will generate default constructors and destructors if user-created ones are not present. These will NOT modify the state of any data members.
In C++ (and C) the contents of any allocated data is not guaranteed. In debug configurations some platforms will set this to a known value (e.g. 0xFEFEFEFE) to help identify bugs, but this should not be relied upon.
Comment: To clarify, those tagging values are usually set by the memory management library (operator new(), malloc, and derivatives), not by the compiler creating default constructors.
Comment: The value used in debug mode is compiler dependant. And different values usually represent different states. Like Allocated/Deallocated/Not Initialized etc.
Answer: Zero-ing out only occurs for globals. So if your object is declared in the global scope, its members will be zero-ed out:
class Blah
{
public:
    int x;
    int y;
};

Blah global;

int main(int argc, char **argv) {
    Blah local;
    cout<<global.x<<endl;  // will be 0
    cout<<local.x<<endl;   // will be random
}

Comment: It's part of the standard though. Do you know a complaint compiler that doesn't zero out globals?
Answer: C++ does not guarantee zeroing out memory.  Java and C# do (in a manner of speaking).
Some compilers might, but don't depend on that.
Answer: In C++11, a default constructor generated by the compiler is marked deleted , if :

the class has a reference field
or a const field without a user-defined default constructor
or a field without a default initializer, with a deleted default constructor

http://en.cppreference.com/w/cpp/language/default_constructor
Answer: C++ generates a default constructor.  If needed (determined at compile time I believe), it will also generate a default copy constructor and a default assignment constructor.  I haven't heard anything about guarantees for zeroing memory though.
Answer: The compiler by default will not be generating the default constructor unless the implementation does not require one .
So , basically the constructor has to be a non-trivial constructor.
For constructor to be non-trivial constructor, following are the conditions in which any one can suffice:
1) The class has a virtual member function.
2) Class member sub-objects or base classes have non-trivial constructors.
3) A class has virtual inheritance hierarchy.