Fastest algorithm to compute the sum of primes?

Question: Can anyone help me with references to the current fastest algorithms for counting the exact sum of primes less than some number n?  I'm specifically curious about the best case running times, of course.  I'm pretty familiar with the various fast algorithms for prime counting, but I'm having a harder time tracking down sum of prime algorithms...
Comment: You may be interested in http://arxiv.org/abs/1011.1667 although it's about bounds and asymptotics rather than exact sums. There is also an impressive tabulation at http://oeis.org/A007504/a007504.txt
Comment: You should be able to get away with using only 64 bits for a pretty long time, since the first few bits are determined by the asymptotic formula.  Even beyond the point you're comfortable holding a few implicitly, it's not hard to use a second 64-bit variable to extend your precision to 128 bits -- you need only check for overflow every million iterations unless you're going over half a trillion primes.
Comment: Thanks, Gerry - both interesting links, and the tabulation in particular is handy for me.  I notice that the largest value (11138479445180240497) requires a full 64 bits to express in binary - looks like you can't count much higher with taking precision concerns pretty seriously (at least in languages like C).
Answer: Deléglise-Dusart-Roblot [1] give an algorithm which determines $\pi(x,k,l)$, the number of primes up to $x$ that are congruent to $l$ modulo $k,$ in time $O(x^{2/3}/\log^2x).$ Using this algorithm to count the number of primes in all residue classes $k<2\log x$ takes
$$1+\sum_{p<2\log x}(p-2)\sim\frac{2\log^2x}{\log\log x}$$
invocations of Deléglise-Dusart-Roblot for a total of $O(x^{2/3}/\log\log x)$ time.
This allows one to determine the value of $\sum_{p\le x}p$ mod all primes up to $2\log x$ and hence, by the Prime Number Theorem and Chinese Remainder Theorem, the value of the sum mod $\exp(\vartheta(2\log x))=x^2(1+o(1)).$ Together with bounds on the value of $\sum_{p\le x}p$ [2], this allows the computation of the sum.
Note that the primes slightly beyond $2\log x$ may be required depending on the value of $\vartheta(2\log x).$ Practically speaking, except for $x$ tiny, $2\log x+\log x/\log\log x$ suffices. This does not change the asymptotics.
I do not know if it is possible to modify the Lagarias-Odlyzko analytic formula [3] to count in residue classes. If so, this would allow an $O(x^{1/2+o(1)})$ algorithm.
References
[1] Marc Deléglise, Pierre Dusart, and Xavier-François Roblot, Counting primes in residue classes, Mathematics of Computation 73:247 (2004), pp. 1565-1575. doi 10.1.1.100.779
[2] Nilotpal Kanti Sinha, On the asymptotic expansion of the sum of the first n primes (2010).
[3] J. C. Lagarias and A. M. Odlyzko, Computing $\pi(x)$: An analytic method, Journal of Algorithms 8 (1987), pp. 173-191.
Comment: An excellent answer! The Lagarias-Odlyzko analytic formula can certainly be obtained in this setting as well (although I am not sure whether someone has done it), giving the $x^{1/2+o(1)}$ answer. This basically comes down to beeing able to calculate multiple values (or multiple zeros) of Dirichlet L-functions fast (The Odlyzko-Schönhage algorithm for Dirichlet L-functions), and this is possible for Dirichlet L-functions as well as Riemann zeta-function (see e.g. Platt's thesis: http://www.maths.bris.ac.uk/~madjp/thesis5.pdf)
Answer: Edit Nov 22: Changed the condition of the test function $\Phi$ somewhat to simplify my argument (removed one sum in the identity below).
Although I like Charles' answer and its application of the Chinese remainder theorem, let me give you a different take on the problem. It is possible to use an analytic method more directly (similar to the Lagarias-Odlyzko method), just using the Riemann zeta-function and not any theory of the Dirichlet L-functions (or primes in arithmetical sequences). This method can treat rather arbitrary sums
$$ \sum_{ p < x } f(p) $$ for smooth functions $f$.
The idea is to consider the identity
$$\sum_{  p < x } f(p) =\sum_{p} f(p)\Phi \left( \frac {p-x} {\sqrt x} \right )
- \sum_{x< p < x + \sqrt x } f(p) \Phi \left(\frac {p-x} {\sqrt x} \right), $$
where $\Phi(x)$ is smooth test function such that $\Phi(x)=1$ for $x<0$ and $\Phi(x)=0$ for $x>1$. It is clear that the last sum can be calculated in $O(  x^{1/2} )$ time (say sieving out the primes in the interval, and explicit calculation). The idea is now to use the Mellin-transform identity
$$ \sum_{p}f(p)\Phi \left( \frac {p-x} {\sqrt x} \right )= \frac 1 {2 \pi i} \int_{c-\infty i}^{c+\infty i} \sum_{p} p^{-s} \int_0^\infty \Phi \left(\frac{y-x}{\sqrt x} \right)f(y) y^{s-1} dyds.  (c>1)$$
The point here is that the Mellin transform $\int_0^\infty \Phi(\frac{y-x}{\sqrt x})f(y) y^{s-1}dy$ is small when $|\Im(s)|>x^{1/2+\epsilon}$ and $\Re(s)=c$ for any $\epsilon>0$, so that part of the integral can be discarded. The Dirichlet series $\sum_{p} p^{-s}$ can be expressed in terms of the logarithm of the zeta function for the arguments $ks$ (summing over $k$). Now the Odlyzko-Schönhage algorithm (Quite nice algorithm, uses fast fourier transform) allows us to calculate the values of the Riemann zeta-function for say $s=c+it$ for $ |t| < x^{1/2+\epsilon}$ in $O(x^{1/2+\epsilon+o(1)})$ time. We also remark that the Weil explicit formula can be used instead of this complex integral (then the zeros of the Riemann zeta-function needs to be calculated fast, but this can also  be done by the Odlyzko-Schönhage algorithm). This means that the total time to calculate $\sum_{  p < x } f(p)$ will be $O(x^{1/2+\epsilon})$ for any $\epsilon>0$.
Note that the same argument applies when primes in arithmetical progression are concerned (see my comment on Charles answer). Since the Odlyzko-Schönhage algorithm also holds for the Dirichlet L-functions, this case can be treated in the same way.
Comment: This is a great answer.
Answer: I'll put in a plug for my original paper with Lagarias and Odlyzko, as well as a recent paper by Bach, Klyve and Sorenson: http://www.ams.org/journals/mcom/2009-78-268/S0025-5718-09-02249-2/home.html Computing prime harmonic sums Math. Comp. 78 (2009), 2283-2305.  Although the algorithms of Lagarias and Odlyzko (with the extra algorithm of Odlyzko-Schonhage for computing good approximations to a bunch of values of $\zeta(s)$) are asymptotically the best, having complexity $O(x^{1/2 + \epsilon})$ the combinatorial algorithms will probably work best for any reasonable ranges.  Though one should look at J. Buethe, J. Franke, A. Jost, and T. Kleinjung, "Conditional Calculation of pi(10^24)", Posting to the Number Theory Mailing List, Jul 29 2010.  A little more detail (that's all I have right now) is contained in the talk of David Platt: www.maths.bris.ac.uk/~madjp/junior%20talk.pdf .   The idea in the combinatorial method is the following:
Suppose that $f(n)$ is a completely multiplicative function of the positive integers.  In the case of calculating $\pi(x)$, we take $f(n) = 1$.  In the case of calculating the sum of the primes $\le x$ we take $f(n) = n$.  In the case of Calculating $\pi(x,a,q)$ we take $f(n)$ to be a Dirichlet character mod $q$.
Define $\phi(x,a)$ as the sum of $f(n)$ for all integers $n \le x$ which are not divisible by the first $a$ primes.  Clearly $\phi(x,0) = \sum_{n \le x} f(n)$.  We have the recursion:
$\phi(x,a+1) = \phi(x,a) - f(p_{a+1})\phi(x/p_{a+1},a).$
Imagine that you have a labeled tree, where the labels are $\pm f(k) \phi(x/k,b)$ for some $k$ and $b$.  You can expand any node in the tree you want by applying the above formula.  This has the property that it leaves the sum of the values at the leaves the same.  So the idea is to start with a tree consisting of one node labeled $\phi(x,\pi(\sqrt x))$ and keep expanding until either $b=0$ or $x/k < $ some cutoff.  If you accumulate all such nodes you can evaluate all of them by sieving (and a special data structure -- see the Lagarias-Miller-Odlyzko paper for details), and the optimal value for the cutoff is $x^{2/3}$ perhaps multiplied by some logarithmic factors.
Here's the reference to my paper with Lagarias and Odlyzko: Computing $\pi(x)$: The Meissel-Lehmer Method
Author(s): J. C. Lagarias, V. S. Miller, A. M. Odlyzko
Source: Mathematics of Computation, Vol. 44, No. 170 (Apr., 1985), pp. 537-560
Comment: You mentioned Platt's talk; possibly relevant is his new preprint http://arxiv.org/abs/1203.5712.
Comment: @Charles: Thanks for the pointer to Platt's paper.  I wasn't aware of it (of course it was only put on arXiv 3 days ago).
Answer: This has been great.  Some nice answers here - I'll accept one shortly.
I was looking for a lit review because I have implemented an approach that runs in $O(n^\frac{2}{3} \log n)$ time and $O(n^\frac{1}{3} \log n)$ space for summing primes to non-negative integer powers, and I wanted to see how it compared.  I wasn't exactly ready to write up what I'd done, but I guess I'll take a stab.  For the curious:
PART 1 - The General Identity
Start with the following identity
$\displaystyle\sum_{j=2}^n\frac{\Lambda(j)}{\log j}j^a = \sum_{j=2}^nj^a - \frac{1}{2}\sum_{j=2}^n\sum_{k=2}^{\frac{n}{j}}j^a \cdot k^a+ \frac{1}{3}\sum_{j=2}^n\sum_{k=2}^{\frac{n}{j}}\sum_{l=2}^{\frac{n}{jk}}j^a \cdot k^a \cdot l^a - \frac{1}{4}...$
where $\Lambda(n)$ is the Mangoldt function.  This is a generalization of Linnik's identity found here.  For ease of notation, using
$D_{a,k}(n) = \displaystyle\sum_{j=2}^n j^a \cdot D_{a,k-1}(\frac{n}{j})$
and
$D_{a,0}(n) = 1$
rewrite the nested sums on the right to give us
$\displaystyle\sum_{j=2}^n\frac{\Lambda(j)}{\log j}j^a = \sum_{j=1}^{\log_2 n} \frac{-1^{j+1}}{j}D_{a,j}(n)$
We evaluate $\log_2 n$ terms because $D_{a,k}(n) = 0$ when $n < 2^k$,
This counts a kind of sum of prime powers.  We can count prime sums by a kind of moebius inversion
$\displaystyle\sum_{p \leq n} p^a = \sum_{j=1}^{\log_2 n} \sum_{k=1}^{\log_2 (n^\frac{1}{j})} \frac{-1^{k+1}}{j \cdot k}\mu(j) D_{a \cdot j, k}(n^{\frac{1}{j}})$
Thus, if we can find fast methods of computing $D_{a,k}(n)$, we'll have fast ways of computing $\sum_{p \leq n} p^a$
In Mathematica, this is
DD[a_, k_, n_] := Sum[j^a DD[a, k - 1, n/j], {j, 2, n}]
DD[a_, 1, n_] := Sum[j^a, {j, 2, n}]
SumPrimes[a_, n_] :=
Sum[(-1)^(k + 1)/(j k) MoebiusMu[j] DD[j a, k, n^(1/j)], {j, 1,
Log[2, n]}, {k, 1, Log[2, (n^(1/j))]}]
SumPrimes[0,n] will return the count of primes, SumPrimes[1,n] will return the sum of primes less than n, and so on.
PART 2 - The Specific Algorithm
Here's my fastest approach for calculating $D_{a,k}(n)$  It is inspired by this method for calculating the Mertens function.  (If you find the following writeup interesting but rushed, I've written about my approach with somewhat more detail here and, for the special case of just prime counting, here.  A C++ implementation is here)
Bear with me; this is a bit involved.  It requires two observations.
First, we can use sieving to calculate values of $D_{a,k}(n)$ up to $n^\frac{2}{3}$ in roughly $O(n^\frac{2}{3} \log n)$ time and $O(n^\frac{1}{3} \log n)$ space with the following approach.
We want to sieve numbers up to $n^\frac{2}{3}$ in such a way that we have their full power signature, with $ n = {p_1} ^ {a_1} \cdot {p_2} ^ {a_2} \cdot {p_3} ^ {a_3} \cdot ... $.  With this, the normal count of divisor function is $d_k(n) = \binom {{a_1} + k - 1} {a_1} \cdot \binom {{a_2} + k - 1} {a_2} \cdot \binom {{a_3} + k - 1} {a_3} \cdot ...$  The strict count of divisors function, a count of divisor function excluding 1 as a factor, is, in turn, $d_k'(n) = \sum_{j=0}^k -1^{k-j} \binom {k}{j} d_j(n)$.  With the strict count of divisors function, we can say $ D_{a,k}(n) = D_{a,k}(n-1) + d_k'(n) \cdot n^a $ .  Thus, if we sieve all the numbers from 1 to $n^\frac{2}{3}$, for each number we can compute its values for $d_k(n)$, from which we can calculate $d_k'(n)$, which in turn lets us keep a running total of $D_{a,k}(n)$.  We will segment our sieve in blocks of size $n^\frac{1}{3}$ to stay in our memory bound.
The second observation is that, using the following identity, we can express $D_{a,k}(n)$ as sums that rely only on $D_{a,k}(j)$ where $j < n^\frac{2}{3}$ and of arbitrary values of $D_{a,1}(j) = \sum_{k=2}^j k^a$, which can generally be computed in constant or log time for any values of j for the values of a that we're working with.
If we let $d_{a,k}(n) = D_{a,k}(n) - D_{a,k}(n-1)$, we start with this combinatorial identity, whose derivation I have written up elsewhere but don't have the room to show:
$D_{a,k}(n) = $ $\displaystyle\sum_{j=t+1}^n d_{a,1}(j) \cdot D_{a, k-1}(\frac{n}{j}) $ $\displaystyle + \sum_{j=2}^t d_{a,k-1}(j) \cdot D_{a,1}( \frac{n}{j}) $
$+ \displaystyle \sum_{j=2}^t \sum_{s=\frac{t}{j} + 1}^\frac{n}{j} \sum_{m=1}^{k-2} d_{a,1}(s) \cdot d_{a,m}(j) \cdot D_{a, k-m-1}( \frac{n}{js} )$
For this identity, t is some value such that $1 < t < n$.  If you look through the sums closely, you should see that the right hand side doesn't rely on any values of $d_{a,k}(j)$ where $j > t$ and $D_{a,k}(j)$ where $ j > \frac{n}{t}$ except when $k = 1$, as desired.
Even if we set $t=n^\frac{2}{3}$ and sieve values of $D_{a,k}(j)$ up to $n^\frac{2}{3}$, these sums are too large to be computed in our time bound.  Instead, we have to take advantage of certain symmetries to reduce the calculations in these sums.  I'm going to hand wave over the process leading to this - you can find a description of it and much else here, but, taking one last leap, the following Mathematica code takes the identity we were just talking about and evolves it further as the function labeled DDFast - remember, when tracing through the following code, that in a full implementation any instances of DD and d in DDFast would be looked up thanks to sieving and caching within our time and space bounds, so what follows isn't an accurate reflection of its execution time, just the accurate mechanics of DDFast.
DD[A_, k_, n_] := Sum[j^A DD[A, k - 1, n/j], {j, 2, n}]
DD[A_, 1, n_] := Sum[j^A, {j, 2, n}]
d[ A_, k_, n_ ] := DD[ A, k, n ] - DD[ A, k, n - 1]
rng[ 0, start_, end_ ] := Floor[end] - (start  - 1)
rng[ 1, start_, end_ ] :=
Floor[end] (Floor[end] + 1)/2 - (start - 1) start/2
rng[ 2, start_, end_ ] :=
Floor[end] (Floor[end] + 1) (2 Floor[end] + 1)/
6 - (start - 1) start (2 start - 1)/6
rng[ A_, start_, end_ ] := Sum[m^A, {m, start, end}]
DDFast[A_, 1, n_] := rng[A, 2, n]
DDFast[A_, k_, n_] :=
Sum[j^A DD[A, k - 1, n/j], {j, Floor[n^(1/3)] + 1, n^(1/2)}] +
Sum[rng[A, Floor[n/(j + 1)] + 1, n/j] DD[A, k - 1, j], {j, 1,
n/Floor[n^(1/2)] - 1}] +
Sum[d[A, k - 1, j] rng[A, 2, n/j], {j, 2, n^(1/3)}] +
Sum[s^A d[A, m, j] DD[A, k - m - 1, n/(j s)], {j, 2, n^(1/3)}, {s,
Floor[Floor[n^(1/3)]/j] + 1, Floor[n/j]^(1/2)}, {m, 1, k - 2}] +
Sum[(rng[A, Floor[n/(j (s + 1))] + 1, n/(j s)]) (Sum[
d[A, m, j] DD[A, k - m - 1, s], {m, 1, k - 2}]), {j, 2,
n^(1/3)}, {s, 1, Floor[n/j]/Floor[Floor[n/j]^(1/2)] - 1}]
SumPrimesFast[A_, n_] :=
Sum[(-1)^(k + 1)/(j k) MoebiusMu[j] DDFast[j A, k, n^(1/j)], {j, 1,
Log[2, n]}, {k, 1, Log[2, (n^(1/j))]}]
The function labeled DDFast, which is really the key here, can be computed in $O(n^\frac{2}{3})$ time as long as all of the functions it references have been cached.
So there we have it.  If you compute SumPrimesFast and, in turn, DDFast, but interleave the computation of those sums with the sieving process described above, you end up with something like an $O(n^\frac{2}{3} \log n)$ time and $O(n^\frac{1}{3} \log n)$ space algorithm that can count prime sums to non-negative, integer powers, including as a prime counting function for $a = 0$.
It's worth taking a look, too, at rng[ A_, start_, end_ ] := Sum[m^A, {m, start, end}] - the reason this algorithm works for non-negative integers is that rng can be computed in constant time for non-negative, integer values with Faulhaber's Formula.  It's possible the algorithm could work for other powers if rng can be usefully extended to other powers with sufficient speed and precision.
I have an implementation of this algorithm in C++ here.  It has a few C math precision issues I haven't tracked down, so it's often off by a 2 or 3, but it does essentially implement what I've described here, and might be useful for stepping through with breakpoints.
A somewhat more fleshed out description of this can be found here.  Several details that I've hand-waved over here are described there.  Even better written up is a description of this as a prime counting algorithm, here.  It does a better job showing a few key derivations.
Answer: This is a difficult problem. I asked about it here on math.se and here on cstheory. In both cases my question was somewhat broader: allowing sums over different exponents rather than just 1.  In the second link I also allowed interactive proofs.
I noted that for exponent 0 there are efficient algorithms (superior to enumerating primes): the various analytical or combinatorial $\pi(x)$ algorithms. But no one was able to suggest an efficient means to solve the problem for any exponent.  An interactive proof was proposed that allows a person to check a proposed proof in linear time, but the confidence in the proof is asymptotically 0% against a cunning adversary.
I am not aware of any hardness results, though, so this seems to be wide-open.
Comment: Unless I am missing something, computing the sum of the kth powers of (the positive primes less than n) should be equivalent in polynomial complexity to finding all the primes less than n, when k is a positive integer.  Also, it may be quick to approximate a sum of kth powers by considering the related sum for numbers of the form , say, 210m + j where j is coprime to and less than 210.  Gerhard "Ask Me About System Design" Paseman, 2011.11.20
Comment: The complexity of counting primes is sublinear. I've seen $n^{2/3}\log n$ for time with $n^{1/3}\log n$ for memory but I don't know if it is the current record. However that counting is based on some non-trivial sieve type identities and I do not immediately see if there are any analogs of those identities for power sums.
Comment: Fedja: Are you saying counting primes is sub-linear, or do you mean summing primes?  If the latter, I would be fascinated to see a reference.  If the former, there is a method from Lagarias-Odlyzko that is commonly listed as having variants that are O(x^3/5+epsilon) time, O(epsilon) space, and O(x^1/2+epsilon) time and O(x^1/4+epsilon) space (though with quite difficult constant time factors).
Comment: I know only about counting (I just responded to Gerhard). It is, indeed, an interesting question if we can do better than $n$ for the sum rather than for the number. I haven't seen it anywhere but the first natural step would be to go back to all those partial sieve formulae and see if they can be modified to give the sums rather than numbers. I do not see how to do it immediately but I do not see why it is impossible in principle either.
Comment: Unfortunately, fedja and I are experiencing a misunderstanding.  I am referring to finding, not counting, primes.  Only if pi(n) and pi(n+1) are different have we found a prime.  Knowing pi(n)and and pi(n+k) does not find the primes in the middle in general.  Gerhard "Ask Me About System Design" Paseman,  2011.11.21


