Why does solving integer factorization by using Shor's algorithm surpass the conventional computation

Question: What is the reason that solving integer factorization by using Shor's algorithm surpass the conventional computation? Can these quantum characteristics be used for different problems? I would like to understand why in this specific case the quantum solution surpasses the conventional computing solution, whereas in many other cases, the quantum has not showed yet a better solutions? What is so unique in Shor's algorithm that enable the quantum to work better?
Answer: This question is actually related to the open problem in computer Science about is there any theoretically provable quantum advantage. I don't think people have already solved the problem yet. However, from my perspective, I think there is a simple answer to the question: All quantum algorithms that is believed to be exponentially faster than all classical counterparts are equivalent to "finding a hidden subgroup" in some Abelian group. In other words, the quantum algorithm is finding the non trivial period in some discrete structure, if there is any.
Let's take a look, first, on the Shor's algorithm. The most important observation, for solving the factoring, is that we only need to find the even order $d=2r$, by randomly choosing a basis $a$, of the modular group of the number $N$ that we want to factor (the order $d$ is defined to be the minimum integer such that $a^d \equiv 1 \mod N$, $a$ has to be coprime with $N$), which is defined as:
$$a^d=a^{2r} \equiv 1 \mod N$$
After factoring the above equation, we get
$$(a^r-1)(a^r+1) \equiv 0 \mod N  \qquad$$
This implies two possibilities, for any prime factor $p$ of $N$:
1.$p$ is a factor of $(a^r+1)$
2.$p$ is a factor of $(a^r-1)$.
We are happy now because now we can use the famous Euclid's algorithm (GCD) for both $gcd(N,a^r+1)$ and $gcd(N,a^r-1)$ to get $p$. (There are bad cases, however, when $N$ is a factor of $(a^r+1)$. But the possibility of such case is bounded.)
Now we can come back to the most important conclusion:
The quantum computer, in its nature, is pretty good at finding such $r$. Because $r$ is the period of the subgroup generated by $a$ in the Abelian multiplication group of modular $N$.
The "trick" used by quantum computer, is called Quantum Fourier Transform (QFT). First, we create a quantum circuit which do the modular exponentiation with respect to $a$ modular $N$. Then we prepare a uniform superposition off all $n$ qubits state. We can prove that, after using inverse QFT, we will finally measure a good approximation of $1/r$, with high probability.
Take a look at the example of $N=15$ and $a=7$. The right answer for the even order, should be $7^4 \equiv 1 \mod 15$. And we can take $gcd(7^2-1,15)=3$ as the answer of our factoring.
The hidden subgroup here, is $\{1,7, 7^2 \mod 15 =4, 7^3 \mod 15 = 13\}=\{1,7,4,13\}$. We can check that this is a subgroup of modular $15$ group because every element has an inverse. The goal of shor's algorithm, is exactly finding the period of this hidden subgroup! $(1 \rightarrow 7 \rightarrow 4 \rightarrow 13 \rightarrow 1 \rightarrow 7 \cdots)$.
We can even take a look at the quantum circuit for solving the problem:
$N=15$ when $a=7$" />
The measuring result of 20000 shot, of the above circuit is :

Now we can see that with high probability, we will measure $010$, which means $1/r \approx 0.010= 1/4$. So shor's circuit, in this case, indeed help us find the non trivial even order $4$!
The magic of the whole thing behind the period finding, is that there is a period in the quantum phase of a qubit. We can carefully match the period of our problem to the period of "phase" of a quantum state that we can construct.
The trick of phase manipulation, is also used in all other quantum algorithms, such as Grover algorithm. But the idea behind the Grover algorithm is rotation the solution vector in the phase space, so it has no exponential speedup.
Answer: community wiki

It is a long-open program to iron out the precise requirements needed to achieve tremendous speedups (e.g., exponential speedups) with quantum algorithms.
If we limit ourselves to decision problems or problems that can be recast as such (like, the factoring problem), a rough and ready answer is that quantum algorithms might afford an exponential speedup when the problems have a certain global structure that interference can exploit.  I'd refer you to Aaronson's summary here.
Recently the same program has moved over to non-decision based problems, such as search or sampling problems, that still achieve exponential speedups with quantum computers.  This is manifest in the results of Yamakawa and Zhandry (for search problems) and the other results on random circuits (for sampling problems).
For Yamakawa-Zhandry, it's not quite clear to me why there should be a speedup apart from some handwaving about multiplication in the primal domain being equivalent to convolution in the Fourier domain.  For sampling problems, the advantage likely has to do with summing a bunch of positive and negative amplitudes together.

Why does solving integer factorization by using Shor’s algorithm surpass the conventional computation


ios backbutton at top of the screen

Question: In many apps like safari or youtube the backbutton is at the top of the screen. That makes it basically impossible to use my ipad pro 9.7 comfortably in bed, I would have to sit up and use both hands to access the back button. Is there any way to get a back button at the bottom of the screen?
Answer: I'm not aware of any way of doing this within iOS proper (although there may be a way to implement such a feature on a jailbroken device).
However, you could just double tap the home button to then select the previous app from the screen.
Also, using your iPad in landscape (I.e. Sideways) may help with accessing the default 'back' button.
Comment: It's likely possible while jailbroken. There's the ability to activate Reachability using some gesture (like a bottom edge swipe), there's an Activator gesture which allows you to go back universally and some tweak (whose name I forgot) which you can assign an Activator action to.
Answer: You raise a valid point... with the larger screens of iPad Pros, a worthwhile option would be a system setting that could allow the back button to be relocated.
Unfortunately at the current time, the back button is set at the top of the screen.
This location is controlled by the operating system and so it is outside the ability of a software developer to relocate elsewhere on the screen.
Remember too that many apps allow a swipe action from the left edge of the screen to the right, that performs the same function as tapping the back button.

ios backbutton at top of the screen


Why is localhost IP 127.0.0.1?

Question: I wondered what is the origin of the decision to make localhost's IP address 127.0.0.1. What is the "meaning" of 127? what is the "meaning" of 0.0.1?
Comment: I haven't seen a "There's no place like 0:0:0:0:0:0:0:1" door mat yet!
Comment: @Wil Compress it to "there's no place like ::1" and you'll get a bit more business.
Comment: @WilliamHilsum expand it to "There's no place like 0000:0000:0000:0000:0000:0000:0000:0001" and charge more.
Comment: I'm curious about this too.  The IPv6 loopback is 0:0:0:0:0:0:0:1, which makes sense to me.
Comment: Yes, IPv6's localhost does not raise too many questions :)
Comment: @Wil: I'll be your first customer :)
Comment: For interest, in the early 2000 I tried redefining localhost on a virtual network.  Linux was quite happy to have 127.0.0.1/24 assigned to lo, as was BSD.  But try the same on a windows box and it sulked as soon as I typed in "127" into the network config box.  Was either win98 or winXP.
Answer: 127 is the last network number in a class A network with a subnet mask of 255.0.0.0. 127.0.0.1 is the first assignable address in the subnet. 127.0.0.0 cannot be used because that would be the wire number. But using any other numbers for the host portion should work fine and revert to using 127.0.0.1. You can try it yourself by pinging 127.1.1.1 if you'd like. Why they waited until the last network number to implement this? I don't think it's documented.
Comment: The only reasons I would see them arbitrarily choosing 127 is that it's an easy number to remember (01111111), and perhaps they were allowing 16 million host addresses for being able to communicate with itself and itself only (like how some programs and Windows components use ports nowadays).

The RFCs only really mentioned that it's standard practice for 127.0.0.1/32 to be used for loopback. It's quite nebulous as to what they intended for the rest of the block aside from it looping back to the host and never hitting the network, hence my above speculation.
Comment: Having all the block addresses reverting to 127.0.0.1 is implementation dependent and might perhaps just be a Linux stack peculiarity. Solaris at least requires an interface to be bound to the destination address for your ping test to succeed.
Comment: The two answers below by Joseph Bui and Dario Fumagalli are brilliant at describing why 127 was chosen. In fact, I don't think it's fair to say 127 was chosen as much as it was its destiny to be used due to its specific properties in the binary world.
Answer: Earliest mention I can find regarding 127's assignment as loopback is November 1986 RFC 990 authored by Reynolds and Postel:

The address zero is to be interpreted
as meaning "this", as in "this
network".
For example, the address 0.0.0.37
could be interpreted as meaning host
37 on this network.
...
The class A network number 127 is
assigned the "loopback" function, that
is, a datagram sent by a higher level
protocol to a network 127 address
should loop back inside the host.  No
datagram "sent" to a network 127
address should ever appear on any
network anywhere.

Even as early as September 1981 RFC 790, 0 and 127 were already reserved:

000.rrr.rrr.rrr                 Reserved                     [JBP]
...
127.rrr.rrr.rrr                 Reserved                     [JBP]

0 and 127 were the only reserved Class A networks by 1981.  0 was used for pointing to a specific host, so that left 127 for loopback.
I know this doesn't answer the question, but this is as far back as I could dig.  It might have made more sense to choose 18.104.22.168 for loopback but that was already given to BBN Packet Radio Network.
Answer: The designers of the Internet really knew how the hardware worked, and they designed with low level implementation in mind.
The values 0, 127 and 255 are special in 8 bit assembly and machine language programming because there are "tricks" you can use to test for these values and branch to different code using smaller instructions that execute faster than for other integers. 127 is the highest signed 8 bit integer, so incrementing it by 1 will cause a signed overflow. Similarly, incrementing 255 will cause unsigned overflow. Merely loading the value 0 into a register will usually set a zero flag on the chip. Imagine the networking program looks like this in pseudocode:
if (value == 0) doLocal();
if (value == 127) doLoopback();
if (value == 255) doNetwork();

