I have the following code:  dp = [[False]*n]*n for i in range(n):     dp[i][i] = True   But it will set all elements to true. For example, for n=2, I will get [[True, True], [True, True]] where I am expecting [[True, False], [False, True]]  Can anyone explain this?
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?
My primary server with SQL Server 2005 broke down, so I've started up the log-shipped database on the secondary server. The database is live on the secondary server, and I just need to remove the log shipping settings for it, while the primary server is no longer accessible.  It seems that the sp_delete_log_shipping_secondary_database stored procedure should be executed on the secondary server to do this, which "removes a secondary database and removes the local history and remote history", as it is stated on .  Would this also remove the database itself? Or only the log shipping settings for it? And what will it do when the primary server is not accessible?  I must not loose the database on the secondary server, as it is already in use. Calculationg base-resistor between microcontroller and transistor I'm curious, when connecting my 2N2222 transistor's base to a PWM output pin on my Arduino, I know the Arduino can deliver a maximum of 40mA current. The 2N2222 only requires around 5 to 10 mA on it's base to switch the collector and emitter. Now, when calculating the base-resistor under "normal" conditions where I'm merely switching it directly from Vcc, the following applies:   However, when putting in a 500 ohm or 1K resistor in (1K for 5mA) directly it works great. But putting it in between the Arduino and the transistor, the transistor doesn't switch.  I suspect thus, that the resistance is too high of the base-resistor. Therefore, we may very well not need a base-resistor.  But, according to spec, the Arduino can deliver 40mA. So, am I correct in assuming the folling: 1) I should calculate the perceived resistance that the Arduino is giving, if it goes high to 5Volt and only gives 40mA, and then 2) Subtract that from the 500ohm resistor needed to make the transistor operate optimally.  Example:    So, I'm theorising that I have to then put in a 375 ohm resistor in to make the total resistance between the Arduino and the base resistor 500 ohm.  Somehow this doesn't feel right. Keep in mind, I'm not an electronic engineer, so I might have the cat by the tail here :P Why does Beamer's table of contents items link to the second slide in a section? When I include a table of contents in a Beamer slide show, each section entry in the TOC ends up linking to the second slide in that section. I would have expected it to link to the first slide. What am I doing wrong?:  \documentclass{beamer}  \begin{document} \begin{frame}{Test TOC}   \tableofcontents \end{frame}  \section{Section 1}  \begin{frame}   \frametitle{Test 1} \end{frame}  \begin{frame}   \frametitle{Test 2} \end{frame}  \end{document}   Just to clarify: when I click Section 1 in the TOC, it takes me to the slide Test 2.  UPDATE: I am actually not sure if it takes me to slide Test 2. When I click the link, the viewer (Evince and Okular) displays most of Test 2, but with a tiny strip of the slide Test 1 visible at the top of the window. I suspect that the viewer may treat the link as pointing to the very bottom of slide Test 1 and then aligns that with the top of the window. Could this be the explanation? I know and have observed that the the division algorithm can be used to convert any number in the decimal system to the binary system. However, I have tried searching for an intuition of why this method works, and I just can't seem to see anything, although I know what type of intuition I am trying to make out.   So, my question is why we can use the division algorithm to convert between the decimal bases and any other number bases?   An example from the decimal system to binary would be appreciated. I have to prove that:     $$\sum_{k=0}^{n} {{m+k} \choose{m}} = { m+n+1 \choose m+1 }$$   I tried to open up the right side with Pascal's definition that: $$ { n \choose k} = {n-1 \choose {k}} + {n-1 \choose {k-1}}$$  Here is what I came up with, and I am sure it is wrong because it does not equal the left side:  $$ {m+n+1 \choose m+1} = {m+n \choose m+1} + {m+n \choose m} = ... ={m+n \choose m+1} + {m+n-1 \choose m} + {m+n-2 \choose m-1} + ... + {m \choose m+1} = \sum_{k=0}^{n} {m+k \choose m+k-n+1 }  $$  Which, again, probably is wrong because it is not equal $\sum_{k=0}^{n} { m+k \choose m}$. Any help is appreciated How can a file be copied? I am a Chinese citizen holding a HK SAR passport. How long am I able to visit the UK within a 365-day period?  My stamp is for 6 months. Could I leave within 6 months but re-enter again a couple of weeks for another 6 months? Is it possible to find all classes or interfaces in a given package? (Quickly looking at e.g. , it would seem like no.) Convergence of $\int\limits_1^{\infty}x^\alpha\sin(x^\beta)dx$ I need to show that $$ \int\limits_1^{\infty}x^\alpha\sin(x^\beta)dx $$ converges if and only if $\alpha + 1 &lt; \beta$. I used substitution and integration to get $$ \lim\limits_{t\to\infty}\int\limits_1^tx^\alpha\sin(x^\beta)dx \overset{u = x^\beta}{\underset{du = \beta x^{\beta-1}}{=} }\lim\limits_{t\to\infty}\left(\frac{1}{\beta}\int\limits_1^{t^\beta}u^{\frac{\alpha + 1 - \beta}{\beta}}\sin{u}du\right) $$ If $\alpha + 1 -\beta &lt; 0$, then we have a product if a function with bounded anti-derivative and a differentiable decreasing function which tend to 0, and from Dirichlet's criterion, the integral converges.   For the converse, I used integration by parts $$  = \frac{1}{\beta}\lim\limits_{t\to\infty}\left(\left.-u^{\frac{\alpha + 1-\beta}{\beta}}\cos{u}\right|_1^{t^\beta} + \frac{\alpha+1-\beta}{\beta}\int\limits_1^{t^\beta}u^{\frac{\alpha + 1-2\beta}{\beta}}\cos{u}du\right) $$ For $\alpha + 1 -\beta\geq 0$, I get that the first term indeed diverges, but this is not enough to show total divergence. How can one show it? C++ iostream Corruption using stringstream Is it possible to unwrap materials made in Vertex Paint? I painted an group of objects in Blender using the Vertex Paint and was wondering if it would be possible to unwrap the mutliple materials(when the objects are joined together using Ctrl+J)? Do I have to paint it all over again? I am having an issue where DHCP (I though as I read in other similar topics) is clearing the /etc/resolv.conf file on each boot. I am not sure about how to deal with this since the post I have found (,  and some others) are for Debian based distros or other but not Fedora.  This is the output of ifcfg-enp0s31f6 so for sure is DHCP:  cat /etc/sysconfig/network-scripts/ifcfg-enp0s31f6  HWADDR=C8:5B:76:1A:8E:55 TYPE=Ethernet DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=no IPV6_AUTOCONF=no IPV6_DEFROUTE=no IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=enp0s31f6 UUID=0af812a3-ac8e-32a0-887d-10884872d6c7 ONBOOT=yes IPV6_PEERDNS=no IPV6_PEERROUTES=no BOOTPROTO=dhcp PEERDNS=yes PEERROUTES=yes   In the other side I don't know if Network Manager is doing something else around this.  Update: Content of NetworkManager.conf (I have removed the comments since are useless)  $ cat /etc/NetworkManager/NetworkManager.conf  [main] #plugins=ifcfg-rh,ibft dns=none  [logging] #domains=ALL   Can I get some help with this? It's annonying be setting up the file once and once on every reboot.  UPDATE 2  After a month I'm still having the same issue where file gets deleted by "something".   Here is the steps I did follow in order to make a fresh test:   Reboot the PC After PC gets restarted open a terminal and try to ping Google servers of course without success:  $ ping google.com ping: google.com: Name or service not known  Check the network configuration were all seems to be fine:  $ cat /etc/sysconfig/network-scripts/ifcfg-enp0s31f6  NAME=enp0s31f6 ONBOOT=yes HWADDR=C8:5B:76:1A:8E:55 MACADDR=C8:5B:76:1A:8E:55 UUID=0af812a3-ac8e-32a0-887d-10884872d6c7 BOOTPROTO=static PEERDNS=no DNS1=8.8.8.8 DNS2=8.8.4.4 DNS3=192.168.1.10 NM_CONTROLLED=yes IPADDR=192.168.1.66 NETMASK=255.255.255.0 BROADCAST=192.168.1.255 GATEWAY=192.168.1.1 TYPE=Ethernet DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=no  Restart the network service:  $ sudo service network restart [sudo] password for &lt;current_user&gt;:  Restarting network (via systemctl):                        [  OK  ]  Try to ping Google servers again, with no success:  $ ping google.com ping: google.com: Name or service not known  Check for file /etc/resolv.conf:  $ cat /etc/resolv.conf  cat: /etc/resolv.conf: No such file or directory  File doesn't exists anymore - and this is the problem something is deleting it on every reboot Create the file and add the content of DNS:  $ sudo nano /etc/resolv.conf   Ping Google servers this time with success:  $ ping google.com PING google.com (216.58.192.110) 56(84) bytes of data. 64 bytes from mia07s35-in-f110.1e100.net (216.58.192.110): icmp_seq=1 ttl=57 time=3.87 ms    Any ideas in what could be happening here? Why is $SO(3)\times SO(3)$ isomorphic to $SO(4)$? How to change the font color of a disabled TextBox? How to harden an SSH server? I have installed Ubuntu 13.04 on my desktop (runs like a charm). Then I used Crouton to install Ubuntu 12. 04 on my chromebook samsung (ARM). It also works quite well.  Here comes my question. Can we have a true Ubuntu (preferably 13.04) on my ARM chromebook?  It seems that the Crouton/Ubuntu is not 100% the real thing.  The best option would be to have the full Ubuntu 13.04 and remove the Chrome OS. Why is it that Android still can't be installed as regular OS? $n$th derivative of $e^x \sin x$ How can I change some pages into document into landscape mode, while leaving the others in portrait mode (or vice versa)? Is there a general theorem stating why the restricted Lorentz group's exponential map is surjective? The exponential map for the restricted Lorentz group is surjective. An outline of why is shown on the wiki page .  Is there a more general theorem that states that for some class of Lie groups or Riemannian manifolds (which includes the restricted Lorentz group), the exponential map is surjective?  There is a theorem stating that compact, connected Lie groups have surjective exponential maps. But as the restricted Lorentz group is not compact, this isn't applicable.