I'm trying to modify the list of lists:  list = [['0', '0', '0', '0', '0', '0'], ['0', '0', '0', '0', '0', '0'], ['0', '0', '0', '0', '0', '0'], ['0', '0', '0', '0', '0', '0'], ['0', '0', '0', '0', '0', '0']]   in particular when I assign list[0][1]='X', list is now:  [['0', 'X', '0', '0', '0', '0'], ['0', 'X', '0', '0', '0', '0'], ['0', 'X', '0', '0', '0', '0'], ['0', 'X', '0', '0', '0', '0'], ['0', 'X', '0', '0', '0', '0']]   instead of just reassigning the second element of the first sub list, it reassigns the first element of every sub list. I don't understand why this is happening. Does anyone know?
I needed to create a list of lists in Python, so I typed the following: my_list = [[1] * 4] * 3  The list looked like this: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]    Then I changed one of the innermost values: my_list[0][0] = 5  Now my list looks like this: [[5, 1, 1, 1], [5, 1, 1, 1], [5, 1, 1, 1]]    which is not what I wanted or expected. Can someone please explain what's going on, and how to get around it?
How can I override the OnBeforeUnload dialog and replace it with my own? I need to warn users about unsaved changes before they leave a page (a pretty common problem). window.onbeforeunload = handler  This works but it raises a default dialog with an irritating standard message that wraps my own text. I need to either completely replace the standard message, so my text is clear, or (even better) replace the entire dialog with a modal dialog using jQuery. So far I have failed and I haven't found anyone else who seems to have an answer. Is it even possible? Javascript in my page: &lt;script type=&quot;text/javascript&quot;&gt;        window.onbeforeunload = closeIt; &lt;/script&gt;  The closeIt() function: function closeIt() {   if (changes == &quot;true&quot; || files == &quot;true&quot;)   {       return &quot;Here you can append a custom message to the default dialog.&quot;;   } }  Using jQuery and jqModal I have tried this kind of thing (using a custom confirm dialog): $(window).beforeunload(function () {     confirm('new message: ' + this.href + ' !', this.href);     return false; });  which also doesn't work - I cannot seem to bind to the beforeunload event. Why didn't the Hobbits get frostbite? This is a question that's been bothering me for the last couple of days:  How is it that the hobbits of the Fellowship were able to survive such cold temperatures throughout their travels without having any foot protection?   I know it's said that they have thick "leather like" soles, with ample amounts of hair for warmth but still, I don't understand how that could provide much more warmth than for instance a regular leather shoe. On top of this I know that multiple days (or even weeks) of their journey was spent crossing mountain ranges, which, near a summit would have a temperature far below freezing. This combined with the assumption that they only have the warmth of shoes on there feet would have presumably resulted in some level of frostbite. But to my knowledge there is no such mention of these problems in the novels or movies aside from the odd "It's cold".  Anyways, I'm just wondering if anyone has some form of explanation to this phenomenon or do hobbits just have really durable feet? Should the site prompt new users to include an @name in comments? Translation help review queue? $M$ connected $\iff$ $M$ and $\emptyset$ are the only subsets of $M$ open and closed at the same time I'm trying to understand this proof that:  $M$ connected $\iff$ $M$ and $\emptyset$ are the only subsets of $M$ open and closed at the same time  Which is:  If $M=A\cup B$ is a separation, then $A$ and $B$ are open and closed. Recriprocally, if $A\subset M$ is open and closed, then $M = A\cup(M-A)$. What? I know that if $M=A\cup B$ is a separation, $A$ and $B$ are both open. But why closed? Also, the 'recriprocally' part is totally nonsense to me. Anybody could help?  Also, there's another proof, which states: $M$ and $\emptyset$ are the only subsets of $M$ at the same time closed and open $\iff$ if $X\subset M$ has empty boundary, theb $X=M$ or $X=\emptyset$  which is proved as the following:  given $X\subset M$, we know the condition $X\cap \partial X = \emptyset$ implies $X$ is open, while the condition $\partial X \subset X$ implies $X$ is closed. Then, $X$ is open and closed $\iff$ $\partial X = X\cap \partial X = \emptyset$, this show $\iff$ for the theorem above.  First of all, I think that the condition $X$ has boundary empty implies that $X\cap \partial X$ is empty, but who said anything about $\partial X\subset X$? Also, where's the $\rightarrow$ of this proof? I can only see $\leftarrow$ What's the problem with my Young slits experiment? My Young's slits experiment doesn’t work. I mean I tried to see wave effect of light but I didn’t see any thing expect particles! I’ve sent you a pic of my laser and a short video of the experiment. Is there any problem you think? How to evaluate $ \lim_{(x,y)\to(0,0)}\frac{y^2\sin^2x}{x^4+y^4} $ Server login attempts NOT blocked after configuring fail2ban So, I installed (and configured) fail2ban on three Ubuntu VPS servers. I configured (imo) a maximum of 3 failed login attempts (via Putty as root) within 2 minutes. Then I restarted the fail2ban service (according to ).    But when I look at my auth.log files in /var/log/ I still see 4, 5 or more failed attempts from certain IP's. So obviously I did something wrong as the IP is not blocked after 3 failed attempts.   It might have to do something with iptables, but that's where it gets a bit "foggy" for me..   Not sure how to setup a max-three-failed-login-attempts rule..  Additional: I see that the login attempts mostly have different ports for every attempt. Does that influence the count to max-three?  Because I see a port being "poked" twice and then no more attempts. Then the IP tries a different port (again 2 times). (all bots of course) Should a user be forced to add a comment when they vote to close? I'm currently dual-booting to either Ubuntu 10.10 or Windows XP. However, I rarely use windows and would like to remove it.  I've use the Ubuntu live CD to access GParted. I've also deleted the windows partitions (I think), which were labeled both ntfs and fat32.  I'm just not sure how to extend the Ubuntu partition to cover the unallocated space. Furthermore, how do I deal with the 'key' designations, which state that a partition is busy.  Help! Can more than one antibody bind the same antigen I'd like to clear something up about antibodies that I'm not sure I've understood in the articles I've read. Looking at concepts such as "affinity maturation", "monovalent antigens" and "polyvalent antigens" it seems as if there are multiple antibodies which can bind to the same antigen. (Although I think I'm right in saying that individual antibodies can only bind to one antigen?) However, when I read sentences like "It has been estimated that humans generate about 10 billion different antibodies, each capable of binding a distinct epitope of an antigen" on the Wikipedia page (for antibody) it does make it sound like it's one antibody per antigen? Is this the case? Or is it one antibody per epitope. Either way, to put this question in a nutshell:  Is it true to say that the same substance could bind with (and, therefore, be recognised by) more than one antibody, or not?  Also, if the answer is no, does that mean that antibodies with different binding affinities are classed as the same antibody or not? Explanation of finite population correction factor? I understand that when sampling from a finite population and our sample size is more than 5% of the population, we need to make a correction on the sample's mean and standard error using this formula:  $\hspace{10mm} FPC=\sqrt{\frac{N-n}{N-1}}$  Where $N$ is the population size and $n$ is the sample size.  I have 3 questions about this formula:   Why is the threshold set at 5%? How was the formula derived? Are there other online resources that comprehensively explain this formula besides  paper? Minimum reputation for answering your own question should be higher than what is needed to ask If we're implementing , why don't we also require that users have at least 1.5 times the amount of reputation needed to ask their current question in order to answer their current question?  I believe this would really reduce the amount of non-answers that should have been edits to the original question, or perhaps a comment under another answer.  Edit  Inspired by marcog's excellent suggestion , perhaps it would make more sense to set a minimum amount of time that must pass before you can answer your own question. New users would need to wait in the neighborhood of six hours, while users with more reputation could answer their own question within minutes if they discovered the solution on their own.  This would get in the way of the behavior that we don't want, which is people posting answers that should have been edits while not annoying most. If $f:\mathbb R \to \mathbb R$ satisfies $f'(x) <L$ for some $L<1$, then $f$ has a unique fixed point Assume that $f: \mathbb{R} \rightarrow \mathbb{R}$  is differentiable.  If there exists an $L&lt;1$ such that for each $x \in \mathbb{R}$, $f'(x)&lt;L$, prove that there exists a unique point $x$ such that $f(x)=x$.  So far I have that where I fixed $a$ to be zero and came up with three cases to show existence for  $f(0) = 0$, $f(0) &lt; 0$, and $f(0) &gt; 0$  $f(0)=0$ was fairly trivial following from the mean value theorem but the other two cases I was only able to eliminate half of the possible fixed points by contradiction and I need help showing it explicitly.  Edit as to avoid confusion here is the work I have garnished so far:  From the mean value theorem it follows for some arbitrary $a,b \in \mathbb{R}$ and $a\neq b$ that there exists a point $c$ such that $a&lt;c&lt;b$ or $b&lt;c&lt;a$ then implies that $\frac{f(b)-f(a)}{b-a}=f'(c)$ and this is because it is differentiable on $\mathbb{R}$ and, by convention, is also continuous on $\mathbb{R}$ as well.  Then the result of $\dfrac{f(b)-f(a)}{b-a}=f'(c)$ then follows for $L&lt;1$ such that $\forall x \in \mathbb{R}$ means $f'(x)&lt;1$ from our hypothesis. Which then follows  (*) $\dfrac{f(b)-f(a)}{b-a}=f'(c)&lt;L&lt;1 \Rightarrow f(b)-f(a)&lt;L(b-a)&lt;b-a$  Now without loss of generality choose $a=0$ and let $b$ be some arbitrary value in $\mathbb{R}$ then there are three cases that need to be considered for the value of $f(a)$:  (i) $f(0) = 0$, (ii) $f(0) &lt; 0$, (iii) $f(0) &gt; 0$  (i) For $f(0)=0$   Then $0$ is a fixed point of point of $f(x)$ and it follows from (*) that if $f(0)=a=0$ then $f(b)-f(0)=f(b)&lt;Lb&lt;b$ which shows that $f(b)&lt;b$ thus shows that for any arbitrary value $b\in \mathbb{R}$ that no $f(b)=b$ thus shows that $0$ is the only fixed point if $f(0)=0$  (ii) For $f(0)&lt;0$  Suppose there exists a fixed point $d&gt;0$ then:  $\frac{f(d)-f(0)}{d}&lt;L&lt;1 \Rightarrow d-f(0)&lt; dL&lt;d \Rightarrow -f(0)&lt;d(L-1)&lt;0\Rightarrow 0&lt;-d(L-1)&lt;f(0)$ but this contradicts that $f(0)&lt;0$  thus no other fixed point exists if $d&gt;0$ when $f(0)&lt;0$  (iii) For $f(0)&gt;0$ Line of Bones to Travel and Conform to Curve (Train or snake following path) I've searched google extensively on this. Can't seem to find an answer.   I know about spline IK, which is wonderful for conforming a row of bones to a path. But combining the armature object with a follow path modifier causes the point of origin to move, but the bones themselves stick to the beginning of curve.   Ultimately my goal is to make a creature like a snake or centipede follow a curve path, thus animating it fairly realistically ... Nginx installation error in Ubuntu 16.04 :~$ sudo apt-get remove nginx* && sudo apt-get install nginx-full*  Reading package lists... Done Building dependency tree        Reading state information... Done  After this operation, 5,579 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 nginx-full-dbg amd64 1.10.0-0ubuntu0.16.04.1 [3,789 kB] Fetched 3,789 kB in 33s (112 kB/s)                                              Selecting previously unselected package nginx-common. (Reading database ... 189767 files and directories currently installed.) Preparing to unpack .../nginx-common_1.10.0-0ubuntu0.16.04.1_all.deb ... Unpacking nginx-common (1.10.0-0ubuntu0.16.04.1) ... Selecting previously unselected package nginx-full. Preparing to unpack .../nginx-full_1.10.0-0ubuntu0.16.04.1_amd64.deb ... Unpacking nginx-full (1.10.0-0ubuntu0.16.04.1) ... Selecting previously unselected package nginx-full-dbg. Preparing to unpack .../nginx-full-dbg_1.10.0-0ubuntu0.16.04.1_amd64.deb ... Unpacking nginx-full-dbg (1.10.0-0ubuntu0.16.04.1) ... Processing triggers for ufw (0.35-0ubuntu1) ... Rules updated for profile 'Apache Full' Rules updated for profile 'Nginx HTTP'  Processing triggers for systemd (229-4ubuntu4) ... Processing triggers for ureadahead (0.100.0-19) ... Processing triggers for man-db (2.7.5-1) ... Setting up nginx-common (1.10.0-0ubuntu0.16.04.1) ... Setting up nginx-full (1.10.0-0ubuntu0.16.04.1) ... Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.  invoke-rc.d: initscript nginx, action "start" failed.  dpkg: error processing package nginx-full (--configure):  subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of nginx-full-dbg:  nginx-full-dbg depends on nginx-full (= 1.10.0-0ubuntu0.16.04.1); however:   Package nginx-full is not configured yet.  dpkg: error processing package nginx-full-dbg (--configure):   dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure.                            Errors were encountered while processing:  nginx-full   nginx-full-dbg  E: Sub-process /usr/bin/dpkg returned an error code (1) What's the difference between a microcontroller and a microprocessor? How is $ \cos (\alpha / \beta) $ expressed in terms of $\cos \alpha $ and $ \cos \beta $? If it is possible to express  $ \cos n \alpha $ in terms of $ \cos \alpha $  as a power series for integer $n$ ...  I like to see an expression for the quotient angle that obviously tallies when $ (\alpha , \beta) $ are swapped.  EDIT1:  Something like:  $$ \cos (\alpha - \beta)= \cos \alpha \cos \beta  + \sin \alpha  \sin \beta $$  EDIT2:  Like to know why $ \cos ( \alpha / \beta )$ cannot be expressed in terms of $ \cos \alpha, \cos \beta $, but  $ \cos ( \alpha + \beta) $  can be expressed in terms of  $\cos \alpha $ and $ \cos \beta. $ Positioning of decorations on parallel lines how to make a 360 video (turntable) of an Object using a python script