Late night taxis from Don Mueang airport?

Question: I'm looking at flights from Tokyo to Bangkok, and one of the more convenient ones unfortunately arrives at Don Mueang Airport at 00:55. Will there be taxis at the taxi stand then?
Answer: Yes.  Taxis are available as long as flights are scheduled.
Comment: (+1) Tom is correct. Make sure you go to the public taxi stand inside the airport, which is in the *domestic* arrival area (turn left after leaving the international arrival area, and walk all the way). You get the form from them first, it will have the taxi number, and they'll call the driver for you (they can also write down the destination in Thai if you ask). You pay by meter plus extra 50 Baht airport surcharge.


How do I exit through the beacon in Faster Than Light mobile?

Question: I recently purchased the Faster Than Light iOS app. I have just made it through my first map with the resistance hot on my heels. I arrived at the beacon and was about to exit through it when I realized. I don't know how. So my question simpler is: How do I exit through the beacon?
Comment: The body is to put *additional* info regarding your problem. There's a reason there's a minimum character limit. Please add more information about what it is you're trying to do.
Answer: (Although I don't have an iOS platform, I will assume that the behavior is consistent across all platforms. For reference this is a screenshot taken in Windows).
Upon reaching the Exit Beacon, your next jump has a new button at the right side of the Sector Map, designated as "Next Sector":

After clicking on the Next Sector button, the following menu appears, asking for what direction you want to take, besides the current layout of all sectors.
Answer: When you reach the exit beacon, there'll be a button in the top-right of the sector (?. Is that what it's called? The one you first see when you press Jump.) map. Pressing this will allow you to travel to new sectors.


