I come from a country where the way we write decimal numbers differs from the other place by whether I use ',' or '.' for decimal separator. Now this is why I by accident wrote somewhere in my c++ program:  while(true){     long double x=0;     //some code that increases the value of x      //by very small amount but it doesn't leave it at 0     if(x&gt;0,000001)break; }   And this made the program run indefinitely. After wasting quite some time thinking my code was wrong I tried this:  while(true){     long double x=0;     //some code that increases the value of x      //by very small amount but it doesn't leave it at 0     if(x&gt;0.000001)break; }   Which worked just fine. Later I understood my mistake (I used ',' instead of '.'), but now I am confused as to why doesn't the next code result with compilation error, and how come it's outcome is "greater"  long double g=0.001; if(g&gt;0,01)cout&lt;&lt;"greater"; else cout&lt;&lt;"smaller";   Edit: When I posted this question I didn't know that the comma is an operator. So the question was marked as duplicate and lead here  . But there I couldn't actually find a comparison between '.' and ',' .
How does the comma operator work in C++?  For instance, if I do:  a = b, c;     Does a end up equaling b or c?   (Yes, I know this is easy to test - just documenting on here for someone to find the answer quickly.)  Update:  This question has exposed a nuance when using the comma operator.  Just to document this:  a = b, c;    // a is set to the value of b!  a = (b, c);  // a is set to the value of c!   This question was actually inspired by a typo in code.  What was intended to be  a = b; c = d;   Turned into  a = b,    //  &lt;-  Note comma typo! c = d;
Connecting two Ethernet PHY without magnetics? Can you transfer a Windows 7 XP-mode VHD to a new PC without the need for reactivation? At the moment I am running Vista 32 bit and use VPC 2007 a lot. I have several Windows 2000 Virtual Machines set up with complex software configurations. For me, one of the advantages of working with VPCs is that a Virtual Machine can easily be copied to another PC (like a notebook). Also, when I move to a new PC, I can immediately work with my existing Virtual Machines without the need to reinstall all applications.   I am thinking about buying a new pc with Windows 7 64 bit pro, and using the XP-Mode Virtual Machine that comes with Windows 7. The advantages would be support for more memory (so being able to run more Virtual Machines simultaneously) and having a licenced XP Virtual Machine.  I would like to know if you can transfer a VHD that is based on the XP-mode VHD to another machine without Activation issues. The other machine will of course, also be running Windows 7. I would guess that this would not be a problem.   However, I did read about a guy who had to reinstall his Windows 7 because of a harddisk failure, and could not access his XP-mode VHD anymore because it demanded re-activation.  So can you transfer a Windows 7 XP-mode VHD to a new PC without the need for reactivation? Using Python, how do I to read/write data in memory like I would with a file? [See  for more on this topic, as well as better illustrations of the final product.]  I have a document with a lot of short excerpts from another book scattered through it.  Putting frames around them looks a little too 'clean'. How can I get a 'torn page' type effect, to make it look as if the excerpt has been physically torn out of a book?  (I've occasionally seen this done in printed books, although I can't find an example right now.)  I'm not wedded to a very specific look here --  gives plenty of examples. But just to give this some frame of reference, here are some of the nicer ones:          (The strong colouration in this second example is a probably a little too distracting for actual use, although it might be interesting as an option. It's more the edge effect I'm interested in.)    Edit (again): I tried typesetting my text according to the updated versions of the answers below. Here are the results:    Or with interpolated shading: In my document, I will write something like this (using natbib, but that shouldn't matter too much):  \citet{reference} show that .....   which would render as     Jones et al (1990) show that....   (\citet in \natbib creates an 'author-list (year)' reference style)  Of course if {reference} was a single individual, I should have written  \cite{reference} shows that ....   rendering as     Jones (1990) shows that....   Since I'm lazy and can't take the extra 5 seconds to search the reference to see if it's a single author or not, is there conceivably an automated way to do pluralization ? Or some relatively simple macro that would look like   \IfRefIsPlural{reference}{show}{shows} My players have been scheming with rapid entry tactics for the megadungeon I've recently started running. Unfortunately, the monsters are aware of the adventurers, and this has lead to a weird question of priority. Given the following situation (which I'm pretty sure is going to happen next session in some form or another) what happens?     Alice the adventurer readies an action; if her teammate Carlos opens   the door, she's going to throw the alchemists fire through the door,   which should do enough damage to kill any goblins hiding there.      Meanwhile, on the other side of the door, Bob the goblin is lying in   wait. He readies an action; if the door opens, he's going to hit the   switch to open the trapdoor in the next room, which should drop any    pesky adventurers into a pit with spikes at the bottom.      Carlos opens the door.   I know what happens when , but what happens when multiple readied actions get triggered at the same time? My guess would be an opposed reflex save or initiative check of some kind to see who goes first, but that's entirely just intuition speaking. The rulebook doesn't seem to speak to the issue. Can one attack for damage after having grappled an opponent? The grappling rules sure are... light. Supposing one has an Extra Attack:   Assuming one has successfully grappled an opponent with one's first attack, can one then perform a normal attack action with one's Extra Attack? Against the grappled opponent or any opponent within reach? Limitations on weapons (e.g. one-handed only)? Assuming one has successfully grappled an opponent with one's first attack, can one's grappled opponent (now with move 0) perform a normal attack action? Against you or against any one in reach? Do advantage and disadvantage (along the lines of restraint) come into play? Are there grappling-specific attacks for damage (e.g. choke-hold)? What is a Superblock, Inode, Dentry and a File? From the article  by M. Tim Jones, I read that Linux views all the file systems from the perspective of a common set of objects and these objects are superblock, inode, dentry and file. Even though the rest of the paragraph explains the above, I was not that comfortable with that explanation. Could somebody explain to me these terms? Why are vias placed this way on a PCB? I used to check complex commercial PCBs specially those of graphics cards to see how professional PCB designers do their layout and learn from their techniques.  When I checked the card shown below I noticed two things regarding the placement of vias:  (A higher resolution image is ).   The PCB is surrounded by stitching vias all around the edges. What's the role of all of these? I think they're connected to ground to act as a shield, if that's true, I can't understand technically how by this placement they achieve this shield? By looking closer to the mounting holes, I noticed they added vias all around the pad, why? What is $\int_0^1 \frac{\log \left(1-x^2\right) \sin ^{-1}(x)^2}{x^2} \, dx$? Does a charged particle accelerating in a gravitational field radiate? A charged particle undergoing an acceleration radiates photons.  Let's consider a charge in a freely falling frame of reference.  In such a frame, the local gravitational field is necessarily zero, and the particle does not accelerate or experience any force. Thus, this charge is free in such a frame. But, a free charge does not emit any photons. There seems to be a paradox. Does a freely falling charge in a gravitational field radiate? I don't want to do this through trial and error, and the best way I have found so far was to start dividing from 1.     $n! = \text {a really big number}$   Ex. $n! = 9999999$   Is there a way to approximate n or solve for n through a formula of some sort?  Update (Here is my attempt):  Stirling's Approximation: $$n! \approx \sqrt{2 \pi n} \left( \dfrac{n}{e} \right ) ^ n$$  So taking the log:     $(2\cdot \pi\cdot n)^{1/2} \cdot n^n \cdot e^{-n}$       $(2\cdot \pi)^{1/2} \cdot n^{1/2} \cdot n^n \cdot e^{-n}$       $.5\log (2\pi) + .5\log n + n\log n \cdot -n \log e$       $.5\log (2\pi) + \log n(.5+n) - n$   Now to solve for n:     $.5\log (2\pi) + \log n(.5+n) - n = r$       $\log n(.5+n) - n = r - .5 \log (2\pi)$   Now I am a little caught up here. I want to implement the EM algorithm manually and then compare it to the results of the normalmixEM of mixtools package. Of course, I would be happy if they both lead to the same results. The main reference is Geoffrey McLachlan (2000), .  I have a mixture density of two Gaussians, in general form, the log-likelihood is given by (McLachlan page 48):      $$ \log L_c(\Psi) = \sum_{i=1}^g \sum_{j=1}^n z_{ij}\{\log \pi_i + \log f_i(y_i;\theta_i)\}. $$ The $z_{ij}$ are $1$, if the observation was from the $i$th component density, otherwise $0$. The $f_i$ is the density of the normal distribution. The $\pi$ is the mixture proportion, so $\pi_1$ is the probability, that an observation is from the first Gaussian distribution and $\pi_2$ is the probability, that an observation is from the second Gaussian distribution.   The E step is now, calculation of the conditional expectation:      $$ Q(\Psi;\Psi^{(0)}) = E_{\Psi(0)}\{\log L_c(|\Psi)|y\}. $$ which leads, after a few derivations to the result (page 49):      \begin{align} \tau_i(y_j;\Psi^{(k)}) &amp;= \frac{\pi_i^{(k)}f_i(y_j;\theta_i^{(k)}}{f(y_j;\Psi^{(k)}}  \\[8pt]                        &amp;= \frac{\pi_i^{(k)}f_i(y_j;\theta_i^{(k)}}{\sum_{h=1}^g \pi_h^{(k)}f_h(y_j;\theta_h^{(k)})} \end{align} in the case of two Gaussians (page 82):      $$ \tau_i(y_j;\Psi) = \frac{\pi_i \phi(y_j;\mu_i,\Sigma_i)}{\sum_{h=1}^g \pi_h\phi(y_j; \mu_h,\Sigma_h)} $$ The M step is now the maximization of Q (page 49):      $$ Q(\Psi;\Psi^{(k)}) = \sum_{i=1}^g\sum_{j=1}^n\tau_i(y_j;\Psi^{(k)})\{\log \pi_i + \log f_i(y_j;\theta_i)\}. $$ This leads to (in the case of two Gaussians) (page 82):      \begin{align} \mu_i^{(k+1)} &amp;= \frac{\sum_{j=1}^n \tau_{ij}^{(k)}y_j}{\sum_{j=1}^n \tau_{ij}^{(k)}}  \\[8pt] \Sigma_i^{(k+1)} &amp;= \frac{\sum_{j=1}^n \tau_{ij}^{(k)}(y_j - \mu_i^{(k+1)})(y_j - \mu_i^{(k+1)})^T}{\sum_{j=1}^n \tau_{ij}^{(k)}} \end{align} and we know that (p. 50)      $$ \pi_i^{(k+1)} = \frac{\sum_{j=1}^n \tau_i(y_j;\Psi^{(k)})}{n}\qquad (i = 1, \ldots, g). $$ We repeat the E, M steps until $L(\Psi^{(k+1)})-L(\Psi^{(k)})$ is small.        I tried to write a R code (data can be found ).    # EM algorithm manually # dat is the data  # initial values pi1       &lt;-  0.5 pi2       &lt;-  0.5 mu1       &lt;- -0.01 mu2       &lt;-  0.01 sigma1    &lt;-  0.01 sigma2    &lt;-  0.02 loglik[1] &lt;-  0 loglik[2] &lt;- sum(pi1*(log(pi1) + log(dnorm(dat,mu1,sigma1)))) +               sum(pi2*(log(pi2) + log(dnorm(dat,mu2,sigma2))))  tau1 &lt;- 0 tau2 &lt;- 0 k    &lt;- 1  # loop while(abs(loglik[k+1]-loglik[k]) &gt;= 0.00001) {    # E step   tau1 &lt;- pi1*dnorm(dat,mean=mu1,sd=sigma1)/(pi1*dnorm(x,mean=mu1,sd=sigma1) +            pi2*dnorm(dat,mean=mu2,sd=sigma2))   tau2 &lt;- pi2*dnorm(dat,mean=mu2,sd=sigma2)/(pi1*dnorm(x,mean=mu1,sd=sigma1) +            pi2*dnorm(dat,mean=mu2,sd=sigma2))    # M step   pi1 &lt;- sum(tau1)/length(dat)   pi2 &lt;- sum(tau2)/length(dat)    mu1 &lt;- sum(tau1*x)/sum(tau1)   mu2 &lt;- sum(tau2*x)/sum(tau2)    sigma1 &lt;- sum(tau1*(x-mu1)^2)/sum(tau1)   sigma2 &lt;- sum(tau2*(x-mu2)^2)/sum(tau2)    loglik[k] &lt;- sum(tau1*(log(pi1) + log(dnorm(x,mu1,sigma1)))) +                 sum(tau2*(log(pi2) + log(dnorm(x,mu2,sigma2))))   k         &lt;- k+1 }   # compare library(mixtools) gm &lt;- normalmixEM(x, k=2, lambda=c(0.5,0.5), mu=c(-0.01,0.01), sigma=c(0.01,0.02)) gm$lambda gm$mu gm$sigma  gm$loglik   The algorithm is not working, since some observations have the likelihood of zero and the log of this is -Inf. Where is my mistake? I did not create a swap partition during Ubuntu installation.  Later, I freed up some space and made a swap partition.  Now after each boot up, I am manually opening gparted to right-click the swap partition to turn on the 'swapon' option.  How can I automatically enable the swap partition at boot?  Also, if I had not created the swap partition, what are my other options? I need to execute a directory copy upon a user action, but the directories are quite large, so I would like to be able to perform such an action without the user being aware of the time it takes for the copy to complete.  Any suggestions would be much appreciated. Proving inequality $(a+\frac{1}{a})^2 + (b+\frac{1}{b})^2 \geq \frac{25}{2}$ for $a+b=1$ I am pretty sure $(B_{t}^{2})$ not Markov because the squared random walk is not.    I guess I can repeat the method since to be Markov it must satisfy the discrete.  Thanks How do I perform a redirect to a custom URL after login? I am trying to redirect users to a custom URL after they logged in, but my code doesn't work.  How do I redirect users after they logged in? Why is ROC AUC equivalent to the probability that two randomly-selected samples are correctly ranked? I found there are two ways to understand what AUC stands for but I couldn't get why these two interpretations are equivalent mathematically.   In the first interpretation, AUC is the area under the ROC curve. Picking points from 0 to 1 as threshold and calculate sensitivity and specificity accordingly. When we plot them against each other, we get ROC curve.  The second one is that the AUC of a classifier is equal to the probability that the classifier will rank a randomly chosen positive example higher than a randomly chosen negative example, i.e. P(score(x+)>score(x−)).  (from ) Ragged Right linebreaking, such that the last line is fullest, and the first most empty