Asymptotic behavior of the partial sums $\sum\limits_{k=1}^{n}k^{1/4} $

Question: What is the asymptotic behavior of the sequence:
\begin{equation}
s_n=\sum_{k=1}^{n}k^{1/4}
\end{equation}
when $n\to \infty$?
Comment: Are you familiar with [Riemann sums](http://en.wikipedia.org/wiki/Riemann_sum)? These yield immediately the equivalent $\frac45n^{5/4}$ (and even, much more precise inequalities).
Comment: Thank you. I've read the wikipedia link and now I think you mean something like this: looking at the interval $[0,n]$, subdivide it in $n$ subintervals. Then, $\sum^{n-1}k^{1/4}<\int_0^n x^{1/4} dx<\sum^n k^{1/4}$. The integral is just what you write. Is this correct? Can it be made more formal?  And how can you get even more precise inequalities? Thanks again
Comment: Pretty much. See answer.
Answer: Let $k\geqslant1$. Since the function $x\mapsto x^{1/4}$ is increasing, $(k-1)^{1/4}\leqslant x^{1/4}\leqslant k^{1/4}$ for every $k-1\leqslant x\leqslant k$. Integrating this double inequality yields
$$
(k-1)^{1/4}\leqslant\int_{k-1}^kx^{1/4}\mathrm dx\leqslant k^{1/4}.
$$
Summing these from $k=1$ to $k=n$ yields
$$
s_{n-1}=\sum_{k=0}^{n-1}k^{1/4}\leqslant\int_{0}^nx^{1/4}\mathrm dx\leqslant \sum_{k=1}^{n}k^{1/4}=s_n.
$$
Since the integral is $\tfrac45n^{5/4}$ and $s_{n-1}=s_n-n^{1/4}$, this yields, for every $n\geqslant1$,
$$
\tfrac45n^{5/4}\leqslant s_n\leqslant\tfrac45n^{5/4}+n^{1/4}.
$$
Note finally that $n^{1/4}=o(n^{5/4})$ hence a (much weakened) version of this is $s_n\sim\tfrac45n^{5/4}$.
Answer: Here is a diagram to accompany Did's fine answer:
Comment: How was the diagram made?
Comment: @lhf Using [JSXGraph](http://jsxgraph.org/).
Answer: There is a standard technique that produces the complete asymptotic expansion for this sum and many others like it, which is to use harmonic sums and Mellin transforms.
Introduce the telescoping sum $$S(x) = \sum_{k\ge 1} \left(\sqrt[4]{k}-\sqrt[4]{x+k}\right).$$
This sum has the property that $$S(n) = \sum_{q=1}^n \sqrt[4]{q},$$ so that $S(n)$ is the value we are looking for.
Re-write the sum as follows:
$$S(x) = \sum_{k\ge 1} \sqrt[4]{k} \left(1-\sqrt[4]{x/k+1}\right).$$
The sum term is harmonic and may be evaluated by inverting its Mellin transform.
Recall the harmonic sum identity
$$\mathfrak{M}\left(\sum_{k\ge 1} \lambda_k g(\mu_k x);s\right) =
\left(\sum_{k\ge 1} \frac{\lambda_k}{\mu_k^s} \right) g^*(s)$$
where $g^*(s)$ is the Mellin transform of $g(x).$
In the present case we have
$$\lambda_k = \sqrt[4]{k}, \quad \mu_k = \frac{1}{k} \quad \text{and} \quad
g(x) = 1 - \sqrt[4]{1+x}.$$
It follows that
$$\sum_{k\ge 1} \frac{\lambda_k}{\mu_k^s} =
\sum_{k\ge 1} \sqrt[4]{k}\times k^s
= \zeta(-1/4-s)$$
which has fundamental strip $-1/4-s > 1$ or $s < -5/4.$
We need the Mellin transform $g^*(s)$ of $g(x)$ which is
$$\int_0^\infty \left(1 - \sqrt[4]{1+x}\right) x^{s-1} dx$$
which is immediately seen to be a beta function integral with value
$$g^*(s) = - \frac{1}{\Gamma(-1/4)} \Gamma(s)\Gamma(-1/4-s)$$
and fundamental strip $\langle -1, -1/4 \rangle,$ which is a problem, because the abscissa of convergence of the zeta function term lies outside this strip. Hence we need to shift $g^*(s)$ by using $$ g(x) = 1 + \frac{1}{4} x - \sqrt[4]{1+x}$$
with fundamental strip $\langle -2, -1 \rangle,$ which is good.
We have now added the following quantity to our sum:
$$\sum_{k\ge 1} \sqrt[4]{k} \frac{1}{4} \frac{x}{k}
= \frac{1}{4} x \zeta(3/4),$$
which we will have to remember to subtract from our final answer.
It follows that the Mellin transform $Q(s)$ of the harmonic sum $S(x)$ is given by
$$Q(s) =
- \frac{1}{\Gamma(-1/4)} \Gamma(s)\Gamma(-1/4-s)
\zeta(-1/4-s).$$
The Mellin inversion integral here is
$$\frac{1}{2\pi i} \int_{-3/2-i\infty}^{-3/2+i\infty} Q(s)/x^s ds$$
which we evaluate by shifting it to the right for an expansion at infinity.
First treat the pole from the zeta function term at $s=-5/4$, which has
$$\mathrm{Res}(Q(s)/x^s; s=-5/4) =
-\frac{1}{\Gamma(-1/4)} \Gamma(-5/4)\Gamma(1)\times -1 \times x^{5/4}
= -\frac{4}{5} x^{5/4}.$$
For the pole at $s=-1$ we get
$$\mathrm{Res}(Q(s)/x^s; s=-1) = -\frac{1}{4}\zeta(3/4)x.$$
We see that this is precisely the contribution that we added in when we shifted $g^*(s)$ into position and hence this residue will not be included in the asymptotic expansion.
For the pole at $s=-1/4$ from the compound gamma function term we obtain
$$\mathrm{Res}(Q(s)/x^s; s=-1/4) =
 -\frac{1}{\Gamma(-1/4)} \Gamma(-1/4) \times -1 \times\zeta(0)
= -\frac{1}{2} \sqrt[4]{x}.$$
For the pole at $s=0$ from the simple gamma function term we obtain
$$\mathrm{Res}(Q(s)/x^s; s=0) = -\frac{1}{\Gamma(-1/4)} \Gamma(-1/4) \zeta(-1/4)
= -\zeta(-1/4).$$
The remaining poles are at $s = q-1/4$ where $q\ge 1$ and contribute
$$\mathrm{Res}(Q(s)/x^s; s=q-1/4) =
-\frac{1}{\Gamma(-1/4)} \Gamma(q-1/4) \frac{(-1)^{q+1}}{q!} \zeta(-q) \frac{1}{x^{q-1/4}}
\\ = - \prod_{p=0}^{q-1} (p-1/4) \times
 \frac{(-1)^{q+1}}{q!} (-1)^q \frac{B_{q+1}}{q+1}  \frac{1}{x^{q-1/4}}
= \frac{1}{4^q} B_{q+1}
\frac{\prod_{p=0}^{q-1} (4p-1)}{(q+1)!}  \frac{1}{x^{q-1/4}}.$$
The zero values of the Bernoulli numbers correctly represent cancelation of the gamma function poles by the trivial zeros of the zeta function.
Setting $x=n$ and observing that the shift to the right produces a minus sign we obtain the following asymptotic expansion:
$$S(n) = \sum_{k=1}^n \sqrt[4]{k} \sim
\frac{4}{5} n^{5/4} + \frac{1}{2} \sqrt[4]{n} + \zeta(-1/4)
- \sum_{q\ge 1} \frac{1}{4^q} B_{q+1}
\frac{\prod_{p=0}^{q-1} (4p-1)}{(q+1)!}  \frac{1}{n^{q-1/4}}.$$
Actually computing the Bernoulli number terms we get the expansion
$$\frac{4}{5} n^{5/4} + \frac{1}{2} \sqrt[4]{n} + \zeta(-1/4) +
1/48\,{n}^{-3/4}-{\frac {7}{15360}}\,{n}^{-11/4}+{\frac {11}{98304}}\,
{n}^{-{\frac {19}{4}}}\\-{\frac {4807}{62914560}}\,{n}^{-{\frac {27}{4}}
}+{\frac {13547}{134217728}}\,{n}^{-{\frac {35}{4}}}-{\frac {9360977}{
42949672960}}\,{n}^{-{\frac {43}{4}}}\\+{\frac {191649409}{274877906944}
}\,{n}^{-{\frac {51}{4}}}-{\frac {1089307862269}{351843720888320}}\,{n
}^{-{\frac {59}{4}}} +\cdots.$$
This MSE link points to a series of similar calculations.

Care must be taken with the asymptotics of these expansions since the Bernoulli numbers eventually outgrow all other terms. For example when $n=10$ the sum of the first $62$ [Bernoulli terms](https://math.stackexchange.com/questions/783492/) converge to produce thirty digits of precision and diverge from then on. These expansions fit the definition however, where we say that an asymptotic sequence $\{\phi_k(n)\}$ has
$$|\phi_{k+1}(n)/\phi_k(n)|\rightarrow 0$$ as $n\rightarrow\infty$ and
$$\lim_{n\rightarrow\infty}\frac{|S(n)-\sum_{k=1}^m\phi_k(n)|}{\phi_m(n)}=0.$$
There is a generalized version where we compute $\sum_{j=1}^{n-1} j^a$ at the following MSE link.
Comment: I recommend looking into Euler-Maclaurin summation, which provides a general technique to find such asymptotic expansions.
Comment: I agree that Euler-MacLaurin is more general, what I meant was to present the trick with the telescoping sum which is also used at this [MSE link](http://math.stackexchange.com/questions/79115/limit-lim-limits-n-rightarrow-infty-left2-sqrt-n-sum-limits-k-1n-frac/670202#670202). I believe it deserves being presented, I myself learned it from a Flajolet paper and I suppose it is somewhere in the Flajolet / Sedgewick book as well. I hope the above was a competent presentation.
Comment: The precise reference for the telescoping sum is page 40 "Chapter 7 Mellin Transform Asymptotics" by Flajolet / Sedgewick, INRIA Rapport de recherche 2956 (1996).
Comment: This sum also appears as example B.28 on page 766 of the internet edition of the Flajolet / Sedgewick book.
Comment: I've been looking at Flajolet and some of your expositions; I cannot quite find a firm statement on this: (Apparently) For real $0 < \sigma < 1,$ we have
$$ \zeta(\sigma) \; \; = \; \; \lim_{n \rightarrow \infty} \; \; \left( \sum_{k=1}^n \frac{1}{k^\sigma}   \right) - \frac{n^{1-\sigma}}{1-\sigma}  $$ example
$$ \lim_{n \rightarrow \infty} \; \; \left( \sum_{k=1}^n \frac{1}{\sqrt[3] k}   \right) - \frac{3 n^{2/3}}{2} - \frac{1}{2 \sqrt[3] n} + \frac{1}{36 n^{4/3}} \; \; = \; \; \zeta \left(\frac{1}{3}\right) \approx -0.973360248350782  $$
Comment: Thank you for the  comment. I replied to your follow-up question at the [MSE link](https://math.stackexchange.com/questions/2597478/).
Answer: Euler McLaurin Summation yields:
$$\sum_{k=0}^{n} k^{1/4} = \frac{4}{5} n^{5/4} + \frac{1}{2} n^{1/4} + C + \mathcal{O}(n^{-3/4})$$
It can be shown that $C = \zeta(-1/4)$ where $\zeta$ is the Riemann-Zeta function as defined on the whole plane.
Note that this is a much stronger statement than $\sum_{k=0}^{n}k^{1/4} \sim \frac{4}{5} n^{5/4}$, which (in the current context) means that
$$\lim_{n \to \infty} \frac{\sum_{k=0}^{n}k^{1/4}}{\frac{4}{5} n^{5/4}} = 1$$
What Euler Mclaurin gives us is the following:
$$\lim_{n \to \infty} \sum_{k=0}^{n}k^{1/4}-  \frac{4}{5} n^{5/4} - \frac{1}{2} n^{1/4} - C = 0 $$
Which actually implies that
$$\lim_{n \to \infty} \sum_{k=0}^{n}k^{1/4}-  \frac{4}{5} n^{5/4} = \infty$$
There is also an elementary proof of this fact (but which does not determine the exact value of $C$) here: How closely can we estimate $\sum_{i=0}^n \sqrt{i}$


Difference between "worst way possible" and "worst possible way"

Question: What is the difference between these two phrases?

worst way possible
worst possible way
Comment: Semantically, there is no difference. The only difference is syntactic.
Comment: They may be used differently according to the position in the sentence. Please give some complete sentences for context.
Comment: Sentences like "She has done it in worst (possible) way (possible).
Answer: The "worst possible way" describes the intensity of the desire.
The "worst way possible" describes the undesirability of the 'way'. For example:
"He wants chocolate ice cream in the worst possible way."
(He really, really, wants chocolate ice cream.)
"He wants chocolate ice cream in the worst way possible."
(He may want a chocolate ice cream enema - you probably don't want to stick around to find out.)
Answer:
"She has done it in the worst (possible) way (possible).

@user129054 -  In your comment under the question, you give the above sentence as context (note I have added the definite article). In that case I would use:
"She has done it in the worst possible way."
Either version is grammatically correct. However my reason is that, to my ear, it sounds better. I emphasise "to my ear" because it is a matter of the rhythm of the sentence. I don't know how to show musical notation here so I can't demonstrate it that way. I can only say that 'possible' consists of three rapid syllables with emphasis on the first.
Perhaps it is the musician in me but it sounds better rhythmically as "worst possible way".
Note: I expect some criticism for this answer but that's the way I feel.


Upgrading Windows Vista 32 bit to 64 bit Windows Server

Question: I am planning on upgrading Windows Vista Home Premium 32 bit to Windows Server 2008 Standard 64-bit (I have a quad core cpu which supports 64 bit and I have 4gb memory so can't see all of it at the moment).
My concern is, some of the development software I have (like those made by the smaller vendors) will not work in this new environment.
The consensus is that my existing apps will work as long as they are 32 bit and not 16 bit, but how can I find out whether they are 32 or 16 bit? I don't want to email each vendor. What are my options if they are 16 bit - host in terminal services?
Thanks
Answer: Almost all software written in the last 10 years is 32-bit (or greater) - I would say "all", but I've learned not to do this on SuperUser.  I wouldn't worry too much about this if you have purchased your development software in this decade.
If not, you can always host your 16 bit software within a virtual machine.
Answer: You can find out whether an application is 16 bit in various ways:

Look at them.

If they don't use visual styles it might be, but many 32-bit applications also do not.
If the console window resizes itself to 80×25 (indicates command.com starting) then it's definitely one.

Look elsewhere

The task manager will have a process named ntvdm running. This is the Windows NT Virtual DOS Machine, i. e. a host process for 16-bit legacy stuff.
Do file open dialogs look like the "Add fonts" dialog in older versions of Windows? Do they only show 8.3 file names?

There are a few ways. Looking for ntvdm is the most reliable one.
That being said, there aren't many 16-bit applications still in use. At least not outside very specialized areas.
Answer: If I was you, I would just go with the upgrade and simply run any old program in Virtual PC or another virtualisation program
Answer: Straight from Microsoft:

Learn How to Spot a 16-Bit Application
Because most Windows 3.x–based
  programs run properly under Windows
  XP, it's sometimes difficult to tell
  16-bit and 32-bit applications apart.
Here are two methods for determining
  whether an application is 16-bit or
  32-bit: •
Right-click the program's executable
  file and then choose Properties. If
  you see a Version tab, it's a 32-bit
  program. •
Or, if the program is running, press
  Ctrl+Shift+Esc to open the Windows
  Task Manager. On the Processes tab,
  look in the Image Name column for the
  name of the program's executable file.
  If any 16-bit programs are running,
  you'll find an entry for Ntvdm.exe,
  the virtual DOS machine. Just above it
  in the list, you'll see indented
  entries for Wowexec.exe (the Windows
  on Windows subsystem) and the
  executable name of each 16-bit program
  running in that virtual machine.


What is `sparse sandbox` and `shared sandbox` in MKS Integrity

Question: What do Make Sandbox Sparse and Make Sandbox Shared mean in MKS Integrity?
Answer: Sparse: The sandbox-directory contains only the files not in sync with the repository. Resynchronise a sparse sandbox deletes all files from the directory that are in sync. (while resynchronising a non-sparse directory will cause the check out of all member-revisions)
Share: You can share this sandbox with other MKS-users. They can import the same sandbox and work on it (check-in, check-out).
You may change both settings in the Sandbox Information window of the (topmost) sandbox by (un)checking the check-box "Sparse" resp. "Shared". Doing so does not change any of your working files, just the behaviuor of some operations (e.g check-in)
Answer: Sparse - if you do not want the Sandbox to retain working files when a member is checked in. A Sandbox is sparse if it has no working files. A sparse Sandbox does not retain working files when a member is checked in, and continues to function this way throughout its use; however, once created,Sandbox directories and sub Sandboxes remain in the Sandbox.
Shared - if you want multiple users to have access to the working files in the Sandbox.


FFT method input argument have to be $2^n$ ?

Question: Does FFT method input argument have to be power of 2, i.e, $2^n$
I just realized there are many algorithm for FFT implementation, is there any algorithm that takes arbitrary amount of samples as input argument?
if yes, what is their advantages amongst each other?
namely, what algorithm does Matlab apply?
Answer: It is a common misconception that all FFT algorithms require their inputs to have a length that is a power of 2. The radix-2 Cooley-Tukey algorithm, the first to be widely known, has this limitation, but there are mixed-radix versions of the algorithm that don't require a power-of-2-sized input. In addition to Cooley-Tukey, there are a number of other FFT algorithms that have differing requirements on their input size; there are even techniques like Rader's algorithm that work on inputs whose sizes are prime.
Good, general purpose FFT implementations like MATLAB's fft() or FFTW support a wide range of algorithms and select one that is most appropriate for the specific situation. For more details on the specifics, go to the MATLAB documentation itself:
> doc fft

Algorithms
The FFT functions (fft, fft2, fftn, ifft, ifft2, ifftn) are based on a
  library called FFTW [3],[4]. To compute an N-point DFT when N is
  composite (that is, when N = N1N2), the FFTW library decomposes the
  problem using the Cooley-Tukey algorithm [1], which first computes N1
  transforms of size N2, and then computes N2 transforms of size N1. The
  decomposition is applied recursively to both the N1- and N2-point DFTs
  until the problem can be solved using one of several machine-generated
  fixed-size "codelets." The codelets in turn use several algorithms in
  combination, including a variation of Cooley-Tukey [5], a prime factor
  algorithm [6], and a split-radix algorithm [2]. The particular
  factorization of N is chosen heuristically.
When N is a prime number, the FFTW library first decomposes an N-point
  problem into three (N – 1)-point problems using Rader's algorithm [7].
  It then uses the Cooley-Tukey decomposition described above to compute
  the (N – 1)-point DFTs.
For most N, real-input DFTs require roughly half the computation time
  of complex-input DFTs. However, when N has large prime factors, there
  is little or no speed difference.
The execution time for fft depends on the length of the transform. It
  is fastest for powers of two. It is almost as fast for lengths that
  have only small prime factors. It is typically several times slower
  for lengths that are prime or which have large prime factors.

Note   You might be able to increase the speed of fft using the
    utility function fftw, which controls the optimization of the
    algorithm used to compute an FFT of a particular size and dimension.

References
[1] Cooley, J. W. and J. W. Tukey, "An Algorithm for the Machine
  Computation of the Complex Fourier Series,"Mathematics of Computation,
  Vol. 19, April 1965, pp. 297-301.
[2] Duhamel, P. and M. Vetterli, "Fast Fourier Transforms: A Tutorial
  Review and a State of the Art," Signal Processing, Vol. 19, April
  1990, pp. 259-299.
[3] FFTW (http://www.fftw.org)
[4] Frigo, M. and S. G. Johnson, "FFTW: An Adaptive Software
  Architecture for the FFT,"Proceedings of the International Conference
  on Acoustics, Speech, and Signal Processing, Vol. 3, 1998, pp.
  1381-1384.
[5] Oppenheim, A. V. and R. W. Schafer, Discrete-Time Signal
  Processing, Prentice-Hall, 1989, p. 611.
[6] Oppenheim, A. V. and R. W. Schafer, Discrete-Time Signal
  Processing, Prentice-Hall, 1989, p. 619.
[7] Rader, C. M., "Discrete Fourier Transforms when the Number of Data
  Samples Is Prime," Proceedings of the IEEE, Vol. 56, June 1968, pp.
  1107-1108.
Comment: Tnx @jason-r do they all have the same time complexity?
Answer: The simplest FFT to explain in a short text book chapter recursively factors a DFT length by 2,  log2(N) times, thus only seems to work for lengths that are powers of 2.  But you don't have to recursively divide-and-conquer all the way down to the last 2 elements, and you can also use the same basic algorithm to divide the length by other small factors, such as 3 or 5, etc.  Thus, the "time" (actually number of arithmetic ops) complexity for any length that can be decomposed into mostly a lot of tiny prime factors is roughly the same.
There are also other methods for larger prime factors that require longer textbook chapters.
Thus, most advanced modern FFT libraries (FFTW, Accelerate/vDSP, etc.) can handle lot of lengths other than powers of 2.  Anyway, the actual order of execution time performance on modern processors is more due to data cache and instruction scheduling issues than just the number of arithmetic operations, so lots of other things have to done to compute a Fast DFT equivalent, not just radix-2 reduction.  Matlab uses one of these modern libraries.
But many simple canonical-looking (student exercise, minimal lines of code, etc.) FFTs only use the short textbook chapter methods for lengths that are powers of 2 (and ignore CPU cache, etc. issues).  These short FFTs were also useful on older or tiny processors with very limited instruction memory.  Thus the common misconception.
Answer: The basic idea of most "FFT" algorithms is to decompose the DFT of a non-prime length N = KM sequence into M DFTs of length K sequences and K DFTs of length M sequences, interconnected with N complex "twiddle factor" multiplications.
Since the multiplicative complexity of the direct realization is N^2 and the resulting complexity is MK^2 + KM^2 + N = N(K + M + 1) there will be savings as N > K + M + 1. Now, K and M can possibly be decomposed again and so on. If not, the DFT is evaluated straightforwardly (which for length 2 is really simple).
If N is prime there are other methods, Bluestein, Rader etc.
If M and K are coprime one can avoid the twiddle factor multiplications at the expense of a bit more complicated ordering of the sequences.
For short (but longer than two) lengths, there are more efficient methods in terms of multiplications than direct evaluation such that the Winograd short length DFT.
There are "split-radix" FFT algorithms, which divides the length into more than two parts. This is the case for FFTW, which splits the sequence in lengths N/2, N/4, and N/4.


Sci-fi novel: object found in solar system goes into FTL, to galactic zoo

Question: Trying to find this novel I've read a few years back. The story revolves around humans exploring an object entering the solar system only to be stranded on it as it goes into FTL. They adapt and flourish only to later find out that they were brought into a sort of galactic zoo where all other alien races are kept. These humans later find out about their legacy and because of relativity, the home they left behind has evolved into a highly advanced society with nanotechnology only to find out that the human race was already extinct but not before they launched millions of probes that will unlock all of that advanced technology when it comes into contact with the genetic marker of the descendants of the protagonist in the story. Any ideas?
Comment: Certain aspects of that sound like the [Rama series](http://en.wikipedia.org/wiki/Rendezvous_with_Rama#Books_in_the_series) by Arthur C. Clarke.  It's been too long and I never read far enough to say how closely it tracks, though.
Answer: Sounds like "Pushing Ice" by Alastair Reynolds, except that the object did not suddenly enter the solar system - instead is was there all along in the disguise of Saturns moon Janus.
The book start with advanced humanities plan to send out the probes as anniversary celebration of the event that started civilization as they know it; they decide the best way to celebrate is to help the "benefactor" Bella Lind (the captain of the ship that was sent out to chase Janus) by sending their combined knowledge after her (Lind and her crew are supposedly still alive due to relativistic effect/time dilation).
Comment: No it's neither Pushing Ice nor one of the Rama books; I've read both books though, good ones too.
Comment: @nOy Seriously? Are you sure? Every point of your description perfectly matches Pushing Ice, with the exception that the object only went close to light speed, it didn't hit FTL.
Comment: There is zero chance this is not Pushing Ice.
Answer: Eon by Greg Bear?
Giant asteroid appears around the Earth, has interesting physics inside.
Comment: The plot of *Eon* has almost nothing in common with the description in the question.
Comment: Does it have something like a gâteaux zoo?
Comment: Could you also expand on this a bit more for how it matches?
Answer: Sorry to not positively nail the correct answer but this sounds like one of Frederik Pohl's Heechee novels.
Hopefully this will be the firefly that illuminates the light switch for you.
Comment: Out of the 5 novels and literally dozens of smaller stories, can you pin it down further?
Comment: Flagged as NaA (in the 'should rather be a comment' sense) since it appears to point towards a direction (by providing an author and a -wide- series), but does not specify a particular title which would fit the question.


Transferring from a Samsung Galaxy to a Mac

Question: Is it ok to connect a Samsung Galaxy to a Mac for transferring photos?
I'm not sure if it is ok to do this with two different brands.
Answer: A good wireless method that I use between Android and Mac is Soduto with KdeConnect.
Both are open source apps.
You can find Soduto for Mac here https://soduto.com/
You can find KDEConnect for Android here https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp&hl=en_IN&gl=US
Now install these and make sure they are on the same Wifi network. Then Pair the two devices (using Soduto on mac to pair with Android through KDEConnect).
Pairing is necessary only once, and you can transfer files and even your Clipboard history across the two devices anytime you want without the hassle of connecting wires!!
Answer: Zero problem. Just use the USB cable and transfer the files, or go by bluetooth if you have the time. Both work flawless. Airdrop also works if you want to use an app and transfer over wlan. If you use the USB cable, you will get a lot of mac files on your Galaxy's SD card file system, like a file called ".DS_Store" in each folder. This doesn't hurt, but you might want to remove them or wonder where they came from.
Answer: Yes it is fine. You can use whatever software you want to do the transfer.
Comment: Fantastic, will get straight on it. Appreciate the prompt advice!
Answer: I also have a galaxy and a mac, and it doesn't work for me. I'd recommend this mimic of airdrop, called Airdroid. Very straightforward. You go to  http://web.airdroid.com/ then install the app on your galaxy, scan a QR code displayed on the website then transfer whatever. Logins optional, whole process takes 2-3 minutes each time.


What happens to scattered light when intensity of light increases?

Question: Does increasing the intensity of the incident light increase the proportion of the light that is scattered?
Comment: Do you mean: *does increasing the intensity of the incident light change the percentage of the light that is scattered?*
Comment: @JohnRennie: Yes.
Answer: In most situations we are familiar with when it comes to light in everyday life, the interaction with light and matter is linear with respect to the electromagnetic field. This means that if you have a material that scatters 50% of a beam of light, then a 2mW beam will scatter 1mW or a 100mW will scatter 50mW etc… In these normal everyday situations, increasing the intensity of the incident light does not increase the proportion of the light that is scattered.
However, if the intensity of the light is great enough (such as at the focus of an ultra-short pulsed laser beam), then the light will no longer interact with matter in a linear way. This situation is known as nonlinear optics. In this situation the light is intense enough that the material itself temporarily changes, and this change causes the light to interact differently with the material. In these situations, the scattering does depend on the intensity of the light. This effect is used all the time in fields such as microscopy and spectroscopy. For instance, nonlinear processes are used to greatly increase (by many orders of magnitude) the amount of Raman scattering in a process known as Coherent anti-Stokes Raman spectroscopy or "CARS".
Answer: Think of a mirror and you shine a bright light in it after enough photons are increased hitting and scattering off the surface it is also getting hotter. There is a range where  metal stops reflecting and begins absorbing the photons more generating heat and glows. The colder the atom the better the scatter.
Comment: The question is whether the proportion of the scattered light increases when the intensity of incoming light increases. In other words whether a higher % of incoming light gets scattered if the intensity of incoming light increase. I don't see how your answer deals with answering the question neither in the general case nor in case of Sun-sky.
Comment: Hey @Jen, Nice job thinking carefully about this issue. The down votes you'be gotten are a bit unfair (to compensate I up-voted your answer). You are absolutely correct, if you have enough light or energy, the thing scattering the light will change, and when it changes the properties (such as how it scatters) will also change.
This can happen in a permanent way (such as an object heating up and melting), but it can also happen temporarily (even almost instantaneously so). E.g. see my answer to see how something called "nonlinear optics" can temporarily change the material (& the scattering).
Comment: What about the light coming from the Sun that gets scattered thru the sky?
Comment: Think of all molecules has a level of transparency. What light isn't absorbed by the ground and air gets reflected back into space. If the sun gets to hot the atmosphere would ignite and burn off.
Comment: http://physics.stackexchange.com/questions/9523/far-field-intensity-from-scattering-of-small-particles?rq=1


Forward function and variables into sudo su -  <<EOF

Question: I have declared functions and variables in bash/ksh and I need to forward them into sudo su - {user} << EOF:
#!/bin/bash

log_f() {
echo "LOG line: $@"
}

extVAR="yourName"

sudo su - <user> << EOF
  intVAR=$(date)
  log_f ${intVAR} ${extVAR}
EOF

Answer: sudo su -, which is a complicated way of writing sudo -i, constructs a pristine environment. That's the point of a login shell. Even a plain sudo removes most variables from the environment. Furthermore sudo is an external command; there's no way to elevate privileges in the shell script itself, only to run an external program (sudo) with extra privileges, and that means any shell variables (i.e. non-exported variables) and functions defined in the parent shell won't be available in the child shell.
You can pass environment variables through by not invoking a login shell (sudo bash instead of sudo su - or sudo -i) and configuring sudo to let these variables through (with Defaults !env_reset or Defaults env_keep=… in the sudoers file). This won't help you for functions (although bash has a function export facility, sudo blocks it).
The normal way to get your functions in the child shell would be to define them there. Take care of quoting: if you use <<EOF for the here document, the content of the here document is first expanded by the parent shell, and the result of that expansion becomes the script that the child shell sees. That is, if you write
sudo -u "$target_user" -i <<EOF
echo "$(whoami)"
EOF

this displays the name of the original user, not the target user. To avoid this first phase of expansion, quote the here document marker after the << operator:
sudo -u "$target_user" -i <<'EOF'
echo "$(whoami)"
EOF

So if you don't need to pass data from the parent shell to the child shell, you can use a quoted here document:
#!/bin/bash
sudo -u "$target_user" -i  <<'EOF'
log_f() {
echo "LOG line: $@"
}
intVAR=$(date)
log_f "${intVAR}"
EOF

While you can make use of an unquoted here document marker to pass data from the parent shell to the child shell, this only works if the data doesn't contain any special character. That's because in a script like
sudo -u "$target_user" -i <<EOF
echo "$(whoami)"
EOF

the output of whoami becomes a bit of shell code, not a string. For example, if the whoami command returned "; rm -rf /; "true then the child shell would execute the command echo ""; rm -rf /; "true".
If you need to pass data from the parent shell, a simple way is to pass it as arguments. Invoke the child shell explicitly and pass it positional parameters:
#!/bin/bash
extVAR="yourName"
sudo -u "$target_user" -i sh  _ "$extVAR" <<'EOF'
  log_f() {
  echo "LOG line: $@"
  }
  intVAR=$(date)
  log_f "${intVAR}" "${1}"
EOF

If you have multiple variables to pass, it will be more readable to pass them by name. Call env explicitly to set environment variables for the child shell.
#!/bin/bash
extVAR="yourName"
sudo -u "$target_user" -i env extVAR="$extVAR" sh <<'EOF'
  log_f() {
  echo "LOG line: $@"
  }
  intVAR=$(date)
  log_f "${intVAR}" "${1}"
EOF

Note that if you expected /etc/profile and the target user's ~/.profile to be read, you'll have to read them explicitly, or call bash --login instead of sh.
Answer: This doesn't work because the function log_f is not declared in the sudo su - shell you launch. Instead:
extVAR="yourName"

sudo su - <user> << EOF

log_f() {
echo "LOG line: $@"
}

  intVAR=$(date)
  log_f ${intVAR} ${extVAR}
EOF

You need to get the function defined in the root subshell. That might do it, but.... I don't know what most of that stuff does. At least - so long as neither sudo nor su needs stdin to read a password - that should get log_f() declared.
I trust that you mean to expand those values into the root shell's input, by the way. If you do not mean to do so then you should quote EOF and the vars themselves.
Answer: In my case I needed to pass an array in and had some trouble, but had success after a while by echoing the array's values to an env-key and wrapping the intended code in bash -c '<intended code>', and basically have it recreating the array, eg.:INNER_KEY=($<env_key>).
For examlpe:
#!/usr/bin/env bash
PLUGINS=(foo bar baz)
sudo -u <some-user> -i env PLUGINS="`echo ${PLUGINS[@]}`" sh <<'EOF'
  bash -c '
    FOO=($PLUGINS);
    echo values: \[${FOO[@]}\];

    for pl in ${FOO[@]};
      do echo value: $pl;
    done;
  '
EOF

The problem was that I could not directly do something like the following (not using bash -c '...'):
FOO=($PLUGINS);
for pl in ${FOO[@]};
...


What is the need for angular magnification

Question: We've been told that angular magnification is defined as the ratio of the angle subtended by the image to the angle subtended by the object. But why would we need a quantity called angular magnification? Won't the simple magnification formula do?
Comment: I'm no specialist here, but I think it would be of no use stating the linear magnification of a telescope, but it means something if it magnifies 20' of sky to 20º after the lenses, for example.
Answer: The angle subtended by an object is called the visual angle and it determines the size of the image formed on the retina.

When you look at the Moon with the naked eye it subtends an angle of about $0.5 ^\circ$.
When looking through a pair of binoculars the angle subtended by the image of the Moon might be $5^\circ$.
The angular magnification is $\dfrac{5}{0.5}=10$
What does that mean?
It means that the image of the Moon formed on the retina of the eye when looking through binoculars is ten times bigger than the image formed on the retina when the Moon is  looked at directly.
So the Moon appears to be bigger.
In such a context the idea of linear magnification would not be useful because the size of the image of the Moon formed by the binoculars is not ten times the actual size of the Moon.
Answer: Linear magnification is only useable in situations where lenses produce real images such as projection onto a screen. Optical instruments with eyepieces such as microscopes produce virtual images whose linear dimensions cannot be measured. Therefore, with these devices, angular magnification is used.
Read more: https://en.m.wikipedia.org/wiki/Magnification


Professions For A Society

Question: I've been working on building a society for my story, but I've run into what I consider to be a significant problem. What are the different professions required to maintain a society of a technological level of ~1800? How much demand is there for these professions compared to each other? (Such as you need X amount of farmers as opposed to X amount of blacksmiths.)
Comment: Dwarf fortress seems like it was made to answer this question, but if dwarf fortress taught me anything it's that playing dwarf fortress is not right the answer to anything.
Comment: More specifics: what is the economic basis of this society?  One might need more fishermen in 1801 Massachusetts than 1801 Pittsburgh.
Answer: Roughly, at around 1800, for a moderately fertile country such as England, you would need:

20% of the population in agriculture (farmers and their families).
25% of the population engaged in various manufacturing jobs or families of men engaged in manufacturing jobs (including blacksmiths, shoemakers, tailors, carpenters and also factory workers making thread, cloth, iron, bronze, machinery, glass etc.)
15% of the population in domestic service (if we include women servants; keeping house was hard work before washing machines, vacuum cleaners, microwave ovens and fast-food restaurants).
10% of the population engaged in commerce (retail shops were all the rage, there were very few large department shops and there were no nation-wide chains such as Wallmart or Carrefour).
5% day labourers (10% with their wives and children).
6% of the population would have independent financial means of be members of the families of financially independent men. Those are the people who engage in politics, run for members of parliament, pursue scientific research and so on.
All other occupations and professions would be rare. There are very few civil servants, social workers, soldiers, sailors, lawyers, doctors etc.

For real numbers you cannot beat A Vision of Britain, which offers (among other delicious treats) synthetic tables extracted from the historical census returns. For example, for the 1841 census (numbers for England and Wales, occasionally rounded):

16.5% percent of the population were engaged in commerce, trade, and manufacture.
7.9% percent of the population were engaged in agriculture, of which:

20% were farmers and graziers.
76% were agricultural labourers.
4% were gardeners, nurserymen and florists.

4.2% were labourers.
0.3% were military (meaning land forces) and 0.6% were naval. If Scotland is included, those numers climb to 0.7% land forces and 1.2% naval.
0.3% were professional persons (that is, engaged in liberal professions, such as medical doctors, lawyers, professors, or architects).
0.8% were other educated persons following miscellaneous pursuits.
0.1% were engaged in government and civil service (the past is a very foreign country, isn't it).
0.1% were parochial, town, and church officers, including police and law-officers.
6.3% were domestic servants.
2.8% were independent (or as we would say today, rentiers, people who have sufficient independent income from property or investment).
1.1% were almspeople, pensioners, paupers, lunatics, and prisoners.
In total, the preceding occupations represent 41% of the population, leaving a residue of 59% of population not engaged in an occupation (which corresponds nicely with about 50% of the population being children and married women).

Note that at that time England was the world's leading exporter of manufactured goods; England had also the world's largest merchant marine. In other countries the percentage of people engaged in making manufactured goods and in trade would be smaller or much smaller. In countries which were large exportes of agricultural products (such as Hungary or Wallachia) the percentage of people engaged in agriculture would be considerably higher.
In general, countries participate in international trade, and the occupations of their inhabitants depend not only on the level of development but also on what each country exports and imports; in the time frame of interest, England specialized in exporting manufactured goods, and imported staple foods, which means that the number of people engaged in industry was higher than the average developed country, and the number of people engaged in agriculture was lower. Socio-political structure and culture are also important.
Comment: I think that you should make it more clear, that England was heavily dependent on grain imports, so a generic ~1800 country at that time should have much more agricultural workers.
Comment: @Shadow1024: Clarification added to the effect that countries participate in international trade, and the occupations of their inhabitants depend on what each country exports and imports.
Comment: I think this would depend somewhat on the specifics of the crops being grown. For example, it's been argued that China's social structure evolved differently from Western countries partly because of how rice differs from crops like wheat - you need more physical space to grow enough rice to feed 100 people than you do to grow enough wheat to feed 100 people, and that affects how much of your population needs to be devoted to that task.
Comment: @BenS.: The last paragraph of the answer is an attempt to say that the specific historical example is just an example, and things may vary. For example, China never really had "a technological level of ~1800" as most Europeans would understand it -- it went straight from about the tech of the 1700s to the tech of the early 1900s; it never really had a sizeable merchant marine until the end of the 20th century; and so on.
Comment: Sorry if I wasn't clear - I think you've provided a lot of really good information here. All I was trying to say is that if these numbers turned out to be problematic for what the OP is trying to do in some way - e.g., more of them need to be engaged in agriculture for some reason - I think differences can be justified by changing the crops, the geography, etc.. But as far as the solid numbers go, what you've provided seems pretty damn good.
Answer: 1800 tech level is quite loose definition. It can be anything from hunting-gathering tribes in South-America to England in the early industrial revolution. I will chose the latter, and rely heavily on this link:
https://en.wikipedia.org/wiki/Social_history_of_England#Georgian_society
England's population was about 8 million at the time
36% of your people will still be farmers and their families.
Another 36% will be rural non-farmer.
This includes a lot of things: Priests, teachers, medics , blacksmiths and coopers and potters, traders, landed gentry, majors...
I think one priest and medic per 100 people should be more than enough for the period. From craftsmen you will need somewhat higher density, but these numbers depend on the sizes of the avarage settlements. If the villages are small, you need more blacksmiths to get everybody's horses iron-shod. Same holds for majors and local judges.
And you need quite a lot of traders, to carry the products of the country into the cities, and then sell the goods of industry on the land.
The remaining 28% is the urban population.

You need one king and some royal family members.
You need some bishops and other high-ranked clerics.
You need some thousands soldiers and naval sailors.
Some thousands of officials for public administration: from ministers to country tax collectors.
Some thousand businessmen: bankers, merchants and factory owners.
Some thousands of engineers, and some hundreds of scientist and university professors.
Tens of thousands of lawyers and medics and priest and teachers again.
The remaining will be workers, sailors, craftsmen, tailors and hairdressers, shopkeepers, and the sinewies of those.
Policemen and criminals are also unavoidable.

Of course, one (a communist for example) can argue, whether bankers and factory owners and priests are actually needed, but I think, that to have a specific 1800 tech level, you need a quite similar society. (for example, with no capitalism, you probably won't get India-going sailing ships.)
Comment: @Mołot Who needs clothes when you have boats? The ancient Greeks certainly didn't seem to.
Comment: @XandarTheZenon OP requested 1800 tech level. Early Industrial revolution was led by looming and weaving industry. So they need clothing.

Professions For A Society


Is it possible for DNA from two male cousins to appear to have the same father in the sibling test?

Question: If a buccal swab is taken from a cousin of a man. (ie his uncle's son) and it was
 compared to that man's DNA in a sibling test, would it be possible for a false
  positive test result showing that they were half siblings?
Comment: Welcome to G&FH SE!  As a new user be sure to take the [Tour] to learn about our focussed Q&A format which is quite different from bulletin boards, discussion forums and other Q&A sites you may be used to.
Answer: Yes it would.
The relationship estimator is based on the number of shared chromosomes. The normal range for a half-sibling is 1317cM to 2312cM. The normal range for a 1st cousin is from 553cM to 1225cM. It's very possible that a larger amount of DNA is shared between the two brothers (uncle and father), and that by chance a larger percentage is also shared between the cousins, bringing them to the half-sibling range.
It's possible, but not very likely though...
Answer: Well, this would happen if the uncle and the father were identical twin brothers.
Otherwise, it's pretty rare -- not impossible, but rare -- for two "first cousins" to have so much DNA in common that they register as if they were half-siblings.


Nested Lookarounds in java regex

Question: I have a pattern that uses lookarounds to ensure that the captured string is between two other strings
so in other words for the subject string
xxxcabyyy

my regex looks like
String myregex = ((?<=xxx)cab(?=[y]+))

so I want to use this regex more than once, because I may be looking for something else like
(test string) xxxcabyyy

I want a regex that is like
"\(test string\)(?=" + myregex + ")"

to say find "(test string)" that comes before  whatever my regex matched.
This doesnt seem to work exactly right and i think its beacuse I have lookarounds in my regex that I am now embedding in the lookforward...what can I do to correct this situation?
Answer: It's okay to put lookarounds inside other lookarounds, but I don't see why you need to.  In fact, I don't see any need for lookarounds period.  Won't this work?
"\\(test string\\)\s*xxx(cab)y+"

Assuming it's the cab part you're interested in, you can extract it via Matcher#group(1).
Answer: Your guess is right - that won't work because you've already specified the lookbehind and lookahead constructs in your string myregex. One way to solve this problem is to hold separate strings for what you want for the lookbehind and lookahead constructs and use them to build the final regex string just before you need to do the matching. For example, you could write a method such as the following that will return a regex string given the lookbehind and lookahead constructs and what to match between them:
public static String lookaroundRegex(String behind, String match, String ahead) {
    return "((?<=" + behind + ")" + match + "(?=" + ahead + "))";
}

You could then use it as follows:
String behind = "xxx";
String ahead = "[y]+";
String match = "cab";

// For the first case:
Pattern regexPattern1 = Pattern.compile(lookaroundRegex(behind, match, ahead));

// For the second case:
String behind2 = "\\(test string\\) " + behind;
Pattern regexPattern2 = Pattern.compile(lookaroundRegex(behind2, match, ahead));

Answer: If you want a solution with the lookarounds in other lookarounds, you can do
\(test string\)(?=.*?((?<=xxx)cab(?=[y]+)))

or if it's (test string) followed by the xxxcabyyy and just spaces in between that you're after:
\(test string\)(?= *((?<=xxx)cab(?=[y]+)))

This is because at the point at which you match (test string), there are still characters to go before you hit the xxxcabyyy, and you'll have to include them in your lookahead.

Nested Lookarounds in java regex


In which countries can you file a provisional patent application?

Question: What countries can you file a provisional patent application in?
Answer: The issue I have with your question is what you mean by "provisional patent application". Not many countries have the figure of "provisional" patent application (I can only think of the US and Portugal), but many countries have some kind of application or a regular patent application that is cheap and create a priority right, which I imagine is what you may be interested in.
Many European countries and the EPO accept the payment of filing/search/examination fees after filing your (regular) patent application. If you do not pay the fees, the (regular) patent application will become abandoned and will not get published, but from day 1 you have a priority right. Therefore, you can file the  patent application, not pay any fees, and claim priority from that patent application during the priority year. You will also find several countries with petty patents or utility models which have low fees and create a priority right as well; usually, this type of patents/models get published after soon after filing (typically between 1 and 6 months), so if you want to create prior art quickly, this would be a good option.
Comment: I think the greatest advantage of a provisional is not the primarily the low official fees, but the "unofficial" fees (attorney's fees). The latter fees are at least an order of magnitude higher then the former. To overcome this, the concept of a provisional imposing a lower burden of formal requirements is what's the most helpful. On the other hand, you can also pay the office fees later at the USPTO. In these aspects, I don't really think the legal construction of a provisional patent anywhere else exist — correct me if I'm wrong on Portugal.
Comment: @PatentosPite As far as I know any company can file its own patent applications at least in its own country without requiring the services of a patent attorney/agent, so I cannot follow your argument. It is up for the attorney and its firm to decide what they want to charge you for filing a provisional or a non-provisional irrespective of the requirements.
Answer: One feature of the US provisional is that it does not set the date from which the 20 year life is calculated.
Comment: You might be asking about provisional rights which have nothing at all to do with provisional applications. They can allow recovery of reasonable royalties back to the date of publication of the application. Since publication occurs 18 months after the earliest priority application filing, the day it publishes is no different if a provisional is filed on day X follows by a non provisional a year later or if a non provisional is filed on that same day X. So the choice does not affect those rights.
Comment: That's interesting, I think I missed that one. And then even if the claims pass substantially as they are drafted first, you will also not be able to retrospectively enforce the exclusionary rights associated with it?


How to run a specific test with Create React App

Question: In an app create with CRA v.1 I need to run a specific test file. How do I go about it? There is the --testPathIgnorePatterns flag to add to the npm test script to ignore a file or path but how do I run a particular test file with CRA from the command line?
Answer: I have done this by using -- to pass custom arguments to the npm script.
Documentation on this option can be found here: https://docs.npmjs.com/cli/run-script
So, to run a single test in a create-react-app application, I run the following:
npm run test -- -t 'test-name'

Where test-name is the value used in the describe function in jest -
describe('test-name', () => {
  it('does something', () => { ... });
});

Answer: You can use the name of the file in the command, and it will run only it.
For example:
npm test src/App.test.js

Comment: Note: I came to this answer by chance as I was having the same issue you are. I'm not sure how reliable it is :)
Comment: For me worked just the file name and not a path: npm test App.test.js
Comment: Thank you. I tried the solution you offered. Here's what I got. I have two test files within client/src: sample.test.js and sample2.test.js. When I run `npm test sample2.test.js` from client/src Jest actually runs sample.test.js and vice versa.
Comment: Maybe [this](https://facebook.github.io/create-react-app/docs/running-tests) or [this](https://jestjs.io/docs/en/cli.html) has something that works.
Comment: as of 2022, this works best!
Answer: By running the command as the accepted answer mentioned, it will take it as regex and if you have multiple same files name like index.test.tsx, it will execute all.
If you are using jest, you can run command below to force it to run only single test file:
npm test --runTestsByPath "src/pages/parentpath/index.test.tsx"
Refer to this.


How to log into git bitbucket repository from jenkins

Question: I have a GIT repository on bitbucket, which I want my Jenkins Server to access automatically. This is only possible using public/private key authentication. So I created a key pair and uploaded the public key to bitbucket. The public and the private key are on my server in the .ssh folder of the tomcat user running jenkins. I am able to clone my project when I am logged in as that user on the server.
However I am unable to get jenkins to actually check out the code from bitbucket. It always says:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Well I assume that this happens because when accessing the repository over ssh I need to provide the passphrase for my private key and jenkins is unable to do this automatically. I read that it is possible to avoid beeing asked for the passphrase by providing a config file inside the .ssh folder containing the following content:
Host bitbucket.org
    IdentityFile ~/.ssh/id_dsa

I did so, but as soon as I provide that file I can no longer clone the repository from bitbucket. Not even directly from the server, getting the same error message as shown above.
Did anyone manage to make this setup work? I also read the following thread here on stackoverflow that was of no use to me: How do i set a private ssh key for hudson / jenkins to access bitbucket? and I checked that tomcat really runs under user tomcat6 by creating an empty test project that simply runs "whoami". So I am pretty much out of ideas for fixing the problem.
Answer: Specifying an IdentityFile in your config doesn't change whether you have to provide a password for the ssh key.  That'd be a gaping security hole if it did.  The only way you can not be required to provide a password for your ssh key is if your ssh key doesn't have a password.
So, you should create an ssh key specifically for your jenkins instance and, if Bitbucket allows, only give read-only access to your repository for that key.
Comment: @ali, Although, if jenkins only needs read-only access, aren't there other ways to access your repository than using ssh?
Answer: This might be related to https://issues.jenkins-ci.org/browse/JENKINS-20879
Using a key without passphrase works for me.


Blood fish and bonemeal

Question: Because of its composition, this fertiliser is attractive to rodents. I find that a topical application often results in the soil in pots being tossed about - as they search for the meat/carcase which the smell of the fertiliser makes them believe is there. Any ideas as tho what to use instead ? Pelleted chicken manure also has a strong odour so might cause the same issue. Does Growmore 7-7-7 [UK product] have the same issues ?
Answer: Growmore has no odour at all and is not attractive to rodents,  so fine to use in pots; it is not an 'organic' fertiliser in that it contains no animal products. It's also useful as a general fertiliser lightly turned into the soil in spring around planting in the garden; because of its granular formulation, it slowly releases nutrients over a period of six  weeks.
Fish, blood and bone and bonemeal are really only useful in the ground, preferably at the bottom of a planting hole when you're putting in a new plant. As you've discovered, used on or near the surface of soil or in a pot, all kinds of animals are attracted by the smell (including dogs, foxes and cats as well as rodents) with fish, blood and bone having the strongest odour.
Comment: Thanks Bamboo, that's helpful.

Blood fish and bonemeal


SQLite issues while installing WPF Application

Question: I have .net 4.0 WPF application.My Active Solution platform is "Any CPU" and I'm running on a 64 bit Windows 7 system.I have used Sqlite.It works fine on my system.But when i am installing my application to some other machin,i am getting an error "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)" .I've tried compiling for x86 and x64 and I get the same error.Any ideas what the problem might be?
Answer: as reported in the site of http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
If the development and customer machines may have different processor architectures, more than one binary package may be required. For this situation, using the native library pre-loading feature is highly recommended. It is available as of version 184.108.40.206 and enabled by default. In order to take advantage of this feature, the separate managed and interop assemblies must be used with XCOPY deployment (i.e. this feature is not supported by the mixed-mode assembly, nor when the assembly is deployed to the global assembly cache), resulting in an application deployment that looks something like this:

\App.exe (optional, managed-only application executable assembly)
\App.dll (optional, managed-only application library assembly)
\System.Data.SQLite.dll (required, managed-only core assembly)
\System.Data.SQLite.Linq.dll (optional, managed-only LINQ assembly)
\System.Data.SQLite.EF6.dll (optional, managed-only EF6 assembly)
\x86\SQLite.Interop.dll (required, x86 native interop assembly)
\x64\SQLite.Interop.dll (required, x64 native interop assembly)

The string "" above represents the directory where the application binaries are to be deployed on the target machine. With the native library pre-loading feature enabled and the application deployment shown above, the System.Data.SQLite managed-only assembly will attempt to automatically detect the processor architecture of the current process and pre-load the appropriate native library.


What does a basic module look like that includes a content type, a couple of fields and a view?

Question: I am looking at turning my Features into proper modules. There is nothing fancy to them other than a content type, a couple of textfields attached and a view. It looks like the features module pretty much exports these into a module anyways but it looks like it relies on some helper functions in the features module to get this going. How can I convert my feature so that it doe not require the features module to be installed?
Comment: I am mainly a designer looking to better understand coding and dev of modules. I feel this would be a good opportunity to learn how a basic module, with some couple of fields and a view would be structured. I learn better by deconstructing something, rather than building from scratch. I have taken a look around D.O for a module that is basic enough for me to dissect, but many have admin options and other settings. I have also taken a look at the Examples module, but it doesn't have have examples of adding views.
Comment: It's an interesting question, so you get an upvote.  However I'm curious as to why you would want to do this?  Features provides the ability to update your..well..features really easily.  You'd lose this ability when converting to standalone module.
Comment: Typically, though, hand-coded modules don't add views or content types. It's much easier to use Features to build them. If you want to spend time productively, you would be better off learning the most commonly-used hooks such as hook_menu, hook_permission and the form api.
Answer: I don't know of an example module that has all of those pieces together, but I think you'll find that field_example and node_example from the Examples for Developers project useful.
As well, this page of the Features documentation mentions something interesting:

Technically, an exported Feature is a Drupal module – it has a .info file and a .module file (along with some .inc files matching the components of the feature).
If you're a developer and find a feature bundle a good starting point for a module, you could just extend the feature by editing its .module file (and if need be also the .info file) to include hooks and what have you.

So you may wish to export your Feature, then develop on it from there based on the samples in field_example and node_example.
Answer: In my experience, you just want to create a content type by a custom module.
If this is your goal, all you need is to create a .install file.
When you install your module all the content type and field will be set up completely.


Should a REPL show null values as null?

Question: I'm working on a REPL for a language that has a null value, and I'm not sure how to represent it in the output. The behavior of existing REPLs seems to be either to represent it by its name (null) or not to show it at all. For example, Python doesn't show any output when a None-returning expression is run in its REPL, but Node will always print undefined for expressions that return it. What are possible display options for nullish values in my REPL?
Comment: Please constrain your question. Ask us to evaluate responses in a way that fact-based. It is your job as a question asker to ask questions in a way that encourages objective answers or ["good-subjective" answers](/help/dont-ask). Ex. What design considerations should answerers here attempt to evaluate the two approaches based on?
Answer: The REPL's output and input should be the same. I should be able to copy an output and paste it back to the prompt.
>>> 5
5

>>> "Hello World"
"Hello World"

>>> null
null

So if your users can enter null onto the REPL, then null should be the output.
Comment: This sounds nice until you get to more complex data structures. Circular references, for example. I don't think this really works as a general rule
Answer: Many implementations of Scheme, among other Lisps, make a distinction between null (the constant value () which serves as both the empty list and the list terminator) and void (the constant value #<void> which is returned by side-effecting functions with no useful return value).
> '() ; yields null, which gets printed
()
> (display "Hello, LanguageDesign!\n") ; yields void, which does not get printed
Hello, LanguageDesign!
>

By this convention, a function that can return void should only return void, so it's reasonable to not print a void return value at all in the REPL. This saves clutter at no expense to the potentially useful null value.
Answer: Output the value if and only if you have multiple nullish types. Python has only None so it doesn't print to avoid clutter:
>>> x=2
>>>

Python does have NotImplemented and Ellipsis but they are quite different from None and functions return None by default
However, javascript has both null and undefined so it needs to print undefined to disambiguate:
>>> let a = 2;
<- undefined

As for the argument that you may want to re-use the value in a later expression: You can always get it back with _ (in python) or $_ (in node). If your language has a similar shortcut there is no need to print the value all the time.
Comment: The reason `x=2` doesn't print anything in Python is that there isn't anything on the stack to be popped. This was a [question I had](https://stackoverflow.com/q/50374265/478288) about how Python knows when to print during REPL mode. It turns out that the codegen phase of the Python compiler appends an opcode to print whatever is on the top of the VM's stack.
Comment: @chrisaycock Maybe, but any function or expression that comes out to `None` has the same behavior

Should a REPL show null values as null?


Extract cross-sections from a DEM

Question: I have the centerline of a river and multiple lines perpendicular to it on Qgis. I would like to extract the cross-sections in correspondence to those lines, how could I do?
I tried qprof but the .csv in output is not correct (if I try to plot it with excel it doesn't give back the section)
Comment: Old, but have you seen this question: [Extracting raster values with polylines in QGIS](https://gis.stackexchange.com/questions/114421/extracting-raster-values-with-polylines-in-qgis)
Answer: Try to use Profile tool which you can download from Plugin Manager. The tool can use your existing line layer to extract the profile from the raster data.
Have a look at this video: Using the Profile Tool plugin in QGIS which I selected randomly to show how to use Profile tool.
To use for existing vector layer:

Select the raster image
Add Layer
From the drop-down list select Selected Polyline
Select the line layer
Select the line in the map view the one above the raster image

It will become yellow and you can see the profile under the line:

Extract cross-sections from a DEM


Is it safe to use a phone while charging it with a powerbank?

Question: Is it safe to use a phone while charging it using a power bank or is it as dangerous while using it with a charging cable?
Answer: It is perfectly safe to use the phone while it is being charged.  If the battery is very depleted, the phone may get a bit warm to hot.  This is normal, but do not cover it with any material.
It is definitely not a good idea to put in under the pillow while it is charging.


dynamic carousel with jcarousel

Question: I have been scratching my head here for hours now,
trying to use jcarousel with a dynamic generated content, meaning , i get an initial carousel , say , with 3 items in it, and then adding another item to the carousel.
im doing it basically like this :
<code>$('.actorslider .slides').jcarousel('add', index, html);
</code>
problem is , the index is dynamic and when a user clicks "next" on the initial carousel i dont know what is the next index i should use , and when im trying to count the elements or increment the last one the carousel just doubles up .
you can see what i mean here
press the button under the image once and then the mess starts.
any ideas ?
Answer: I'm sure there's a neater way of achieving your goal, however in the meantime, you could always create a global index variable like
<code>var $i;
</code>
and increment it each time you load a slide dynamically.
<code>$i++;
</code>
If you remove all slides, reset your counter.
<code>$i=0;
</code>

dynamic carousel with jcarousel


Access GPIO pins through a Flask + Apache/mod_wsgi

Question: I get an internal server error when I import the gpio pins library in my simple <code>__init__.py</code> file.  And the debugger doesn't show up.
As I understand it,  the server doesn't have the permission to access the gpio pins.  How do I give it permission?
Comment: What library are you using to access the GPIO pins? If it's RPi.GPIO (and it's a recent version) then the user running the script needs to be a member of the gpio group (the pi user is by default)
Answer: If you are trying to access the GPIO pins and trigger the pins from a web UI (http request). I would suggest you to keep a utility directory (lib) in your flask project and write your triggers/actions for GPIO pins there.
Keep it away from your flask application.Based on your request (ReST API request) have this utility module imported on the corresponding file and then introduce your trigger to the pin.
Let me know if this helps.


Is this safe? 2 wires to 1 screw

Question:
I want to buy a WiFi wall switch for my lights outside to turn on without me but my house has no ground and the WiFi wall switch requires one and I noticed this can somebody explain the wiring?
Comment: You have asked two questions, how to wire a wifi switch without a ground, and why are there two wires on one screw terminal. Please separate your post into two questions so that they may be answered, indexed, and evaluated separately.
Comment: do mean you have no neutral? most contactless switches i've seen don't even have a ground connector...
Answer: No, it is not safe.  That screw terminal is made to take just one wire.  Since it doesn't use the switch as it's intended (by its UL listing) it's a code violation.  It will make a poor connection, which can heat up and potentially cause a fire.
As long as there's room in the box, it can be corrected by pigtailing.  You would connect one end of a new short section of wire (the "pigtail") to the terminal screw, and splice the two wires on the screw and the other end of the pigtail.
Very basic task for an electrician, doable for a DIY that knows the basics of working safely with electrical.
Answer: Three potential issues:
Double-wire on Screw -> Pigtail
As already answered, you should switch the double-wire on one screw to a single wire using a pigtail. That's the easy part...
Ground
It looks like the switch is in a metal box. If so, then the box may be grounded via metal conduit and be a valid grounding point for your new switch. You need to check that to be sure. Even if it is a metal box and metal conduit at the box, there is still a possibility that somewhere along the way to the breaker the ground path is broken.
Neutral
It is very likely that your WiFi switch needs a neutral in the box for power. The ground is for safety, the neutral (together with the hot) actually powers the switch. Older simple switches will often not have a neutral in the box. The wires going in & out of the switch hot & switched hot (if I have the terminology correct) but not hot & neutral (as is the case with an ordinary outlet). Because older switches didn't need a neutral, it is not always present inside the box. If it is present and split & wire-nut capped then you can pigtail to the switch. If it is present as a continuous wire and has enough slack to work with then you can cut it and wire-nut a pigtail to the switch. If it is not there then you have a problem.

Is this safe? 2 wires to 1 screw


How do I change my Field of View?

Question: I know that I can kind of adjust my field of view by switching from a 4:3 resolution to a 16:10 or 16:9 resolution.  Is there any way that I can just set the field of view to the maximum allowable width?
Comment: I know that the source engine allows a settable parameter for the field of view, but I'm not sure how to expose it. I know that some source games allow up to 90 degrees, but I'd bet it's configurable for all source games, but I'm not sure how high it goes.
Comment: For general FOV, type fov (70 - 90) into the console. For weapon/model fov, type viewmodel_fov (no limit, but the default is 60. Most people use 90. Over 1000 your weapon is invisible).
Answer: According to a question on the now defunct teamfortress2fort.com

It's in the Multiplayer tab of the options window
Answer: It now appears to be limited to 70 degrees for TF2, much to my annoyance (I play on a triple monitor setup with 15:4 aspect ratio, and everything is severely distorted at the edges of the screen).
Answer: Yes you can!
in console
fov 90

(~ = console that you need to enable in multiplayer options)
at least this worked for me :)
Answer: To set your field of view set to 90, in the type console fov_desired 90. You can only go  between 75 and 90, anything above 90 is considered cheating.
Answer: You can adjust your fov with fov_desired. It will only go up to 90.
The viewmodel_fov, however can be beyond 90. This command only affects what is in front of your screen (gun, hands,etc) instead of how much you can see.

More viewmodel_fov, the less your guns and your hands cover up your screen.
More fov_desired, the more you can actually see.

Now while both fov_desired and viewmodel_fov will help with what you see, they are not the same thing.
This video explains it better:
Comment: Why has someone voted to delete this? It's a good explanation of the differences between the two commands and how to combine both to achieve the desired result. None of the other answers do this.
Answer: You can go more than 90 or less than 70 and still can play. This is not considered cheating. Enter this in the console viewmodel_fov <fov number>.
Answer: You can try adjusting viewmodel_fov
Comment: This does not add anything new.

How do I change my Field of View?


watir-webdriver-0.6.4 text_field cannot set japanese characters

Question: I have been using watir-webdriver-0.6.4 and chrome browser to test my webpages.
Below is my code slice
@admin_browser.text_field(:name, "member[name]").set "そん"

It works fine if I replace "そん" with English characters, but with this code it behaves like this:

As you can see it changes into "]".
I ever searched in Japanese Google and they said I should use .value = "そん" instead of .set "そん". But sadly this still doesn't work.
P.S. The ruby version is ruby 1.9.3p429. gem update watir-webdriver said nothing to update, so I believe watir-webdriver is the latest. I just downloaded the latest webdriver from here. My os is windows7 32bits.
P.S. again:
I just tested it on firefox and it works perfectly. Besides, I remember this code ever worked fine on chrome about a week ago and until just now I didn't update my ruby, watir-webdriver or chromedriver. So maybe the cause is the update of my chrome browser? I'll download an earlier version of chrome and try again.
Answer: Problem solved, a matter of Chrome version. I installed Chrome 29.0.1547.62 and all works fine. I guess this is a bug of latest chrome or the interface has been changed and the chromedriver developer is not noticed


Why does increase of national debt of the USA not lead to inflation?

Question: Increase of national debt is increase of money supply.
But why does increase of national debt of the USA not lead to inflation?
Thanks.
Comment: @user253751 Ok. Is it false that debt increases money supply? (It was my assumption)
Answer:
Increase of national debt is increase of money supply. But why does increase of national debt of the USA not lead to inflation?

The premise of your question is simply wrong. Increase of national debt is not necessarily increase in money supply. New government debt can be accompanied by increase in money supply when the new government bonds are bought up by central bank against fresh reserves, since these new freshly created reserves will constitute increase in money supply.
However, if you or I or any other private entity or foreign governments buy US bond they are not doing that with freshly created reserves. They do that out of pre-existing money stock. So your premise is wrong.
Increase in money supply accompanied by increase in government debt actually leads to more inflation. That is actually the central theme of Cochrane's recent book the Fiscal Theory of the Price Level. Currently also US experiences high inflation, which happened right after a lot of US debt was purchased by Fed, and Cochrane argues, and provides evidence for, this being the reason why original rounds of QE that also increased money supply did not lead to large inflation but the last 'covid round' that focused on government debt did.
Comment: @Mike_bb no, it does not work that way. China cannot print USD, if they want to buy US bonds they have to first purchase USD on forex market (or use stock of USD they got some other way) in any case that USD is preexisting
Comment: If foreign government buy US bond then money of foreign government increase money supply of US, isn't it?
Answer: By accounting identity, government spending more than it collects back in taxes results in an increase in the base money supply (liabilities of the Treasury/central bank).
Each year, the base money supply (reserves and cash) plus issued bonds increases by precisely the same amount as the government deficit for that year.
If you add up all government deficits throughout history (and substract any surpluses), you arrive at the total level of outstanding government liabilities (i.e. the national "debt").
However, government financial liabilities (reserves, cash, and bonds) only represent a portion of the total money supply available to agents in the economy to buy things.
Commercial banks are licenced to create credit denominated in the government's unit of account (i.e. the dollar in the US).  They do this every time they create a loan for some borrower.  New money is created and circulates within the commercial banking system.  These newly created deposits are liabilities of commercial banks, not the government.  However, they are still money, which you use every time you buy a coffee using your bank cards.
Inflation is an average increase in the price level of goods and services over time (specifically most modern economies use a "basket" of goods and services which represents what typical people spend money on.  This makes up the Consumer Prices Index (CPI)).
The price level rises over time for several possible reasons.  One is an increase in the total money supply.  This could come from the government running deficits.  Alternatively, the government could run a balanced budget and the commercial banking system could instead increase their deposit liabilities via new loans (this also increases the money supply).  Or, as is more likely, some combination of the two occurs.
Typically, modern sovereign democracies have 'outsourced' (although still wholely owned by the gov) the job of managing the price level to their central banks.
Central banks have several tools at their disposal to achieve their inflation target and price stability.  One major one is the control of the price of money via setting interest rates.
If the central bank pressures commercial banks to raise the interest rates they charge customers on new loans (and raise rates on customer savings), then borrowers are less inclined to borrow and savers are more inclined to save (often these are the same people).
The result is a contraction in the aggregate money supply of commercial bank deposit liabilities.  Why?  Because the rate and volume of new loans decreases but old loans are being paid back.  Paying back a loan destroys the money that was created when the loan was made.
So by changing the price of money in the economy, the central bank is aiming to have the rate and volume of new loans being made to be less than the rate and volume of old loans being repaid.  This contracts the money supply and reduces the spending power of agents in the economy, thereby tampering down inflationary price pressures.
The above is monetary policy.


What are the differences between IOHK, Emurgo and the Cardano Foundation?

Question: What are the similarities and differences between IOHK, Emurgo and the Cardano Foundation? How do they independently provide value to the ecosystem? What are their individual mandates? Do they oversee each other in any way?
Answer: IOHK is one of the world's pre-eminent blockchain infrastructure research and engineering companies.
The company builds high-assurance blockchain infrastructure solutions for public, private sector and government clients
EMURGO is a global blockchain technology company providing solutions for developers, startups, enterprises, and governments.
The Company develops, supports, and incubates commercial ventures and help integrate these businesses into cardano decentralized blockchain ecosystem. EMURGO also provides technical support services.
Cardano is a third-generation, decentralized proof-of-stake (PoS) blockchain platform designed to be a more efficient alternative to proof-of-work (PoW) networks. Scalability, interoperability, and sustainability on PoW networks like Ethereum are limited by the infrastructure burden of growing costs, energy use, and slow transaction times.
The Cardano platform runs on the Ouroboros consensus protocol. Ouroboros, created by Cardano in its foundation phase, is the first PoS protocol that not only was proved to be secure, but also was the first to be informed by scholarly academic research.


What framework is suited for new product development which are more research and development sort of?

Question: I am working on multiple projects. One of the projects is all about research and development. Like the developer cannot give me the timelines for when it will be finished. Also, the developer doesn't know what needs to be done in the smaller steps. These tickets are historically created as design spikes for completing 1 sprint. I don't know what is the best way I can tackle it so that the progress can be measured and I can do some forecasting. What is the best framework or process to tackle such work?
Comment: Progress towards what? R&D can be done with many frameworks. This question has been asked and answered before (please search). Unless you can articulate a specific set of circumstances, this question is likely to be closed as an opinion poll.
Answer: Why do you want a framework to begin with? A framework may give you a good starting point, but one aspect of agility is "uncovering better ways of developing software by doing it and helping others do it".
That said, in an environment with a lot of uncertainty, I would recommend looking in two places for inspiration:

Lean Startup has ideas for testing hypothesis, delivering rapidly, and getting information about real-world usage of the thing you are building.
Flow-based approaches like Dan Vacanti's Kanban or David J. Anderson's Kanban Method can help to eliminate waste in the process and increase the rate of feedback without the need for planning days and weeks in advance.


Hard drive contents not showing in GIMP (Windows 10)

Question: I installed GIMP 2.10.0 yesterday. When I try to open files, there are a few folders listed, such as "Documents" and "Pictures" as well as the letters of the hard drives. When clicking on a listed folder, the contents show up fine, but when clicking on any of the hard drives, it shows absolutely nothing. I tried running as administrator, but to no avail. Restarting the PC did nothing as well.
Answer: This could be a bug in GTK+, unless it is something deliberate (similar to the default Windows Explorer setting which hides system directories from the user).
For the moment it's being tracked in the GIMP Bug Tracker:
https://bugzilla.gnome.org/show_bug.cgi?id=795855
Typing a drive letter - i.e. c:\, d:\, ... - in the location bar is a workaround, as this open a dropdown of possible completions.
Comment: The workaround works for me, thanks. Hopefully this will be fixed soon. If I weren't tech savvy I would just give up on GIMP immediately


How long can a Windows computer name be?

Question: Is there a limit to the number of allowed characters for Windows computer names?  If so, what is the limit?
Comment: I've heard it will handle over 9,000 before you start to see issues.
Comment: The text field in the dialog for changing the name on XP seems to have a 64 character limit.
Comment: The other issue you could run into is UNC paths.  There is a max length for UNC paths (256 characters???) so if your machine name is long, and you have long share names, or deep directory structures, you could have issues.
Comment: The input field in Windows 10 let you enter a much longer name then 15 characters, but responds with "too long computer name". The question is: Which number between 15 and 63 is actually valid?
Answer: According to MS KB, maximum length varies based on the name resolution protocol.

NetBIOS computer names:
Minimum name length
1 character.
Maximum name length
15 characters.

DNS computer names:
Minimum name length
2 characters.
Maximum name length
63 characters.
Comment: Microsoft also notes this in the same article:

_Note Windows does not permit computer names that exceed 15 characters, and you cannot specify a DNS host name that differs from the NETBIOS host name. You might however create host headers for a web site hosted on a computer and that is then subject to this recommendation._
Comment: This seems to have changed. I just set up Windows Server 2019 and it would allow me to enter a name with a length greater than 15, but it does warn that the hostname will then differ from the NetBIOS name. I'm not going to risk that complication, but it seems like I'd be allowed to.


Captcha fails to prevent spam submission

Question: i have added captcha in comment form and its working, but i still keep getting spam. Is there any other methods I can use? Thanks for the help
Comment: This might very well be a site-design question, not a coding question _per se_, so some people might downvote it.
Answer: DISCLAIMER: I own SpamCaptcher but will still try to be impartial here
The results you will see with your CAPTCHA depend heavily on 3 main factors:

How you implemented the CAPTCHA
The type of CAPTCHA you use
The return on investment a spammer gets from spamming your site

CAPTCHA Implementation
Before we discuss whether the type of CAPTCHA you are using is the right one for your needs (or whether you should be using one at all), first check to see if it is implemented correctly. If it isn't being validated server side, can be bypassed by turning off JavaScript or disabling Flash (or changing any other client-side configuration), or the answer is stored client-side then the implementation needs to be fixed. Of course, whoever makes the CAPTCHA you use should make it so you don't have to worry about this. Note: I highly recommend against you rolling your own CAPTCHA solution.
CAPTCHA Type
Most people think of CAPTCHAs as a picture of distorted text that they have to decipher. While this is certainly one implementation of a CAPTCHA (and currently the most "popular") it is not the only one. While this distorted text based CAPTCHA was successful for a little while, the improvement of OCR made it so that spammers could solve these with automated tools. In an effort to combat this, the people who made the CAPTCHAs made them harder to read and now we are stuck in a situation where computers keep getting better at solving them while humans struggle more and more. Recently there has been a boom in CAPTCHA providers providing a range of different types of CAPTCHAs:

Image recognition
Image orientation (my personal favorite)
Games
Video comprehension
Audio comprehension
etc.

Also, people have moved away from the strict definition of a CAPTCHA and have come up with some other solutions that may work for you depending on your site (more about this in the next section).
Some things to keep in mind when you are selecting a CAPTCHA type is that certain people may struggle with certain types. It is good practice to make sure that people with visual impairments and people with hearing impairments can still solve the CAPTCHA. It is also important to note that the CAPTCHA is only as strong as its weakest point. So, for example, if the visual portion of a CAPTCHA were rock solid but the audio component was weak, then security would be weak. In fact, in this case you would only be bothering most of your legitimate users with the CAPTCHA while providing the spammers an easy way to get around it it.
Spam ROI
Depending on the nature of your site, spammers may have a big or small incentive to spam you. If the incentive is small then chances are that they will not write custom solutions to spam you. However, if the incentive is big then there is a good chance that they will write custom solutions for your site.
Let's start with the small incentive case. If you fall into this category then I recommend picking a CAPTCHA that doesn't have widespread adoption yet (but is still secure) and is extremely easy, if not transparent, for your users. Honeypots and Hashcash are examples of transparent solutions. At SpamCaptcher we provide such a solution called Proof-of-Work.
If, on the other hand, you have a site that has a high ROI for the spammers then you will need more security. In this case you obviously want to pick a solution that has strong security and still provides a good user experience. However, if the ROI of your site is high enough then you may be faced with Human CAPTCHA Solvers. A CAPTCHA alone will not protect you from them. However, (another shameless plug), SpamCaptcher has its TrustMe Account solution for that.
Conclusion
You really need to pick the CAPTCHA that is right for your needs which means you need to find the right balance between security and user friendliness. I obviously recommend SpamCaptcher and think our Rotational Image CAPTCHA would be a great solution for you but you obviously need to decide what is best for your site. Here are a couple CAPTCHA providers you may want to consider:

SpamCaptcher
Confident Technologies
ReCaptcha

Hope that helps!
Answer: Captcha has been broken for some time.
There is no perfect solution to preventing spam comments.
You can require users to register before posting a comment.  While spambots can also break that, it's a harder problem for them to solve.  This solution also discourages participation by real people.
You can automatically flag comments from non-registered users as requiring review before they are posted, and either review them yourself or through the community (much as Stack Overflow does with certain content such as edits).  You might also want to flag comments by "new" users that have not established much credibility yet.
You should not create an IP block list.  Most of your spam will come from compromised computers that are also used by legitimate people.  If you block one IP, another zombie computer will most likely try an connect to resume work.  On the other hand, you may well block the human user of a zombie computer from using your site.
Answer: I suggest adding extra measures in addition to Captcha.
In my case I experitmented with adding a hidden field ->
<form action="/submit.php" method="post">

Your name: <input type="text" name="name" />

Your email: <input type="text" name="email" />

Leave this empty: <input type="text" name="url" />

<textarea name="message"></textarea>

<input type="submit" value="Send" />

</form>

.antispam { display:none;}

and then validate it on server side ->
<?php
// if the url field is empty
if(isset($_POST['url']) && $_POST['url'] == ''){
     // then send the form to your email
}
// otherwise, let the spammer think that they got their message through
?>

The above code example was extracted from this useful article: http://www.nfriedly.com/techblog/2009/11/how-to-build-a-spam-free-contact-forms-without-captchas/
from Nathan Friedly
In my site I'm implementing both -the above approach AND Google's reCaptcha-.
So far is working OK.
Answer: On (one of a thousand reasons) why your Captcha might not have worked: one technique that's been noted is that hackers will have their bots send a screenshot of the Captcha back to base, and a minimal-wage human will fill it out. (Erik J's link details this.)
Better solutions seem to revolve around the structure of websites than implementation.
You could look around this website in particular - techniques like restricting privileges until the user shows themselves to be a functional part of your little society. Putting the responsibility before the privileges, in essence.
XKCD, of course, says it well
Answer: Unfortunately, CAPTCHA has it challenges. A study last year found that CAPTCHAs may not be as reliable in preventing computer recognition as they once were. The study is available at http://homepages.cs.ncl.ac.uk/jeff.yan/google.pdf.
My company works with clients to stop social spam. Check out our blog post on Answers to Developers Questions on Fighting Social Spam. In our post, we highlight strategies you can build (and we offer too) to enhance your site's defense against spam. http://www.impermium.com/blog/2012/02/03/answers-to-developer-questions-on-fighting-social-spam/.


When are linear (OLS) models valid when variables are nested

Question: I have data where counselors are nested inside units which are nested inside areas. I would prefer to use OLS regression rather than multilevel analysis because I only have 7 areas (which I am told is too small a sample size for multilevel models) and because no one in my organization is interested in units (of which there are 70). Formally the nesting violates the assumptions of regression I know which in turn negatively effects the calculated p values. Is there a way to know how serious this impact is, that is if it really invalidates using OLS?
Answer: One way to interpret a random effect in your model is like assuming those $7$ areas come from some larger population of potential areas to draw future observations from. If you have no interest in other areas, you could model area as a fixed effect. This is far less efficient though, as you'd be estimating $7-1$ offsets from the intercept, instead of a single random variance for 'areas'.
Technically speaking, you could estimate a random variance for as little as $2$ areas. Do you have any particular reason to believe $7$ would be too few? More importantly, if your concern is the validity of $p$-values, then it is irrelevant whether you are interested in units (or areas): You add hierarchy to your model to account for dependency in the data. You don't have to do anything with the estimated variances if you don't want to.

Is there a way to know how serious this impact is, that is if it really invalidates using OLS?

To my knowledge, there are no measures of 'wrongness' of a model that does not account for dependency. One thing you can do is to run both models to see how large the estimated random effects are, and how large the resulting discrepancy in $p$-values is.
Comment: The reason I was concerned about only have 7 areas is that one of the articles I read on this topic yesterday said that you need a minimum of 25 of your highest level (in my case area which is level 3) and suggested that if you had less then MLM would not correct the problem with p values. If I understand your response you disagree with that.
Answer: Some thoughts on determining how series the impact of ignoring Clustering can be on OLS estimates
In general, if your data is clustered, e.g. in your case some sampling units are clustered within 7 areas, and you ignore this fact when conducting OLS, your standard errors, confidence intervals and p values will indeed be upwardly biased compared to commonly assumed simple random sampling design.

Heeringa, West & Berglund (2012) provide a more eloquent explanation. In almost all cases, sampling plans that incorporate cluster sampling result in standard errors for survey estimates that are greater than those from a simple random sampling (SRS) of equal size. The SRS variance estimation formulae and approaches incorporated in the standard programs of most statistical software packages no longer apply, because they are based on assumptions of independence of the sample observations and sample observations from within the same cluster generally tend to be correlated (p.28-29).

Without knowing more specific information about your sampling design, the actual sample, and your precise modeling objectives, it is hard to say with more certainty what exact effect ignoring clustering will do in your specific case. However, the following questions can help you better reflect on the effect of clustering on the standard errors and therefore p values in your case.

Are all clusters equal in size? If some clusters are, say, 6,000 units while others are only 200 units, it is easy to see how over-represented individuals from the largest cluster(s) will be. If you want to read more about the effect of unequal clusters, a great example is provided here
Are units selected with equal probability? If in some clusters the probability of selecting certain individuals was much higher than in other clusters, it is reasonable to expect more biased cluster composition in some cases. This will thus partially preclude correct inference.
Is the sample also stratified? For example, stratification by socio-economic status or age is commonly used. This is very important as usually, stratification leads to lower standard errors than SRS. Consider the following example from Heeringa et al (2010, p.34), according to which standard errors of both stratified and clustered design are the closest to the SRS. In contrast, the only-clustered design gives overinflated standard errors compared to the SRS, whereas the only-stratified design gives markedly lower standard errors compared to the SRS. Thus, I would like to emphasize the point that if your design used both stratification and clustering, their combined effect may produce standard errors comparable to those of using SRS alone.

Further thoughts
You only have 7 clusters, and it is generally true that it is a somewhat small number of clusters, which can, thus, lead to biased results. I am not sure how far you would be prepared to go with your modeling but a quick Wikipedia search showed a number of viable solutions to this problem. That is:

One can use a bias-corrected cluster-robust variance matrix, make T-distribution adjustments, or use bootstrap methods with asymptotic refinements, such as the percentile-t or wild bootstrap, that can lead to improved finite sample inference. Cameron, Gelbach and Miller (2008) provide microsimulations for different methods and find that the wild bootstrap performs well in the face of a small number of clusters.

Finally, you may find it useful to determine how similar cases within each cluster are by calculating the intra-class correlation. You would expect that the cases within each cluster are correlated with another much higher than cases across clusters. But how homogenous each group is remains to be seen

References
Cameron, A. C., Gelbach, J. B., & Miller, D. L. (2008). Bootstrap-based improvements for inference with clustered errors. The Review of Economics and Statistics, 90(3), 414-427.
Heeringa, S. G., West, B. T., & Berglund, P. A. (2010). Applied survey data analysis. The UK, London: CRC Press.
Comment: I did not sample. All staff were sent an instrument about half returned useful ones. The areas likely have a similar number of units, but they have very different number of staff as some are rural and some urban. I am not familiar with most of the solutions you mentioned although I have used bootstrapping. To add complexity to this my dependent variable is a 4 point likert scale so I am using HGLM. Having mainly learned linear MLM I am not sure how this changes things. Since I posted this I have learned that some suggest just using OLS with robust errors to deal with clustering which I may do
Comment: @user54285 yes, the fact that your dependent variable is measured on a 4-point Likert scale surely complicates things, because it is ordered categorical rather than continuous. However, If you want to be practical and time is of the essence for you, you may indeed resort to doing just OLS. Indeed, robust standard errors should bring down your standard errors and make them more in line with what you would have expected had you not had any clusters.
Comment: @user54285 Many things that I mentioned for you above were primarily to provide some hints as to the factors that could be taken into account when thinking about how negative the effect from clustering might have been in your case