About Skanda Shasti Fasting

Question: Skanda Shasti is a famous festival in Tamilnadu. I want to know
what is Skanda Shasti and Skanda Shasti Fasting? How to observe this fasting and pooja?
Answer: Skanda is Lord Shiva & Goddess Parvati's son,younger brother of Ganapaty, also known by names such as Karthikeya,Shanmuga etc.
The Puranas say that Karthikeya was born on Sukla Shashti tithi in the MArgasirsha month.Hence the name Skanda Shasti,which is the day/vrata dedicated to Lord Karthikeya.Just like the Ekadashi Tithis are dedicated to Vratas related to Lord Vishnu ,Chaturthi Tithis to Lord Ganapaty similarly the Sukla Paksha Shasti Tithi is dedicated to Lord Karthikeya.

Sashti Tithi is dedicated to Lord Skanda. Devotees keep fast during
  Shukla Paksha Sashti day. For Skanda Sashti Vratam the day when Sashti
  Tithi is combined with Panchami Tithi is preferred. Hence Skanda
  Sashti Vratam might be observed on Panchami Tithi.
Skanda Sashti is also known as Kanda Shashti

The Varaha Purana describes the origin & importance of Skanda Shasti as follows:

The birth of Kartikeya at the Krittika Star on the Sixth day of the
  bright fortnight of Margasira month (Krittika Nakshatra of Shashthi
  Tithi of Suddha Paksha of Margasirsha Month) brought relief to the
  Universe, immense joy to the Siva Couple, sense of liberation to all
  Devas who were indeed the direct beneficiaries since Brahma�s boon was
  that only Siva�s son could terminate the Demon Tarakasura and finally
  great fear and apprehension to Tarakasura and followers! Brahma had formally declared Shashthi of every month would be a day of austerity and fast only with �Phalaahar� or fruits as food. Those who are deviod of sons, prosperity and status ought to observe the fast and recite the above Karikeya Stuti for instant results.

The Karthikeya Stuti referred to in the passage above is this:

�Bhavasva Deva Senani Maheswarastuta Prabho Shanmukha Kanda Visvesha kukkutadwaja Paavake- Kampitare Kumaresha Skanda Balagrahnuga Jitaare
  Krounchavidhvamsa Krittikasuta Matruja- Bhutagrahapati sreshtha
  Paavaki Priya Darshana, Maha Bhutapateh Putra Trilochana Namostutey-
  Yvam Stutastada Devaihi vavardha Bhavanandanah, Dwadasaadithya samkaso
  vabhuvaadhuta Darshanah Trilokyamapi tattejasthaapayamaasa Parthiva!�

One who knows tamil can also recite the famous Kanda Shasti Kavacham  on the Vrata days.

About Skanda Shasti Fasting


Classification Problem with Big Unbalanced Data

Question: I have a dataset with over 1 million observations, and a few dozens of predictors. My target variable is binary (gold customer vs. not gold customer) and I wish to build a classifier for prediction. Out of the 1 million observations, only around 30,000 are gold customers.
I read the file into a couple of computer software packages that struggled with the size. I tried making a prediction, using decision trees (CART), but got a poor result with specificity nearly perfect and sensitivity of less than 30%. I calculated the effect size (cohen's D) for each variable, and 3 variables showed higher values of D. I got the median difference for them, and it was higher than other variables too. Then I took all the gold customers and a random sample of 30,000 non gold customers, and the decision tree gave much better results, with both sensitivity and specificity being over 80%. I tried it on a different random sample, and same again. The results I am mentioning are the validation results, not the training. Can you please help me understand what it means ? Is it possible that a very unbalanced data creates a problem that damages prediction? Thanks!
Answer: Imbalanced datasets indeed might damage the predictions. The reason is that when the dataset is imbalance the majority rule gets high accuracy and learner are biased toward it and perform badly on the minority class. You might be interested in this Editorial: Special Issue on Learning from Imbalanced Data
Sets and Learning from Imbalanced Data
You have 30K samples of the minority class (3%) so are dealing with a relative imbalance and not absolute imbalance. These are good new since in such scenarios you are likely to end up with enough data after downsampling.
Your intuition of balancing the set was correct - in order to differ between the majority and the minority classes. However, your model is needed to perform well not in differing between them in a balance distribution but on their natural distribution. You can adapt your model back to the natural distribution by learning a new model that will do this adaptation. For details see here.
For the usage of different datasets in order to learn and validate see here


Looking for specific examples of University spin-offs where the researchers can earn part of the benefits

Question: I have demonstrated that some of the technologies derived from our research are marketable; I have offered services based on them to industry customers and have been paid for that. So as academic research group, I have received income, but which can only be used to buy lab equipment mostly and not for personal use (salary complement, a new mobile phone, etc). Therefore I am thinking to create a spin-off, but the policies of our university in that case do not allow income to go directly to the researchers, so that I feel a bit frustrated about that. From the other side, I can not create a company and manage it in my free time since my contract does not allow to do that, and all technology derived from my research belong to the company. This is a private university and very young (15 years) and there are not many cases like mine. So my plan is to go and talk directly with the main head and tell them I want to create this spin-off, since this will be good for the university, its reputation, and so on, but that I want to receive some part of the benefits in terms of personal (for me) income. For doing this I would like to give them concrete examples that this works in other universities, since I have heard this situation is typical in other academic contexts, etc. Therefore I wonder if you know of concrete and specific examples of spin-offs from universities, where the university allows the researchers to earn some money derived from the incomes.
Comment: I have workaround: Incorporate a company and appoint a CEO other than yourself, retain some of the shares yourself.
Comment: that is very interesting but not what I was asking, thanks
Answer: The policy at my university for managing patent licensing fees and the like, which is somewhat distinct from a spin-off but somewhat conjoined - for example, you could start a spin-off that then licenses the patent, or find a company interested, etc.

Division of Patent Royalties

a) All monetary proceeds from the commercialization of University-owned inventions are the property of the University or its assignee. The University or its designee will collect and distribute royalties, fees, equity interests, or dividends to inventors and the University in accordance with the procedures established by the University.
(1) The University or its designee will deduct the costs of obtaining and maintaining legal protection, for each invention, to arrive at "adjusted income" unless other arrangements, agreed to by all parties that share in the income, are made by the relevant branch campus, research unit or program in advance of the expense and agreed to with the OC. Such arrangements may include contracted marketing, licensing and business development. In such cases, any agreed upon expenses will be deducted to arrive at adjusted income.
(2) The Office of Commercialization will deduct twenty percent (20%) from adjusted income and the remainder will be "net income." This deduction is directed toward covering the expenses (excluding direct patent expenses) for administering the OC and provides initial funds for patent prosecution for other inventions without obvious commercial partners.
(3) Net income will be distributed according to the following schedule.
University's portion of the share will be distributed as follows: 30% to the University, 20% to the college and department (or relevant branch campus, research unit, or Program when appropriate) to be equally split between the two
<code>Cumulative Net Income Inventor/Contributor University
$1-$10,000                    100%
Above $10,000                 50%              50%
</code>
Comment: thanks, can we know which university is this? (since I am looking for concrete examples). and in summary, which percentage of net income can then receive the researcher?
Comment: Washington State University. What percentage of net income will depend on the amount in question, as in the bottom table. I believe the total amount is uncapped.
Comment: ok, and this 50% for the inventor, goes directly to the personal bank account of the inventor and he/she can do whatever he/she wants with the money or can only be used for lab equipment ?
Answer: University spinoffs are quiet common, although setting them up can be quite complex. There seem to be reviews of the process and lists of successful ones. Some of the benefits are described in this Nature article. Spin offs are not just limited to the US, UK spinoffs have also been very successful.
As an example, Herbert Boyer progressed up the academic ranks at UCSF from 1966 to 1991. He also co-founded Genentech in 1976 and served as its vice president. While I cannot easily dig up anything that says he received a salary, royalties, or a stake in the company, he did donated $10,000,000 to Yale in 1990.
Michael Mauldin developed Lycos while at CMU. He left his faculty position to become the founder and chief scientist at Lycos, but maintained an adjunct position. Again I didn't find anything about his ownership stake or salary, but most adjunct professors do not retire to their own cattle ranch at age 50.
Comment: yes, that is a very interesting list, but can one there find information about whether researchers involved can earn part of the benefits?
Comment: @flow yes, you just need to look a little. I provided two examples.
Comment: thanks, but I need solid examples that I can show to my employer
Comment: @flow what do you want? I don't think you are going to find copies of contracts...
Answer: Just to add another university to the list, Carnegie Mellon University has an entire department dedicated to managing spinoffs. The previous link (here again) lists a number of successful spinoff companies, as well as a brief blurb on each, with occasional links to more detail. They also have an extensive list of forms, policies, disclosures, and other resources that you may want to reference when speaking with your university. You may find that you can save a lot of time by simply using these forms and procedures rather than starting from scratch.
Answer: I think this one should count: It's called Ant-Optima and, as the description suggest, is a spin-off of a rather well known AI research lab affiliated with the University of Lugano, Switzerland.
Comment: but do you know if there the researchers earn part of the benefits?
Comment: @flow Good point. I do not (and cannot) know for sure. My guess would be "yes" (where else the benefits would go?) But it's not more than a guess.
Answer: Here is the Duke Policy:
https://provost.duke.edu/wp-content/uploads/FHB_App_P.pdf
Relevant exerpts:
Section IV, Part C: "Inventions resulting from research or other work conducted by University employees in whole or in  part  on  University  time  or  with  significant  use  of  University  funds  or  facilities  shall  be  considered the property of the University."
Section V, Part C: All  income  derived  from  inventions  falling  within  Article  IV, Section C  shall  be  distributed  in  accordance with the following rules:

