I would like to do a deep copy of a primitive array of n dimensions.  public static double[] deepCopy(double[] arr) {     return arr.clone(); }  public static double[][] deepCopy(double[][] arr) {     arr = arr.clone();     for (int i = 0; i &lt; arr.length; i++) {         arr[i] = deepCopy(arr[i]);     }     return arr; }  public static double[][][] deepCopy(double[][][] arr) {     arr = arr.clone();     for (int i = 0; i &lt; arr.length; i++) {         arr[i] = deepCopy(arr[i]);     }     return arr; }   Above is the code to deep copy a double array of 1, 2, and 3 dimensions. I would like to generalize for any primitive type and/or generalize for the dimension of the array. I would like both, but I know a lot of things in Java are not possible, so it is okay if you can only get one, or tell me why it wouldn't work.  Thank you!
It's a bit difficult to implement a deep object copy function. What steps you take to ensure the original object and the cloned one share no reference?
Setting "checked" for a checkbox with jQuery I am working on a proof about Dedekind cuts on the positive rational numbers. I have been stuck for a while on the following point and would appreciate any help.  Given $x\in \mathbb{Q}^+$ such that $x^2&lt;2$, how to find $y\in \mathbb{Q}^+$ such $y&gt;x$ and $y^2&lt;2$? Show that $\sum\limits_{n=0}^\infty \frac{z}{(1+z^2)^n}$ converges for all $z\in \mathbb{C}$ outside $|1+z^2|=1$ Show that $\sum\limits_{n=0}^\infty \frac{z}{(1+z^2)^n}$ converges for all $z\in \mathbb{C}$ outside $|1+z^2|=1$  Actually, I have the problem to understand the meaning of "outside $|1+z^2|=1$". If it means that the collection of $z\in\mathbb{C}$ such that $|1+z^2|&gt;1.$ This problem will be easy to verify since for each given $z$ with $|1+z^2|&gt;1$, then we have $|1+z^2|^{-1}&lt;1$. Then, it is the geometric series with common ratio less than $1$ which implies that the series converges.   Do I have correct interpretation with "outside $|1+z^2|=1$"? If not, what is the correct interpretation with this? Thanks. Loading a .X model in DirectX 9 Uniform convergence of $f_n(x)=nx^n(1-x)$ for $x \in [0,1]$? I want to decide whether or not $f_n(x)=nx^n(1-x)$ is uniformly convergent or not. I have shown that $\lim_{n\to\infty} f_n(x)=0$ for $x \in [0,1]$.  Now $f_n(0)=f_n(1)=0$. And in $(0,1)$, we have $f'_n(x)=n^2x^{n-1}-n(n+1)x^n$. Putting this to zero gives $x=\frac{n}{n+1}$. Also $f_n(\frac{n}{n+1})=(\frac{n}{n+1})^{n+1}$. But that tends to $\frac{1}{e}$ as $n$ tends to $\infty$ which is not $0$ so we don't have uniform convergence, right?  Nonetheless we have $\lim_{n\to\infty} \int_0^1 f_n(x)dx=\lim_{n\to\infty} (\frac{n}{n+2}-\frac{n}{n+1})=0=\int_0^1 \lim_{n\to\infty} f_n(x)dx$.  Is all this right? I have some doubts, I mostly doubt my intuition in analysis... Thank you! Why must a final variable be initialized before constructor completes? So I came across this exercise: Show that if $Y$ is path-connected then the set of homotopy classes $[I,Y]$ of maps of $I=[0,1]$ into Y has a single point.   But I am confused here. If $Y=S^1$ then not all loops are homotopic! I mean, isn't true that $\pi_1(Y)\subset [I,Y]$? Or maybe I don't understand the set $[I,Y]$ well! "I don't know nothing" vs "I don't know anything" Possible Duplicate:             I'm not a native English speaker, and this question may be very basic, but I want to learn English better, so don't hurt me with downvotes.  What is the difference between "I don't know nothing" and "I don't know anything"?  Do they have the same meaning or opposite ones? I have a Python regular expression that contains a group which can occur zero or many times - but when I retrieve the list of groups afterwards, only the last one is present. Example:  re.search("(\w)*", "abcdefg").groups()  this returns the list ('g',)  I need it to return ('a','b','c','d','e','f','g',)  Is that possible? How can I do it? The $n$ complex $n$th roots of a complex number $z$ Suppose $z$ is a nonzero complex number, so $z=re^{i\theta}$. Show that there are only $n$ distinct complex $n$-th roots, given by $r^{1/n}e^{i(2\pi k+\theta)/n}$ for $0\leq k\leq n-1$.   My proof: Let $z=re^{i\theta}\in\mathbb{C}$ and $a\in\mathbb{C}$ s.t. $a^{n}=z$. Let $a=\rho e^{i\varphi}$. Then, $a^{n}=(\rho e^{i\varphi})^{n}$. Setting $\rho^{n}e^{i\varphi n}=re^{i\theta}$ and rewriting in polar form, we get $$\rho^{n}(\cos(n\varphi)+i\sin(n\varphi))=r(\cos(θ)+i\sin(\theta)).$$ Thus $\rho^{n}=r$ $\rightarrow$ $\rho=r^{1/n}$ and $n\varphi=\theta\rightarrow\varphi=\theta/n$. Thus the roots of $a\in\mathbb{C}$ have the form $$r^{1/n}(\cos(\tfrac{\theta}{n})+i\sin(\tfrac{\theta}{n}))=r^{1/n}(\cos(\tfrac{\theta}{n}+2\pi j)+i\sin(\tfrac{\theta}{n}+2\pi j))$$ for some $j\in\mathbb{Z}$ due to the periodicity of trig functions. Then, $$r^{1/n}(\cos(\tfrac{\theta}{n}+2\pi j)+i\sin(\tfrac{\theta}{n}+2\pi j))=r^{1/n}e^{i\left(2\pi j+\tfrac{\theta}{n}\right)}=r^{1/n}e^{i(\theta+2\pi k)/n}$$ for $0\leq k\leq n-1 ,j=nk\in\mathbb{Z} $.  I feel like there could be a more concise way to put this. Let $\phi : R \to S$ be a homomorphism. If $N$ is an ideal of $S$, then $\phi ^{-1} (N)$ is an ideal of $R$. "Was" or "were" for "half a dozen" In Microsoft Word, the following sentence is flagged.  It tells me to use "was" instead of "were"     There were half a dozen books strewn about the floor.   I would think that you would use "were" since it's a quantity more than one.  You wouldn't say, "There was twelve books strewn about the floor."  Does the use of the "half" modify it somehow? Is there a suffix for loathing? For instance trichomania is a love of hair, and trichophobia is a fear of hair. But what suffix would denote a loathing of hair?  Edit: Maybe I'm looking at the wrong end of the word, and I should be considering the prefix "miso-". Could we please be a bit nicer to new users? There is a distinct decline in the level of civility on all the sites here.  Some of this is due to new users coming in and posting spam and other nonsense, but the off-topic and downvote buttons are doing a pretty good job of keeping this under control. Unfortunately, a lot of this is coming from more experienced users, and the site's built-in moderation system does not (and probably cannot) handle this very well.  Folks are rushing to pound new users down with &quot;this belongs on meta!&quot;, &quot;this is off topic&quot;, &quot;this is a duplicate!&quot; and &quot;read the Help!&quot;. (Which is correct, but should be done nicer) All this, of course, is accompanied by a flurry of downvotes.  This is not very welcoming to new users who don't know about meta, the Help, or what counts as off-topic. Now I am not proposing that we just allow off-topic, meta, or duplicate questions.  However, I think we could be gentler in the way we express these sorts of things.  Explain what meta and the FAQ are and provide useful links.  Just using please and thank-you when asking folks to read the FAQ or post something on meta would be an improvement.  I also think we could rein in the downvoting a bit.  Not that we shouldn't vote stuff down, but unless a new user's post is clearly spam, voting it down to -1 or -2 should be sufficient to send a message without piling on. I like Stack Exchange and I want it to become a resource for everyone, not just an elitist site for high-rep users on the sites. Mapping/texturing inside of a box I'm trying to replace the content of a box in a video, I have used the tracking system to match the movement of the video box with the interior of the one rendered in Blender, but I am running trough what seems a simple thing but I can't manage to get done.   I want the outside faces of the box to be invisible while hiding the inside of the box where the front wall of the box hides it, and the inside of the box to be rendered where visible. To do that I thought it would be as simple as making the face normals point to the inside of the box and giving a color only to the faces where normals are pointing to. But I can't manage to get that, am I going the wrong road? How can I achieve my goal? Easiest way to delete a column? I have a set of 10 tables and each has an extra column that I don't want. Specifically, these tables are descriptions of database tables exported by phpMyAdmin, and they all have a "MIME" column that I would like to remove. Is there a way to do this other than using string manipulation / find and replace?   I have tried setting the column to p{0in}, but the column title still remains. How do I get the value of text input field using JavaScript? On iPhone it's very easy to clone an app (running multiple copies of the app on the same device); e.g.:    Is it possible to do this on Android? What a pluperfect a##hole Is there a way to view your own progress towards certain badges? For example:   Tumbleweed - What value constitutes low views for a week? Fanatic  – Is there a way to view how many days in a row you currently have? Beta – Is it even possible to get this badge anymore?