Although it depends on the chip, in those days most chips could encode these tests with 2 words, 3 words and 3 words respectively (total 8 words) and further those particular tests were all likely to execute in 1 clock cycle each. Using any other value would probably require 4 words each (total 12 words), a 50% increase in code size and likely a 50% increase in execution time as well.
Comment: Note that I used "words" because old machines back then had unusual word sizes, but they often still used 8 bit arithmetic. For an 8088, I would have said "bytes."
Comment: This is a great example of premature optimization. Compared to all the other latencies needed for network communication, the ability to avoid a single compare operator on a given hardware was pretty poor cause for messing the address space to allocate 16 million addresses to localhost use only, from the middle of possible 32 bit address space. Localhost could have been only 18.104.22.168 just as well. However, that would have prevented Cloudflare from running global DNS service in that IP address later...
Comment: A great example of optimization, yes. Premature? No. Read this description of how IPv4 was defined by direct competition in RFC 1025 https://datatracker.ietf.org/doc/rfc1025/
Comment: Selecting specific magical *binary* values for a new *protocol* because it happened to have the best performance on a *single* CPU architecture? Yes, it does check the premature optimization box in my books.
Comment: Mikko, it seems like we have endless amounts of resources now, but it's not like assembly language disappeared. Think about the importance of efficiency here. How many data packets do you suppose pass through the internet daily? I don't know what comes after decillion (trillion, quadrillion,... decillion) but I bet the number is a lot higher than that. Doesn't it seem like this little tweak of efficiency is part of the reason the internet is as fast and durable as it is? Take that out and the cost of running the internet to give us the performance we're used to would be unaffordable.
Answer: Because when those standards were created, computers were slow and usually limited to 8 bit registers.
Comparing numbers to numbers was very slow, expecially if those numbers had to be fetched from the back then REALLY slow memory. Registers, that is "CPU on board" storage were much faster.
Moreover those old computers had special, faster instructions to detect "equal to zero", "different than zero", "negative / positive integer" (where the sign was... guess what, the leftmost bit, now see a connection with 127, that is the number with all binary "1" except the leftmost = sign?).
Therefore those were special numbers, because they allowed programming trickery to save a lot of CPU cycles on frequently done operations.
You'd never see a "IF CallerIP = "0" but a "IF NotZero(CallerIP)" instruction.
You could go check ancient assembly instructions like "BEQ, BNE" (6502 CPUs) for longer explanations. Also check this page out.
In the end:
0, 255 and 127 could all be checked for with an one, fastest, instruction. Even more high level languages like C have "shortuct" comparison functions that the compiler may internally optimize into a one instruction.
Years 70 and 80 programmers really produced magnificent architectures with super-scarce resources, behind standards like IP numbering there's a lot of thought and genius.
Comment: Great answer. This is really the clearest and most sensible explanation.
Comment: Actually, back when IP was designed and some of the early groundwork for it was laid down, working with data in integer multiples of 8 bits wasn't a given. Many architectures at that time had registers and word sizes in multiples of 12 or 18 bits, for example. This is one reason why octal was so popular at the time; 18 bits can be represented as exactly 6 octal digits with no loss and no waste; 12 bits is 4 octal digits. Microcomputers typically worked in 8-bit quantities, but it was only *much* later that microcomputers started being regularly connected (especially directly) to the Internet.
Comment: Very nice answer, @Dario Fumagalli. I also like your comments on SE Politics!
Answer: If you think about what a localhost or loopback IP address means, you realize that you never want to see that address, or the network that that address belongs to, outside of a host. (Inside of a host, it's too dark to see it. Apologies to Mark Twain.)
So, someone had to pick an IP network to represent this localhost address. I don't recall who first chose it, but it's specified in the IETF Request for Comments that is periodically issued as "Host Requirements".
It was done so long ago, that the idea of "wasting" an entire class A address didn't enter anyone's mind at the time.
The utility of localhost is that you can talk to yourself using a hard-coded IP address. It was used long before there was the Domain Name System. You could actually use any of the 127.x.x.x valid addresses, but no one ever does. You can't sneak and use 127 as a real network because the "Router Requirements" RFC disallows ever routing that network on any internet.
Answer: First, the whole 127.x.x.x range points to your localhost.
127 in binary is "01111111". "11111111" = 255 and 0 are reserved, so the choice is obvious :)
Comment: How come it's obvious again?
Comment: Nope. Try again.
Comment: I believe they just chose something simple. Again, all "1"s is reserved, so one zero was added :)
Comment: so why not 10111111 ? :) or 11011111 or 11101111 or 11110111 or 11111011 or 11111101 or something like it ?

Why is localhost IP 127.0.0.1?


Reason for adding libxml2?

Question: Both FMDB and TouchXML are outside fraweworks. But we need to add -libxml2 flag while  implementing TouchXML and we don't add any flag while implementing FMDB. Can anybody explain this to me ?
Answer: fmdb is NOT a framework. It's a objective-C wrapper. you will need to add the sqlite3 flag if you are linking against the sqlite3 lib installed in your system. If you just use the sqlite3.c and sqlite3.h, you do not need to add the sqlite3 flag.

Reason for adding libxml2?


how to find function boundaries in binary code

Question: I see that binary translation is usually trace-based. Is it because one can not get the  boundaries of functions? Is there function label in binary code?
Answer: There's no trivial answer to this. You could search for ret instructions, but they are no guarantee that they are function boundaries as you could return from the middle of a function.
Searching for stuff like
mov   ebp, esp

will work to some extent, but again, it's no guarantee.
Some compilers (most notably the Intel Compiler), will move branched blocks to after the function ends, and jump back into the function...
Comment: It is easy to get the function label info from LLVM binary code. Why doesn't machine code include function label info?
Comment: But this isn't LLVM. It's a fully-compiled binary. (at least that's what I'm assuming...)
Answer: What does trace-based mean? The essential answer to your question is no, there is no function label in machine code. There are probably patterns specific to each compiler you could look for and you could also use the executable format to find entry points into public functions in the code. But these days compilers can do whole-program optimizations that blur out the concept of a function at the machine code level.
Answer: The usual method for finding the begin and ending addresses of C functions is to print out a memory map and scan for the start of the function.  Many compilers will specify the function length in the memory map.
Some compilers provide #pragma or preprocessing keywords to allow you to assign a function to a specific address.
Sorry, but the C language only provides the starting address of functions; not their lengths.
Comment: If one knows the starting addresses of all functions, it is easy to get the lengths, right?
Comment: No, the C language does not provide facilities for getting function lengths. One must consult the map file and the linker instruction file. There is no requirement for the linker to place functions contiguously, nor in the same space; one function could be in SRAM, another in ROM.


usage of "nasty"

Question: I want to describe a little girl who behaves bad. she breaks everything, scares poor animals and can even make an ogre cry. Can I use the term 'nasty' when speak about her? About a child?
(She is a nasty girl, She was the nastiest girl I ever saw.) Is 'nasty' equal to 'awful', 'terrible', 'horrid'?
(I'm confused because of a song Destiny's Child - Nasty Girl.)
Comment: Bear in mind that ***nasty*** is increasingly used as a sexually loaded term these days with the same connotations as *wicked, filthy, dirty, kinky* (often seen as *desirable* uninhibited sexual deviancy).
Comment: She sounds pretty nasty to me.  The word has a number of connotations, but I *think* it's avoided being fatally sullied by association with excessively prurient connotations such that it can't be safely used to describe this little girl.
Answer: Yes, though context can provide additional implications - whether you mean nasty to imply disgusting and lacking in cleanliness, or malicious and deliberately mean, or another variant. One of the other terms you suggest would sound more natural.
The Destiny's Child song carries complex implications about the woman's attitude to sex, using the other lines in the song, with overtones of her behaviour being disgusting and shameful.
Answer: If you google the meaning of this word, you will find its meaning like: - not kind, very bad or very angry or violent.
So, if you were going to describe a little girl as a nasty girl, you could say: - she has always been a nasty girl to her parents.
I hope you got it.
http://dictionary.cambridge.org/pt/dicionario/ingles/
Answer: As @FumbleFingers commented, the word "nasty" is loaded with the same sexual connotations as "wicked," "filthy," "dirty," and "kinky" these days...
As an alternative, you might want to consider mean.

mean: cruel, spiteful, or malicious: a mean boy who liked to make fun of others. AHD
She was the meanest girl I ever saw.

usage of "nasty"


Laptop web camera "active" history

Question: Is there a way to see the history of when my web camera has been active? For example during the previous day?
Answer: To answer your question you must first understand the webcam is "always active" just like your keyboard or mouse. To see list of active devices:
$ xinput
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Logitech Performance MX                   id=10   [slave  pointer  (2)]
⎜   ↳ Logitech K800                             id=11   [slave  pointer  (2)]
⎜   ↳ AlpsPS/2 ALPS GlidePoint                  id=14   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳ Sleep Button                              id=9    [slave  keyboard (3)]
    ↳ Laptop_Integrated_Webcam_HD               id=12   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=13   [slave  keyboard (3)]
    ↳ Dell WMI hotkeys                          id=15   [slave  keyboard (3)]

What you need to look at are the applications that use the webcam such as Skype and see what usage log files (if any) they maintain. If they don't maintain log files you can create a wrapper script to maintain your own log files. It can get really complicated when webcams can be used by the Browser because that could mean downloading Chromium source code and modifying it.
A decade ago people laughed when I put masking tape over the webcam. Now days it is common practice for many. Especially when you learn of all the webcam spying software out there.
A couple years ago I took broken earbuds, cut the wires off to the male jack and plugged it into the microphone jack on the laptop. Now there is something new to laugh at ;)
Answer: Technically, it is possible to do, but realistically, no.
You might find this possible duplicate of value:
https://security.stackexchange.com/questions/80285/do-webcams-generates-logs-on-operating-system

Laptop web camera "active" history


Download app update once, install twice/thrice?

Question: I have a very slow internet connection and would like to be able to download app updates (iTunes, Aperture, iWork etc.) just for one machine and be able to update 3 machines offline on home network. Is this possible on Mavericks?
Answer: The "Caching Server" is one of the features of OS X Server. Whenever one of your computers (iOS or OS X) downloads an update it is cached on the server.  This link has a simple description: Caching Server
This is the official solution that Apple provide.  It does mean another level of complexity to managing your network and only you you will be able to decide whether you want to follow the OS X Server path. From my point of view, I would not unless I intended to use some of the other features of OS X Server (e.g. centralised Time Machine). The server Mac can continue to be used for desktop activity.
Comment: Ha - nice, you beat me by seconds... ;)
Comment: Thanks to you both! Your caveats aside, I may treat myself to the Server.app as I feel like I owe Apple money for the free Mavericks release (cough cough). More seriously I need a distraction to get me through the 'dark months'.
Answer: Yes, there is a way.
You can install Mavericks Server (Server costs $20 from the Apple Store), and activate the Caching Server.
From Apple:

The Caching server speeds up the download of software distributed by
  Apple through the Internet. It caches all software updates, App Store
  purchases, iBooks, iTunes U (apps and books purchases only), and
  Internet Recovery software that local Mac and iOS devices download.
Comment: Great minds think alike ;-)


stock price at 4:00am when the pre-market opens

Question: What happens to the stock price when pre-market opens at 4:00am? Will there be a significant different to the close price at 8:00pm on the previous day? I have never got up so early to watch the stock price at 4:00am.
Comment: There _can_ be. _Will_ there be a significant difference? Who knows.
Answer: Most stocks do not trade as early as 4:00 am unless there is specific news in the stock and/or national or global economic or political news that affects them.
Story stocks like TSLA and the FAANG stocks may trade modestly circa 4:00 am in the absence of such news but price will not differ much from the previous 8:00 pm close unless there is a reason for it to change (news).


Cut a stroke into pieces in Inkscape

Question: I have drawn the stroke or border, that is without the fill set, of a star with the star tool. Now I want to cut the star stroke into several pieces. I tried to use the eraser tool but it will add stroke lines rather than only cut the stroke. I have no idea how to do this. Any help much appreciated!
Answer: There are several ways to do it.