...
The University  will  then  pay  and  distribute  the  income  remaining  after  payment  of  direct expenses in the following manner:
a. income from $0 to $500,000:

(1) fifty percent (50 %) thereof to the inventor;
(2) ten percent (10 %) thereof to the inventor's laboratory until, in the discretion of the President after consultation with the Chancellor   or   the   Provost, this distribution equals the maximum amount which can reasonably be expended in that laboratory, after which any excess shall be added to and distributed as a part of share in accordance with V.C.2.a.(4) below;
(3) ten percent (10 %) thereof to the inventor's department/organizational unit;
and
(4)  thirty  percent  (30%)  thereof  to  be  directed  to  the  school  of  the
inventor's primary appointment.
Comment: thanks this is kind of what I was looking for. Last question is, this 50% for he inventor, goes directly to the personal bank account of the inventor and he/she can do whatever he/she wants with the money or can only be used for lab equipment ?
Comment: I don't know personally, but the language suggests 50 percent personal bank account, 10 percent lab (only lab-related expenses).


What is the difference between Electrostatic potential (not "Potential Energy"!) And Electric potential

Question: I have spent an hour with all I had got to figure out the diffrence between them : So What I understood is please correct me if I'm wrong (I know I will be dead wrong) That electrostatic potential occurs in stationary charges and that this term means The potential or the ability of a charge to do work and for Electric potential it's the same the only diffrence is that the charges are not stationary but moving
Comment: I belive potential energy and potential are two diffrent things
Comment: What you just stated is correct. Although both terms you used mean the same thing. I believe what you are trying to say is "What is the difference between electrostatic potential and electrodynamic potential?" For electrostatic cases (which is often taught for introduction to E&M courses), the potential is somewhat straight forward, but for moving charges (i.e. electrodynamics), you need to start consider other variables such as retarded time, for example. Look up Lienard-Wiechert potential. I think you will find your answer there.
Comment: @Kane Billiot  Excuse me,I'm sorry but by moving charges I mean electricity not electrodynamics
Answer: "Electrostatic potential" implies that it is given by positions of all charges at the same time. Usually given by the Coulomb formula for potential
$$
\phi(\mathbf x) = \sum_k K\frac{q_k}{|\mathbf x - \mathbf r_k|}.
$$
"Electric potential" is a more general term, it implies only a function of position and time $\phi(\mathbf x,t)$ which is to be used in the formula for electric field
$$
\mathbf E = -\nabla \phi - \partial_t \mathbf A
$$
Electrostatic potential is a special kind of electric potential, but it is the most common and most useful one. There are other kinds, like retarded electric potential, used when solving the wave equation for EM fields of accelerated charged particles.
Comment: Sorry @Jan for being a Little bit implicit in my question I can understand your answer to my problem to a much extent, I've not yet progressed to wave equation until now so, could you please put it in terms of work done, cheers!
Comment: I can't, retarded electric potential has no direct connection to work.
Comment: Oh Ok, I didn't know that before
Answer: Unfortunately, the vector notation is not the best one to grasp the actual nature of electromagnetism. Indeed, the best way is to dive into relativity and consider the electric and magnetic field together. In Minkowski space-time, define the 4-potential
$$\phi = (V,\mathbf A).$$
To find the associated field strength, do what you would normally do, i.e. take the differential of the potential and set
$$F = \text d\phi$$
With a slight abuse of the vector notation, the above differential expands to
$$F = \left(-\nabla V + \frac{\partial\mathbf A}{\partial t}\right)\cdot(\text dt\wedge\text d\mathbf x) + (\nabla\times\mathbf A)\cdot(\star\text d\mathbf x),$$
where $\star\text d\mathbf x$ is the vector of spatial surface elements
$$\star\text d\mathbf x = (\text dx_2\wedge\text dx_3, \text dx_3\wedge\text dx_1, \text dx_1\wedge\text dx_2).$$
From this expression you can now recognise the electric and magnetic components of the Faraday tensor field $F$:
$$\mathbf E = -\nabla V + \frac{\partial\mathbf A}{\partial t}$$
$$\mathbf B = \nabla\times\mathbf A$$
Undoubtedly, the covariant definition of the electromagnetic tensor is simpler: just $F = \text d\phi$. Thanks to this one can then produce the more general formula for the electric component and from that produce the electric potential as the path integral of $\mathbf E$, which in general is a function of the path itself:
$$V[\gamma] = \int_\gamma \mathbf E\cdot\text d\mathbf x.$$
When we talk about something static, e.g. the electrostatic potential, we can then assume that the time derivatives vanish (simply by definition), so that the electric component of the Faraday tensor reduces to the gradient of a scalar field. In this case, the electrostatic potential coincides with the scalar field $V$, i.e. the time component of the 4-potential $\phi$.
Comment: Frankly speaking @Phoenix87 All this is fancy for me, No offense your answer is indeed a very professional one but Its at a level much much higher than I can understand ,I'm like literally a noob I feel in this amazing huge community. I'm acquainted till Biot-Savart law !
Comment: You can safely ignore the first half of the answer that shows how to derive the expressions for the electric and magnetic field in terms of the potentials.


How do I get a transparent background in Illustrator CC?

Question: I need help trying to make a transparent background. I do realize that the transparency is there, but I have enabled "Show transparent background" and there is still a white background behind my image. I know this sounds noobish, but this is my first time with Illustrator, I don't usually do work with it, I had to for this one time.
Here's something I made to upload here to show as an example of what I mean.

