Why does cloning an object to modify properties also modify the original object?
What is the most efficient way to deep clone an object in JavaScript?
Limiting floats to two decimal points I want a to be rounded to 13.95.  &gt;&gt;&gt; a 13.949999999999999 &gt;&gt;&gt; round(a, 2) 13.949999999999999   The  function does not work the way I expected. Each event has two possible outcomes: a and b.  Each event is independent.  Outcome a has $X\%$ chance of happening.  If we run $Y$ number of such events, what are the chances of getting $K$ outcomes a in a row, at least once?  To put it in practical terms imagine a series of coin tosses. Each coin toss has two possible outcomes: a = heads and b = tails. Outcome a = heads has a chance of $50\%$. If we run $Y = 100$ number of coin tosses, what are the chances of getting $K = 10$ outcomes a=heads in a row, at least once?   I'm using the practical example only so I can express the idea more clearly. I'm interested in finding out the general formulas and computations so that I can run the calculations for any $X$, $Y$, or $K$.  I would also be very interested in knowing how the probabilities would change if the events would not be independent. What if the more outcomes a we have in a row the bigger the chance of getting an outcome a in the next event? What if it's the other way around, and the more outcomes a in a row we have the lower the chance of getting another a? After upgrade of any app - apps move back from SD Card to phone memory.  After that, to save phone memory, I have to move upgraded app back to SD card.   Is any possibility to avoid this because it is very annoying?  I have Android 5.0.2 on Motorola E second gen phone. Removing unwanted appearance of underlying mesh How to copy the contents of a file in UNIX without displaying the file contents. I don't want to cat or vi to see the contents.  I want to copy them to clipboard so that I can paste it back on my windows notepad.  I can't copy the file from that server to another due to access restrictions. I would be happy to get some hints on the following integral: $$ \int_0^1\frac{x^{19}-1}{\ln x}\,dx $$ I'm writing a simple bash script, but I need it to check whether it's being run as root or not. I know there's probably a very simple way to do that, but I have no idea how.  Just to be clear: What's a simple way to write a script foo.sh, so that the command ./foo.sh outputs 0, and the command sudo ./foo.sh outputs 1? Show rigorously that the sum of integrals of $f$ and of its inverse is $bf(b)-af(a)$ Suppose $f$ is a continuous, strictly increasing function defined on a closed interval $[a,b]$ such that $f^{-1}$ is the inverse function of $f$. Prove that,   $$\int_{a}^bf(x)dx+\int_{f(a)}^{f(b)}f^{-1}(x)dx=bf(b)-af(a)$$   A high school student or a Calculus first year student will simply, possibly, apply change of variable technique, then integration by parts and he/she will arrive at the answer without giving much thought into the process. A smarter student would probably compare the integrals with areas and conclude that the equality is immediate.  However, I am an undergrad student of Analysis and I would want to solve the problem "carefully". That is, I wouldn't want to forget my definitions, and the conditions of each technique. For example, while applying change of variables technique, I cannot apply it blindly; I must be prudent enough to realize that the criterion to apply it includes continuous differentiability of a function. Simply with $f$ continuous, I cannot apply change of variables technique.  Is there any method to solve this problem rigorously? One may apply the techniques of integration (by parts, change of variables, etc.) only after proper justification.  The reason I am not adding any work of mine is simply that I could not proceed even one line since I am not given $f$ is differentiable. However, this seems to hold for non-differentiable functions also.  I would really want some help. Pictorial proofs and/or area arguments are invalid. Broken "Network profile" link when Area51 is their only account Solve $x^{5} \equiv 2$ mod $221\ $ [Taking modular $k$'th roots if unique] Change password on root user and user account JavaScript YAML Parser How to configure a firewall that only allows a few webpages and dropbox and U1 services? Proving Binomial Identity without calculus How to establish the following identities without the help of calculus:  For positive integer $n, $ $$\sum_{1\le r\le n}\frac{(-1)^{r-1}\binom nr}r=\sum_{1\le r\le n}\frac1r $$  and  $$\sum_{0\le r\le n}\frac{(-1)^r\binom nr}{4r+1}=\frac{4^n\cdot  n!}{1\cdot5\cdot9\cdots(4n+1)}$$ For $a\ge 0$ let's define $$I(a)=\int_{0}^{\pi}\ln\left(1-2a\cos x+a^2\right)dx.$$ Find explicit formula for $I(a)$.   My attempt: Let  $$\begin{align*} f_n(x) &amp;= \frac{\ln\left(1-2 \left(a+\frac{1}{n}\right)\cos x+\left(a+\frac{1}{n}\right)^2\right)-\ln\left(1-2a\cos x+a^2\right)}{\frac{1}{n}}\\ &amp;=\frac{\ln\left(\displaystyle\frac{1-2 \left(a+\frac{1}{n}\right)\cos x+\left(a+\frac{1}{n}\right)^2}{1-2a\cos x+a^2}\right)}{\frac{1}{n}}\\ &amp;=\frac{\ln\left(1+\dfrac{1}{n}\left(\displaystyle\frac{2a-2\cos x+\frac{1}{n}}{1-2a\cos x+a^2}\right)\right)}{\frac{1}{n}}. \end{align*}$$ Now it is easy to see that $f_n(x) \to \frac{2a-2\cos x}{1-2a\cos x+a^2}$ as $n \to \infty$. $|f_n(x)|\le \frac{2a+2}{(1-a)^2}$ RHS is integrable so $\lim_{n\to\infty}\int_0^\pi f_n(x)dx = \int_0^\pi \frac{2a-2\cos x}{1-2a\cos x+a^2} dx=I'(a)$. But  $$\int_0^\pi \frac{2a-2\cos x}{1-2a\cos x+a^2}=\int_0^\pi\left(1-\frac{(1-a)^2}{1-2a\cos x+a^2}\right)dx.$$ Consider $$\int_0^\pi\frac{dx}{1-2a\cos x+a^2}=\int_0^\infty\frac{\frac{dy}{1+t^2}}{1-2a\frac{1-t^2}{1+t^2}+a^2}=\int_0^\infty\frac{dt}{1+t^2-2a(1-t^2)+a^2(1+t^2)}=\int_0^\infty\frac{dt}{(1-a)^2+\left((1+a)t\right)^2}\stackrel{(*)}{=}\frac{1}{(1-a)^2}\int_0^\infty\frac{dt}{1+\left(\frac{1+a}{1-a}t\right)^2}=\frac{1}{(1-a)(1+a)}\int_0^\infty\frac{du}{1+u^2}=\frac{1}{(1-a)(1+a)}\frac{\pi}{2}.$$ So $$I'(a)=\frac{\pi}{2}\left(2-\frac{1-a}{1+a}\right)\Rightarrow I(a)=\frac{\pi}{2}\left(3a-2\ln\left(a+1\right)\right).$$  It looks too easy, is there any crucial lack?  $(*)$ — we have to check $a=1$ here by hand and actually consider $[0,1), (1,\infty)$ but result on these two intervals may differ only by constant - it may be important but in my opinion not crucial for this proof. Let $D := \{z \in \mathbb{C}: |z| &lt; 1\}$ and $f\colon D \rightarrow \mathbb{C}$ be holomorphic. Suppose $\lvert f(z)\rvert \leq 1$ on $D$, show that $$\frac{|f(0)| - |z|}{1 + |f(0)||z|} \leq |f(z)| \leq \frac{|f(0)| + |z|}{1 - |f(0)||z|} \ \forall z \in D.$$  I have tried using Cauchy Integral Formula to $f$ and expanding $f$ at $0$, but I have no idea why $f(0)$ appears in the inequality in the former case. Both answers and hints are appreciated and thanks in advance! Why do I need to type `./` before executing a program in the current directory? While executing a C program, a.out, using the Ubuntu terminal, why do I always need to type ./ before a.out, instead of just writing a.out? Is there solution for this? How do I delete unwanted Apple ID's? I'm going thru a phone swap, and I now realize that I have multiple ID's   "codename" "codename@example.com" "realname@example.com"   I've tested all three, and they all have different login passwords. Not sure how I got here but I'd like to clean the mess up.  Is there any way to delete / remove / erase unwanted ID's so they don't exist anymore?  (Note: their existence creates total havoc with any type of ID edit...)  I see from  that I can't merge the apple ID's, but can I simply delete the unwanted ID's? Assigning point IDs to respective start and end attributes of polyline? I have two shapefiles, Point and Polyline. I'm trying to populate my polyline layer with the point data ID (systemID) where the lines start to where they end; eg. create two columns (from and to). The lines already have flow direction assigned to them. I am using ArcHydro tools but Arcpy is also fine.  In ArcHydro I have tried using Attribute Tools > Generate From/To Nodes for lines but it creates values for To and From that are not from my point data. My other alternative was using Feature to Vertices and joining the result to my point data table to get the systemID. But then I would have to update the polyline layer as well. I am sure there is a easier way of doing it.  Note: not all the lines have points at the vertices, blank values are fine for them. Image uploader shouldn't remove unused link references