Select the star shape and click Path > Object to Path
Add nodes by double clicking using the Edit Paths by Nodes Tool, and/or select a node/nodes where you want to cut.
In the tool bar along the top, hit the Break Path at Selected Nodes icon.
Click Path > Break Apart
Select the path you just cut, and move it away from the star.

Another method is to draw an open path over the star, where you want to cut it, then select both star and path, and click Path > Cut Path

Then you can move both parts of the star apart
Comment: @Daniel OK, I added another method that might suit you better.  Also forgot to say to add nodes just double click with the Edit Nodes by Paths tool.
Comment: Thanks! Okay, that seems cumbersome. So there is no way to just cut it along some path or so? Also, how do I add a node? I found that when selecting a path segment I can add a node exactly in the middle of the math by clicking on the add node button. But I want other cutting points then this. Is that possible?
Comment: "Cut path" didn't do this for me, but "division" did!

Cut a stroke into pieces in Inkscape


Why Taylor series does not converge for all x in the domain of the function

Question: Example:
$$
f(x)=\frac{1}{1+x} \qquad x\neq-1
$$
$$
f(x)=1-x+x^2-x^3+x^4-x^5+\;... \qquad  |x| < 1
$$
Why Taylor series does not converge for all x in the domain of the function?
Comment: What do you mean it doesn't? It does converge. Check by yourself with $x = 1/2$ for example.
Comment: Is your question: "why doesn't the taylor series converge everywhere?"
Comment: @user88595 he meant why doesn't it work, say, 2.
Comment: @JoshuaPepper yes. *"Why Taylor series does not converge for **any** x in the domain of the function?"* That should mean every I think.
Comment: @Sabyasachi : Ah ok. Got confused by the domain he was talking about.
Comment: sorry, my mistake, I meant for all x in the domain.
Answer: It's actually surprising that the Taylor series converges to the function anywhere other than $x=0$ -- functions that are equal to their Taylor series are actually rather rare.
Of course, most of the functions people actually study do have this property of being "analytic", so it's easy not to get a sense of how special this property is.
It turns out there is a pleasing geometric description of what the radius of convergence of a Taylor series will be: if you look at the complex plane, your analytic function may have some singularities. The Taylor series around any point will converge in a disk around that point whose radius is as large as it can possibly be without including any of those singularities.
Your particular $f$ has a singularity at $x = -1$, and that is its only singularity in the complex plane. Thus, the Taylor series around $x=0$ will have a radius of convergence equal to $1$. Its Taylor series around $ x = 41$ will have a radius of converge equal to $42$. Its Taylor series around $x = \mathbf{i}$ will have radius of convergence $\sqrt{2}$, and so forth.
Answer: This series is obtained from Newton's generalization of the binomial theorem which is only applicable for $|x|\lt 1$. This can be also obtained from the infinte geometric series, as
$$\lim_{n\to\infty}1-x+x^2-\cdots+(-1)^nx^n = \lim_{n\to\infty}\frac{1-x^{n+1}}{1+x}$$
Clearly, this only converges if $|x|\lt1$
Although it is useful to note, that Gottfried Leibniz admitted that the series,
$$1-2+4-8+\cdots = ?$$
Could either yield positive or negative infinty depending on how you subtract, and therefore neither can be correct, and the actual value should be finite. To quote:

"Now normally nature chooses the middle if neither of the two is permitted, or rather if it cannot be determined which of the two is permitted, and the whole is equal to a finite quantity."