**EDIT:**Since I had some comments that require answers, and I just registered so I dont have enough rep to reply, this is how I'm going to do it.
The image was a raster image, brought it over to Illustrator and traced it already, what you see in the image is a vector image (traced).
Until now, I used the pen tool and selected the surrounding, selected the whole image and created a clipping mask, that got rid of most of the white background, however, because of my bad use of the pen tool, it leaves an outline on the shape, so I still have trouble with it.
Comment: Re: your edit: you might want to try and `Object > Expand Appearance` the trace to be able to edit the shapes in the trace. You could also try and change the Trace settings and check `ignore white`.
Comment: Hi Sam, is that a raster image with a white background (jpg, gif or png etc) you've placed in your file? If so, your best option is to trace that shape, which as it's simple, 1 colour and symmetrical, should be pretty easy or to use you can use Illustrators "Image Trace" function.
Comment: Hi Sam, welcome to GDSE! It would appear you have accidentally created multiple accounts. Stack Exchange only allows one account per user on a site.  Please go to our [help section](http://graphicdesign.stackexchange.com/help/merging-accounts) and contact SE to have this issue fixed.
Answer: Used the Magic Wand tool and selected the white space background, then pressed the delete button on my keyboard and done.
It is a bit weird because I tried that before and it didn't work, I don't know how it worked this time.
FINAL ANSWER: A comment on the post, moderator Vincent, provided the answer. On my real project it also removed some white parts of the content as well, but I can put those back. Thank you, Vincent.
P.S.: I submitted the form for accidental multiple accounts.
Comment: HI msamprz, the user is talking about the program Adobe Illustrator which does not have a magic wand tool.
Comment: Hi Andrew, thank you for your response. I am OP, and yes, I am using Adobe Illustrator, it's Illustrator CC 2015, and I am very well sure it is a Magic Wand tool :)
However, when I attempted it again on my real project and not the example above, it is no longer working, so I'm confused now.
Comment: So you have two user accounts now, msamprz?
Comment: @SamF Oh you're right, I am mistaking. I haven't used that tool since it was added.
Comment: @Johannes I did, until twenty minutes ago, but Vincent, helped me out and now I only have one.


Does chromium oxide form on Stainless-steel in 'deoxygenated' water?

Question: Will a passive layer form on stainless-steel in pure (0.055 μS/cm) water with an oxygen concentration < 50 ppb. If so, why is this type of water generally called 'deoxygenated'? If a passive layer (chromium oxide) does not form with such low oxygen concentration why is this, since there IS still oxygen in the water.
Comment: There are too many unknowns for a definitive answer. For instance there are many kinds of stainless steel. In general water at room temperature wouldn't "attack" stainless steel. In steam plants however steam under high pressure is much more reactive. Having oxygen in the steam makes the oxygen/water combination even more reactive. Since there is oxygen in the air it is nearly impossible to get ALL the oxygen out of any water sample. Look at it this way. Air has about 78% nitrogen and 21% oxygen by volume. A mixture of 99% nitrogen and 1% oxygen would kill you.
Answer: From a practical standpoint, once the stainless steel item is made the passive layer immediately begins to form. Passivation with acids is a process used to accelerate this process and have parts ready to use in a shorter period of time. So if you have any high quality SS parts, they will come to you with the passive layer already developed.
Theoretically speaking, if a completely naked section of stainless was put into this "pure water", there would still be some oxide formation because the specification of <50 ppb still allows for some oxygen to be present. However, this should not have any practical implications. I suspect the name "deoxygenated water" is used to indicate there was a conscious process used to reach such a low amount of free oxygen in the water but not to claim o% free oxygen content.


Does a sidebar like Google Desktop sidebar exist for Ubuntu?

Question: Does a sidebar like Google Desktop sidebar exist for Ubuntu? I want to see commodity prices, stock tickers, CPU performance, etc. out of the corner of my eye. Thx.
Answer: I don't think so, however there is something called Conky which can display CPU information and more.
You can install it by running the following command in the terminal:
sudo apt-get install conky conky-all

Or install it the Ubuntu Software Center, by searching for conky.
The problem however is that you still need to configure Conky by yourself which can be tricky, the best thing to do that is by using the program called Conky Manager or visit the website of conky. http://www.webupd8.org/2013/07/conky-manager-gui-for-managing-conky.html
http://conky.sourceforge.net/
Personally I don't use conky but I hope this helps a bit.
Answer: You might find this of interest.
http://code.google.com/p/google-gadgets-for-linux/


In aircraft construction, what is the difference between a firewall and a bulkhead?

Question: I'd like to know the difference between a firewall and a bulkhead.  They both separate segments of an aircraft, so how are they different as it pertains to their design and purpose in aircraft construction?
Answer: A bulkhead is any kind of structural panel separating two spaces in a fuselage.  Like a solid panel in the tail cone that has only small holes for cables to pass, or the panel that forms the end of the baggage area.  Pretty much any solid lateral partition with a structural use. On a large aircraft, any structural partitions separating parts of the cabin, like the flight deck bulkhead, or terminating the pressure hull at each end, the "pressure bulkheads".
A firewall is a firebreak.  It's a bulkhead that is fireproof to separate a "hot" area like an engine compartment from adjacent structure, so that if you have an engine fire, you'll have more time to try to land, or if at high altitude, say your prayers.  To be a firewall, the material of the bulkhead has to be flame resistant, with a much higher melting point than aluminum.
On GA airplanes, the firewall is usually stainless steel, but can be galvanized steel (antiques and homebuilts), or even special flame proof coatings on a normal bulkhead (some composite homebuilts).  On transport airplanes, a firewall will be stainless or titanium.
So in a nutshell, a bulkhead is a structural lateral panel in a fuselage.  A firewall is a "fireproof" bulkhead normally separating the engine compartment (or other flame source) from the rest of the plane.
Comment: I would also like to add that firewalls are NOT fireproof but are there to slow the spread of fire and heat until something can be done with it. They can last a really long time, but they are all rated to fail after "a while"
Comment: This is correct. Ships notably have *waterproof* bulkheads engineered into their design. The *Titanic's* waterproof bulkheads were famously not tall enough to be effective in that particular disaster.
Comment: Re read the middle paragraph carefully.
Comment: @RobertColumbia Both waterproof ones and fireproof ones, to be precise. Every 40 meters is a mandatory main fire zone, with a keel to top fire-resistant bulkhead. Major bulkheads under the main deck are generally waterproof, above it nothing is. Note how a bulkhead can be waterproof, fireproof, both, or neither.


Is it possible to make partition of Quicksort run in O(lg n)?

Question: I was thinking maybe I can make it 2T(n/2) + C split the list into two halves and work on them recursively to partition the list.
Comment: Does your question asks whether it is possible to find median in logarithmic time (to split into two halves)? The answer is no, it is not possible to find median faster than linear time in unsorted array under general assumptions.
Comment: $T(n) = 2T(n/2) + C$ gives $T(n) = \Theta (n) $
Answer: No.  The partition operation must access every item in the list: if there is any item it does not look at, then you don't know which side of the partition it belongs on.  Consequently, the partition operation cannot run any faster than $O(n)$ time, where $n$ is the length of the list.
Answer: No, this doesn't work. Whatever method it uses, your partitioning still has to look at every element of the list, even if that's hidden inside recursions.
Mathematically, you're confusing the recurrence $T(n)=2T(n/2)+c$ with the binary search recurrence $T'(n)=T'(n/2)+c$. $T'=\Theta(\log n)$ but $T(n)=\Theta(n)$. In binary search, you only have to recurse on one half; having to visit both halves kills you.
In fact, it's probably even worse. Saying that your partitioning scheme runs in time $T(n)=2T(n/2)+c$ is saying that you can combine the partitions of the two halves in constant time. The only way I can think of doing that would be using some kind of linked list data structure. But then splitting the list requires finding the middle, which is still $\Theta(n)$. Maybe you could do something with binary trees but, man, this is getting complicated and your best possible outcome is a complicated way of getting the $\Theta(n)$ partitioning time we already had with the simple algorithm on an array.


Should I trim the flowers off a new blackcurrant bush?

Question: I bought a starter cutting for a blackcurrant bush - it's doing very well, looking healthy. The problem is that there are also some flowers developing, and a pamphlet that came with the cutting said I should trim any fruit that grows. Should I trim the flowers off so the young bush will put more energy into vegetative growth (nipping the fruit problem "in the bud")?
Answer: Do you mean a bare root or potted plant? Did you prune it when you planted it? Either way, I would prune each stem back to 4 or 5 buds. Then you can remove any flowers that are left, if there are any. Good luck with it! My black currants are some of my favorite plants in my garden.


Recognition of small objects

Question: I'm currently implementing an Android app for street sign recognition. My solution works quite well for the GTSRB dataset, since it provides a labeled test set of centered images. However, it doesn't scale up to more realistic scenarios like for images in the GTSDB, where the signs only take up some pixels. Is it still recommended to downsample the image to 224x224?
Answer: There is a big difference between the 2 datasets. When you train on the GTSRB dataset, your model performs image recognition, while for the GTSDB dataset you need to perform object detection. These are 2 related but different tasks (with detection being considerably harder).
You can consider using a sliding window approach, or use some prior attention model that will learn to extract the area of the signs for later classification.
I don't think that it is recommended to down sample images of 1360x800 pixels to 224x224.
(224x224)/(1360x800)=0.046. You are loosing 96% of the information (including your street signs which might reduced to nothing), granted most of it is not interesting, but simple down-sampling doesn't get to choose what to forfeit.

Recognition of small objects


Is It Always a Best Practice to Decouple the Frontend from the Admin Area When Developing a WordPress Application?

Question: Is it always a best practice to decouple the admin area from the frontend portion in a WordPress application? Are there any instances when one might want to use the admin area/screen as the application's main interface?
Answer: Off the top of my head I can't think of any instance where you would want the WordPress admin to be the main entry point for your website, that there isn't a more suitable software to use. Do you have a specific application or use in mind?
In general I would say say, yes it is best practice to keep the admin potion of your WordPress install for "Administrators" as it could be used to upload many forms of malicious or abusive code.


Where should I connect a second slave phone box?

Question: Hi I'm new to doing diy jobs, but I already wired up a slave phone line to the master box. I'm now looking to wire a 3rd box up, would I wire this off the slave box or the master ?
Answer: For simple telephone service it doesn't matter.  You can run them all to one point or chain from one to the next; whichever is easiest to run.
For more advanced use of the phone wiring like DSL, having the shortest total path of wire to the demarc point is preferable, with as few splices as possible, which usually means running a cable from each jack to near the demarc point, usually in an electrical room or basement.
Running them all to that point also means if a wire breaks it only takes out that jack, not all the ones downstream of it.
Comment: For DSL you want to minimize reflections: no stub ends.  Star wiring is best.
Comment: Most new construction here (Canada), thankfully, runs a separate line from each jack to a common point (usually beside electrical panel), and same for cable and ethernet jacks. If you're running cable back to a central point, you should consider using ethernet (Cat5e or Cat6) as then it can be used for computer networks (LAN) but is still compatible with regular phones.
Comment: Yes for new construction definitely run seperate wires back to the electrical room area.  But if adding the jacks with walls in place either way will work just fine for phone service.


How common is phonemic vowel length across languages?

Question: Including different kinds of length distinctions, such as in stressed syllables only, or stressed and unstressed, etc.
Comment: That's nice, but it's not very helpful for languages that aren't stress-based. It surprises me that WALS doesn't have a map for presence/absence of phonemic length contrasts.
Comment: There's a [map of syllabic weight factors](http://wals.info/feature/16A?tg_format=map&v1=cfff&v2=cd00&v3=c00d&v4=c909&v5=c000&v6=cff0&v7=cccc) in WALS.
Answer: None of the standard resources for this sort of typological information, it would seem, have helpful information to answer this question as accurately as one might like. That being said, both UPSID and the World Phonotactics Database can help us give an initial plausible range. Both have entries for long vowels, but these include all long vowels, so, for instance, English is included, despite the fact that while vowels like in beet  /iː/ are phonetically long, there is no phonemic length contrast in English.
UPSID's dataset says that 51 languages, or around 11% of their dataset have long vowels. Some of these are obvious cases where the entry is spurious, at least as it relates to phonemic vowel contrasts.
While the World Phonotactics Database does not actually give an accessible list of segment inventories, it's dataset contains 1,384 languages with long vowels, around 34% of its total sample. A number of these will likely not represent phonemic length contrasts.
So our estimate should be no less than 10% of the world's languages, based on the UPSID data, and no more than 33%, based on the World Phonotactics Database. Due to the size of UPSID's dataset, my guess would be that the true number is somewhere closer to the number found in the World Phonotactics Database, something like 25% of the world's languages.
There are also 3-way length contrasts, but these are quite rare, and all examples I know of (Estonian, Mixe languages, Wichita, etc.) are at least debatably analyzed without resorting to anything more than a 2-way contrast.
Comment: Australian English has a phonemic length contrast on vowels.
Comment: Three-way length contrast used to appear in Sanskrit as well, as pluti.
Answer: While I can't give a definitive answer, I can just say it's somewhat to very common. Within the Indo-European family, almost all the branches have at one point had vowel length (Germanic, Italic, Slavic, Indo-Aryan, Greek, Anatolian, Celtic etc.) and many have had it re-innovated (certain English dialects' treatment of /eə > e:/, Belgian French compensatory lengthening before a lost /s/ etc.) . Outside the IE family, there's Uralic where vowel length is quite widespread amongst almost every member of the family, then in Korean, Japanese, certain members of Turkic, Bantu, Mongolian, Afro-Asiatic, Uto-Aztecan, Athabaskan, Wakashan, Algonquian, Mayan etc.
This just shows that it's not really a local phenomenon as vowel length appears in about any area where there are languages; some areas might have vowel length more common, though.
Comment: Very common in Australian languages as well.


How can we ever know the population variance?

Question: In hypothesis testing, a common question is what is the population variance? My question is how can we ever know the population variance? If we knew the entire distribution, we might as well know the mean of the entire population. Then what is the point of hypothesis testing?
Comment: Some relevant literature: http://www.nber.org/papers/w20325
Comment: One can know the variance without knowing anything about the mean.  For instance, the variance can be recovered from the squares of all differences of values in the population, but those differences give no information about the mean. Regardless, I do not see how the statements and questions in this post lead up to the question itself about the point of hypothesis testing.
Answer: I'm not sure that this issue really comes up "often" outside of Stats 101 (introduction to statistics).  I'm not sure I've ever seen it.  On the other hand, we do present the material that way when teaching introductory courses, because it provides a logical progression:  You start with a simple situation where there is only one group and you know the variance, then progress to where you don't know the variance, then progress to where there are two groups (but with equal variance), etc.
To address a slightly different point, you ask why we would bother with hypothesis testing if we knew the variance, since we must therefore also know the mean.  The latter part is reasonable, but the first part is a misunderstanding:  The mean we would know would be the mean under the null hypothesis.  That's what we're testing.  Consider @StephanKolassa's example of IQ scores.  We know the mean is 100 and the standard deviation is 15; what we're testing is if our group (say, left-handed redheads, or perhaps introductory statistics students) differs from that.
Comment: (+1) Perhaps it comes up more when "sampling from a population" is a way of thinking about the data-generating process, rather than something to be taken literally. Knowing the precision of a measuring instrument for example.
Comment: @DJohnson, I suppose it depends on the topics you work on.
Comment: Gung, as a practitioner with a 20+ year career, this issue came up in my experience more frequently than you imply. I'm not suggesting that it came up "frequently," just that the debates occurred. However, and to your point about Stats 101, more times than not the discussions were red herrings that resolved little or nothing regarding the particulars of a study or project -- somebody just wanted to create the appearance of intelligence in asking the question.
Answer: Often we don't know the population variance as such - but we have a very reliable estimate from a different sample. For instance, here is an example on assessing whether average weight of penguins has gone down, where we use the mean from a small-ish sample, but the variance from a larger independent sample. Of course, this presupposes that the variance is the same in both populations.
A different example might be classical IQ scales. These are normalized to have a mean of 100 and a standard deviation of 15, using really large samples. We might then take a specific sample (say, 50 left-handed redheads) and ask whether their mean IQ is significantly larger than 100, using 15^2 as a "known" variance. Of course, once again, this begs the question whether the variance is really equal between the two samples - after all, we are already testing whether means are different, so why should variances be equal?
Bottom line: your concerns are valid, and usually tests with known moments only serve didactic purposes. In statistics courses, they are usually immediately followed with tests using estimated moments.
Answer: The only way to know the population variance is to measure the entire population.
However, measuring an entire population is often not feasible; it requires resources including money, tools, personnel, and access. For this reason we sample populations; that is measuring a subset of the population. The sampling process should be designed carefully and with the objective of creating a sample population which is representative of the population; giving two key considerations - sample size and sampling technique.
Toy example: You wish to estimate the variance in weight for the adult population of Sweden. There are some 9.5 million Swedes so it is not likely that you can go out and measure them all. Therefore you need to measure a sample population from which you can estimate the true within-population variance.
You head out to sample the Swedish population. To do this you go and stand in Stockholm city centre, and just so happen to stand right outside the popular fictitious Swedish burger chain Burger Kungen. In fact, it's raining and cold (it must be summer) so you stand inside the restaurant. Here you weigh four people.
The chances are, your sample will not reflect the population of Sweden very well. What you have is a sample of people in Stockholm, who are in a burger restaurant. This is a poor sampling technique because it is likely to bias the result by not giving a fair representation of the population which you are trying to estimate. Furthermore, you have a small sample size, so you have a high risk of picking four people that are in the extremes of the population; either very light or very heavy. If you sampled 1000 people you are less likely to cause a sampling bias; it is far less likely to pick 1000 people that are unusual than it is to pick four that are unusual. A larger sample size would at least give you a more accurate estimate of the mean and variance in weight among the customers of Burger Kungen.

The histogram illustrates the effect of sampling technique, the grey distribution could represent the population of Sweden that doesn't eat at Burger Kungen (mean 85 kg), while the red could represent the population of the customers of Burger Kungen (mean 100 kg), and the blue dashes could be the four people you sample. Correct sampling technique would need to weigh the population fairly, and in this case ~75% of the population, thus 75% of the samples that are measured, should not be customers of Burger Kungen.
This is a major issue with a lot of surveys. For example, people likely to respond to surveys of customer satisfaction, or opinion polls in elections, tend to be disproportionately represented by those with extreme views; people with less strong opinions tend to be more reserved in expressing them.
The point of hypothesis testing is (not always), for example, to test whether two populations differ from one another. E.g. Do customers of Burger Kungen weigh more than Swedes that do not eat at Burger Kungen? The ability to test this accurately is reliant on proper sampling technique and sufficient sample size.

R code to test make all this happen:
<code>df1 = data.frame(rnorm(9500000, 85, 15), sample(c("Y","N","N","N"), replace = T))
colnames(df1) = c("weight","customer")
df1$weight = ifelse(df1$customer == "Y", df1$weight + rnorm(length(df1$weight[df1$customer =="Y"]), 15, 2), df1$weight)
subsample = sample(df1$weight[df1$customer=="Y"], size = 4)

png(paste0(path,"SwedenWeight.png"), res =1000, width = 4, height = 4, units = "in")
par(mar=c(5,6,2,2))
hist(df1$weight[df1$customer=="N"], xlab = "Kilograms", col = rgb(0,0,0,0.5), main ="")
hist(df1$weight[df1$customer=="Y"], add = T, col = rgb(1,0,0,0.5))
axis(side = 1, at = c(subsample), labels = c("","","",""), tck = -0.03, col = "blue")
axis(side = 1, at = c(0,150), labels = c("",""), tck = -0)
dev.off()

t.test(df1$weight~df1$customer)
</code>
Results:
<code>> t.test(df1$weight~df1$customer)

        Welch Two Sample t-test

data:  df1$weight by df1$customer
t = -1327.7, df = 4042400, p-value < 2.2e-16
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -15.04688 -15.00252
sample estimates:
mean in group N mean in group Y
       84.99555       100.02024
</code>
Answer: Sometimes the population variance is set a priori. For example, SAT scores are scaled so that the standard deviation is 110 and IQ tests are scaled to have a standard deviation of 15.
Comment: Yes, that's true, but in those cases there is also scaling to a fixed mean, so it does not yield a situation where there is an unknown mean and known variance.  Also, the scaling is done after all values are known.
Answer: The only realistic example I can think of when the mean is unknown but the variance is known is when there is random sampling of points on a hypersphere (in whatever dimension) with a fixed radius and an unknown centre.  This problem has an unknown mean (centre of the sphere) but a fixed variance (squared-radius of the sphere).  I am unaware of any other realistic examples where there is an unknown mean but known variance.  (And to be clear: merely having an outside variance estimate from other data is not an example of a known variance.  Also, if you have this variance estimate from other data, why don't you also have a corresponding mean estimate from that same data?)
In my view, introductory statistical courses that teach tests with an unknown mean and known variance are an anachronism, and they are misguided as a modern teaching tool.  Pedagogically, it is far better to start directly with the T-test for the case of an unknown mean and variance, and treat the z-test as an asymptotic approximation to this that holds when the degrees-of-freedom is large (or not even bother to teach the z-test at all).  The number of situations where there would be a known variance but unknown mean is vanishingly small, and it is generally misleading to students to introduce this (insanely rare) case.
Answer: Sometimes in applied problems, there are reasons presented by physics, economics, etc that tell us about variance and have no uncertainty. Other times, the population may be finite and we may happen to know some things about everyone, but need to sample and perform statistics to learn the rest.
Generally, your concern is pretty valid.
Comment: I have a hard time picturing an example from physics or economics where we would *know* the variance, but not the mean. Similar for discrete distributions. Could you give a concrete example or two?
Comment: @Peteris: that makes sense - but it sounds more like the case [I note](http://stats.stackexchange.com/a/214557/1352), of the variance (of your instrument) having been estimated on previous "calibration samples". I'd expect a theoretically derived variance with no uncertainty (!) to be a different thing.
Comment: @StephanKolassa I believe that physics experimental measurements would be an example - we may have a process or device of measurement that has a well known variance (measurement error), so when measuring a particular event then you can assume that variance is the same but you can only estimate the true mean.


Mushroom replacement in Beef Wellington

Question: I saw a great recipe for Beef Wellington on Serious Eats that I'm eager to try. However, my roommate does not eat mushrooms (both because he dislikes the flavor and because he had a bad experience as a child, so "hidden mushrooms" are out too). I worry that omitting them would defeat most of the purpose of the dish. Is there anything that could be used in their place to give a similar flavor?
Comment: Awww, don't hate mushrooms. I know one, and he's quite the **fun guy**!
Comment: I am a mushroom hater too--I read Kenji's article--but this is a dish I just wouldn't make.   Mushrooms are kind of key to its identity.
Comment: I'm also a mushroom hater; I've scrapped off this part of the wellington for years. To me it's about how the beef cooks wrapped in this way not about the flavor of the layer.
Comment: Butter fried Sinsimella flower paste? Without mushrooms, it's not going to be Beef Wellington. You could put some garlic in there to cover the inevitable chlorophyll taste. -Check the legality in your sate/country before proceeding.
Answer: I don't think you can make a Beef Wellington without the obligatory mushrooms, it essentially becomes something else.
The whole concept behind beef wellington is to keep the meat juices in by being surrounded by pastry but there's no reason why you shouldn't omit the mushrooms for something else. I really can't think of any other food substance that would replicate the flavour of mushrooms without being mushrooms other than truffle.
I would try something like a pork/onion sausage meat stuffing and being the time of year it is, perhaps with chestnuts as a possible alternative, either surrounding the beef or inside it.
Comment: Ooh, chestnuts might work! The recipe I linked sends the mushrooms through a food processor anyway.
Answer: Two years later, the chestnut idea worked swimmingly :D
I followed the recipe I linked in the question, with the following changes:

Obviously, I replaced one pound of mushrooms with one pound of chestnuts. In hindsight, that was probably a bit too much, as a pound of mushrooms would have cooked down significantly more, but we didn't mind.
In step 3, I omitted the horseradish, as I don't like it. I'm only reporting that for accuracy :)
I replaced step 4 entirely with the following: Chop all chestnuts in half, being careful as they have a tendency to fly apart. Boil the halves in a saucepan of water for 7 minutes. Drain and let cool, then peel -- this should now be a much easier task. Chop chestnut meats finely.

I should note that I accidentally boiled them too long, and they got a bit crumbly while I was peeling them. That didn't matter, because I was going to chop them. However, in the future I might try using a food processor to chop them, because I ended up with an uneven chop and the larger pieces stood out from the eventual mixture, making it harder to eat.

In step 5, I had to add more butter, as the chestnuts basically absorbed the entire amount of butter called for without actually sauteeing in it. Not that I minded :) I sauteed the chestnuts until soft, then added the shallots and thyme and proceeded as usual.
I omitted the foie gras, again, added only for accuracy. Kenji mentioned in the comments that it's not needed if you don't like it or can't find it, so I omitted to make the whole thing simpler.

The dish turned out utterly delicious :D I don't usually buy beef tenderloin, finding it usually lacking in flavor; since the goal of the dish was to add more interesting flavor and texture back, I definitely feel this was a success. I realized during the rolling step that I hadn't bought the exact right cut, so it kind of fell apart a bit during serving, but despite all the hard work and mistakes I'd definitely make this again.
Answer: I hate mushrooms too. The only time I ever made wellington, I simply put a mixture of onions and bacon and cheese in place of the mushroom layer. I first sprinkled parmesan cheese. Then I put a layer of finely chopped sauteed onions and then crumpled cooked bacon. It was fantastic and everyone there said it was the 'best thing they ever ate'. I realize this isn't really 'wellington' anymore. But let's face it. The only real reason anyone wants to eat it is because it's beef and puffed pastry! That's what's most important I think :)
Answer: I don't like mushrooms much either, I've made wellingtons with pate mostly, although I've experimented with chopped up brussel sprouts with some success as well. One thing I would like to try is yellow lentils but haven't had the opportunity.
You could still try mushrooms though if it's the texture your roommate doesn't like rather than the flavor. If it is texture then try making a rough paste out of mushroom and shallots rather than chopped up pieces. Or try shitakes instead.
Comment: Pate and onion would work well.
Answer: My husband also dislikes mushrooms. I substituted them for caramelized onions. Together with the pâté, it turned out quite well, though I agree that substituting the the mushrooms totally changes the character of the dish!
Answer: I have used haggis, and it worked a treat! The oats soaked up the juices and kept the pastry dry, and it complemented the beef wonderfully. The only thing I would say is ensure that you only make a thin layer as haggis can have quite a strong taste.
Answer: I've used both haggis and black pudding as an alternative to duxelle. Obviously they both change the nature of the dish and is a bit of a faff to prepare  (particularly the black pudding) but the combination of flavours is fantastic. As mentioned above, whether haggis or black pudding, it needs to be quite a thin layer so it doesn't completely overpower the beef.
Comment: I endorse the "thin layer" advice for the Wellington but only for black pudding with rough bits of cooking apple added otherwise the black pudding will fight it out with the pate part of the dish. I venture to suggest that haggis won't work save for upsetting the Scots!
Answer: I find olives tend to keep a similar texture to the mushrooms without bringing their disgusting earthy flavor to the dish :)
Comment: Olives tend to be as controversial as mushrooms however; that won't work for me either. But maybe someone else can try that one!
Comment: Ew. Instead of the lovely earthy flavor of mushrooms, you want to put in the disgusting petroleum-like flavor of olives. Ick.
Answer: I have a mushroom allergy so i can't make beef wellington with it. I was thinking about using caramelized onion or garlic and cheese (probably a sharp cheddar or brie) wrapped in bacon or prosciutto.
Comment: I doubt everyone who suggests substitutions has actually tried them in the specific recipe the OP is asking about; everyone extrapolates from experience. Let's not give someone a hard time just because they used the word "thinking".
Comment: If you were only *thinking about* why you post this an answer? You don't even know (yet) if this will be a good substitute.
Answer: Try sun dried tomatoe pesto on layers of thin slice prosciutto then roll on puff pastry for an Italian style Wellington

Mushroom replacement in Beef Wellington


What environment variables are set in .profile for OS X?

Question: I accidentally overwrote my .profile file and I believe deleted my environment variables. To be honest, I don't really understand how the operating system handles environment variables. My rough understanding is that there are configuration files like .profile which the operating system looks at, or runs, automatically and sets the environment variables that way. But how does the system know which config files to run? Are there default config files? Is .profile a default config file in OS X? If .profile is one of these default config files, is there a way for me to retrieve it or else the environment variables that it sets by default. What are the default values for .profile in OS X?
Comment: `.profile` is not a Bash file, exclusively. It is read by `sh` and possibly other shells as well.
Comment: Most of environment variables are not set by `.profile`. By default, that file does not even exist. Whatever problem you have, it is not because you have overwritten your `.profile`.
Answer: In your terminal that still has the variables write printenv > with_profile.txt. This will dump all available variables into with_profile.txt. Open a new terminal window and write printenv > without_profile.txt.
Start python and write:
with open("with_profile.txt") as w_profile, open("without_profile.txt") as wo_profile:
    w_profile_vars = {line.strip() for line in w_profile}
    wo_profile_vars = {line.strip() for line in wo_profile}
    for var in w_profile_vars - wo_profile_vars:
        print var

That should print the set of missing variables one by one.
P.S.
~/.profile is not there by default (not on Mavericks, Yosemite and El Capitan for sure). Hence it's possible that you overwrote nothing, unless you had created the file yourself a long ago.


How to change SQL sever configuration manager settings using TSQL?

Question: SQL server configuration manager is used to configure certain settings like connection protocols, service start up,  etc...
Is it possible to make these changes that is done in SQL server configuration manager by using TSQL statements, or in the SSMS?
Answer: Most settings that can't be done via sp_configure are registry based
So, you can use xp_instance_regread etc to change them. You'll have to find a list of registry keys yourself sorry but most are under HKLM\Software\Microsoft\Microsoft SQL Server
One examples , protocols is under
...
...(instancename)\MSSQLServer\SuperSocketNetLib\Tcp
...(instancename)\MSSQLServer\SuperSocketNetLib\Sm
...

and each of these has an Enabled value
One important note: you can stop SQL Server from xp_cmdshell or using SHUTDOWN but not start it of course...
Answer: Going to have to go with the good ol' "it depends on what you want to do"
You could use the xp_cmdshell or powershell to change or start some options. For example if you want to start your SQL agent do this:
xp_cmdshell 'net start sql server agent (instancename)'

If you want to change server protocols with powershell, check out - http://msdn.microsoft.com/en-us/library/dd206997.aspx
Powershell is like it says, powerful.
Comment: I was looking at scripting these changes so that I can distribute it to the users, rather than being physically in front of the user's computer. Thanks for the powershell link.
Comment: If you set up powershell right, you can ship the scripts to use a txt file for specific parameters. Have the user just give it a nice little clickly click click and bam, you'll have your settings set up.


WP can't create new directory

Question: Edit2: I'm renaming the question from "WP didn't add theme automatically" to "WP can't create new directory" because I found out that the problem is a little bit more complex. The same error is going on on any operation I do that involves writing data to /var/www/html/wordpress. I already tried what has been suggested here, tried also to gpasswd -a www-data sudo and nothing... I have no idea now what to do. /Edit2
I was just following this tutorial, I did exactly like he did from 02:30 to 03:30: added a folder in /wp-content/themes/mytheme, inside mytheme added a style.css and index.php. When I went to dashboard it wasn't added automatically so I tried to upload the theme.zip manually. Now I'm getting the error message "Could not create directory". I already set chmod -R 777 to wordpress folder but still having this
Edit:
Output of ls -la /var/www/html/wordpress:

lrwxrwxrwx 1 fabio www-data 20 Jan  4 16:45 /var/www/html/wordpress -> /usr/share/wordpress

Output of ls -ld /usr/share/wordpress:

drwxrwxrwx 5 www-data root 4096 Jan  8 15:46 /usr/share/wordpress

In my theme folder I got only index.php and style.css, that's how they are atm:
index.php:

Hello, world!

style.css:
/*
Theme Name: ThemeTutorial
Theme URI: http://github.com/FabioNevesRezende
Author: fabiotk
Author URI: http://github.com/FabioNevesRezende
Description: Descrição do tema
Version: 1.0
Tags: black, brown, orange, tan, white, yellow, light, one-column, two-columns, right-sidebar, flexible-width, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, translation-ready
Text Domain: twentythirteen

Este tema foi criado por Fábio Neves Rezende
*/

I put those github links just because I got no other link to put, I think this won't make any error, right?
Answer: Does your style.css file have something like this at the top, customized to your theme?
/*
Theme Name: ! Startups in Boston
Theme URI: http://bostonstartupsguide.com/
Author: Jay Neely
Author URI: http://socialstrategist.com
Description: Theme for BostonStartupsGuide.com. Initially built using Whiteboard Framework (http://whiteboardframework.com), redesigned using HTML 5 Boilerplate and inspired by 960.gs.
Version: 1.0
 */

WP can't create new directory


Hybrid functional calculations using different approach

Question: In hybrid functional such as B3LYP, PBE0, HSE etc, some part of HF exchange and/or correlation is added to some part of DFT X/C part in order to get better results. My question is if I am adding 1/4 th of HF exchange part that means I already calculated HF exchange part and HF is undoubtedly better than DFT, then why don't we just use the full HF solution that we already have in our hand?
Comment: HF is usually less accurate than DFT because it lacks electron correlation
Comment: I guess the theoretical reason is, the artificial system of KS is not the mean field. Hence, the exchange effect is not exactly the same as wave-function based schemes.
Answer:
In hybrid functional such as B3LYP, PBE0, HSE etc, some part of HF
  exchange and/or correlation is added to some part of DFT X/C part in
  order to get better results.

First, there is no correlation in HF, only exchange, so you can not add part of the HF correlation into DFT, as you said. In principle, of course, if you want to add not only exchange from the wave function theory (WFT) methods but also some correlation, you could use other that the HF sources, but the conventional hybrid DFT corresponds to mixing in just (a part of) the HF exchange.
Now, you very question of

why don't we just use the full HF solution that we already have in our
  hand?

is addressed in almost any textbook on DFT. I suggest that you read, for instance, Section 6.6 Hybrid Functionals in Koch & Holthausen, specifically, pages 78-80. The authors provide a relatively simple argument for for the well-known failure of the exact exchange/density functional
correlation combination approach.
In short, the source of the problem is that the separation of an exchange-correlation entity (would it be energy, or hole, or something else) into exchange and correlation contributions is artificial. Only the whole exchange-correlation entity has a physical meaning, while the above mentioned individual contribution are introduced just for convenience. Usually, it means that exchange and correlation contributions has to be chosen consistently so that their sum, an exchange-correlation entity, has some desired properties.
For instance, the exchange-correlation hole in molecular systems is usually relatively localized, so that the exchange hole and the correlation hole must both be either localized or delocalized (in a very special way so that combined they result in a localized hole). In LDA- and GGA-DFT both the exchange and the correlation hole are localized, but when we mix HF exchange and LDA/GGA-DFT correlation in the most straightforward way, i.e.,
$$
E_{\mathrm{XC}} = E_{\mathrm{X}}^{\mathrm{HF}} + E_{\mathrm{C}}^{\mathrm{DFT}} \, ,
$$
then, I quote:

We combine the exact, delocalized exchange hole with a localized model
  hole for correlation. Because the cancellation between the two
  individual holes cannot take place, the resulting total hole has the wrong characteristics.

1) Koch, W., & Holthausen, M. C. (2001). A Chemist's Guide to Density Functional Theory, Second Edition, Wiley-VCH Verlag GmbH.
Answer: As already noticed by Jan, Hartree-Fock is a poor theory, since it completely neglects correlation effects. DFT is in principle an exact theory but in practice its accuracy depends on the approximations and the self-interaction is not exactly cancelled as it is in Hartree-Fock theory. Both approximations have strengths and shortcomings and it is by combining them to some extent that we can obtain better results.
A striking example of why we don't use the whole Fock exact exchange in hybrid functionals is found in solid-state physics. Semilocal approximations (LDA and GGA) largely underestimate the band gap of semiconductors and insulators: this is known as the band gap problem of DFT. Hybrid functionals can be used to reproduce the experimental band gap by tuning the portion of exact exchange taken into account (1/4 is absolutely not a magic number and higher or lower mixing coefficients can and should be used). The portion of exact exchange needed to reproduce the experimental band gap depends on the system, but it is never 100%: this is because Hartree-Fock theory tends to overestimate the band gap.

