I am making a little game in pygame, for use in reinforcement learning (openAI gym) but I'm encountering an issue with lists/dictionaries. I presume this is to do with empty lists all pointing to the same memory address, but I do not understand why/how or how to avoid it in this scenario.  Ultimately I want to be able to use empty lists or dicts for this, I am trying to group a list of tuples of the form ((int1, int2), int3)) by their second element (int3).  I have tried using copy() when initializing the empty array but with no difference. I did not find/understand anything useful from tutorials or docs pages, so I would greatly appreciate a brief explanation of how to avoid this issue.  def works(t):     lst = [[1],[2],[3]]     lst[1].append([x for x in t if x[1]==1])     return lst  def does_not_work(t):     lst = 3*[list()]     lst[1].append([x for x in t if x[1]==1])     return lst  t = [(('a'), 0), (('b'), 1), (('c'), 1), (('d'),2)] print('Expected Result:') print(works(t)) print('Confusing Result:') print(does_not_work(t))   Expected Result: [[1], [2, [('b', 1), ('c', 1)]], [3]] Confusing Result: [[[('b', 1), ('c', 1)]], [[('b', 1), ('c', 1)]], [[('b', 1), ('c', 1)]]]
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?
Just want to get clarification on something we're noticing in our org. Its regarding a new integration user we've created for an external application to connect to Salesforce. We also created a Connected App for this application to authenticate using OAuth. All of this is setup and working up to this point.   But one thing that we don't understand is there is a related list on the integration user detail page named "OAuth Connected Apps". We're concerned because although we are connecting fine and data is getting return to the external application no records are showing up in this "OAuth Connected Apps" related list. Should we expect to see Authorization or Access tokens in this list?   We just want to make sure we aren't bypassing the connected app in anyway, which we assume not, but just want to run it by the community and see. All comments are appreciated. Thanks ahead of time for the support. Command not found $ (dollar sign) Any command that starts with $ returns  command not found   How can I fix this?  I am  using 16.10 Ubuntu. Running a 32-bit application in Debian Wheezy 64 bits: Missing libraries I want to play the game Aquaria in a Debian Wheezy 64 bits. The installation went ok, but when trying to play the game I get these errors:  ALSA lib conf.c:3314:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so ALSA lib control.c:951:(snd_ctl_open_noupdate) Invalid CTL hw:0 AL lib: alsa.c:1000: control open (0): No such file or directory Message: SDL_GL_LoadLibrary Error: Failed loading libGL.so.1   I have added 32 bit compatibility with dpkg --add-architecture i386 and I think that the required libraries are present in the system since typing locate libasound_module_conf_pulse.so yields:  /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_conf_pulse.so  and locate libGL.so.1:  /etc/alternatives/glx--libGL.so.1-x86_64-linux-gnu /usr/lib/mesa-diverted/i386-linux-gnu/libGL.so.1 /usr/lib/mesa-diverted/i386-linux-gnu/libGL.so.1.2 /usr/lib/mesa-diverted/x86_64-linux-gnu/libGL.so.1 /usr/lib/mesa-diverted/x86_64-linux-gnu/libGL.so.1.2 /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/x86_64-linux-gnu/fglrx/fglrx-libGL.so.1.2 /usr/lib/x86_64-linux-gnu/fglrx/libGL.so.1   However, it seems that Debian is ignoring them. What can I do to play Aquaria?  EDIT 1: ldd aquaria  linux-gate.so.1 =&gt;  (0xf77e1000) libSDL-1.2.so.0 =&gt; /opt/Aquaria/./libSDL-1.2.so.0 (0xf7748000) libopenal.so.1 =&gt; /opt/Aquaria/./libopenal.so.1 (0xf76fa000) libstdc++.so.6 =&gt; /opt/Aquaria/./libstdc++.so.6 (0xf760d000) libm.so.6 =&gt; /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0xf75c3000) libgcc_s.so.1 =&gt; /opt/Aquaria/./libgcc_s.so.1 (0xf75b8000) libc.so.6 =&gt; /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xf7455000) libdl.so.2 =&gt; /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xf7451000) libpthread.so.0 =&gt; /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xf7437000) librt.so.1 =&gt; /lib/i386-linux-gnu/i686/cmov/librt.so.1 (0xf742e000) /lib/ld-linux.so.2 (0xf77e2000) "Important to me" or "Important for me" I cannot easily figure out which one is more appropriate to use:     It's important to me.        It's important for me.   Are they the same? If not, what's the difference? Checkbox in listview control Can you have a multicolumn listview control where one of the columns is a checkbox?  Example code or links would be greatly appreciated.  I am using visual studio 2005 I frequently need to check which packages are installed, and I use the following command:  dpkg -l | grep foo  which gives the following output  Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name                       Version         Description ii   foo                       &lt;version&gt;         &lt;description&gt;    What does the ii mean?  What other flags are there? How to read the flags? (because the explanation is quite complicated, IMO)   Thanks. How do you file a bug report for Windows? I have come across an issue that I feel is a  in Windows 7. What is the official process for submitting an issue to Microsoft from a consumers perspective as an end user of Windows? Citations with no bibliography at the end How do you produce a document with citations (\citep, \citet) working properly in the paper but without a bibliography at the end?  I've come up with one solution that is bad because it breaks my makefile.  latex file.tex bibtex file # comment out \bibliography{} command latex file.tex   Similarly, is there a way to produce the bibliography with no accompanying text?  Again, I've come up with a solution: fill an otherwise blank .tex file with \nocite{} commands.  However, this is a pain because I have to keep two files synced by hand (and regular expressions to search for \citep{author1, author2} can be a huge pain when there are pagebreaks...). What's the equivalent of the "cls" command from Windows/DOS? RedirectMatch and Query String Compare these two RedirectMatch's. The first doesn't work: RedirectMatch 302 ^/redirect\.php[?]page=(.+)$ http://somewhereelse.com/$1  Versus this, which will redirect to http://somewhereelse.com/?page=wherever: RedirectMatch 302 ^/redirect\.php([?]page=.+)?$ http://somewhereelse.com/$1  Does RedirectMatch only match the URI and not the query string? Apache's documentation is a bit vague in this area. What I'm trying to do is extract the page query parameter and redirect to another site using it. Is that possible with RedirectMatch or do I have to use RewriteCond + RewriteRule? Tags in spoilers are always visible, even if you don't put your mouse on the spoiler (on  for example). See the screenshot:      Looks a bit strange on this site too:        that needs ! The uniform limit of Continuous Functions is continuous.   Proof Let $\varepsilon &gt; 0$. There exists $N$ in natural numbers such that $n&gt;N$ implies  $|f_n(x)-f(x)| &lt; \frac{\varepsilon}{3}$ for all $x$ in $S$. In particular $|f_{N+1}(x)-f(x)| &lt; \frac{\varepsilon}{3}$ for all $x$ in $S$. Since $f_{N+1}$ is continuous at $x_0$ there is a $\delta&gt;0$ such that, $x$ in $S$ and $|x-x_0| &lt; \delta$ imply $|f_{N+1}(x)-f_{N+1}(x_0)|&lt; \frac{\varepsilon}{3}$ Now we conclude $x$ in $S$ and $|x-x_0| &lt; \delta$ imply $|f(x)-f(x_0)|&lt; 3 \cdot \frac{\varepsilon}{3} = \varepsilon$.  Can someone explain what is happening here? I don't follow it all. So, I'm working creating a lamp... yes, newbie here.  After modeling for a bit, I noticed that my point of origin was no longer the center of my object:    How to I reset an object origin point to the center of it's geometry? Visual design changes to the review queues Is there any way other than instanceof operator for object type comparison in java? I remember reading in some Java book about any operator other than 'instanceof' for comparing the type hierarchy between two objects.  instanceof is the most used and common. I am not able to recall clearly whether there is indeed another way of doing that or not. Suppose $\sum_{n=1}^\infty \frac{1}{n} = S$ where $S$ is finite.  Then  $$S =\sum_{n=1}^\infty \frac{1}{n}= \sum_{n=1}^\infty \frac{1}{2n-1} + \frac{1}{2n} &gt; \sum_{n=1}^\infty \frac{1}{2n} + \frac{1}{2n} = S$$  which is a contradiction.  Is this valid? One way function existence Let $x = (x_1, x_2,...,x_n)\in\{0,1\}^n$ for $n\in\mathbb{N}$. Prove that if one-way functions (OWFs) exist, then there exists a one-way function $f$ such that for every bit $i\in[1,n]$ there exists an algorithm $A_i$ such that: $$\Pr[A_i(f(x)) = x_i] \geq \frac{1}{2} + \frac{1}{2n}$$ I'm having trouble understanding this. How to get the location of a program in Ubuntu? For example I have Oracle, how to get the folder racine (location) of Oracle? Finding the fallacy in this broken proof Today, a friend gave me a "proof" of $1=2$ and challenged me to find the fallacy.     $1 = 1$      $1 = 1 + 0 + 0 + 0 ...$      $1 = 1 + 1 - 1 + 1 - 1 + 1 - 1 ...$      $1 = 2 - 1 + 1 - 1 + 1 - 1 ...$      $1 = 2 + 0 + 0 ...$      $1 = 2$   My answer was that once you turn the initial $1 + 1$ into a 2, everything is offset so a $-1$ is always left at the end no matter how many times it is repeated. This negative one balances out the $2$ at the beginning so $1=1$ still holds true. I.e.  $$1 = 1 + 0 + 0 + 0 ... = 1 + (1 - 1) + (1 - 1) + (1 - 1) = 2 + (-1 + 1) + (-1 + 1) - 1$$  However, my friend claimed that my answer only applies if the $+ 1 - 1$ repeats for a finite number of times. He argues that because the sequence repeats infinitely and things work differently when working with infinity, my answer is not valid.  Can anyone enlighten me to the true fallacy in this proof? Why is a normal subgroup of $G_1\times G_2$ with trivial intersections with $G_1$ and $G_2$ is abelian? Let $G=G_1\times G_2$ be a direct product, and let $H\triangleleft G$ be a normal subgroup such that $H\cap G_1=H\cap G_2=\{1\}.$ Then $H$ is abelian.     I considered the commutators of two elements in $H$, trying to show that it must be $1,$ but I don't see how this works. Any hint is very welcomed and appreciated. Thanks in advance.