I'm self-studying Python using "Python Crash Course", and have been programming most of the code in the book as well as the set questions.  There is one example where a list of dictionaries is created, using this code:  # Make an empty list for storing aliens. aliens = []  # Make 30 green aliens. for alien_number in range (0,30):     new_alien = {'color': 'green', 'points': 5, 'speed': 'slow'}     aliens.append(new_alien)  for alien in aliens[0:3]:     if alien['color'] == 'green':         alien['color'] = 'yellow'         alien['speed'] = 'medium'         alien['points'] = 10  # Show the first 5 aliens: for alien in aliens[0:5]:     print(alien) print("...")   This works as expected, producing an initial list of 30 green aliens, and then the first three are modified to be yellow.  However, I was experimenting with the code, and I wondered why the   new_alien = {'color': 'green', 'points': 5, 'speed': 'slow'}   line was inside the first for loop (as it seemed to be creating the same thing every time, it seemed redundant to me that it was inside the loop).  Moving it outside (I'll only put the relevant changes, so the second block of code is altered):  # Make 30 green aliens. new_alien = {'color': 'green', 'points': 5, 'speed': 'slow'} for alien_number in range (0,30):     aliens.append(new_alien)   This produces output that I can't understand - ALL the aliens become yellow - the [0:3] part of the second for loop has no effect - I tried setting it to all sorts of values, and none of the changed the function - they all and up being altered by the second loop.   Could someone explain why this is happening?  I'm happy to read an appropriate link if someone can provide one, but I can't think of what to search for that would explain this (as I don't know what's happening, therefore don't know what to look for other than Yellow Aliens!)
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?
Django Template Variables and Javascript When I render a page using the Django template renderer, I can pass in a dictionary variable containing various values to manipulate them in the page using {{ myVar }}.  Is there a way to access the same variable in Javascript (perhaps using the DOM, I don't know how Django makes the variables accessible)? I want to be able to lookup details using an AJAX lookup based on the values contained in the variables passed in. Verbatim in beamer showing error: "File ended while scanning use of \@xverbatim." I am using Texmaker and MiKTeX on Windows 7. I have the following beamer code,  \documentclass{beamer} \theme{AnnArbor} \begin{document} \begin{frame} \begin{verbatim}     \begin{frame}[&lt;alignment&gt;]    \frametitle{Frame Title Goes Here}    Frame body text and/or LATEX code    \end{frame}  \end{verbatim} \end{frame} \end{document}   I was expecting the following output,         \begin{frame}[&lt;alignment&gt;]        \frametitle{Frame Title Goes Here}        Frame body text and/or LATEX code        \end{frame}   But instead I got the following Error Message,  File ended while scanning use of \@xverbatim.   Can any one please point out the error here. As far as I know verbatim can have anything inside it.  Also when I tried the following code,  \begin{verbatim}  \ begin{frame}[&lt;alignment&gt;]  \frametitle{Frame Title Goes Here}  Frame body text and/or LATEX code  \ end{frame} \end{verbatim}   I got the following output,      \ begin{frame}[&lt;alignment&gt;]      \frametitle{Frame Title Goes Here}      Frame body text and/or LATEX code     \ end{frame}   But I don't want space between \ and begin and \ and end. /oracle/GR1/121/bin/sqlplus / as sysdba &lt;&lt;EOF &gt;&gt; $LOGFILE whenever sqlerror exit sql.sqlcode; set echo on; set serveroutput on; STARTUP; EXIT EOF   Already tried it with the path, but it hasn't worked. Difference between DispatchQueue.main.async and DispatchQueue.main.sync Is Poly1305 an information-theoretically secure MAC? Programmatically selecting non adjacent Cells Does there exist a $1$-form $\alpha$ with $d\alpha = \omega$? How to view recently opened media files? In windows we have an option to view recently opened media files as my recent documents, I was  wondering does there exists something like that in Ubuntu?  via terminal or via GUI? Can I make my Ubuntu make sounds when I press Caps Lock etc.? How do you persuade an organization to value UX? UX is such an underrated field in a lot of industries. I wonder how companies consider employing UX designers and even heavily valuing their suggestions. Some big companies happen to see the light and invest in UX, and that keeps them on top of others. However, UX people rarely make it to the top management. In Don Norman's talk (  ), out of so many UX people (I don't know exactly), only two were vice presidents. I assume that there are even less influential UX designers in developing countries, and that's what makes it even harder for people like me. In the same talk, Don Norman suggested that UX designers should approach their executives like marketing people, showing how investing in something will affect profit. Perhaps, it's the best thing to do but it has to be mastered for it to be executed successfully.   I'm a fresh grad and am looking for a job. I think, working for a company with a more conventional job description would be the way to go. When I'm already influential enough, I'll go up to the executives and show them how UX will improve sales (in whatever industry it is. I just want to do UX)  Do you do UX as consultants or are you employed? How do you persuade companies to invest in UX? Are you lucky enough to be employed by people who you didn't have to persuade to value UX? Are Stack Overflow people *still* nice? The title is a reference to . We had the good fortune, to start this experiment with a really positive culture and have managed to hang onto it through vast growth and several fairly bitter internal arguments. But that does not guarantee we'll keep it forever. Lately I've had a unscientific feeling that Stack Overflow has been a bit rougher on newbie mistakes. The actual composition of this question was triggered by the comment thread on  (now with pending delete votes, so it is in danger of being 10k only). The  currently has 3 reputation points and has been a member for all of two days. The question bear the obvious (to me, at least) hallmarks of being written by a non-native English speaker with a shaky grasp of the tongue, and it is a rather simplistic question that could be answered fairly easily by Google. Question body:  Sir, I am mc student, I have knowledge in c,c++,J2EE. I want to ask you should I command in Linux with J2EE. Is it worth?  Instead of trying to improve the question, to discern exactly what the OP meant, or explaining how the question should be improved we get this comment thread instead (without wanting to call out these posters in particular, this was just the thread that got be off my duff):  2 Can you elaborate? – Dave McClelland 21 hours ago 1 Absolutely yes! If it can run on your Blu-Ray player, imagine the possibilities it can do on Linux. – The Elite Gentleman 21 hours ago 1 Basically, it's as worth as running Java on any other platform. – Alexander Gessler 21 hours ago 1 @The Elite Gentleman, You can try run it on your sim-card too) – Stas Kurilin 21 hours ago 1 @STas Kurilin, really? What heapspace size must I give? sarcastic laugh – The Elite Gentleman 21 hours ago 1 @The Elite Gentleman I don't know. But there are some) See for details oracle.com/technetwork/java/javacard/overview/… – Stas Kurilin 21 hours ago @The Elite Gentleman, you're absolutely right given a full fledged desktop machine with Linux, Java would run so fast his program could go back in time and rescue whales from extinction. – Quaternion 21 hours ago @Stas Kurlin, if you have a program that runs on a sim-card isn't it hard to get output? I've always found processorless environments problematic. – Quaternion 21 hours ago @Quaternion - It was a joke) I've newer wrote such programs. But, I think there should be some processor. – Stas Kurilin 20 hours ago @Stas Kurlin, I was joking too, but I have to apologize after reading that page you liked to. You can run Java off a smart card... that's crazy and cool. +1 on account of good learning for the day. – Quaternion 20 hours ago @Quaternion Thanks. I heard about this stuff several weeks ago. Java at a sim card is a really cool argument) – Stas Kurilin 20 hours ago @Quaternion, lol, without having to worry about Segmentation Faults along the way. – The Elite Gentleman 19 hours ago  I've been leaving comments on threads like this from time to time, asking them to be a little more forgiving, but that is a drop in the bucket. Nothing flag-worthy here, but not a &quot;nice&quot; as things once were. There is very little effort to understand what the question may really be, nor why to explain why the question has been closed, what other resources exist, or how that decision could be reversed. With a brand new user who probably has a hard time with English. Ouch. Do we need an official re-iteration of &quot;Be nice.&quot;? Is there something else we can do to encourage our big city to keep the small-town feel we grew up with? Extracting matrix rows when one of its elements is part of a list (without a loop) When I compile the Python code below, I get      IndentationError: unindent does not match any outer indentation level     import sys  def Factorial(n): # Return factorial     result = 1     for i in range (1,n):         result = result * i     print "factorial is ",result     return result   Why? Should 'fuck' be present in review audits (intentionally fake suggested edit reviews)? Are two norms equivalent if they induce the same topology on a vector space? Does a shortcode with a single attribute have to use an array? I want to build a shortcode that takes a single attribute.  Everything online is telling me to make it using an array:  // Add Shortcode function bg_comparison_points_shortcode( $atts ) {     // Attributes     $atts = shortcode_atts(         array(             'custom_field' =&gt; '',         ),         $atts,         'comparison_points'     );     return bg_calculate_points($custom_field); } add_shortcode( 'comparison_points', 'bg_comparison_points_shortcode' );   But in my mind something like this would be much simpler  // Add Shortcode function bg_comparison_points_shortcode( $custom_field ) {     return bg_calculate_points($custom_field); } add_shortcode( 'comparison_points', 'bg_comparison_points_shortcode' );   Is there a problem doing this simpler version? lstlisting - line number gaps Opening Chromium on Ubuntu VPS Ubuntu noob here. I recently got a VPS running Ubuntu, and decided to install Chromium, my preferred browser, on it. After installation completed, I got a message stating that I cannot open Chromium with root privileges. How would I go about opening Chromium? Let I and J be ideals of a ring R. Show by example that the set of products {xy | x ∈ I, y ∈ J} need not be an ideal Let I and J be ideals of a ring R. Show by example that the set of products {xy | x ∈ I, y ∈ J} need not be an ideal, but that the set of finite sums of products of elements of I and J is an ideal. This ideal is called the product ideal, and is denoted by IJ.   I want to check if my work on the first part makes any sense. I am not sure if I am picking the right example.  If I let R = Z and I = (2) and J = (3) then I has multiples of 2, and J has multiples of 3  6 will divide the product IJ if we add 2 and 3 though we get 5 in IJ, but I am not sure if 5 Divides IJ. If $G/Z(G)$ is cyclic, then $G$ is abelian Continuing my work through Dummit &amp; Foote's "Abstract Algebra", 3.1.36 asks the following (which is exactly the same as exercise 5 in ):     Prove that if $G/Z(G)$ is cyclic, then $G$ is abelian. [If $G/Z(G)$ is cyclic with generator $xZ(G)$, show that every element of $G$ can be written in the form $x^az$ for some $a \in \mathbb{Z}$ and some element $z \in Z(G)$]      The hint is actually the hardest part for me, as the quotient groups are somewhat abstract. But once I have the hint, I can write:  $g, h \in G$ implies that $g = x^{a_1}z_1$ and $h = x^{a_2}z_2$, so \begin{align*}gh &amp;= (x^{a_1}z_1)(x^{a_2}z_2)\\\  &amp;= x^{a_1}x^{a_2}z_1z_2\\\ &amp; = x^{a_1 + a_2}z_2z_1\\\ &amp;= \ldots = (x^{a_2}z_2)(x^{a_1}z_1) = hg. \end{align*} Therefore, $G$ is abelian.  1) Is this right so far?  2) How can I prove the "hint"?