[1] A. Alkauskas, P. Broqvist and A. Pasquarello, Phys. Status Solidi B, 248, No. 4, 775–789 (2011).


Creating a choice column (IF statement/display specific choices)

Question: I create an customize list. There are two choice columns and I want to achive the result is,
If column A select "aa" column B will only display some specific choices, such as "1.1 aaa" "1.2 bbb"
Same as above said if column A select other choice, column will show other specific choices.
How should I do? Is it possible to come true with the "Rule" feature by Infopath?
Thanks.
Answer: You could use Cascading Dropdown using jquery.SPServices. Download the library here, and save it to your site (for example, you could save it at /_catalogs/masterpage/js).
Assuming you have 3 lists:
List A has 2 fields: ID, NameA
List B has 3 fields: ID, NameB, AID (this is a lookup field to the list A item)
List C (here is the list who has 2 choice columns) has 3 fields: ID, TitleA (lookup to list A), TitleB (lookup to list B).
Then on your list C form (add / edit form), you could add the following code:
<code>// Refer to the library
<script src="/_catalogs/masterpage/js/jquery.SPServices-2014.02.min.js"></script>

// Start cascading dropdown code
<script type="text/javascript">
$(document).ready(function() {
    $().SPServices.SPCascadeDropdowns({
        relationshipList: "B", // The list who has reference to list A
        relationshipListParentColumn: "AID", // The 'foreign key' of the relationshipList
        relationshipListChildColumn: "NameB", // The value (anything you want to display) field of the relationshipList
        parentColumn: "TitleA", // The field on list C which refer to the list A (this is the first choice column)
        childColumn: "TitleB", // The field on list C which refer to the list B (this is the second choice column)
        debug: true
    });
});
</script>
</code>
Answer: The definition of what you are looking for is called 'cascading filters'.
It can be achieved in 2 ways, one of which with InfoPath.
Here is a video that explains very clearly.
your other option is to create a term set in the metadata/taxonomy term store where you have first level and second level terms. Unlike the InfoPath solution, in this case you will not have 2 different columns for your values but only one.
Comment: Thanks for your answer. I'm a rookie on sharepoint 2013. It's just what I want.


