I have trouble declaring a two-dimensional list in Python. Below are two different matrices; A and R. When changing the content of a single cell I am successful in the R-matrix, but not so much in the A-matrix, as the value-input affect the entire column and not only the single cell.  Why does this happen? I would prefer the A-style of declaring the matrix.   n=6  A = [[0]*n]*n     R=[[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], [0,0,0,0,0,0]]  R[1][1]=5 A[1][1]=5  print(R) print(A)   The output from the two operations is:  [[0, 0, 0, 0, 0, 0], [0, 5, 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, 5, 0, 0, 0, 0], [0, 5, 0, 0, 0, 0], [0, 5, 0, 0, 0, 0], [0, 5, 0, 0, 0, 0], [0, 5, 0, 0, 0, 0], [0, 5, 0, 0, 0, 0]]
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?
App Store asks for old Apple ID when installing updates I got a MacBook that a colleague of mine had used previously. It runs OS X 10.10.2. I created a new administrator account for myself and turned off the "admin" flag on the old account.  I also entered my iCloud / Apple ID account, so that it syncs my calendars and contacts correctly, and even in the App Store, I am signed in with my correct account.  But when I try to install pending software updates (that is, OS X system updates!), the window that pops up has the the e-mail address of my colleague filled in and greyed out—and I can't change it.     Note that I'm signed in with a different (correct) account in the App Store. When I go to Featured and click Account on the right, it has my correct e-mail address filled in:    How do I make the App Store "forget" the old Apple ID?  I  where it just says "it's not possible", and that apps are glued to the original account the Mac was set up with, but that doesn't make a lot of sense, especially in a company where laptops may be handed over from one person to another. A 10x10 table filled with 0 to 9 numbers Which browsers are officially supported, and what else do I need? Are there any expressions that describe going from a bad to a worse situation? Are there idioms or expressions in English that describe going from one bad situation to one that's even worse?  I heard "between a rock and hard place" but this describes a dilemma not really a transition. I am looking for an expression that describes someone trying to get out of a bad situation but after much effort, the situation only got worse. Prove that if $n$ is not the square of a natural number, then $\sqrt{n}$ is irrational. MathJax does not work on question title on Android app Although, the question is displayed correctly with MathJax when opened.   App Version: 1.0.85 Device Manufacturer: Spreadtrum Device Model: Celkon A35K   OS Version: 4.4.2 (eng.root.20140613.225402) Ignore folders/files when Directory.GetFiles() is denied access I am trying to display a list of all files found in the selected directory (and optionally any subdirectories). The problem I am having is that when the GetFiles() method comes across a folder that it cannot access, it throws an exception and the process stops.  How do I ignore this exception (and ignore the protected folder/file) and continue adding accessible files to the list?  try {     if (cbSubFolders.Checked == false)     {         string[] files = Directory.GetFiles(folderBrowserDialog1.SelectedPath);         foreach (string fileName in files)             ProcessFile(fileName);     }     else     {         string[] files = Directory.GetFiles(folderBrowserDialog1.SelectedPath, "*.*", SearchOption.AllDirectories);         foreach (string fileName in files)             ProcessFile(fileName);     }     lblNumberOfFilesDisplay.Enabled = true; } catch (UnauthorizedAccessException) { } finally {} One of the most common gauges in QED computations are the $R_{\xi}$ gauges obtained by adding a term  \begin{equation} -\frac{(\partial_\mu A^{\mu})^2}{2\xi} \end{equation} to the Lagrangian. Different choices of $\xi$ correspond to different gauges ($\xi=0$ is Landau, $\xi=1$ is Feynman etc.) The propagator for the gauge field is different depending on the choice of gauge. The choice of Landau gauge forces $\partial_\mu A^\mu=0$, but I have never seen a similiar statement for the other gauges. I would like to know what constraint on the gauge field is produced by the other covariant gauges. For instance, what is the constraint on $A_\mu$ when $\xi=1,2,3,...$ etc. Is it still $\partial_\mu A^\mu=0$ or something different (it seems like it should be different)? What is the difference between call and apply? I typically have two needs:  Scenario A. Change a single PDF page.  In this case I have a PDF but not the original source file used to create the PDF. I don't want to try to recreate the document from scratch. I'd like to open the PDF and change a few things. A good example of this scenario: I was responsible for planning a big event at a campground site, I had a PDF of the site. I wanted to start with that document, highlight some parts, add some labels, remove some parts that weren't relevant.   or   Scenario B. Combine PDFs or extract page(s) from a PDF  This scenario usually arises because I want a single PDF deliverable that is made up of parts that are best created in different programs. In this case I have the source files for all the documents but they don't play well enough together to easily create a single PDF deliverable. For part of it, I may want to use Libre Office Writer. For another page I may want to use Gimp. Still another page I may use Libre Office Calc. I could use Writer as the master document and embed images or the Calc object into that, but for ultimate control, you can't beat separate PDF documents that are then combined.  What are the best tools / processes for editing PDFs in Ubuntu? Local translations in curved spacetime A global Poincare transformation on a scalar field induces  $$\delta(a, \lambda)\phi(x) = [a^{\mu}+\lambda^{\mu\nu}x_{\nu}]\partial_{\mu}\phi(x). \tag{11.46}$$  In curved spacetime we replace $a^{\mu} \rightarrow \xi^{\mu}(x)$, but I read that in fact this new spacetime dependent parameter $\xi^{\mu}$ eats up the effect of the "orbital part of global Lorentz", so that in fact $\xi^{\mu}(x)=a^{\mu}(x)+\lambda^{\mu\nu}(x)x_{\nu}$, and we effectively have to treat $\xi^{\mu}$ and $\lambda^{ab}$ (the spin part of Lorentz) as the basis for gauge transformations.  I don't understand why this should be, any comments that might help? Why does the new local translation parameter include the effect of what globally used to be rotations/boosts?  References:   D.Z. Freedman &amp; A. Van Proeyen, SUGRA, 2012; p. 225. Does "corresponding author" carry an implied meaning? After reading the question , I got the impression that (at least in the writers' field) the "corresponding author" flag could carry an implied meaning, such as "did more work than the other authors", or "is a more senior author". Is it the case?  I am in mathematics, a field where we typically sort the authors alphabetically, and I've never given any importance to that role (apart from "this author is willing to answer a couple of extra e-mails, if needed"). How important is the following in purchasing a laptop that will be used for image editing:   processor speed amount of RAM integrated vs. dedicated graphics card HD speed (SSD; or 5400/7200/10000 rpm) Let $\Gamma$ denote the positively oriented circle of radius $2$ with center at the origin. Let $f$ be an analytic function on $\{z \in\mathbb{C} : |z|&gt;1 \}$, and let $$\lim_{z\to \infty}f(z)=0.$$  Prove that $$ f(z)=\frac{1}{2\pi i} \int_{\Gamma} \frac{f(\xi)}{z-\xi}d\xi,  $$ for all $z\in\mathbb{C}$ with $|z|&gt;2$.  I have no idea how to even start. Any hint will be appreciated. How do I monitor the computer's CPU, memory, and disk usage in Java? I would like to monitor the following system information in Java:   Current CPU usage** (percent) Available memory* (free/total) Available disk space (free/total)  *Note that I mean overall memory available to the whole system, not just the JVM.   I'm looking for a cross-platform solution (Linux, Mac, and Windows) that doesn't rely on my own code calling external programs or using JNI. Although these are viable options, I would prefer not to maintain OS-specific code myself if someone already has a better solution.  If there's a free library out there that does this in a reliable, cross-platform manner, that would be great (even if it makes external calls or uses native code itself).  Any suggestions are much appreciated.  To clarify, I would like to get the current CPU usage for the whole system, not just the Java process(es).  The SIGAR API provides all the functionality I'm looking for in one package, so it's the best answer to my question so far. However, due it being licensed under the GPL, I cannot use it for my original purpose (a closed source, commercial product). It's possible that Hyperic may license SIGAR for commercial use, but I haven't looked into it. For my GPL projects, I will definitely consider SIGAR in the future.  For my current needs, I'm leaning towards the following:   For CPU usage, OperatingSystemMXBean.getSystemLoadAverage() / OperatingSystemMXBean.getAvailableProcessors() (load average per cpu) For memory, OperatingSystemMXBean.getTotalPhysicalMemorySize() and OperatingSystemMXBean.getFreePhysicalMemorySize() For disk space, File.getTotalSpace() and File.getUsableSpace()   Limitations:  The getSystemLoadAverage() and disk space querying methods are only available under Java 6. Also, some JMX functionality may not be available to all platforms (i.e. it's been reported that getSystemLoadAverage() returns -1 on Windows).  Although originally licensed under GPL, it  to , which can generally be used for closed source, commercial products. Driver for Validity Sensors Fingerprint scanner prakhar@pr3d4tOr:~$ lsusb -s 001:003 -v  Bus 001 Device 003: ID 138a:0018 Validity Sensors, Inc. Fingerprint scanner Couldn't open device, some information will be missing Device Descriptor:   bLength                18   bDescriptorType         1   bcdUSB               1.10   bDeviceClass          255 Vendor Specific Class   bDeviceSubClass        17    bDeviceProtocol       255    bMaxPacketSize0         8   idVendor           0x138a Validity Sensors, Inc.   idProduct          0x0018 Fingerprint scanner   bcdDevice            0.78   iManufacturer           0    iProduct                0    iSerial                 1    bNumConfigurations      1   Configuration Descriptor:     bLength                 9     bDescriptorType         2     wTotalLength           46     bNumInterfaces          1     bConfigurationValue     1     iConfiguration          0      bmAttributes         0xa0       (Bus Powered)       Remote Wakeup     MaxPower              100mA     Interface Descriptor:       bLength                 9       bDescriptorType         4       bInterfaceNumber        0       bAlternateSetting       0       bNumEndpoints           4       bInterfaceClass       255 Vendor Specific Class       bInterfaceSubClass      0        bInterfaceProtocol      0        iInterface              0        Endpoint Descriptor:         bLength                 7         bDescriptorType         5         bEndpointAddress     0x01  EP 1 OUT         bmAttributes            2           Transfer Type            Bulk           Synch Type               None           Usage Type               Data         wMaxPacketSize     0x0040  1x 64 bytes         bInterval               0       Endpoint Descriptor:         bLength                 7         bDescriptorType         5         bEndpointAddress     0x81  EP 1 IN         bmAttributes            2           Transfer Type            Bulk           Synch Type               None           Usage Type               Data         wMaxPacketSize     0x0040  1x 64 bytes         bInterval               0       Endpoint Descriptor:         bLength                 7         bDescriptorType         5         bEndpointAddress     0x82  EP 2 IN         bmAttributes            2           Transfer Type            Bulk           Synch Type               None           Usage Type               Data         wMaxPacketSize     0x0040  1x 64 bytes         bInterval               0       Endpoint Descriptor:         bLength                 7         bDescriptorType         5         bEndpointAddress     0x83  EP 3 IN         bmAttributes            3           Transfer Type            Interrupt           Synch Type               None           Usage Type               Data         wMaxPacketSize     0x0008  1x 8 bytes         bInterval               4   I have searched high and low but I cannot get this to work. All questions related to 138a:0018 are either unanswered or old. Any help guys? Combinatorial argument for $\sum\limits_{k=i}^{n}\binom{n}{k}\binom{k}{i} = \binom{n}{i}2^{n-i}$ I need to show that $$\sum\limits_{k=i}^{n}\binom{n}{k}\binom{k}{i} = \binom{n}{i}2^{n-i}$$  I know that $\displaystyle \binom{n}{k}\binom{k}{i}$ is counting the number of ways to pick $k$ elements from $n$ and then $i$ elements from those $k$, so $\displaystyle \sum\limits_{k=i}^{n}\binom{n}{k}\binom{k}{i}$ is counting the number of ways to do that $\forall k$.  I know that $\displaystyle \binom{n}{i} = \binom{n}{n-i}$ and that $2^{n-i}$ is the number of elements in the power set for $[n]\setminus[i]$.  How do I show that both sides are equivalent? I'm stumped on this one. Could anyone give me a pointer in the right direction? Disable automatic driver update for only one device in Windows 10 Is there a way we can disable automatic driver update for a specific device in Windows 10? The updated driver for that device (Intel Management Engine Interface 11.x in particular) causes problems on some laptops during. The version 9.x works perfect.  I don't want to disable automatic driver installation for all devices. Proof that the set of irrational numbers is dense in reals Testing stored procedure scalability I have an email application that will be called upon to deliver to the UI the number of new messages for a given user on each page load. I have a few variations of things I am testing on the DB level but all are abstracted by the stored proc call.  I'm trying to slam the DB to see what the breaking point (# of requests per second) would be.   In a nutshell, I have a table such as this userId, newMsgCount with a clustered index on userId. SQL should be able to server hundreds or thousands of these responses per second. I think the laggard is my .NET app.  How can I make this a good test to achieve the test results based on SQL performance?  Is there a tool for this that i can give it a stored proc name and param for it to pund my  DB?  I want to see if the DB can return a min. of 250 responses per second.