Javascript array deep copy not working as expected
How do you clone an Array of Objects in Javascript?
I asked a question that has been marked as a duplicate. I read a lot of similar questions and explanations in advance but I couldn't find a solution. In the question that should answer my question the asker used a different (not working) approach. There is even an answer that would work for my case however I'd rather consider it as a workaround than a solution since I have seen examples using my approach.  So I would like your opinion in that case. Would it be ok to repost my question while explaining why other answers didn't help me? I edited my question but I think it's not getting any attention anymore. Naturally I will remove the old question. How do I stop my 2013 Macbook Air from putting the computer to sleep? Why do we need to set swap space as twice big as our physical memory? When we want to setup a linux system, there is a common a suggestion to set the swap space  twice as big as your physical memory. I want to know why do we need this, and how it is this suggestion come to be? How to prove $\sum\limits_{r=0}^n \frac{(-1)^r}{r+1}\binom{n}{r} = \frac1{n+1}$? Other than the general inductive method,how could we show that $$\sum_{r=0}^n \frac{(-1)^r}{r+1}\binom{n}{r} = \frac1{n+1}$$  Apart from induction, I tried with  to check the validity, but I can't think of an easy (manual) alternative.  Please suggest an intuitive/easy method. Array#each vs. Array#map We've just been learning about complex numbers in class, and I don't really see why they're called numbers.  Originally, a number used to be a means of counting (natural numbers).  Then we extend these numbers to instances of owing other people money for instance (integers).  After that, we consider fractions when we need to split things like 2 pizzas between three people.  We then (skipping the algebraic numbers for the purposes of practicality), we use the real numbers to describe any length; e.g. the length of a diagonal of a unit square.  But this is when our original definition of a number fails to make sense- when we consider complex numbers, which brings me to my main question: what is a rigorous definition of 'number'?  Wikipedia claims that "A number is a mathematical object used to count, label, and measure", but this definition fails to make sense after we extend $\mathbb{R}$.     Does anyone know of any definition of number that can be generalised to complex numbers as well (and even higher order number systems like the quaternions)? Let $n\geq 2$ and let $k$ be "considerably larger" than $n$ (like some large multiple of $n$). Then for each $i$ such that $0&lt;i&lt;n$ and $\gcd(i,n)=1$ let's define $$c_i=\left|\{p_j\;|\; p_j\equiv i \mod n,\;\mbox{where $p_j$ is the $j$-th prime, $1\leq j\leq k$}\}\right|$$ so $c_i$ represents how many of the first $k$ primes are congruent to $i$ modulo $n$.  What can we say about $c_i$s, that is about the distribution of the first $k$ primes modulo $n$?  I thought the distribution will be seemingly random, and that is mostly true - for example $c_i$s are always very close together. But there are observable non-random patterns. For example for $n=3$, for various $k$s I've tried  (up to $10^6$) I always got $c_2&gt;c_1$. If this were just some kind of random discrepancy due to distribution of small primes, it would eventually vanish for large $k$s, which I don't observe. Printing the value of a variable in SQL Developer How do I  prevent .xsession-errors from eating disk space? Constant term in Lagrangian Why can we always drop any constant term in a Lagrangian density in quantum field theory?  This issue is somehow related to the constant term being some kind of cosmological constant.  Can you please explain this issue? How to get the current time in Python What is the module/method used to get the current time? Open terminal window and execute Python script on startup I have a Python script which I would like to execute at every startup. I can run it by adding this to the startup applications:  python3 /path/to/script.py   That works, but it doesn't open a terminal window, so I can't see the program's output. How could I make it open a terminal window and execute the script in there?  Note: I get the window to stay open with input(' ') at the end of the Python script. Thanks! Is there only a single Skywalker family? Given the size of the Empire, it seems highly probable that names would be reused. Although I'm not aware of any in canon, there must be other Skywalkers in the galaxy, leading me to my question.  Are there other Skywalkers in the galaxy, and are they mentioned in canon? Does Luke have any third cousins twice removed (etc.)?  Bonus points if you can attest to force sensitivity among the surname. Clipping a figure to content Is it possible to clip a figure inserted with \includegraphics to contents? That is, remove all surrounding whitespace. When one wants to list various cases/classes/categories/types of objects in a string of conjunctions, is it preferable (or even mandatory) to keep on using (the same) preposition in front of each one them?  Moreover, does singular or plural form of the word "case", "class", "category" make any difference in the previous question?  Examples:   In the present article, we study the case of X, of Y and of Z objects. (in this example, as in most of the ones I have in mind, it is the preposition "of" which is relevant to my question). We study the cases/classes of X and of Y objects. vs. We study the cases/classes of X and Y objects.   Although it is rather clear that, in the singular case, the absence of "of" in later conjuncts may lead to a logical confusion (e.g., mistakenly taken as the one class/case of objects which are both X and Y), when it comes to plural of the words "case", "class", etc., this might not be an issue. Still, there might anyway be a rule in the plural setting as well. I  that there are two folders for unit files (not in user mode). /usr/lib/systemd/system/: units provided by installed packages /etc/systemd/system/: units installed by the system administrator  Conflicting with this understanding is the answer to this question: . Can someone fill in the missing information so that I understand what is going on? (UPDATE: The answer has been updated, and my understanding no longer conflicts with it.) Also, it seems that the scripts are organized in subfolders within the /etc/systemd/system/ folder: getty.target.wants multi-user.target.wants  In another location I read that there are other locations. It seems these are for user-specific services. /usr/lib/systemd/user/ where services provided by installed packages go. /etc/systemd/user/ where system-wide user services are placed by the system administrator. ~/.config/systemd/user/ where the user puts its own services.   Update 2015-08-31: For the sake of others, here is a link to a related question I recently asked: There is a socket related function call in my code, that function is from another module thus out of my control, the problem is that it blocks for hours occasionally, which is totally unacceptable, How can I limit the function execution time from my code? I guess the solution must utilize another thread. New phone: How to transfer game progress? I'm planning to buy a new Android phone and I'd like to be able to transfer the progress I have made at several games to the new device, so I won't have to play all the levels again from scratch.  I currently have an HTC Desire and will buy an HTC Evo 3D.  There's probably no simple/general solution to this.  But I was wondering if anyone did something similar and could provide some advice (e.g. where to look for files that might hold game progress information). Don't heavier objects actually fall faster because they exert their own gravity? The common understanding is that, setting air resistance aside, all objects dropped to Earth fall at the same rate. This is often demonstrated through the thought experiment of cutting a large object in half. The halves clearly can't then fall more slowly just by being sliced in two.  However, I believe the answer is that when two objects fall together, attached or not, they do "fall" faster than an object of less mass alone does. This is because not only does the Earth accelerate the objects toward itself but the objects also accelerate the Earth toward themselves. Considering the formula: $$ F_{\text{g}} = \frac{G m_1 m_2}{d^2} $$  Given $F = ma$ thus $a = F/m$, we note that the mass of the small object doesn't seem to matter as when calculating acceleration the force is divided by the $m$ term, its mass. However, this overlooks that the force is actually applied to both objects, not just to the smaller one. The acceleration on the second, larger object is found by dividing $F$, in turn, by the larger object's mass. The two objects' acceleration vectors are exactly opposite, so closing acceleration is the sum of the two:  $$ a_{\text{closing}} = \frac{F}{m_1} + \frac{F}{m_2} $$  Since the Earth is extremely massive compared to everyday objects, the acceleration imparted on the object by the Earth will radically dominate the equation. As the Earth is $\sim 5.972 \times {10}^{24} \, \mathrm{kg} ,$ a falling object of $5.972 \, \mathrm{kg}$ (just over 13 pounds) would accelerate the Earth about $\frac{1}{{10}^{24}}$ as much, which is one part in a trillion trillion.  Of course in everyday situations, we can for all practical purposes treat objects as falling at the same rate because of this negligible difference—which our instruments probably couldn't even detect. But I'm hoping not for a discussion of practicality or what's measurable or observable, but what we think is actually happening.  Am I right or wrong?  What really clinched this for me was considering dropping a small Moon-massed object close to the Earth and a small Earth-massed object close to the Moon. This made me realize that falling isn't one object moving toward some fixed frame of reference, but that the Earth is just another object, and thus "falling" consists of multiple objects mutually attracting in space. Would you capitalize the job title in the following sentence?      I am writing this letter in regard to Joe Brown who is applying for the director of teaching and learning position in the XYZ School District.