Can a sitting U.S. Senator run against the other sitting U.S. Senator in a state?

Question: I'm wondering, could a sitting U.S. Senator run against the other sitting U.S. Senator in that state?
Comment: I'm voting to close this question as off-topic because this should be on Politics.SE.
Comment: It's a legal question, but it also relates to politics.
Comment: @TimLymington: This is a legal question, not a political one, though its about the law governing who may run for political offices. Specifically, it is dealing with a peculiarity of the US legislature. In the lower chamber of Congress, the House of Representatives, there is one representative for each district, in the same way that there is one MP for each constituency in the House of Commons. However, in the upper house, two Senators are elected (for offset terms) to represent a collection of districts (which happens to be a semi-autonomous State).
Comment: It might be possible under the rules, but it would be pretty pointless, since the senator running for early reelection would preumably have to resign the other seat after winning, triggering a special election.  The only reason to do this would be if the senator seeking early reelection believed that his or her chances were significantly better than they would be in two or four years' time.
Comment: Or if the other senator were of the other party.
Answer: The only requirements are those specified in the Constitution, regarding age, citizenship and residence. Title 2 of the US Code has laws regarding elections governing timing of elections and soon, but nothing like a law saying "No sitting US Senator can run for the other senatorial position in his state". This article reviews aspects of congressional qualifications, and it is noted that the courts find that the constitutional qualifications are exclusive, meaning that there can't be such additional requirements. Therefore, convicted felons can be US Senators.