He associated it with $\frac13$ which now happens to be the accepted convergent representation for this divergent sum,  and can be otained by substituting $x=2$ in the Taylor series for $\frac{1}{1+x}$. So this formula isn't entirely inapplicable. Citation
Comment: Similarly for [$\frac{1}{1-x}$](http://en.wikipedia.org/wiki/1_%2B_2_%2B_4_%2B_8_%2B_%E2%8B%AF)
Answer: A quick answer is imagine $|x| > 1$, then $x^n \to \pm \infty$ as $n\to \infty$.
So your series is adding and subtracting larger and larger numbers at every step. How could this possibly converge?
A more mathematical reason is that this is the same as a well known formula :
$$\dfrac{1}{1-x} = 1+x+x^2+x^3+...\qquad |x| < 1$$
multiplying both sides by $1-x$ you obtain :
$$1 = (1+x+x^2+x^3+...+x^n)(1-x) = 1-x+x-x^2+x^2 - ... -x^{n-1}+x^{n+1} - x^n$$
Most terms cancel and you get : $$1 =\lim_{n\to\infty} 1-x^n$$
This only holds for $|x|<1$.
Comment: I know this. My question is, why it's like this? the taylor series of a function has the same nth derivative as the function, how come their values are not same for some x outside radius of convergence. I've expected taylor series converge for all x in the domain of the function.


Adding 方(ほう)after a phrase

Question: I've been reading Yotsuba and in this part, when talking about these two sisters, Yotsuba asks: "追いかけてくる方か?強い方か?きれいじゃない方か?". I'm assuming this is a way to say "The (qualifier) one", but I'm not finding anything directly explaining this on the internet lol
Comment: Does this help: https://japanese.stackexchange.com/a/60591/9831
Answer: You are correct in reading 方 as ほう. I am going only on what you've quoted in text in the question, but 方 here almost certainly definitely means "type" or "one," something chosen between options. The translation would be:
"The one who comes running to you? The strong one? or... do you mean the non-pretty one...?" (on that last part I am here reading into the possible emotions but believe this is probably what is going on, not knowing the source of what you are referencing)
Answer: ほう's literal meaning is "direction", and it is used to turn things into options to choose from. For example, you can say to a child who doesn't want to get the vaccine shot:
病気にかかって苦しむ方がいいの?それとも今ちょっとちくっとするだけで、病気にかからないようにする方がいいの?
When used to refer to a person, it gets confusing because 方(かた) is also used to refer to a person (without making them into options). For example, you can say あの方は誰 and that usage doesn't imply they are an option. To my knowledge, 方(かた) as a way to refer to a person has also evolved from the original meaning of "direction".
You cannot use ほう in the same way as かた, i.e. a generic way to refer to a person. It can only be used when you are turning people into options.
Importantly, if you say 方(かた) to refer to a person, it's polite. Whereas if you say ほう then it's almost disrespectful (if you are e.g. 先輩 in a sports club situation then it might be acceptable). This is also why I can confidently say in this instance it must read ほう because the context is not a polite context.
If it's 外国の方ですか、それとも日本の方ですか then I would read it as かた as the polite context implies it's used as かた

Adding 方（ほう）after a phrase


In multipart rar, is there any way to determine the order of files except by filename?

Question: Suppose I had a RAR archive split in several smaller files and the names of the resulting  files have later on been changed.
Is there any way to determine the correct order of files?
Answer: Open any filepart in winrar, then get the information of the file (Alt+I).
No matter what the file name is, it will show you the order of file (volume 1, volume 2...). Rename the file parts as it was shown.
Answer: You can get the volume number with unrar, given that the info is present in the archive header:
unrar l myarchive.rar
The volume shows up in the lower right corner of the output:
-------------------------------------------------------------------------------
0                0 101753210   0%       volume 118
                                               ↑↑↑

To specify a password, use the following:
unrar l -pmypassword myarchive.rar
Answer: I have found the specification of the rar headers, it does not mention multipart explicity but it looks like it is covered by it.
Looking at the 'archive' headers, there are not fields that show the order of the file. Of course, that specification is incomplete (there are even two reserved fields), but I found nothing better in the web.
Here is the source coude to unrar, from there you should be able to know if there is such thing. But if you are able to check this, probably it will be easier to just write a program to try all permutations of the files and check with the unrar DLL if it works or not...
So, my answer is "if it is possible at all, it is complicated to find out". My bet would be contacting email@example.com and hope for the best
Comment: Looks interesting! If I don't manage to decode the format, I'll probably end up writing shell script to try everything out.
Answer: Late answer, but that may be useful to future reference. There is an optional volume number field in the Main archive header, as specified here: http://www.rarlab.com/technote.htm
Most of the time this field is present, but there is no guarantee. For example you see more and more often renumbered RAR archives on usenet posts, this is obviously coming with this field to re-organize the volumes, or sometimes with a text file containing the sequence and another way to identify the corresponding files (like a CRC-32).
Answer: Late answer but a google search brought me here, so maybe others too. I just took a look myself and it looks like the last byte after all the data and before the few padding zeros at the end of the file, is the volume index (starting with 00).
And 7zip shows the volume index too, when you click on "properties".


Z-Wave Three Way Wiring

Question: We purchased a set of Z-Wave three way light switches a while back, finally getting around to installing them.
However, our wiring does not match the instructions. Instructions call for power to the main switch, then auxiliary, and finally the light. Our wiring is power directly to the light, and then splitting in two directions to each switch.
Is there any way to wire these switches up with this setup? I really do not want to rip apart my walls and ceiling and rewire everything.
https://www.amazon.com/gp/aw/d/B0013V58K2/ref=mp_s_a_1_1?qid=1463332768&sr=8-1&pi=SX200_QL40&keywords=GE+Z-Wave+Wireless+Lighting+Control+Three-Way+Dimmer+Kit&dpPl=1&dpID=31CP9kPMCIL&ref=plSrch
Comment: What wires to you currently have going to each switch? Does the z wave require just a hot and neutral to the second switch or does it require a neutral and 2 travelers like a standard 3-way?
Comment: Currently each switch just has the single black/white/red setup.  Z-wave has two travelers it looks like. https://youtu.be/Fx1luE9llSQ for the 'recommended install'
Answer: I would sell this kit and go with another one that is compatible with LED lighting and your wiring scheme.  This one is not.  If you're not into that ...
Looking at the manual for this 45607 dimming 3-way...  each smart device needs always-hot (which I show as black here), neutral and ground, which is fairly typical of smart devices.  They need power (hot+nuetral) simply to function.
In this family, only the 45607 main actually switches the light, on a "switched hot" line (red here).  The remote merely sends a data signal to the effect that "the human requested on/off/dim", and even though these are supposed to be wireless devices, they have a data-signal wire between them to communicate (yellow here).  There can be an unlimited number of 45610 remotes -- anywhere they can get hot, ground and that yellow signal wire.  I assume they are misusing ground as neutral; Code actually requires you bring a neutral anywhere you bring power, so I drew it in.

And you can see where that fits pretty well with most 3-way wiring.  The black and white can be used for always-hot and neutral, and the red wire can be re-tasked as the yellow signal wire.  Usually.
It does raise some interesting questions about the 45610 remote.  Why couldn't it run on a couple of AA batteries?  Why can't it use wireless/radio to communicate with the 45607 main?  And in fact, the ZWave system has many manufacturers, another one may make a remote which does exactly that. That is worth looking into.
Now, in your setup, power feeds into the lamp itself.   This leaves you with a wire problem. Here it is.

See, you can hook up the 45607 no problem.  And it will control the light just fine.  But now you've used up all your wires between lamp and main.  So when it comes time to add the data-signal wire over to the 45610(s), you're out of wires.
Here's the thing.  The yellow wire is a data signal wire.  It's not a power wire.  Check with the manufacturer but you may be able to use intercom, doorbell or thermostat wiring for it, which has relaxed rules for installation.   You only need to get from the main to the lamp.  You can re-task the old red wire once you're there.
There's one last way to make this work, but it's crazy.  Put the 45607 main controller inside the fixture.  Use two 45610 remotes, one at each lamp position.  You'll have enough wires for that.
Comment: @Phrogz and this here is probably why...
Comment: Unfortunately -- the yellow wire might be a Class I control circuit instead of a Class II -- which would make the idea of running it using something other than mains wiring no good...as you said, that's something the OP will have to check with the manufacturer. I will say that putting the main controller at the fixture is an interesting approach, though!
Comment: I don't know about the 45607/45610, but I wanted to point out that the newer Z-Wave Plus switches by GE/Jasco (e.g. [14299](https://www.amazon.com/dp/B07361Y54Z)) use the 12723 Add-On switch, which takes a ground and neutral wire, and a "traveler" wire from the main switch, but no hot wire. The traveler wire connects the main switch to the add-on(s). The ports say "No 120V" on them, but measuring them post-installation the master switch is sending 120V AC of some sort over them. Just pointing out that—at least in 2018—the Add-On switches don't appear to mis-use ground.
Answer: It sounds like you do not have a neutral at either of the current 3-way switches.  This was common in the past, although new wiring now requires a neutral at every switch.
The white wire in old 3-way setups is usually the common wire, either carrying line hot to the switch or carrying hot to the fixture after the second switch. If so, the white wire was supposed to be marked with black tape or a black marker (but it often isn't).  The red and black wires are usually the travelers in a 3-way setup, each serving as hot depending on the throw of the switch.
If that is the case, you cannot use the z-wave switches in the current setup because they need a neutral, and you need another wire to carry the neutral.
This can be remedied by rewiring between the fixture and switches with 14/4 cable, or by bringing power to one of the switches instead of to the fixture.
Short of that, your setup will not work.
Comment: Shoot, not the answer I was hoping for, though it was what I unfortunately expected.  Not really worth tearing my walls and ceiling apart to rewire.  Guess I'll just have to get off the couch to turn my lights on and off.  Unless, do you know if there are any smart switches out there that would work with my stupid wiring?  I betting there isn't...
Comment: If you want to lose one of the switches, you could use the three wires at the other switch to supply a single pole switch with a remote. You also might be able to find a remote switch you can combine with a no wire switch (battery operated) if you want two wall switches in addition to the remote. Search *wireless switches*.

Z-Wave Three Way Wiring


"Pursue my goals" vs "reach my goals"

Question: Is it correct to say so? For instance,

I like to pursue my goals wholeheartedly

Or maybe reach my goals would be better?
Answer: Both pursue and reach are grammatically correct, but they mean different things and have to be used a little differently.
To pursue something is to chase or follow it, usually with the intent of catching it, either literally or metaphorically.

The dog pursued the rabbit. (meaning the dog chased the rabbit)
We are pursuing a global strategy. (meaning we are following a strategy that includes the entire world)

To reach something, in this kind of usage, means to get arrive at it, or to achieve it.

The swimmer reached the island. (meaning the swimmer swam all the way to the island)
The monk reached enlightenment by meditating. (meaning the monk achieved enlightenment through meditation)

To say "I like to pursue my goals wholeheartedly" makes sense grammatically and syntactically; it means "I like to chase my objectives with complete devotion."  To say "I like to reach my goals wholeheartedly" is grammatically correct, but sounds very strange and doesn't make a lot of sense.  Of course you like to achieve your goals - isn't the whole point of a goal that it's something that you want?  And how do you obtain something with complete devotion?  You either obtain it or you don't.
The thing that might make reach slightly confusing is the phrasal verb reach for, which means to extend your grasp for something (again, either literally or metaphorically) but not necessarily to actually obtain it!

"What time is it?", I said, reaching for my watch.  (meaning that I extended my arm to grasp my watch, and presumably did grasp it)
He reached for words to explain himself, but could find none.  (meaning that he metaphorically grasped for words, but couldn't find anything)

You could say "I enjoy reaching for my goals wholeheartedly", since it means "to try to grasp", and not necessarily "to obtain".
Answer: The difference between the verbs "pursue" and "rich" is that the former means the process, whereas the latter--the result, the exact meanings of the two being easy to find in any online dictionary.
In your sentence, the adverb "wholeheartedly" appears to be synonymous to "enthusiastically" and it qualifies the actions being carried out to achieve the goal. So "to pursue my goals wholeheartedly" will be the right choice to make.
As for "to reach ones goal", once it has already been reached, the appropriate adjectives to use would be "finally", "eventually", "easily", "quickly", and so on.

"Pursue my goals" vs "reach my goals"


Which algorithm Doc2Vec uses?

Question: Like Word2vec is not a single algorithm but combination of two, namely, CBOW and Skip-Gram model; is Doc2Vec also a combination of any such algorithms? Or is it an algorithm in itself?
Answer: Word2Vec is not a combination of two models, rather both are variants of word2vec. Similarly doc2vec has Distributed Memory(DM) model and Distributed Bag of words (DBOW) model. Based on the context words and the target word, these variants arised.
Note: the name of the model maybe confusing

Distriubted Bag of words is similar to Skip-gram model
Distributed Memory is similar to Continuous bag of words model
Answer: Documentation says:

Deep learning via the distributed memory and distributed bag of words
  models from [1], using either hierarchical softmax or negative
  sampling [2], [3].
Comment: Those are algorithms used for approximation. and you could use hierarchical softmax or negative sampling in any models, CBOW or SG.
Comment: Are DM and DBOW deep learning? I have read CBOW and SG uses a shallow neural network to predict word/context. Shouldn't it be the same for Doc2Vec?
Comment: `doc2vec` uses the same algorithm as `word2vec`, except that it uses sentence labels. None of the models are deep learning to be specific. As deep learning model should have multiple hidden layers. Since, deep learning is mostly involved with big data and `word2vec` and `doc2vec` mostly works with big data, some term it as deep learning model. But actually it is not.
Answer: Distributed Memory model preserves the word order in a document whereas Distributed Bag of words just uses the bag of words approach, which doesn't preserve any word order.
This has been explained in details in this research paper.
Comment: No problem, and welcome to Data Science!

Which algorithm Doc2Vec uses?


Groupby combined with rolling to make matrices

Question: I'm relatively new to Pandas and came accross a problem that has consumed 2 days of my time. I tried many things and read many threads but none of them were close to what I am looking for.
I have the following dataframe:
import pandas as pd

df = pd.DataFrame({'a': [1,1,1,2,2,2,3,3,3,1,1,1,2,2,2,3,3,3],
                   'b': ['b1','b1','b1','b1','b1','b1','b1','b1','b1','b2','b2','b2','b2','b2','b2','b2','b2','b2',],
                   'c': ['c1','c2','c3','c1','c2','c3','c1','c2','c3','c1','c2','c3','c1','c2','c3','c1','c2','c3',],
                   'value': ['v1','v2','v3','v4','v5','v6','v7','v8','v9','v10','v11','v12','v13','v14','v15','v16','v17','v18']})

print(df)

Here is the dataframe printed:
    a   b   c value
0   1  b1  c1    v1
1   1  b1  c2    v2
2   1  b1  c3    v3
3   2  b1  c1    v4
4   2  b1  c2    v5
5   2  b1  c3    v6
6   3  b1  c1    v7
7   3  b1  c2    v8
8   3  b1  c3    v9
9   1  b2  c1   v10
10  1  b2  c2   v11
11  1  b2  c3   v12
12  2  b2  c1   v13
13  2  b2  c2   v14
14  2  b2  c3   v15
15  3  b2  c1   v16
16  3  b2  c2   v17
17  3  b2  c3   v18

I want to group these row by 'b' and then roll every 2 consecutive 'a's within the same 'b' group and make a matrix where the rows (2 rows) are 'a's and the columns (3 columns) are 'c's and the entries are 'v's. It was confusing, so let me show the expected output (note that I don't care about Pandas auto-generated index 0 to 17):
          c1 c2 c3
b1   a1   v1 v2 v3
     a2   v4 v5 v6

b1   a2   v4 v5 v6
     a3   v7 v8 v9

b2   a1   v10 v11 v12
     a2   v13 v14 v15

b2   a2   v13 v14 v15
     a3   v16 v17 v18

As you see, I want them grouped by 'b' and then rolling over 2 based on 'a' and produce matrix-likes
     c1 c2 c3
a1   v1 v2 v3
a2   v4 v5 v6

here as are rows, 'c's are columns and 'v's are values (entries).
Thanks
Answer: Is this what you are looking for:
c=df.pivot(index=['b','a'],columns='c',values='value')

returns:
c      c1   c2   c3
b  a
b1 1   v1   v2   v3
   2   v4   v5   v6
   3   v7   v8   v9
b2 1  v10  v11  v12
   2  v13  v14  v15
   3  v16  v17  v18

Comment: Thank you for your reply. It is very close to what I was looking for. I totally forgot about using pivot. On top of the output of your code, I want it be rolling(2) but that part is very easy. Thank you for your help!


What inherited code has impressed or inspired you?

Question: I've heard a ton of complaining over the years about inherited projects that us developers have to work with.  The WTF site has tons of examples of code that make me actually mutter under my breath "WTF?"
But have any of you actually been presented with code that made you go, "Holy crap this was well thought out!" or "Wow, I never thought of that!"
What inherited code have you had to work with that made you smile and why?
Comment: @Malfist: Do us all a favor and stop editing tags.
Comment: And I thought the request to be able to downvote a user was stupid. Now my foot is in my mouth...
Answer: Long ago, I was responsible for the Turbo C/C++ run-time library.  Tanj Bennett wrote the original 80x87 floating point emulator in 16-bit assembler.  I hadn't looked closely at Tanj's code since it worked well and didn't require attention.  But we were making the move to 32-bits and the task fell to me to stretch the emulator.
If programming could ever be said to have something in common with art this was it.
Tanj's core math functions managed to keep an 80-bit floating point temporary result in five 16-bit registers without having to save and restore them from memory.  X86 assembly programmers will understand just what an accomplishment this was.  Register space was scarce and keeping five registers as your temp while simultaneously doing complex math was a beautiful site to behold.
If it was only a matter of clever coding that would have been enough to qualify it as art but it was more than that.  Tanj had carefully picked the underlying math algorithms that would be most suitable for keeping the temp in registers.  The result was a blazing-fast floating point emulator which was an important selling point for many of our customers.
By the time the 386 came along most people who cared about floating-point performance weren't using an emulator but we had to support Intel's 386SX so the emulator needed an overhaul.  I rewrote the instruction-decode logic and exception handling but left the core math functions completely untouched.
Answer: The code that impresses me the most, and which I try to emulate - is code that seems too simple and easy to understand.
It is damn difficult to write that kind of code. :-)
Answer: In my first job, I was amazed to discover a "safe ID" class in the codebase (c++), which was wrapping numerical IDs in a class templated with an empty tag class, that ensured that the compiler would complain if you tried for example to compare or assign a UserId into an OrderId.
Not only did I made sure that I had an equivalent Id class in all subsequent codebases I would be using, but it actually opened my eyes on what the compiler could do to guarantee correctness and help writing stronger code.
Answer: I have a funny story to tell here.
I was working on this Javaish application, filled with getters & setters that did nothing but get or set and interfaces and everything ever invented to make code unreadable. One day I stumbled upon some code which seemed very well crafted -- it was basically an algorithm implementation that looked very elegant = few lines of readable code, even though it respected every possible rule the project had to adhere to (it was checkstyled automatically).
I couldn't figure out who on the team could have written such code. I was dying to discuss with him and share thoughts. Thankfully, we had switched to subversion (from cvs) a few months earlier and I quickly ran am 'svn blame'. I loled all over the place, seeing my name next to the implementation.
I had heard stories about people not remembering code they wrote 6 months back, code that is a nightmare to maintain. I could not believe such a thing could happen: how can you forget code you wrote? Well, now I'm convinced it can happen. Thankfully the code was alright and easy to extend, so I've only experienced half of the story.
Comment: Heh. I was tempted to tell a story like that, too, but now there's no need to.
Comment: I thought a mother always knows her chicks? I always recognize my own code, since I'm the only coder at my company who can spell.
Answer: Some VB6 code by another programmer at my company I came across that handled the error conditions very well (whether it be deal with them directly or log them).
Along with some rather complex code that was well commented.
Comment: I'm always excited whenever I run into error-handling code that actually *handles error*, rather than just logging them and re-throwing them.
Answer: I know this will bring a lot of answers like,
"I've never find good code before I step in" and variations.
I think the real problem there is not that there isn't good coders or excellent projects out there, is that there's an excess of NIH syndrome and the fact that no body likes code from others. The latter is just because you have to make an intellectual effort to understand it, a much bigger effort than you need to understand you own code so that you dislike it (it's making you think and work after all).
Personally I can remember (as everyone I guess) some cases of really bad code but also I remember some pretty well documented, elegant code.
Currently, the project that most impressed me was a very potent, Dynamic Workflow Engine, not only by the simplicity but also for the way it is coded. I can remember some very clever snippets here and there, as well as a beautiful metaprogramming library based on a full IDL developed by some friends of mine (Aspl.es)
Answer: I inherited a large bunch of code that was SO well written I actually spent the $40 online to find the guy, I went to his house and thanked him.
Comment: What was well written about it?
Answer: I think Rocky Lhotka should get the credit, but I had to touch a CSLA.NET application recently {in my private practice on the side} and I was very impressed with the orderliness of the code.  The app worked extremely well, but the client needed a few extensions.  The original author had died tragically, and the new guy was unsophisticated.  He didn't understand CSLA.NET's business object based approach, and he wanted to do it all over again in cut-and-dried VB.NET, without any fancy framework.
So I got the call.  Looking at a working example of WinForm binding and CSLA.NET was pretty instructive about a lot of things.
Answer: Symbian OS - the old core bit of it anyway, the bit that dated back to the Psion days or those who even today keep that spirit alive.
And sitting right along side it and all over it is all the new crap created by the lowest bidders hired by the big phone corporations.  It was startling, you could actually feel in your bones whether a bit of the code-base was old or new somehow.
Answer: I remember when I wrote my bachelor thesis on type inference, my Pascal-to-Pascal 'compiler' was an extension of a Parser my supervisor programmed (in Java). It had a pretty good structure as far as I can remember, and for me who had never done any serious Object-oriented programming, it was quite a revelation.
Answer: I've been doing a lot of Eclipse plug-in development and often had to debug into the actual Eclipse source code. While I haven't "inherited" it in the sense that I'm not continuing work on it, I've always been impressed with the design and quality of the early core.


Feasibility of Symbiotic/Beneficial Parasites

Question: Is it feasible for an ectoparasite such as a a Tick to create a symbiotic relationship with its host? The hosts feeds the tick and the tick has some sort of beneficial substance within its saliva. This could be some sort of naturally evolved anti-fungal or anti-biotic. This relationship would allow those with the tick to out compete those without the tick due to superior disease resistance.
Comment: I would call this a symbiote, rather than a parasite, since by definition a parasite takes without providing something useful to its host.
Comment: It is feasible. Humans already have a ton of beneficial bacteria living in the stomach that help us digest food. Termites have something similar going on. The concern with tick scenario is that it can fall off easily, so it will probably have to burrow under the skin.
Comment: I'll write up an answer in a few hours, but look up the origin of mitochondria.
Comment: I guess I'm looking for an ok from everyone else I guess! I didn't know if there would be any problems I hadn't thought of! @Raditz_35
Answer: Conditionally beneficial parasite.
A cool thing for a fiction would be some parasite which was not beneficial but which caused some symptom that the host could use in a particular circumstance.
For example, toxoplasmosis.
https://www.nature.com/news/parasite-makes-mice-lose-fear-of-cats-permanently-1.13777

A parasite that infects up to one-third of people around the world may
  have the ability to permanently alter a specific brain function in
  mice, according to a study published in PLoS ONE today1.
Toxoplasma gondii is known to remove rodents' innate fear of cats. The
  new research shows that even months after infection, when parasites
  are no longer detectable, the effect remains. This raises the
  possibility that the microbe causes a permanent structural change in
  the brain.

Crazy bravery like this means mice get eaten by cats.  But suppose you were a warrior mouse and you craved the crazy brave.  Maybe toxo in the brain could do that for you.

A real life example: hookworms to treat autoimmunity.
https://www.theguardian.com/lifeandstyle/2010/may/23/parasitic-hookworm-jasper-lawrence-tim-adams

While in the field in Papua New Guinea in the late 1980s, Pritchard
  noted that patients infected with the Necator americanus hookworm were
  rarely subject to the whole range of autoimmune-related illnesses,
  including hay fever and asthma. In the years since, Pritchard had
  developed a thesis to support this observation through painstaking
  clinical trials (which began after he infected himself with 50
  hookworm). The thesis proved that hookworm, in small numbers, seemed
  able to regulate inflammatory immune responses in their hosts

Hookworms are looking out for their own interests by crippling the immune system of their host.  But if the immune system of the host has gone rogue, crippling it up is helpful and apparently hookworms produce fewer side effects than pharmacologic methods accomplishing the same end.

So your parasite - it produces symptoms which advance its own cause.  The parasite is not your friend.  It cares only about itself.  But can you use those symptoms to advance your cause too?  I am reminded of the infected demon arm of Prince Ashitaka in Princess Mononoke.  Not good in the long term, a demon arm.  But very useful in the short term it turns out.
Answer: The medical use of parasites offers fascinating examples.
A leech is a parasite in general, but for certain health problems it has an effect that potentially outweighs the harm.
Immune suppressant worms presumably are big picture bad, but seem to give specific auto-immune and allergy sufferers less problems than they had before.
Additionally with some non-obvious conditions some strictly bad changes to an individuals potential to reproduce might be of positive value to their genes through relatives or already having offspring:
Some parasites modify the hosts reproduction to divert that energy to the parasite, if the parasite only takes most of that energy the social network of the host might come out ahead.
Some parasites compete with each other, resulting in a host less disadvantaged than having either parasite alone. Similarly in cases where one of the parasites kills the other(s) it might not be the one most deteriorates to the host. If (like most species including humans) there are a lot of common parasites a super parasite that wipes out the others might be a net win even if it ends up killing the host eventually.
Comment: You may also mention a [syphilis treatment with malaria](https://en.wikipedia.org/wiki/Julius_Wagner-Jauregg#Nobel_prize).
Answer: This is literally the definition of symbiosis. The only issue in your question, as pointed out in comments, is that a parasite is definitionally not a symbiote, as a parasite derives a benefit for itself while damaging its host. Symbiotic relationships involve benefits to both organisms.
There are tons of examples of this in the world right now. Think of remora cleaning sharks in order to feed themselves and avoid predators, or (again already mentioned in comments) mitochondria in animal cells.
From a worldbuilding perspective, the key elements are that both organisms derive a net benefit from the relationship, and exist in such a way that they can interact to produce those benefits (like living physically close enough to interact, as in the remora, or even becoming incorporated into the same larger organism, as in the mitochondria). The net benefit piece means that there can still be negative consequences to the interactions, just that the balance must tip towards the favorable.
Answer: Take a look at anglerfish. The female is this gigantic thing, and the male is super-tiny. He bites the female and gets embedded in there. In time, his body wastes away, and he's little more than a sack of sperm for the female to use when she needs eggs fertilized.
There are plenty of symbiotic relationships like this in the wild. Just think of something the host needs and something the symbiote needs where pairing would help both achieve their separate needs.
Comment: As a note, the anglerfish do not have a symbiotic relationship. For it to be symbiosis there have to be multiple species involved, and both need to derive a benefit. That's the definition.
Comment: those anglerfish dudes have got it made.


Does the normal distribution converge to a uniform distribution when the standard deviation grows to infinity?

Question: Does the normal distribution converge to a certain distribution if the standard deviation grows without bounds? it appears to me that the pdf starts looking like a uniform distribution with bounds given by $[-2 \sigma, 2 \sigma]$. Is this true?
Comment: No, but in order to answer your question properly, we need to know what is your definition of convergence. Keep in mind that formal discussion is only possible when the right hand side is not changing. So, you can't establish convergence to Unifrom[$-\sigma,\sigma$] because your $\sigma$ is changing. Look up the formulation of CLT to see what I mean
Comment: only if you wrap or truncate it to something $o(\sigma)$.
Answer: A common mistake in probability is to think that a distribution is uniform because it looks visually flat when all its values are near zero. This is because we tend to see that $f(x)=0.001 \approx 0.000001=f(y)$ and yet $f(x)/f(y)=0.001/0.000001=1000$, i.e. a small interval around $x$ is 1000 times more likely than a small interval around $y$.
It's definitely not uniform on the entire real line in the limit, as there is no uniform distribution on $(-\infty,\infty)$. It's also not even approximately uniform on $[-2\sigma,2\sigma]$.
You can see the latter from the 68-95-99.7 rule you seem to be familiar with. If it were approximately uniform on $[-2\sigma,2\sigma]$, then the probability of being in $[0,\sigma]$ and $[\sigma,2\sigma]$ should be the same, as the two intervals are the same length. But this is not the case: $P([0,\sigma])\approx 0.68/2= 0.34$, yet $P([\sigma,2\sigma])\approx (0.95-0.68)/2 = 0.135$.
When viewed over the entire real line, this sequence of normal distributions doesn't converge to any probability distribution. There are a few ways to see this. As an example, the cdf of a normal with standard deviation $\sigma$ is $F_\sigma(x) = (1/2)(1+\mbox{erf}(x/\sqrt{2}\sigma)$, and $\lim_{\sigma\rightarrow\infty} F_\sigma(x) = 1/2$ for all $x$, which is not the cdf of any random variable. In fact, it's not a cdf at all.
The reason for this non-convergence boils down to "mass loss" is the limit. The limiting function of the normal distribution has actually "lost" probability (i.e. it has escaped to infinity). This is related to the concept of tightness of measures, which gives necessary conditions for a sequence of random variables to converge to another random variable.
Comment: The incorrect "it's" was "all it's values are near zero". The "It's" in "It's a common mistake" was correct.
Answer: Your statement the pdf starts looking like a uniform distribution with bounds given by $[−2σ,2σ]$ is not correct if you adjust $\sigma$ to match the wider standard deviation.
Consider this chart of two normal densities centred on zero. The red curve corresponds to a standard deviation of $1$ and the blue curve to a standard deviation of $10$, and it is indeed the case that the blue curve is almost flat on $[-2,2]$

but for the blue curve with $\sigma=10$, we should actually be looking at its shape on $[-20,20]$.  Rescaling both the $x$-axis and $y$-axis by factors of $10$ gives this next plot, and you get exactly the same shape for the blue density in this later plot as the red density in the earlier plot
Answer: The other answers already here do a great job of explaining why Gaussian RVs don't converge to anything as the variance increases without bound, but I want to point out a seemingly-uniform property that such a collection of Gaussians does satisfy that I think might be enough for someone to guess that they are becoming uniform, but that turns out to not be strong enough to conclude that.
$\newcommand{\len}{\text{len}}$
Consider a collection of random variables $\{X_1,X_2,\dots\}$ where $X_n \sim \mathcal N(0, n^2)$. Let $A = [a_1,a_2]$ be a fixed interval of finite length, and for some $c \in \mathbb R$ define $B = A +c$, i.e. $B$ is $A$ but just shifted over by $c$. For an interval $I = [i_1,i_2]$ define $\len (I) = i_2-i_1$ to be the length of $I$, and note that $\len(A) = \len(B)$.
I'll now prove the following result:
Result:  $\vert P(X_n \in A) - P(x_n\in B)\vert \to 0$ as $n \to \infty$.
I call this uniform-like because it says that the distribution of $X_n$ increasingly has two fixed intervals of equal length having equal probability, no matter how far apart they may be. That's definitely a very uniform feature, but as we'll see this doesn't say anything about the actual distribution of the $X_n$ converging to a uniform one.
Pf: note that $X_n = n X_1$ where $X_1 \sim \mathcal N(0, 1)$ so
$$
P(X_n \in A) = P(a_1 \leq n X_1 \leq a_2) = P\left(\frac{a_1}{n} \leq X_1 \leq \frac{a_2}n\right)
$$
$$
= \frac{1}{\sqrt{2\pi}}\int_{a_1/n}^{a_2/n} e^{-x^2/2}\,\text dx.
$$
I can use the (very rough) bound that $e^{-x^2/2} \leq 1$ to get
$$
\frac{1}{\sqrt{2\pi}}\int_{a_1/n}^{a_2/n} e^{-x^2/2}\,\text dx \leq \frac{1}{\sqrt{2\pi}}\int_{a_1/n}^{a_2/n} 1\,\text dx
$$
$$
= \frac{\text{len}(A)}{n\sqrt{2\pi}}.
$$
I can do the same thing for $B$ to get
$$
P(X_n \in B) \leq \frac{\text{len}(B)}{n\sqrt{2\pi}}.
$$
Putting these together I have
$$
\left\vert P(X_n \in A) - P(X_n \in B)\right\vert \leq \frac{\sqrt 2 \text{len}(A) }{n\sqrt{\pi}} \to 0
$$
as $n\to\infty$ (I'm using the triangle inequality here).
$\square$
How is this different from $X_n$ converging on a uniform distribution? I just proved that the probabilities given to any two fixed intervals of the same finite length get closer and closer, and intuitively that makes sense that as the densities are "flattening out" from $A$ and $B$'s perspectives.
But in order for $X_n$ to converge on a uniform distribution, I'd need $P(X_n \in I)$ to head towards being proportional to $\text{len}(I)$ for any interval $I$, and that is a very different thing because this needs to apply to any $I$, not just one fixed in advance (and as mentioned elsewhere, this is also not even possible for a distribution with unbounded support).
Comment: Right, you could *almost* say they converged in distribution, except that the limit of what they converge to is an improper distribution. One type of convergence that would be well defined is I would guess you could show the Wasserstein metric will approach zero as $\sigma \rightarrow \infty$?
Answer: The limit of normal distributions leads to another nice property that reflects a uniform distribution, which is that conditional probabilities for any two bounded sets converge in the limit to the conditional probability that applies for the uniform distribution.  I will show this below.

To facilitate our analysis, we will let $Z \sim \text{N}(0,1)$ be a standard normal random variable and we will examine the behaviour of the random variable $X=\sigma Z$ in the limit where $\sigma \rightarrow \infty$.  Let $\mathcal{B}$ be a (measureable) bounded set and denote the density bounds over the set as:
$$L_\mathcal{B}(\sigma) \equiv \min_{x \in \mathcal{B}} \ \text{N}(x|0,\sigma^2)
\quad \quad \quad
U_\mathcal{B}(\sigma) \equiv \max_{x \in \mathcal{B}} \ \text{N}(x|0,\sigma^2).$$
Since $\mathcal{B}$ is bounded, it can be shown that:
$$\lim_{\sigma \rightarrow \infty} \frac{U_\mathcal{B}(\sigma)}{L_\mathcal{B}(\sigma)} = 0.$$
Now, let $\mathcal{A}$ and $\mathcal{B}$ be arbitrary (measureable) bounded intervals.  We can write the conditional probability of the first given the second as:
$$\begin{align}
\mathbb{P}(X \in \mathcal{A} | X \in \mathcal {B})
&= \frac{\mathbb{P}(X \in \mathcal {A} \cap \mathcal{B})}{\mathbb{P}(X \in \mathcal {B})} \\[6pt]
&= \frac{\int_\mathcal{A \cap \mathcal{B}} \text{N}(x|0,\sigma^2) \ dx}{\int_\mathcal{B} \text{N}(x|0,\sigma^2) \ dx} \\[6pt]
&= \frac{\int_\mathcal{A \cap \mathcal{B}} \text{N}(x|0,\sigma^2) \ dx}{\int_\mathcal{A \cap \mathcal{B}} \text{N}(x|0,\sigma^2) \ dx + \int_\mathcal{B-A} \text{N}(x|0,\sigma^2) \ dx} \\[6pt]
\end{align}$$
Let $\lambda_{\ \cdot}$ denote the Lebesgue measure (of a set $\cdot$ shown as a subscript).  By applying the bounds to the densities in the above integrals we obtain the conditional probability bounds:
$$\frac{\lambda_\mathcal{A \cap \mathcal{B}} \cdot U_\mathcal{B-A}(\sigma)}{\lambda_\mathcal{A \cap \mathcal{B}} \cdot U_\mathcal{B-A}(\sigma) + \lambda_\mathcal{B-A} \cdot L_\mathcal{B-A}(\sigma)}
\leqslant
\mathbb{P}(X \in \mathcal{A} | X \in \mathcal {B})
\leqslant
\frac{\lambda_\mathcal{A \cap \mathcal{B}} \cdot L_\mathcal{B-A}(\sigma)}{\lambda_\mathcal{A \cap \mathcal{B}} \cdot L_\mathcal{B-A}(\sigma) + \lambda_\mathcal{B-A} \cdot U_\mathcal{B-A}(\sigma)}.$$
Taking the limit $\sigma \rightarrow \infty$ and applying the squeeze theorem then gives:
$$\lim_{\sigma \rightarrow \infty}
\mathbb{P}(X \in \mathcal{A} | X \in \mathcal {B})
= \frac{\lambda_\mathcal{A \cap \mathcal{B}}}{\lambda_\mathcal{B}},$$
which is the standard conditional probability result for a uniform distribution.  This confirms that when we take the limit of a sequence of normal distributions with variance approaching infinity, the conditional probability of any bounded set given any other bounded set is just as for a uniform random variable taken over any set encompassing the union of those sets.
Comment: This conclusion is true when the standard Normal distribution is replaced by any distribution supported on a neighborhood $\mathcal{U}$ of $0$ where, either on $\mathcal{U}\cap[0,\infty)$ or $\mathcal{U}\cap(-\infty,0]$ (or both), the distribution has a nonzero everywhere differentiable density with bounded derivative.  The point is that as $\sigma$ grows, locally the density becomes constant.
Comment: Indeed.  The answer was certainly not certainly not intended to imply that this is a property restricted to the normal distribution.
Answer: Your question is fundamentally flawed. The standard normal distribution is scaled so that $\sigma = 1$. So for some other Gaussian distribution ($\mu = 0, \sigma = \sigma^*$) then the  curve between bounds $[-2\sigma^*, 2\sigma^*]$ has the same shape as the standard normal distribution. The only difference is the scaling factor. So if you rescale the Gaussian by dividing by $\sigma^*$, then you end up with the standard normal distribution.
Now if you have a Gaussian distribution ($\mu = 0, \sigma = \sigma^*$) then yes as $\sigma^* \rightarrow \infty$, the region between $[-2, 2]$ becomes increasing flatter.
Answer: Here is an alternative view of the problem that shows that of $X_n\sim N(\mu;n\sigma)$, where $\mu$ and $\sigma>0$ are fixed and $\{x\}=x-\lfloor x\rfloor$ is the fractional part function, then $\{X_n\}$ converges weakly to a random variable $U$ uniformly distributed over $[0,1]$, in other words, $$X_n\mod 1\stackrel{n}{\Longrightarrow}U$$
The function $\{x\}$ is measurable of period $1$ and so, for any $f\in\mathcal{C}_b(\mathbb{R})$, $f_\sigma(x):=f(\{\sigma x\})$ is measurable bounded and $\frac{1}{\sigma}$-periodic. Let $\phi(x)$ be the density function of the standard normal distribution.  Then, by Fejér's formula
$$\begin{align}
E[f(\{\sigma n X+\mu\})]&=\int f(\{n\sigma x+\mu\})\phi(x)\,dx=\int f_\sigma\big(nx+\tfrac{\mu}{\sigma}\big)\phi(x)\,dx\\
&\xrightarrow{n\rightarrow\infty}\Big(\frac{1}{1/\sigma}\int^{1/\sigma}_0f_\sigma(x)\,dx\Big)\int\phi(x)\,dx=\sigma\int^{1/\sigma}_0f(\{\sigma x\})\,dx\\
&=\int^1_0f(x)\,dx=E[f(U)]
\end{align}$$

Edit: After a second inspection and a comment of @whuber, it seems that view the I suggested in my answer is actually holds for any random variable $X$ whose law  admits a density with respect Lebesgue measure, that is, if the law if $X$ $P_X(dx)= \phi(x)\,dx$ where $\phi\in L_1(\mathbb{R})$, then for any $\mu\in\mathbb{R}$
$$\{\sigma n X+\mu\}\stackrel{n\rightarrow\infty}{\Longrightarrow}U(0,1)$$
The same argument used above for $X_n\sim N(\mu;\sigma n)$ works for $\sigma n X+\mu$. So indeed, in this instance, other than scale and location invariance, there is nothing special about normality in the context of $\mod 1$.
One last observation. When variance is increased by the transformation $\sigma X$, where $X$ is a random variable that has density $\phi$ (with respect to Lebesgue's measure $\lambda$) such that $\phi$ is continuous at $0$, and  $\phi(0)>0$, then  the density of $\sigma X$ flattens out  locally as $\sigma\rightarrow\infty$ giving the appearance of convergence to uniform distribution. To be more precise, suppose $A$ is a Borel set with $0<\lambda(A)<\infty$ and $P(X\in A)>0$. Consider the conditional distribution
$$ P^A_\sigma(dx):=P[\sigma X\in dx|\sigma X\in A]$$
Then, for any $f\in\mathcal{C}_b(\mathbb{R})$
$$\begin{align}
E[f(\sigma X)|\sigma X\in A]&=\frac{\int \mathbb{1}_{A}(\sigma x) f(\sigma x)\phi(x)\,dx}{\int\mathbb{1}_A(\sigma x)\phi(x)\,dx}\\
&=\frac{\int \mathbb{1}_{A}(x) f(x)\phi\big(\tfrac{x}{\sigma}\big)\,dx}{\int\mathbb{1}_A(x)\phi\big(\tfrac{x}{\sigma}\big)\,dx}\xrightarrow{\sigma\rightarrow\infty}\frac{1}{\lambda(A)}\int_A\,f(x)\,dx
\end{align}$$
by dominated convergence. Therefore,  $P^A_\sigma\stackrel{\sigma\rightarrow\infty}{\Longrightarrow}\frac{1}{\lambda(A)}\mathbb{1}_A(x)\,dx$, that is,  $P^A_\sigma$ converges weakly to the uniform distribution over the set $A$. This in particular, holds for $X\sim N(0;1)$.
Comment: @whuber: Thanks for pointed that out. I just realize that indeed, for $\mod 1$, there is nothing special about normality as variance grows.
Comment: There is much less to this result than meets the eye: I believe it holds for all continuous distributions.


Which lens do I need for a christening?

Question: Which lens do I need when photographing a christening? Inside a church. I have a Nikon D3200.
Comment: Too broad a question as posed.  What is your budget?  How close can you get to what you want to shoot and how wide a scene?  E.g., do you want to fill the frame with the baby from the rear of the church, or do you want to shoot the extended family from the front pew?
Comment: What lens(es) do you already own?
Comment: Yes, please do add more details.
Answer: Your Question is beyond broad in spectrum. You only stated what body you had and nothing about your level of skills or what lenses you already tested or looking to buy.
Lenses can range from 150$ (or less) second hand to 2000$ or more.
I will attempt to answer your question in detail since I own a D3200 myself.
I have the stock 18-55mm that comes with a Kit and I have a 35mm 1.8G prime lense that I shoot 99% of the time.
I have rented out a 24mm F1.4 and 17-55mm.
I also have Speedlight as my flash.
With that - the best combo are:
1) Any zoom lense with a F2.8 where you can get a focus shot on your subject if you cannot move into the subject
2) a 35mm prime or a 24mm (not the F1.4 as it is expensive) will enable you sharp images at a reasonable cost - but remember that a prime is a fix focal therefore no zoom, so make sure you are able to close the distance.
This is more than sufficient for you to get great picture AFTER you learn how to operate your D3200. Do not think that you can leave it on auto and it will do it for you.
The church is dim lit so anything at F2.8 will aid you for your need and then post processing will aid you to eliminate noise if you raise the ISO.
Again: any zoom lense F2.8 if you have to be stationary. 35mm or 50mm if you can position yourself.
Extra tip:
Leave the flash at home unless you plan on taking pictures in the dark corner of the church
Answer: The classic response would be something fast and slightly wide. I would go for a 35mm equivalent. Take a look at the work of William Albert Allard for inspiration.
Answer: A prime lens, say 35mm or 50mm, are best for indoor photography where light intensity varies highly within small areas. They usually have a fast autofocus, good for events.
The 50mm lens is versatile enough to cope with group and portrait photos alike.
Within prime lenses, look for f1.2 to f2.0, they take the most light in.
In this layout, consider also an M42 universal adaptor for Nikon, so you can get very inexpensive M42  vintage manual focus lenses (e.g 10 $/EUR). For instance the Helios' 44m2 to 44m7 are well reputed. Especially the 44m7 has a very high resolution and brings up beautiful colours; the 44m2 is well known for its astonishing bokeh. Aside from these qualities, the manual focus requires good anticipation for snapshots.
If image quality is of utmost importance in portraying the event, consider the rental of a medium format digital camera and a set of lenses, e.g 35mm (group), 50mm and 85mm (portraits).
For group portrait photos, an option includes the use of panoramic photo software which stitches a sequence of images into a larger one.
A last comment, for Nikon D3200, lenses Nikon 35mm and Nikon 50mm may require their own autofocus motor. Worth checking this with the seller.
Comment: I'm guessing f/1.2 is not an option, but yes, f/1.8 is generally available for reasonable price.  Also, depending on poster's location, they may be able to rent a lens for a special occasion.
Comment: @khedron Entirely agree f/1.2 and also f/1.4 are far from reasonable prices.

Which lens do I need for a christening?


Global proxy settings for all Windows applications in Windows Vista

Question: How do I make Windows (Vista) to apply certain proxy server for all applications that use internet?
Comment: Can this question be applied to Win 7 & 8 as well ?
Answer: The short answer is: you can't. There is no "global" proxy setting, because proxies are used by individual applications (like Internet Explorer, Firefox, etc.), not by Windows itself. However, some programs internally use Internet Explorer libraries to access the web, so they will use the IE setting, as posted by firedfly.
You can force individual applications to use proxies, even if the applications themselves don't support proxies, by using tools such FreeCAP or Socksify.
If you really do want to force all programs to go through a proxy it would have to be done at the network level, so you would need to establish a VPN connection to a service like Your Freedom or Steganos Internet Anonym.
Comment: +1 FreeCap is exactly what I needed for a very long time! Thanks.
Comment: This answer is more correct, as not all software uses the proxy settings for Internet Explorer. Some software gives you the option to use the same settings as Internet Explorer, but not all of them do that.
Comment: Do you know if Visual Studio uses the IE libraries?
Answer: The default proxy settings are set in Internet Explorer's options.

Tools->Internet Options->Connections tab->Lan Settings button

The proxy information specified here will be the system default.  Though, not all applications use the default proxy settings.
Comment: if you want to enable windows updates via a proxy server, run this command first: `Netsh winhttp import proxy source=ie` . Source: http://answers.oreilly.com/topic/1391-how-to-configure-windows-update-to-use-a-proxy-server/
Comment: you can also get to the internet options through the control panel
Comment: No, the "Internet Options" are settings for the >current user<, stored in HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings.
So this is only for Aplications running in the current user account and not for Services running in the local SYSTEM account
Comment: The way I normally get to proxy settings (in Windows 8+) is `Ctrl+X-C` (for Command Prompt) or `Ctrl+X-A` (for Admin prompt) and execute `inetcpl.cpl` to bring up *Internet Options*, and then click the Connections tab and Lan Settings button.  For Vista, it would be `Ctrl-R` (Run dialog), enter `cmd` > `[Enter]` > `inetcpl.cpl` > `[Enter]`.  If you want to cut right to the chase, the command `control inetcpl.cpl,,4` opens straight to the *Internet Options* Connections tab.  You may have to tweak the number for earlier versions of Windows (such as Vista).
Answer: You can set a global, machine level proxy by using netsh.exe.
Run:
netsh winhttp set proxy <proxy server address> <exception list in quotes, seperated by ;>

Comment: Pre-Vista versions of Windows use [ProxyCfg.exe](http://msdn.microsoft.com/en-us/library/aa384069%28VS.85%29.aspx).
Comment: I tried `netsh winhttp set proxy` on my Windows Server 2016, it seems not all programs use this setting. Set in Internet Explorer's options works for me.
Answer:  Proxifier

Out of the box, you cannot set a global proxy for all applications to use. Although you can enter your proxy details in Internet Explorer as firedfly suggests, this will only work for certain applications (mostly Windows apps, but Google Chrome uses these settings.).
Privoxy does exactly what you are after. It will establish a connection to the proxy and route all of the traffic out it (excluding local traffic, of course). It works on both Windows and OS X, and even has a portable version.

Proxifier is a program that allows network applications that do not support working through proxy servers to operate through an HTTPS or SOCKS proxy or a chain of proxy servers.
With Proxifier you can work with any Internet client (browsers, FTP, IRC, BitTorrent, messengers, telnet, SSH, video/audio, games...) through a network that is separated from Internet by a firewall (only one open port is required for a proxy tunnel to bypass firewall).

I also used this program to answer my Force Steam (and other programs that do not specify proxy settings) to use a proxy question.
Comment: Looks nice, but it's very expensive: $40 for a license, that is ***not*** cross-platform, despite the fact that they have both OS X and Windows versions.
Comment: Privoxy only supports HTTP connections and not HTTPS.
Answer: You can use group policy to set the default proxy server for all users:

In group policy:
  Local Computer Policy - Computer Configuration - Administrative Templates - Windows Componants -Internet Explorer - enable "Make proxy settings 'Per Machine'rather than 'Per User'" This setting makes it so you don't have to reassign the settings each time a different user logs into the machine.
Local Computer Policy - User Configuration - Windows Settings - Internet Explorer Maintenance - Connection - Proxy Settings. (You can define the proxy settings here)
Local Computer Policy - User Configuration - Windows Settings - Internet Explorer Maintenance - URLs (you can set your default home page, ect, here)

There also is an option to configure Windows Update to use a proxy server:
Netsh winhttp set proxy myproxy

Netsh winhttp set proxy myproxy:80 ";bar"

Netsh winhttp set proxy proxy-server="http=myproxy;https=sproxy:88" bypass-list="*.   contoso.com"

In our environment we ended up using: netsh winhttp set proxy 192.168.0.100:88 "<local>;*.company.com"
Answer: If you have fiddler you can look at requests from your browser after you have already authenticated and copy the Proxy-Authorization header, then set a breakpoint before requests to capture requests from your program and paste the header to the request. Or you can add a custom rule inside OnBeforeRequest (Ctrl+R):
if(!oSession.oRequest.headers.Exists("Proxy-Authorization")){
    oSession.oRequest.headers.Add("Proxy-Authorization", "Basic xxxxxxxxxxxxx");
}

where xxxxx is what you captured from the browser's request. Although not a permanent solution it's simple and  works fine. Adding the rule also works with streaming turned on.


What is the mechanism of trialkylborane oxidation with hydroperoxide?

Question:
This is the mechanism of trialkylborane. In this mechanism I can't understand why should the -OH group leave and the -R group enter in its place to form borate ester. Can someone please explain me that step?
Comment: The carbon migrates because peroxide bonds are generally weak and dissociate quite easily.
Comment: Also, the mechanism is drawn poorly. In the species labeled "Unstable intermediate," the left arrow should not point towards the boron or the bond; the arrow head should terminate at the left oxygen.
Comment: @Zhe Yes. In the upper mechanism, curved arrows are drawn in a wrong way. The arrowhead should be placed pointing towards boron in two of the curved arrows.
Answer: One aspect is the release of the stable anion $\ce{OH-}$.
Another aspect is that $\ce{B-O}$ bonds are much stronger than $\ce{B-C}$ bonds because the empty p-orbital of boron overlaps with one p-orbital with a lone electron pair of oxygen.
$\ce{B-C}$ $D_{298}^ \circ  = 448 \pm 29\ \mathrm{kJ\ mol^{-1}}$
$\ce{B-O}$ $D_{298}^ \circ  = 809\ \mathrm{kJ\ mol^{-1}}$
values taken from "Bond Dissociation Energies", in CRC Handbook of Chemistry and Physics, 90th Edition (CD-ROM Version 2010), David R. Lide, ed., CRC Press/Taylor and Francis, Boca Raton, FL.


Sodium thiosulfate and Hydrochloric acid

Question: If I was using this method (https://edu.rsc.org/resources/the-effect-of-concentration-on-reaction-rate/743.article) however used pre-prepared concentrations of sodium thiosulfate solution, which intervals would be more suitable, 0.1M, 0.2M, 0.3M, 0.4M or 0.5M, 1M, 1.5M and 2M? Also, what concentration of Hydrochloric acid should be used (I've seen a variety of suggestions elsewhere). This is for a secondary school practical. Thank you.
Answer: There's a nice demonstration of the experiment performed by Annis Hapkiewicz.
She uses a 0.15 M $\ce{Na2S2O3}$ stock solution.  She prepares 5 beakers with 50 40, 30, 20 and 10 mL of the stock solution filled up to a total volume of 50 mL with destilled water.
This corresponds to thiosulfate concentrations of 0.15, 0.12, 0.09, 0.06, and 0.03 M.
I couldn't figure out the concentration of the hydrochloric acid used, but the times for the appearance of the sulfur cloud (disapperance of the cross) were given.
The range is between 20 s and 5 min.
I'd probably go with the 2 M HCl for safety reasons and perform the experiment with the thiosulfate concentrations given above. Check the times and adjust the concentrations if necessary.
You don't want it to to fast to be measured by the kids, but you don't want the lowest concentration to take half an hour.


Div positioning

Question: I have a three column layout with a container "three-col"
In the right column I have a "Feature Tile" which is basically a 220px wide placeholder with editable content.
I need the "Feature Tile" To move with the "three-col" container, so if the content expands in height, I need the feature tile to move down with it...
May need Jquery - not sure.
Thanks!
EDIT: I want the feature tile to always be positioned at the bottom. Move = The div will expand in height based on how much content is inserted - no fixed height
Comment: Where exactly do you want the "Feature Tile" to be, at the top always? Bottom? What does "move with" mean? This could use a good deal of clarification.
Comment: Ah right sorry, I want the feature tile to always be positioned at the bottom. Move = The div will expand in height based on how much content is inserted - no fixed height.
Answer: Try this:
.right-column {
    position:relative;
}
.featured-tile {
    position:absolute;
    bottom:0;
}

This will keep .featured-tile at the bottom of .right-column no matter what height it is due to variable content.
UPDATE: I think I know what you mean, try this instead.
.three-col {
    position:relative;
}
.featured-tile {
    position:absolute;
    bottom:0;
}

This will keep .featured-tile at the bottom of .three-col
Demo: http://jsfiddle.net/wesley_murch/4FKhm/4/
Comment: I tried that and no luck, I can't use position: absolute - remember the height will always change depending on which page you are on based on the content. It's as if the feature tile needs to recognize the height of the "three-col" and position at the bottom
Comment: Some more specifics - The left and middle columns all have content in them so I need the "feature tile" to position to the lowest point of either of the divs
Comment: @Jordy, updated answer and gave a demo. You can try putting some content into left-col to see how it will behave. If this isn't what you need, you'll probably need to provide your actual code, a link to a page, or make a demo on jsfiddle.
Answer: Have you considered a 2-column layout with the second column being a div with another two columns in it?
Comment: Thanks for your post although, this will only change the layout - not specifically what I'm trying to achieve.

Div positioning


How to store 25 char string on erc20 token and cost?

Question: I'm wanting to be able to create an ERC20 token that stores a 25 character long string with it. Just wondering if this is actually possible? Also if it is possible I'm gathering from the posts I've read similar to it you would need to pay additional gas for it, would that cost be expensive if I was to have a lot of tokens? (Eg. > 10,000 unique tokens)
Answer: No, the ERC20 token standard is for fungible tokens. This means that each token is identical to the other.
You may want to investigate the ERC721 standard which is still in development. This allows for non-fungible tokens.
This standard includes an interface for ERC721Metadata, which adds the tokenURI function, which should return the URI to metadata for any specific token (in a format provided in the aforementioned link). This is to minimise storing actual data on the ETH blockchain.
Although the ERC721 standard doesn't provide functionality for adding a string to each token, you could certainly add this functionality in yourself. Provided it was extra to the required ERC721 standard, and didn't require you to break any rules set out by the standard, your token would still be ERC721 compliant.
Whether this would require multiple transactions or a single transaction to apply all the strings to the different tokens would depend on how you chose to code it. But I suspect that no matter what, unless there were very strong repeating patterns in the strings, the gas cost would increase with more tokens.
Comment: How does something like cryptocritties store there genes of the kitties on the block chain then?
Comment: Although I am not overly familiar with cryptokitties or its inner workings, I believe the genes of the kitties are stored on chain as hexadecimal numbers. And I think they have to manually create each kitty. But in any case, I think the ERC721 token specification was originally inspired by cryptokitties, so this is your best bet if you're trying to do something similar.


Convert Black/White image to 2d object

Question: Hello i need to read a 2d black and white image and convert that to an 2d Object that can be ready by AutoCAD, so the file format will have to be DFX, i think.
I am not realy sure how to go about this, it will be used for a machine there shale cut a shape out of a plexiglass plate, where white is nothing and black is plexiglass.
I have really no idea on how to attack this problem, reading the image file and determining where it is black or white is easy! But the question is what to do with this data? as i understand it dose the DFX file format work in lines?
Any information or advise would be greatly appreciated!
Answer: Autodesk provides a reference for the DXF file format. It looks like it's indeed a line-by-line representation of the contents of an Autocad(R) drawing.
There also other variations, like "Binary DXF" (a Google search for "DXF file format" will yield more links).
Answer: AutoCAD works with vector images. You sholud look at bitmap-to-vector convertion.
You can using tracing for convertion. Potrace is an open source bitmap-to-vector tracer library. Potrace can currently produce the following output formats: DXF
However, bitmap tracing is imperfect; for high-quality vector image, line tracer is generally only used to do the initial tracing, which would later be hand-tweaked. Inkscape, an open source vector image editor, provides built-in support for tracing (internally using potrace).

Convert Black/White image to 2d object


Motor controller structure for constant torque starting and then switching to constant speed

Question: I need to design a field-oriented-control (FOC) controller for a permanent magnet synchronous motor (PMSM) with position sensor. In the starting process where the motor goes from zero speed to rated speed, the controller should be able to control the motor to produce constant torque. After the motor reaches rated speed, the controller should controller the motor to maintain the speed even when the motor load varies in certain range. I know PMSM is normally controlled with a speed loop and Id/Iq loop, and Iq loop is the one that controls the torque. So, what would this controller look like or how different loops are used to realize such a motor control process? Is it like Iq controller only during starting process and then add the speed controller once it reaches rated speed? If yes, how to switch the Iq_ref smoothly from a constant value to the output of speed controller without causing a sudden change of motor torque?
Answer: The typical structure is, as you mention, a Id/Iq loop and a speed loop. However, you don't "switch between" them. Normally, the Iq-controller would take a requested torque as input (equivalent to a certain Iq), and control the motor to achieve this, using feedback from current sensors, while the speed-controller, would take a requested speed as input, and produce a torque-request as output.
You still need the torque-controller to control the motor, but now you can ask the outer conroller for a speed instead of a torque. The output of the speed-controller will typically be limited to be within the rated torque of the motor.
If I understand your goal correctly, you need to tune this system so that when the input to the speed-controller (the outer controller) steps from zero to the rated speed, the response of the motor (its step response) is smooth and controlled, without overshooting the speed, or overloading anything. After all, you will need to lower the torque request before you hit the required speed, otherwise you will overshoot. How early you need to lower it, is what the speed-controller will figure out.
How this tuning is done will depend on what kind of (mechanical) load the motor is driving, and how known the various parameters are.
Answer: Have a look on my answer to similar question.
What you describe is an ordinary FOC control loop made of cascaded loops: position, speed, torque.

In the starting process where the motor goes from zero speed to rated
speed, the controller should be able to control the motor to produce
constant torque.

Well, it is not perfectly constant in real world. \$T=J\alpha\$, so knowing the moment of inertia of the system and desired torque you have to accelerate  the motor at calculated acceleration.

See, the speed \$\Omega\$ is differentiated to get the \$\alpha\$ and then multiplied by J to get the torque setpoint. The velocity controller just corrects the velocity error.
When the drive reaches the setpoint speed, then the speed controller output just sets the torque that is needed to overcome the load torque.

Is it like Iq controller only during starting process and then add the
speed controller once it reaches rated speed?

Iq and Id are current controllers, they are always present and working.

If yes, how to switch the Iq_ref smoothly from a constant value to the
output of speed controller without causing a sudden change of motor
torque?

The speed controller and the feedforward path does it for you. Keep in mind that is up to you to ramp the velocity, possibly in S-shape and write the correct value for the J.
Comment: thanks for the explanation. I understand the controller structure is a feedforward one, but my questions is: during motor starting from zero to rated speed while maintaining constant torque, the T=Jα should be enough to generate the ref value for the current loop. But the speed control loop also has output. If they are added together, won't it make the torque reference non-constant?
Comment: @roTor-roTor If you look closely on my block diagram, the velocity error is delayed with 1st order lag before entering the PI contoller. But even without it, the PI controller will settle at stable value, you could even omit the feedforward path if the exact timing is not required. As per torque reference, you shall not expect a completely flat value since there is also a friction involved.
Comment: does it mean even without the feedforward control branches, the speed control loop plus the Id/Iq control loop will be able to realize constant torque starting from zero to rated speed and then automatically change to constant speed control?