why the code adding 3 to all the lists ? lists = [[]] * 3 print(lists) print(lists[0]) lists[0].append(3) lists
List of lists changes reflected across sublists unexpectedly
Java generics type erasure: when and what happens? Finding files by only knowing extension? I'm somewhat disorganized in my file saving habits, so I wind up using the Search function in Windows Explorer more often than one should. I was wondering, is it possible to have Windows find all files of a certain extension ( like, say for example all .rar files) if it is, how? I've been going through  and have a question on the inductive proof for the . Recurrent relation:  $J(1) = 1$ $J(2n) = 2J(n) - 1$ $J(2n+1) = 2J(n) + 1$  Closed form hypothesis:  $J(2^m + l) = 2l + 1$, for $m \ge 0$ and $0\le l&lt;2^m$  Inductive Proof (for the even case):  $J(1)=1$ $J(2^m+l)= 2J(2^{m-1}+l/2)-1=2(2l/2+1)-1=2l+1$  How do the authors get from $2J(2^{m-1}+l/2)-1$ to $2(2l/2+1)-1$? Java FileReader encoding issue I tried to use java.io.FileReader to read some text files and convert them into a string, but I found the result is wrongly encoded and not readable at all.  Here's my environment:   Windows 2003, OS encoding: CP1252 Java 5.0   My files are UTF-8 encoded or CP1252 encoded, and some of them (UTF-8 encoded files)  may contain Chinese (non-Latin) characters.  I use the following code to do my work:     private static String readFileAsString(String filePath)     throws java.io.IOException{         StringBuffer fileData = new StringBuffer(1000);         FileReader reader = new FileReader(filePath);         //System.out.println(reader.getEncoding());         BufferedReader reader = new BufferedReader(reader);         char[] buf = new char[1024];         int numRead=0;         while((numRead=reader.read(buf)) != -1){             String readData = String.valueOf(buf, 0, numRead);             fileData.append(readData);             buf = new char[1024];         }         reader.close();         return fileData.toString();     }   The above code doesn't work. I found the FileReader's encoding is CP1252 even if the text is UTF-8 encoded. But the JavaDoc of java.io.FileReader says that:     The constructors of this class assume   that the default character encoding   and the default byte-buffer size are   appropriate.   Does this mean that I am not required to set character encoding by myself if I am using FileReader? But I did get wrongly encoded data currently, what's the correct way to deal with my situtaion? Thanks. Notation: Why write the differential first? i am getting a weird error - white screen in the list of posts for a specific Custom post type (just for that one)   tried deactivating all the plugins tried checking for error (debugging = true)   Still nothing the page just doesnt echos anything... (nothing in source too)  I am talking about such a url in the admin:     Here is register_post_type part i am using:    function register_submodelcpt() {     $labels = array(         'name'                  =&gt; __('Sub Models', THEME_NAME),         'singular_name'         =&gt; __('Sub Models', THEME_NAME),         'add_new'               =&gt; __('New Model', THEME_NAME),         'add_new_item'          =&gt; __('Add new Model', THEME_NAME),         'edit_item'             =&gt; __('Edit Model', THEME_NAME),         'new_item'              =&gt; __('New Model', THEME_NAME),         'all_items'             =&gt; __('All Sub Models', THEME_NAME),         'view_item'             =&gt; __('Watch Model', THEME_NAME),         'search_items'          =&gt; __('Search Models', THEME_NAME),         'not_found'             =&gt;  __('No Models found', THEME_NAME),         'not_found_in_trash'    =&gt; __('No Models found in trash', THEME_NAME),          'parent_item_colon'     =&gt; '',         'menu_name'             =&gt; __('Sub Models', THEME_NAME),      );      $args = array(         'labels'                =&gt; $labels,         'public'                =&gt; true,         'publicly_queryable'    =&gt; true,         'show_ui'               =&gt; true,          'show_in_menu'          =&gt; true,          'query_var'             =&gt; true,         'rewrite'               =&gt; array('slug' =&gt; 'submodels'),         'capability_type'       =&gt; 'post',         'has_archive'           =&gt; true,          'hierarchical'          =&gt; true,         'menu_position'         =&gt; 5,         'menu_icon'             =&gt; get_stylesheet_directory_uri().'/images/cpt/subcars.png',                     'supports'              =&gt; array('title', 'thumbnail', 'revisions', 'page-attributes')     );      register_post_type('submodelscpt',$args); } add_action('init', 'register_submodelcpt');   Did anyone encounter such an issuse? can you think of a reason this might happen?   Another weird thing when i change this:    To this:     The posts list loads correctly... Zero-pad digits in string Services Actions Missing in Central Admin How do I trust a self signed certificate? Show $\text{Hom}_{Ab}(A,\mathbb{Q}) = \{0\}$ for finite $A$ I have a finite abelian group $A$ and I have shown that $A\otimes\mathbb{Q} \cong \{0\}$, the trivial group.  Now I want to show that $\text{Hom}_{\textbf{Ab}}(A,\mathbb{Q}) = \{0\}$, i.e we only have the trivial zero group homomorphism from $A$ to $\mathbb{Q}$.  The question I'm trying to solve is phrased in such a way that $\text{Hom}_{\textbf{Ab}}(A,\mathbb{Q}) = \{0\}$ should fall out almost automagically once you have that the tensor product collapses but I'm really stuck on this even though some people I talked to said it was really easy.  Some thoughts:   I've tried to assume the existence of a nontrivial homorphism $A \to    \mathbb{Q}$ to generate a contradiction but with no success. We have the Tensor-hom adjunction theorem stating that for abelian groups $A,B,C$ we have a natural bijection  $$\text{Hom}_{\textbf{Ab}}(A\otimes B,C) \cong \text{Hom}_{\textbf{Ab}}(B ,\text{Hom}_{Ab}(A,C))$$ and by plugging in our particular groups we get that:   $$\text{Hom}_{\textbf{Ab}}(A\otimes \mathbb{Q},\mathbb{Q})\cong\text{Hom}_{\textbf{Ab}}(\mathbb{Q} ,\text{Hom}_{Ab}(A,\mathbb{Q}))$$  Since $A\otimes\mathbb{Q} \cong \{0\} \implies \text{Hom}_{\textbf{Ab}}(\mathbb{Q} ,\text{Hom}_{Ab}(A,\mathbb{Q})) = \{0\}$ so we only have the trivial morphism from $\mathbb{Q} \to \text{Hom}_{Ab}(A,\mathbb{Q})$ but I don't think this implies that $\text{Hom}_{Ab}(A,\mathbb{Q}) = \{0\}$ and I'm not sure if this reasoning helps me at all. How to pick one number from each sorted list so that the difference between the minimum and maximum is as small as possible? When to use "respectively"? I have been wondering what it means when people use "respectively" in, before, and after sentences. For example:     We are looking for a babysitter to pick up and supervise our kids ages   6 and 3, respectively, on Monday and Friday.   I don't know if this person used it correctly, but if they did what does it mean? If they didn't use it properly what would be the proper usage?  Thanks in advance. Do we have $\lim_{h\to 0^+}\int_0^\infty|f(t+h)-f(t)|dt=0$? Let $f:\mathbb{R^+}\to\mathbb{R}$ be an integrable function ($f\in L^1(\mathbb{R}^+,\mathbb{R})$). Do we have $$\lim_{h\to 0^+}\int_0^\infty|f(t+h)-f(t)|dt=0$$ ? How can we prove it ? Prevent people from downloading / copying / making a copy of data in Google doc Is a hexagonal house feasible? Recently I have been considering the economics and feasability of building a house versus buying a used one. In my design I settled on a hexagon as the logical shape for the frame, which I am considering for masonry construction. This would be a big house, each side being at least 30 feet wide (footprint 2340 sq ft). The advantages of a hexagon are obvious: simple roof shape, no valleys, space efficient, heat efficient (this would be in New England and subject to cold winters), good wind resistance.  What I can't understand is why there seems to be no-one building hexagonal houses? The only notable building I could find at all was the Supreme Court.  Possible explanations would be that the shape is expensive for small houses due to the 6 corners, but for a large house like mine the room shapes work out fine, in fact they are better than a box house. Maybe its just tradition? People don't like it because it looks like church? Builders have some objection to 60-degree angles?  What is the reason there are no hexagonal houses? How to shut down Ubuntu 11.10 host from within a Windows 7 VirtualBox guest? What is the significance of allowing nilpotents in scheme theory? Java generics super keyword C programming: How to program for Unicode? I know that there's a difference between relativistic and rest mass. Relativistic mass is "acquired" when an object is moving at speeds comparable to the speed of light. Rest mass is the inherent mass that something has regardless of the speed its moving at.  When fusion happens, a certain percentage of the rest mass of two hydrogen atoms is converted into energy. I understand that $E = m_{rest}c^2$.   How does the rest mass of an object turn into energy? Does this involve particle physics? Doesn't this suggest that rest mass can be viewed as some sort of potential energy? It seems to me that it's a sort of locked energy that has to undergo a certain process to expel its energy to surrounding particles.  Also, Why does only a small percentage of rest mass turn into energy? Why not all of it. What dictates how much rest mass gets converted into energy?