Can you get grace period of 30 days after expiration of office 365 account my license is Office 365 Enterprise E3?

Question: I am using Sharepoint online and have lots of data in it.So after 30 days will I get grace period if I don't want to buy license or I will have to create new account?
Answer: Exactly this way. The demo is for testing purpose only. But you can choose if you want to have licences for 12 months (which is a little bit cheaper) or for 1 month only. In doubt call your next CSP who can tell you the right price.


How are aeronautical procedures created in the US?

Question: In creating new procedures for an airport, does someone from the FAA go to an airport, examine all their information, and choose what kind of approach/departure (for example) will be created? Or do airport officials advise the FAA (chart creators)?
Comment: You don't mention where you are which is important as in most locations this is the responsibility of the governement (or its designated agency/contractor).  You might want to start with this FAA [Division](https://www.faa.gov/about/office_org/headquarters_offices/avs/offices/afs/afs400/afs420/) responsible for procedure development for the US.
Comment: Are you asking about commercial aviation, or general aviation?
Comment: things don't usually change unless it's to avoid dangerous situations, these are very often revealed by accidents.
Comment: The guidelines that they use to develop procedures are contained in FAA Order 8260.3C United States Standard for Terminal Instrument Procedures (TERPS)
Comment: I want to know the algorithm why procedures changes, and how they created, especially commercial
Answer:
does a worker go to an airport and monitors all information, and choose what kind of approach/departure (for example) will be? Or do airport workers advise regulators (charts creators)?

Yes. :)
Airport/airspace procedures are mainly created by a country's local aviation authority, so if you want an instrument approach to your private airstrip in the US you would contact AFS-420, the FAA's procedures branch, probably through someone at your local FSDO, and ask them to work with you to develop the procedure.
The Procedures people will survey the approach and design a procedure that makes sure you won't hit anything on the ground, and ensure that your procedure won't conflict with other existing procedures.
Once the procedure is designed they'll test-fly it - that's done by another group - and if everything checks out they'll publish charts for it.
Once published the FAA will periodically re-evaluate then procedure, both through flight checks and other feedback (if your new procedure is generating a lot of noise complaints for example the FAA will work with you to reduce the impact).


Terminology: writer's block

Question: Does the term "writer's block" refer to the condition in which the author not having anything to write, or has the material but unable to put it in words in the way he wants; or both?
Answer: In my opinion, it can be both - the clear indication is that the author has a desire and makes some effort to write - but can't.
This can be opposed to an author on a "sabbatical", who maybe thinks it's a nice idea to finish some of the works or start a new one, but makes no effort to do so. Procrastination, imho, is not a writer's block, however some people may think otherwise.
Answer: I'm 90% sure it means the first one, where you sit down to write, touch the pencil to the paper, and then you mind just goes blank. Sorry this is such a short answer, but I think that's about all there is to say.
Answer: I'd say it can be both, and that people using the term don't diiferentiate between the two meanings.

I'm not an author, but I do write software.  I've been doing that for a very long time.
I've had days where I would write the structure of some program or class or whatever, then just sit there and stare at it and want to puke because it looked just like what I did yesterday or the week before.  You want to get on to the interesting part of implementing new functions, and here's this pile of boiler plate that you have to slap down before you can get started.  It sits there, staring at you and daring you to do something new - and your mind just goes blank.  I have to find something else to work on for a while (fix a bug, or track down the cause of a problem somewhere) before I can face that screen full of mocking boiler plate again.
I'd imagine authors get the same thing, as well as having the other problem - the need to write to meet a deadline (or other reason,) and there's not a single damn idea or word to be had.

Another way I have of dealing with that screen full of mocking boiler plate is to not write it.  Scribble the interesting parts together first, then go back and pack them in the needed boiler plate junk so that you can use it.
Answer: It can mean either.  Therefore, it's unwise to merely speak of "writer's block" unless either meaning can apply, or it's clear which you mean.
Answer: It can be either of those, but it's usually the second one (the writer has the material, but is unable to put it into words in the way they want).

Terminology: writer's block


Editing gmail subject line when replying or forwarding

Question: I tried clicking on the drop-down arrow next to the reply arrow, as suggested in "Editing Subject in new Gmail", but "Edit Subject" is not among the choices.  Any other suggestions?
Comment: That's the way to do it and there's not another method within Gmail to use. Can you provide a screen shot?
Comment: See answer below but also, this video might be helpful:
https://youtu.be/zarFloHK-Is?t=66
Answer: The process changed slightly when Google redid their compose message process.
Under the new process, when you click reply it will open a mini window at the bottom of the message for your to compose your reply.  At the top of the composing area will be the address to which you are sending the message, and to the left of that will be a different "reply" arrow, with the following options:

Select Edit Subject here and it will change to the full compose window, rather than the mini "inline" version at the bottom of the message.  From the full compose window you can change the subject line before sending.
Comment: This is the same answer as given to the question the OP says doesn't work, so this isn't terribly helpful. (Although the OP hasn't come through with the asked-for extra information, either.)
Comment: It seems that she is asking about the menu in the **reply** button, but the option is not there.  The link she gave to the duplicate question *does* explain where to find it, but if you get hung up on the first part of the answer, you may be misled.  I definitely agree with your request for screenshot though, because otherwise I think this is just a bit of confusion rather than an actual problem.
Comment: There are two different such dropdowns. One At the top of the message which allows you to select the actions: Reply, Forward, Filter, Print, Delete, Report etc. The other is more in the middle (but at top of composing area as mentioned), and has the option to "Edit Subject". As mentioned it is to the Left of "Recipients". It is not obvious or easy to find among the multiple arrows and dropdowns you will see and it doesn't always appear as pictured above (depends on whether you are forwarding, replying etc)