Python float division "rounding error" on division by 100
Limiting floats to two decimal points
I need to be able to merge two (very simple) JavaScript objects at runtime.  For example I'd like to:  var obj1 = { food: 'pizza', car: 'ford' } var obj2 = { animal: 'dog' }  obj1.merge(obj2);  //obj1 now has three properties: food, car, and animal   Does anyone have a script for this or know of a built in way to do this?  I do not need recursion, and I do not need to merge functions, just methods on flat objects. Why do video cables (DVI, VGA) still screw in? Permission Denied To Delete File First of all, I'm not looking for an answer on how to remove the files. I am looking for a reason why this doesn't work - and a suggestion on how to remove the files without sudo.  I have a directory in my Desktop that has a few inner directories (don't judge the naming - I just extract what I need from files I'm given) and after getting the files I try and remove the files with rm -rf Bengal\ Tiger\ Creative/, I am surprised to see the following warning for each image.     rm: cannot remove ‘Bengal Tiger Creative/Bengal Tiger Creative/images/customer-services-landscape.jpg’: Permission denied   Below is some code outputs.  tree  nathan@nathan-pc:~/Desktop$ tree . ├── Bengal Tiger Creative │   └── Bengal Tiger Creative │       └── images │           ├── awards.jpg │           ├── blank.gif │           ├── bullet1-light-green.gif │           ├── bullet2-light-green.gif │           ├── bullet3-light-green.gif │           ├── bullet4-light-green.gif │           ├── customer-services-landscape.jpg │           ├── desktop.ini │           ├── header-img1.jpg │           ├── header-img2.jpg │           ├── header-img4.jpg │           ├── header-img5.jpg │           ├── softhr.gif │           ├── Thumbs.db │           ├── tiger_main-img1.jpg │           ├── tiger_main-img2.jpg │           ├── tiger_main-img3.jpg │           ├── tiger_main-img4.jpg │           ├── Vanquis-benefits-icons_iphone-green.gif │           └── white-arrow-green.gif   ls -laR  nathan@nathan-pc:~/Desktop$ ls -laR Bengal* Bengal Tiger Creative: total 12 drwxrwxr-x 3 nathan nathan 4096 Aug 10 11:30 . drwxr-xr-x 6 nathan nathan 4096 Aug 10 11:34 .. drwxrwxr-x 3 nathan nathan 4096 Aug 10 11:34 Bengal Tiger Creative  Bengal Tiger Creative/Bengal Tiger Creative: total 12 drwxrwxr-x 3 nathan nathan 4096 Aug 10 11:34 . drwxrwxr-x 3 nathan nathan 4096 Aug 10 11:30 .. dr-xr-xr-x 2 nathan nathan 4096 Aug 10 11:36 images  Bengal Tiger Creative/Bengal Tiger Creative/images: total 356 dr-xr-xr-x 2 nathan nathan   4096 Aug 10 11:36 . drwxrwxr-x 3 nathan nathan   4096 Aug 10 11:34 .. -rwxrwxrwx 1 nathan nathan  14910 Mar 18 12:29 awards.jpg -rw-rw-r-- 1 nathan nathan   1093 Mar 21  2014 blank.gif -rw-rw-r-- 1 nathan nathan   1978 May  8  2014 bullet1-light-green.gif -rw-rw-r-- 1 nathan nathan   1969 May  8  2014 bullet2-light-green.gif -rw-rw-r-- 1 nathan nathan   2416 May  8  2014 bullet3-light-green.gif -rw-rw-r-- 1 nathan nathan   2449 May  8  2014 bullet4-light-green.gif -rw-rw-r-- 1 nathan nathan 113138 Apr 14  2014 customer-services-landscape.jpg -r--r--r-- 1 nathan nathan    142 Mar 25 11:58 desktop.ini -rw-rw-r-- 1 nathan nathan  14312 Mar 23 11:39 header-img1.jpg -rw-rw-r-- 1 nathan nathan   1480 Mar 23 11:41 header-img2.jpg -rw-rw-r-- 1 nathan nathan   1278 Mar 23 11:41 header-img4.jpg -rw-rw-r-- 1 nathan nathan   1168 Mar 23 11:41 header-img5.jpg -rw-rw-r-- 1 nathan nathan   1703 Mar 21  2014 softhr.gif -rw-rw-r-- 1 nathan nathan  88064 Aug  4 10:39 Thumbs.db -rw-rw-r-- 1 nathan nathan  23607 Mar 23 11:56 tiger_main-img1.jpg -rw-rw-r-- 1 nathan nathan  23400 Mar 23 11:56 tiger_main-img2.jpg -rw-rw-r-- 1 nathan nathan   6970 Mar 23 11:56 tiger_main-img3.jpg -rw-rw-r-- 1 nathan nathan   8996 Mar 23 11:57 tiger_main-img4.jpg -rw-rw-r-- 1 nathan nathan    275 Jul 31  2014 Vanquis-benefits-icons_iphone-green.gif -rw-rw-r-- 1 nathan nathan   1821 Jul  9  2014 white-arrow-green.gif   Doing chmod 777 and then delete does not work.  Doing rm -rf * inside the directory does not work.  Doing sudo rm file does work.   I can easily remove these files using sudo, however, I cannot see why they cannot be removed without sudo. As a relatively new Ubuntu user, I would like to learn why.  Thanks in advance, Nathan How can I switch between starting a coroutine vs running the routine all at once? One of the topics that seems to come up regularly on mailing lists and online discussions is the merits (or lack thereof) of doing a Computer Science Degree. An argument that seems to come up time and again for the negative party is that they have been coding for some number of years and they have never used recursion.  So the question is:   What is recursion? When would I use recursion? Why don't people use recursion? Is "tri-quarterly" a real English word meaning 3 times a year? Are there any other words that mean 3 times a year? Continuous v. per-chapter/section numbering of figures, tables, and other document elements Simplest Example of a Poset that is not a Lattice A partially ordered set $(X, \leq)$ is called a lattice if for every pair of elements $x,y \in X$ both the infimum and suprememum of the set $\{x,y\}$ exists. I'm trying to get an intuition for how a partially ordered set can fail to be a lattice. In $\mathbb{R}$, for example, once two elements are selected the completeness of the real numbers guarantees the existence of both the infimum and supremum. Now, if we restrict our attention to a nondegenerate interval $(a,b)$ it is clear that no two points in $(a,b)$ have either a suprememum or infimum in $(a,b)$.   Is this the right way to think of a poset that is not a lattice? Is there perhaps a more fundamental example that would yield further clarity? Simple PHP Pagination script Proofs of AM-GM inequality The arithmetic - geometric mean inequality states that $$\frac{x_1+ \ldots + x_n}{n} \geq \sqrt[n]{x_1 \cdots x_n}$$ I'm looking for some original proofs of this inequality. I can find the usual proofs on the internet but I was wondering if someone knew a proof that is unexpected in some way. e.g. can you link the theorem to some famous theorem, can you find a non-trivial geometric proof (I can find some of those), proofs that use theory that doesn't link to this inequality at first sight (e.g. differential equations …)?  Induction, backward induction, use of Jensen inequality, swapping terms, use of Lagrange multiplier, proof using thermodynamics (yeah, I know, it's rather some physical argument that this theorem might be true, not really a proof), convexity, … are some of the proofs I know. Is there any canon information in Harry Potter that proves one way or another whether a wizard always owns only one wand as a matter of routine?  What I am talking about is a wizard buying and owning one wand and also a second wand (for backup, or simultaneous use, or separate purpose, or ceremonial+work wand), akin to people buying more than one pair of boots, guns or hammers.  A proof would be either canon info showing someone owning 2 wands simultaneously; or a statement showing why that does not happen except in rare exceptions (see below).    NOTE: I am discounting special situations such as winning an extra wand in a duel ala Harry (e.g. the second wand's obtainment wasn't intended/planned), or someone winning a Death Stick from prior owner (in which case it was intended as a replacement wand and not an extra one); or taking another's wand for a time being, ala Voldemort and Lucius Malfoy (since it was more of a "temporary replacement because main wand was useless for the purpose due to paired cores" - far from a normal situation).  Also, I meant wands intended for use - e.g. if Malfoy would have a (imagined by me) collection of rare antique wands, that's as irrelevant as someone having flintlocks in a display case. Using something like this:  try:    # Something... except Exception as excep:    logger = logging.getLogger("component")    logger.warning("something raised an exception: " + excep)    logger.info("something raised an exception: " + excep)   I would rather not have it on the error-level cause in my special case it is not an error. I have to prove that a function $f:]0,1] \rightarrow \Bbb R$ : $$ f(x) = \begin{cases} \frac1q,  &amp; \text{if $x \in \Bbb Q$  with $ x=\frac{p}q$ for $p,q \in \Bbb N$ coprime} \\ 0, &amp; \text{if $x \notin \Bbb Q $} \end{cases} $$  is discontinuous in every point $x \in \ ]0,1] \cap\Bbb Q$.  And then to consider $x \in \ ]0,1] \backslash \Bbb Q$ and prove that it is continuous.  For now I learned different ways to prove continuity (epsilon-delta, sequences), but I'm never sure what would be better to use in each different case.  I wanted to prove the discontinuity by using sequences: $$\forall x_n \quad x_n\rightarrow a \quad \Rightarrow \quad f(x_n) \rightarrow f(a)$$  I tried creating a sequence $ x_n=\frac1n + a$, we know it converges to $a$ but $f(x_n)\ $ doesn't  converges to $\ f(a)$ because there would still be some points not in our set (irrational numbers that creates gaps).  But I don't think it works, so I'm asking you if you could help me solving the two questions. Why does magnetic force vary in proportion to the cube of the distance instead of the square? Magnetic forces vary from gravity and electromagnetic radiation (such as light) in that gravity and radiation diminish by the square of the distance from the source, but magnetism diminishes by the cube of the distance.  Why is this? Does Google use the Meta Description Tag for Description of Page? When you do a Google search, there is typically a snippet of sample content from the page. I seem to recall that the Meta Tags can influence this choice of descriptive sentences. Is that correct(?) and if so, is it the Meta Description Tag?  Also, how many characters is Google's descriptive sentences limited to? Collisions in space/vacuum How to restrict users on changing their wallpapers? I don't want my users to change the system wallpaper. How do I the lock the wallpaper down? Update  Users are changing wallpaper by right clicking the picture and choosing set as wallpaper. How to restrict this behaviour?  Is it possible to remove Backgrounds Tab from Appearance Preferences? If yes how? Collinearity diagnostics problematic only when the interaction term is included Let $V$ be spherically symmetric and $W$ i.i.d. Gaussian. Then $E[V|V+W=t]=g(\|t\|)$ A random vector $V \in \mathbb{R}^n$ is said to be spherically symmetric. If for every orthogonal matrix  $A$   the distribution of $AV$ is the same as the distribution of $V$.   My question: Let $W$ be  i.i.d. zero mean Gaussian random variable.     Can we show that  for a spherically symmetric $V$ the conditional expectation  \begin{align} E[V|V+W=t]=   g(\|t\|).  \end{align}  That is the conditional expectation is only a function of the magnitude.   My attempt:  \begin{align} E[V|V+W=t]= \int  V  \frac{f_W(t-v)}{f_{V+W}(t)} dP_V(v)= \frac{\int  v  f_W(t-v) dP_V(v)}{f_{V+W}(t)}= \frac{E[ V  f_W(t-V) ]}{f_{V+W}(t)} \end{align}  Therefore, we can show that the two functions in the above ratio only depend on $\|t\|$.   Observe that we can write $t= \|t\| u_t$  where $u_t$ is a unit vector. Then, for any orthogonal matrix $A$ \begin{align} f_{V+W}(t)=f_{V+W}(\|t\|, u_t)&amp;= \frac{1}{(2\pi)^{n/2}} E[ e^{-\frac{\|t-V  \|^2}{2}} ]\\ &amp;= \frac{1}{(2\pi)^{n/2}} E[ e^{-\frac{\|t-AV  \|^2}{2}} ]\\ &amp;= \frac{1}{(2\pi)^{n/2}} E[ e^{-\frac{\|tA^{-1}-V  \|^2}{2}} ]\\ &amp;= \frac{1}{(2\pi)^{n/2}} E[ e^{-\frac{\|t A^T-V  \|^2}{2}} ]\\ &amp;= f_{V+W}(tA^T)\\ &amp;= f_{V+W}(\|t\|,  u_t A^T) \end{align}  Since, $A$ was arbitrary  we have that $f_{V+W}(t)=h(\|t\|)$(i.e., only depends on the magnitute).  Now I am not sure how to show that $E[ V  f_W(t-V) ]$ only depends on $\|t\|$? Joining non-spatial CSV file to spatial data (shapefile) using QGIS? I have a CSV file which has postcode data in a field, but it is non-spatial e.g. no Easting and Northing.   I have a shapefile with postcode in a field and some additional data.  I want to join the CSV with the shapefile based on attributes (postcode fields). I know I can do this in ArcMap, but how can I achieve the same thing in QGIS?