why there is no clone operation for collections in Java ? There must be able to copy the contents of the collections to a new collection and modify the second collection without affecting the first one
How can I clone an ArrayList and also clone its items in Java?  For example I have:  ArrayList&lt;Dog&gt; dogs = getDogs(); ArrayList&lt;Dog&gt; clonedList = ....something to do with dogs....   And I would expect that objects in clonedList are not the same as in dogs list.
Determining the Orbits/Orbit Space of $O(3)$ on Real 3 by 3 Traceless Symmetric Matrices Let $O(n)$ be the set of $3 \times 3$ orthogonal matrices, and $S$ be the set of traceless real symmetric $3 \times 3$ matrices.  Now  $O(n)$ will act on $S$ by conjugation. Note that by the spectral theorem $ \forall A \in S$ in the orbit of $A$ there is a diagonal matrix $D=diag(\lambda_1, \lambda_2,\lambda_3)$ with $\lambda_1\le\lambda_2 \le\lambda_3 $.  Determine the all the orbits of the action &amp; the orbit space of the action.  What I've done:  Since all elements of $S$ are diagonlizable that the orbit of any element should be the orbit of its' diagonalized form because $\forall A \in S,   \exists P \in O(3)$ st  $PAP^t=D $ with $D$ a diagonal matrix and moreover for any other  $Q\in O(3)$ we get $QDQ^t=QPAP^tQ^t=(QP)A(QP)^t=RAR^t$.   And so would that imply the orbit space is just the set of traceless diagonal matrices as $tr(QDQ^t)=tr(DQ^tQ)=tr(Q)$ (cyclic property of trace) and $Q\in S$.  Any help is appreciated. I have a StreamReader object that I initialized with a stream, now I want to save this stream to disk (the stream may be a .gif or .jpg or .pdf).  Existing Code:  StreamReader sr = new StreamReader(myOtherObject.InputStream);    I need to save this to disk (I have the filename). In the future I may want to store this to SQL Server.   I have the encoding type also, which I will need if I store it to SQL Server, correct? I am trying to do a clean install of the octave3.2 package.   To do this, I removed it, then tried to reinstall it.   When I reinstalled, an error occurred. It could be a bug in the package, but I want to make sure I have everything removed so that I can do a clean install.  Is it enough to do this?  sudo apt-get --purge remove octave3.2 How did nobody at Hogwarts (especially Dumbledore) figure out what killed Myrtle? The information is all clearly there, since Harry and Ron, two 12-year-olds, were able to figure it out (with a bit of help from a petrified Hermione), thought at the time Aragog was much younger and smaller and wouldn't have been as easy to find, so maybe the "spiders flee before it" clue would have been lost, although to be honest it's not exactly as vital a piece of the puzzle as the others.  Dumbledore himself is obviously a very capable and intelligent Wizard, and after Myrtle died she came back as a ghost and was able to provide (admittedly limited) details of her own death.  I don't know about you, but I'd have thought at least someone would have tried to piece it together at the time, and it wouldn't have taken them long to figure out "Oh, she saw a pair of big yellow eyes after hearing a boy speak a funny language in the bathroom and dropped dead? Sounds like she might have heard somebody order a Basilisk to look her in the eyes in parseltongue", especially if the investigator in question was someone like Dumbledore.  Do we have any info on why nobody seemed to have found out anything in 50 years prior to Harry Potter (and, probably more importantly, Hermione Granger) turning up at Hogwarts? Is there a specific term for a statement that uses words such that their precise meaning conveys a subtext contrary to the colloquial meaning?  For example, the joke in Men in Black:     Gentlemen, congratulations. You're everything we've come to expect   from years of government training.   where the precise use of the words conveys a sarcastic meaning (ie that the candidates are inept because that's what he's come to expect from government training).  I was going to use "irony" to describe this but then realized this is basically the opposite of irony - the use of words to convey their literal intention, when a nonliteral intention was expected. How to plot an image with non-linear y-axis with Matplotlib using imshow? Python HTTPS requests (urllib2) to some sites fail on Ubuntu 12.04 without proxy I have an little app I wrote in Python and it used to work... until yesterday, when it suddenly started giving me an error in a HTTPS connection. I don't remember if there was an update, but both Python 2.7.3rc2 and Python 3.2 are failing just the same.  I googled it and found out that this happens when people are behind a proxy, but I'm not (and nothing have changed in my network since the last time it worked). My syster's computer running windows and Python 2.7.2 has no problems (in the same network).  &gt;&gt;&gt; url = 'https://www.mediafire.com/api/user/get_session_token.php' &gt;&gt;&gt; response = urllib2.urlopen(url).read()   File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen     return _opener.open(url, data, timeout)   File "/usr/lib/python2.7/urllib2.py", line 400, in open     response = self._open(req, data)   File "/usr/lib/python2.7/urllib2.py", line 418, in _open     '_open', req)   File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain     result = func(*args)   File "/usr/lib/python2.7/urllib2.py", line 1215, in https_open     return self.do_open(httplib.HTTPSConnection, req)   File "/usr/lib/python2.7/urllib2.py", line 1177, in do_open     raise URLError(err) urllib2.URLError: &lt;urlopen error [Errno 8] _ssl.c:504: EOF occurred in violation of protocol&gt;   What's wrong? Any help is appreciated.  PS.: Older python versions don't work either, not in my system and not in a live session from USB, but DO work in a Ubuntu 11.10 live session. A large number of variants of this question were already asked here, including these - , , which are close, but none seem to answer my question. Assume that $n$ balls are thrown randomly and independently into $k$ bins.  What is the probability of finding $x$ empty bins? What is the expectation of the number of empty bins? Yes, I'm a moron, and I tried to manually install a higher point release of python 2.7.16 to /usr/bin/  (i did ./configure --prefix=/usr) on my Ubuntu 16.04 machine. It seems to work fine EXCEPT for packages that depended on python, like apt-listchanges, which fails with messages like ImportError: No module named apt_pkg  there's no make uninstall available, I've tried manually removing files, and still when I try apt --reinstall install python, Nothing gets overwritten and the python executable still gives the new 2.7.16 version...   Any idea how to get the official repository version back?? Trying to find vehicles which are free between 2 variable dates Question on how to normalize regression coefficient Not sure if normalize is the correct word to use here, but I will try my best to illustrate what I am trying to ask. The estimator used here is least squares.  Suppose you have $y=\beta_0+\beta_1x_1$, you can center it around the mean by $y=\beta_0'+\beta_1x_1'$ where $\beta_0'=\beta_0+\beta_1\bar x_1$ and $x_1'=x-\bar x$, so that $\beta_0'$ no longer has any influence on estimating $\beta_1$.  By this I mean $\hat\beta_1$ in $y=\beta_1x_1'$ is equivalent to $\hat\beta_1$ in $y=\beta_0+\beta_1x_1$. We have reduced equation for easier least square calculation.  How do you apply this method in general? Now I have the model $y=\beta_1e^{x_1t}+\beta_2e^{x_2t}$, I am trying to reduce it to $y=\beta_1x'$. What is "my guy syndrome" and how do I handle it? I've been reading forum posts and blogs who mention "my guy" syndrome as a specific type of difficult player, but I can't seem to find a solid definition for the term. Can someone explain this particular kind of problem player to me? How do you deal with this kind of problem? What is the difference between an "API," a "framework," an "IDE," and an "engine?" Removing the password from a PDF file I have a couple of ebooks as PDFs with passwords, however my ebook reader (sony prs600) doesn't seem to support PDFs with passwords.  What is the easiest of removing the password from a PDF (I know the password, which presumably helps a lot).  It's a bit annoying buying a book and then only being able to read it in front of a computer. What's the C++ way of parsing a string (given as char *) into an int? Robust and clear error handling is a plus (instead of ). Possible Duplicate:        When I click 'Unanswered' in the menubar, I get a list of questions, all of which have been answered. Does it just mean there's no accepted answer? If so, can we make that more obvious? Can we get some way of finding really unanswered questions? HDMI/Displayport audio control for OS X How can I fix silverLight problem? Is it acceptable to say "fed up OF" - surely it should be "fed up WITH" or "bored WITH something" rather than "bored OF something"? Is it okay to ask a professor from another university for class lecture notes of a course that he offered on that university? I find two very interesting courses that were offered in the Spring 2019 semester at ETH Zürich. Unfortunately, their class lecture notes are not shared publically. I wonder if it is appropriate to email the professors and ask them for class notes.