How does the value of this simulated function-static-variable is kept during callings?
"Least Astonishment" and the Mutable Default Argument
Why does QgsSpatialIndex.nearestNeighbor(point, 1) sometimes return 2 lines? I'm trying to get the closest line to a point using PyQGIS in a plugin. The active code file is this:   When I request the closest line (only 1)  nearestIds = self.spIndex.nearestNeighbor(self.feat2.geometry().centroid().asPoint(),1)   I sometimes get a list with two lines and the first one is not the closest but as far as I can see the second one is. Why is this?   Does QgsSpatialIndex use only boundingboxes for lines? How do I get the real closest line always, not only most of the time? Reason for the discreteness arising in quantum mechanics? What is the most essential reason that actually leads to the quantization. I am reading the book on quantum mechanics by Griffiths. The quanta in the infinite potential well for e.g. arise due to the boundary conditions, and the quanta in harmonic oscillator arise due to the commutation relations of the ladder operators, which give energy eigenvalues differing by a multiple of $\hbar$. But what actually is the reason for the discreteness in quantum theory? Which postulate is responsible for that. I tried going backwards, but for me it somehow seems to come magically out of the mathematics. Analysis's output vs analysis output vs output of the analysis How to find out who deleted some data SQL Server My boss had a query from a customer yesterday asking how they could find out who deleted some data in their SQL Server database (it is the express edition if that matters).  I thought this could be found from the transaction log (providing it hadn't been truncated) - is this correct? And if so how do you actually go about finding this information out? How do I get on a Minecraft PE server when it says 'invalid name'? I am having trouble getting onto a server in Minecraft PE on iOS. When I tap on the person's server it just says invalid name:    I have tried turning off and restarting the iPad, going to home screen and logging back into the server but I have had no luck and no change. Is there a reason why this is so? Are common cryptographic hashes bijective when hashing a single block of the same size as the output? Zero-dimensional ideals and finite-dimensional algebras Tall fraction puzzle I was given this problem 30 years ago by a coworker, posted it 15 years ago to rec.puzzles, and got a solution from Barry Wolk, but have never seen it again.  Consider the series:  $$1, \frac{1}{2},\frac{\displaystyle\frac{1}{2}}{\displaystyle\frac{3}{4}},\frac{\displaystyle\frac{\displaystyle\frac{1}{2}}{\displaystyle\frac{3}{4}}}{\displaystyle\frac{\displaystyle\frac{5}{6}}{\displaystyle\frac{7}{8}}},\cdots$$  Each fraction keeps its large bars while being put atop a similar structure. This can also be represented as $$\frac{1\cdot 4 \cdot 6 \cdot 7 \cdot\cdots}{2 \cdot 3 \cdot 5 \cdot 8 \cdot\cdots}$$ terminating at $2^n$ for some $n$, where it is much closer to the limit than elsewhere.  The challenge:   Find the limit, not too hard by experiment In the last expression, find a simple, nonrecursive, expression to say whether $n$ is in the numerator or denominator Prove the limit is correct-this is the hard one. Accidentally ejected External drive while downloading file, now having problems reading One-hot vs dummy encoding in Scikit-learn Find all polynomials $P:\mathbb{C}\rightarrow\mathbb{C}$ such that $$P(x^2)=P(x)^2 .$$   Here is what I tried:  First, it is easy to see the constant solutions, namely $P\equiv 0,P\equiv 1$.  Let $r$ be a root of $P$ (i.e. $P(r)=0$). It follows that all terms in the infinite sequence $r,r^2,r^4,\dots,r^{2n},\dots$ are roots of $P$. To avoid a polynomial with infinite roots, we have to have the sequence be periodic. So it turns out that either $r=0$, or the roots of $P$ are roots of unity of degree $2n$ for some $n\in\mathbb{N}$.  In the first case, we get $P(x)=xQ(x)$. Plugging in, we get $$x^2Q(x^2)=x^2Q(x)^2\implies Q(x^2)=Q(x)^2 ,$$ i.e. that $Q$ satisfies the same condition as $P$.  In the second case, we have $P(x)=(x^{2n}-1)Q(x)$. Plugging in, we get $(x^{2n}-1)Q(x^2)=(x^{2n}-2x^n+1)Q(x)^2$. I was not sure how to proceed from here. I just updated my iPhone 7 Plus to iOS 13 tonight and noticed that the post menu in the Stack Exchange app became close to unreadable, because the font/text is too large to be properly displayed. Luckily we can still recognize the icons...    (Yes, app development has been frozen for quite a while but the app continues to serve me well.) I cannot install any package. It seems the command apt-get update must be run but it throws some errors:  $ sudo apt-get update Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]      Hit:2 http://ve.archive.ubuntu.com/ubuntu xenial InRelease                      Hit:3 http://ve.archive.ubuntu.com/ubuntu xenial-updates InRelease              Hit:4 http://ve.archive.ubuntu.com/ubuntu xenial-backports InRelease            Fetched 102 kB in 23s (4337 B/s)                                                *** Error in `appstreamcli': double free or corruption (fasttop): 0x000000000210f4b0 *** ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fac8d8317e5] [...] Aborted (core dumped) Reading package lists... Done E: Problem executing scripts APT::Update::Post-Invoke-Success   'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli;   then appstreamcli refresh &gt; /dev/null; fi' E: Sub-process returned an error code Redirecting stdout to a file you don't have write permission on When you attempt to modify a file without having write permissions on it, you get an error:  &gt; touch /tmp/foo &amp;&amp; sudo chown root /tmp/foo &gt; echo test &gt; /tmp/foo zsh: permission denied: /tmp/foo   Sudoing doesn't help, because it runs the command as root, but the shell handles redirecting stdout and opens the file as you anyway:  &gt; sudo echo test &gt; /tmp/foo zsh: permission denied: /tmp/foo   Is there an easy way to redirect stdout to a file you don't have permission to write to, besides opening a shell as root and manipulating the file that way?  &gt; sudo su # echo test &gt; /tmp/foo What are Unity's keyboard and mouse shortcuts? Clipboard.GetText returns null (empty string) My clipboard is populated with text, but when I run  string clipboardData = Clipboard.GetText(System.Windows.Forms.TextDataFormat.Text);   I get back an empty string. I've toyed with various forms of the call including:  string clipboardData = Clipboard.GetText(); string clipboardData = Clipboard.GetText(System.Windows.Forms.TextDataFormat.UnicodeText);   But with the same result.  Am I missing something obvious? Why every polynomial over the algebraic numbers $F$ splits over $F$? Why are my sauces splitting? Recently all my attempts at sauces are splitting and I'm not sure what's going wrong. Tonight I tried a balsamic vinegar reduction / chicken stock / pan juices recipe to go with my lamb chops, but once again the dreaded split occurred. My wife is patient and forgiving, but I feel like I must be missing something fundamental to get this wrong so often.  Two questions.   What could I be doing wrong to cause these sauces to split? What can I do to recover when it happens again?   UPDATE: The Pan juices contained a tbsp or two of olive oil, and some of the fresh herb rub I'd coated the lamb chops in (thyme, rosemary, and mint). I did not drain the pan before starting the sauce. It has crossed my mind that perhaps there was too much oil / fats in the pan at that point?  For completeness, I should point out that I also sauteed some chopped shallots in the pan juices immediately before adding the vinegar. How do I iterate over the words of a string? Dark Energy / Accelerating universe: naive question