mat = [[0] * 5] * 5 mat[1][1] = 3 print(mat[2][1])  expected output is 0 but compiler is giving 3 Can someone please explain me why this is happening.
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?
554 5.7.1 : Relay access denied centos postfix I have problem in send mail from postfix in centos  I have following  for sending mail but I am getting error.  As in the link I tried following commands  telnet localhost smtp  Trying ::1... Connected to localhost. Escape character is '^]'. 220 mydomain.com ESMTP Postfix ehlo localhost 250-mydomain.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN mail from:&lt;domain.com&gt; 250 2.1.0 Ok rcpt to:&lt;test@gmail.com&gt; 554 5.7.1 &lt;test@gmail.com&gt;: Relay access denied   Edit-1  In terminal this works  echo TEST | mail -v -s "Test mail" testing@gmail.com   my postconf -n shows belog information  alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix debug_peer_level = 2 home_mailbox = Maildir/ html_directory = no inet_interfaces = localhost inet_protocols = all mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain mydomain = dummy.com myhostname = dummy.com mynetworks = all mynetworks_style = host myorigin = $mydomain newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES sample_directory = /usr/share/doc/postfix-2.6.6/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop unknown_local_recipient_reject_code = 550   What configuration I have to perform to send mails from my server. Are collective nouns always plural, or are certain ones singular? I'd say Microsoft have a way of bending the rules and I know that McLaren have won the championship. While this sounds strange, I believe it is correct English (sorry, I'm not native).   But when it's a small company, would you still use it this way? Is a company always plural, or are small companies singular? I.e., would you say Bakery Johnson makes fine bread or Bakery Johnson make fine bread? Is it My book seller, Woody's, have moved or is it has moved? PHP: Replace umlauts with closest 7-bit ASCII equivalent in an UTF-8 string What I want to do is to remove all accents and umlauts from a string, turning "lärm" into "larm" or "andré" into "andre". What I tried to do was to utf8_decode the string and then use strtr on it, but since my source file is saved as UTF-8 file, I can't enter the ISO-8859-15 characters for all umlauts - the editor inserts the UTF-8 characters.  Obviously a solution for this would be to have an include that's an ISO-8859-15 file, but there must be a better way than to have another required include?  echo strtr(utf8_decode($input),             'ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ',            'SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy');   UPDATE: Maybe I was a bit inaccurate with what I try to do: I do not actually want to remove the umlauts, but to replace them with their closest "one character ASCII" equivalent. How to not have an equation in the first line using the align environment? Let $f$ and $g$ be continuous at $ x=a$, with $f(a)<g(a)$. Prove that there exists a neighborhood $I$ of a such that $f(x)<g(x)$ for all $x \in I$. I understand if you travelling in or to the US, you can lock your luggage using the TSA Luggage Lock. (Immigration is still able to open your luggage using their own special keys)  How about Europe? Especially Heathrow + Charles de Gaulle?    If the TSA Lock is not acceptable in Europe, are there any other alternative precautions I could use instead?  (FYI, information about the ) Proving that $\frac{\phi^{400}+1}{\phi^{200}}$ is an integer. How do we prove that $\dfrac{\phi^{400}+1}{\phi^{200}}$ is an integer, where $\phi$ is the golden ratio?  This appeared in an answer to a  I asked previously, but I do not see how to prove this.. How to replace all occurrences of a string in JavaScript? Power Supply Capacity Formula Given that I am building a home computer from scratch and I have several components (MB, CPU, HDD, Video, Sound, etc) which have specific power requirements, is there a formula for me to calculate the size/capacity of the Power Supply I will need? I want to be able to expand the setup later on also... How to justify $\phi(n) \ge \sqrt{n}$ If $\phi(n)$ is the Euler-totient function, how can I show that $\phi(n) \ge \sqrt{n}$? Dirac's remark that inspired Feynman when formulating path integral When Feynman was trying to formulate  of quantum mechanics, he was inspired by Dirac's remark which roughly states that $e^{i\frac{S}{\hbar}}$corresponds to the transition amplitude, where $S$ is the action.   I'm wondering what was Dirac's original argument behind this statement. How does extra damage work for critical hits? How do people at Hogwarts usually tell the time? Sometimes I need to write text and then pipe that text into another command. My usual workflow goes something like this:   vim # I edit and save my file as file.txt cat file.txt | pandoc -o file.pdf # pandoc is an example  rm file.txt   I find this cumbersome and seeking to learn bash scripting I'd like to make the process much simpler by writing a command which fires open an editor and when the editor closes pipe the output of the editor to stdout.  Then I'd be able to run the command as quickedit | pandoc -o file.pdf.   I'm not sure how this would work. I already wrote a function to automate this by following the exact workflow above plus some additions. It generates a random string to act as a filename and passes that to vim when the function is invoked. When the user exits vim by saving the file, the function prints the file to the console and then deletes the file.   function quickedit {     filename="$(cat /dev/urandom | env LC_CTYPE=C tr -cd 'a-f0-9' | head -c 32)"     vim $filename     cat $filename     rm $filename } # The problem: # =&gt; Vim: Warning: Output is not to a terminal   The problem I soon encountered is that when I do something like quickedit | command vim itself can't be used as an editor because all output is constrained to the pipe.   I'm wondering if there are any workarounds to this, so that I could pipe the output of my quickedit function. The suboptimal alternative is to fire up a separate editor, say sublime text, but I really want to stay in the terminal. We should be able to find questions or answers that we have deleted I deleted one of my questions and would like to undelete it. This requires finding the question.  I think you shouldn't be prevented from seeing your own posts that you have deleted. It should be easier than me remembering the link or checking the browser history to easily look these up.   I would currently need 10K to see my deleted items and even then if I can find their URL. Say, I have foo-1.2.3.deb which depends on perl and python, however, running command:  dpkg -i ./foo-1.2.3.deb   won't install these dependencies. So I must apt-get install perl python by hand.  How to make dpkg -i install these dependencies for me automatically? I have some files/directories on an external hard drive connected using USB to my Windows XP laptop. I am trying to delete those files but every time I try, I get an error "Cannot delete ....: Access Denied. Make sure disk is not full or write protected and that the file is not currently in use".  I checked that the directory is not is use. However, the permissions are set to read-only. Even if I remove the "read-only" checkbox, in Properties->Attributes, it automatically comes back again. How do I fix this? Is it a virus that is automatically changing it back to read-only?  regards,  JP I am currently thinking about open-sourcing a project of mine and am in the process of preparing the source code and project structure to be released to the public. Now I got one question: how should I handle the signature key for my assemblies? Should I create a new key for the open-source version and publish it along with the other files to the SVN repository? Should I leave the key out and everyone who wants to compile the code should generate his own key?  How do you handle this? I feel a little bit uncomfortable with releasing a signature key to the public. Java: Date from unix timestamp How to get the key for a given object from an NSMutableDictionary?