When does light act as a particle and when as a wave? Can you compare this bizzare property of light to some situation so that I can understand it better?
Which side of wave-particle duality to choose in a given situation How does one know whether, in treating a certain problem, one should consider particles as waves or as point-like objects? Are there certain guidelines regarding this?
How do you construct a std::string with an embedded null? If I want to construct a std::string with a line like:  std::string my_string("a\0b");   Where i want to have three characters in the resulting string (a, null, b), I only get one.  What is the proper syntax? How do you unlock the Dream Suite? Can a homomorphic encryption scheme be made CCA2 Secure? Is it possible to modify a homomorphic encryption scheme so that it can be CCA2 secure?  From the definition of a homomorphic scheme, it seems that it is malleable, which would result in lack of CCA2 security. So, if we use the regular method to convert a CPA secure scheme to CCA2 secure scheme (using a hash of the message and a random value), will it still preserve its homomorphic property? Please correct me if my understanding is wrong. Temperature and kinetic energy of molecules I was wondering if temperature is related to the average translational kinetic energy of the molecules then why does the average kinetic energy of say a moving object not affect the temperature? What is the mechanism regarding these vibrational motions that imparts temperature. Also do a gas and liquid at the same temperature possess the same kinetic energy? and a heavier molecule traveling at the same speed as a lighter molecule will have a greater temperature? I would like to convert a large LaTeX project (i.e. spanning multiple files) into plain text. The purpose is generation of statistics, so representing mathematics is not an issue. In fact, all mathematics is ideally ignored.  I have found  but could not get it to run. It seems unfinished, but is exactly what I am looking for otherwise. What category does the 'the recent perfect' belong to? A scholar has said that there are 4 usages of the present past tense:   The Universal sense of the Perfect, used to indicate that a state of affairs prevailed throughout some interval stretching from the past into the present       I've known Max since 1960.  The Existential sense of the Perfect, used to indicate the existence of past events     I have read Principial Mathematica five times.  The Stative/Resultative sense of the Perfect, used to indicate that the direct effect of a past event still continues     I can't come to your party tonight - I've caught the flu.  The Hot News sense of the Perfect, used to report hot news     Malcolm X has just been assassinated.    To what category does the recent past belong? How to change a default application in Ice Cream Sandwich? I used the ADWLauncher EX by default while having Gingerbread 2.3.6.  Today I have manually updated my Nexus S to Ice Cream Sandwich 4.0.3, and I wanted to give the new default launcher a shot, but I cannot find anymore where to select / forget the default application for an action.  I've turned the settings of my phone inside out, googled and crawled the forums, but without success. If anybody can tell me how to change a default application in ICS, I'd be grateful!      Yeah, I never thought I'd want to see that Complete action using... window again! :D iOS 7 Weather app expand/collapse transition Understanding MCMC and the Metropolis-Hastings algorithm Over the past few days I have been trying to understand how Markov Chain Monte Carlo (MCMC) works. In particular I have been trying to understand and implement the Metropolis-Hastings algorithm. So far I think I have an overall understanding of the algorithm but there are a couple of things that are not clear to me yet. I want to use MCMC to fit some models to data. Because of this I will describe my understanding of Metropolis-Hastings algorithm for fitting a straight line $f(x)=ax$ to some observed data $D$:  1) Make an initial guess for $a$. Set this $a$ as our current $a$ ($a_0$). Also add $a$ at the end of the Markov Chain ($C$).  2) Repeat the steps bellow a number of times.  3) Evaluate current likelihood (${\cal L_0}$) given $a_0$ and $D$.  4) Propose a new $a$ ($a_1$) by sampling from a normal distribution with $\mu=a_0$ and $\sigma=stepsize$. For now, $stepsize$ is constant.  5) Evaluate new likelihood (${\cal L_1}$) given $a_1$ and $D$.  6) If ${\cal L_1}$ is bigger than ${\cal L_0}$, accept $a_1$ as the new $a_0$, append it at the end of $C$ and go to step 2.  7) If ${\cal L_1}$ is smaller than ${\cal L_0}$ generate a number ($U$) in range [0,1] from a uniform distribution  8) If $U$ is smaller than the difference between the two likelihoods (${\cal L_1}$ - ${\cal L_0}$), accept $a_1$ as the new $a_0$, append it at the end of $C$ and go to step 2.  9) If $U$ is bigger than the difference between the two likelihoods (${\cal L_1}$ - ${\cal L_0}$), append the $a_0$ at the end of $C$, keep using the same $a_0$, go to step 2.  10) End of Repeat.  11) Remove some elements from the start of $C$ (burn-in phase).  12) Now take the average of the values in $C$. This average is the estimated $a$.  Now I have some questions regarding the above steps:   How do I construct the likelihood function for $f(x)=ax$ but also for any arbitrary function? Is this a correct implementation of Metropolis-Hastings algorithm? How the selection of the random number generation method at Step 7 can change the results? How is this algorithm going to change if I have multiple model parameters? For example, if I had the model $f(x)=ax+b$.   Notes/Credits: The main structure of the algorithm described above is based on the code from an MPIA Python Workshop. Installing a 16-bit Windows 95 game on 64-bit Windows 7 Home Premium What are the norms in Ito isometry? Itō isometry from :     Let $W : [0, T] \times \Omega \to \mathbb{R}$ denote the canonical   real-valued Wiener process defined up to time $T &gt; 0$, and let $X :  [0, T] \times \Omega \to \mathbb{R}$ be a stochastic process that is   adapted to the natural filtration $\mathcal{F}_{*}^{W}$ of the Wiener   process. Then $$      \mathbb{E} \left[ \left( \int_{0}^{T} X_{t} \, \mathrm{d} W_{t} \right)^{2} \right] = \mathbb{E} \left[ \int_{0}^{T} X_{t}^{2} \,  \mathrm{d} t \right], $$ where $\mathbb{E}$ denotes expectation with   respect to  $\gamma$. In other words, the Itō   stochastic integral, as a function, is an isometry of normed vector   spaces with respect to the norms induced by the inner products $$      ( X, Y )_{L^{2} (W)} := \mathbb{E} \left( \int_{0}^{T} X_{t} \, \mathrm{d} W_{t} \int_{0}^{T} Y_{t} \, \mathrm{d} W_{t} \right) =  \int_{\Omega} \left( \int_{0}^{T} X_{t} \, \mathrm{d} W_{t}  \int_{0}^{T} Y_{t} \, \mathrm{d} W_{t} \right) \, \mathrm{d} \gamma  (\omega) $$ and $$      ( A, B )_{L^{2} (\Omega)} := \mathbb{E} ( A B ) = \int_{\Omega} A(\omega) B(\omega) \, \mathrm{d} \gamma (\omega). $$   I was wondering what the two normed spaces are and what their norms are, so that the two normed spaces are isometric wrt their norms?  Thanks and regards! When is "seems to be" used instead of "seems"? The baby seems happy/comfortable. The baby seems to be happy/comfortable.   Are these both correct? If both are correct, what are the differences between them? Why does printf() not print anything before sleep()? Why is the result of a raster calculation integer when it should be decimal? I'm trying to calculate the NDVI using raster calculator, but the result is integer instead of decimal.  NDVI = (NIR - RED)/(NIR + RED)   The result is normally in the range -1 to 1, but when i tried to calculate de result is -1, 0 and 1, and it does not have have any number in between like, -0.9 or 0.1. And i need those values so i can classify the result in term of soil occupation html - how to remove right margin completely? Why did they make another prequel? Star Trek: Discovery, the first new Star Trek television series in 12 years, debuted last week.  As with a number of recent Star Trek efforts, this is a prequel to the Original Series, occurring roughly one decade prior chronologically.    The Original Series, the Next Generation, Deep Space Nine, and Voyager occur in a chronological sequence that, generally speaking, moves forward (although TNG, DS9, and Voyager overlap to various degrees).  The linear trajectory of Star Trek productions took a sudden shift with the television series Enterprise, which was set just over 100 years before TOS. This was followed by J.J. Abrams' 2009 film Star Trek, which created a new timeline and which followed the characters from TOS, but at a time that is also chronologically one decade before TOS.  Given that the last few interpretations of Star Trek were prequels in one sense or another, I was disappointed that Discovery was yet another prequel.  I'd like to know why the showrunners decided to take this direction.  I haven't been able to find any statements about the rationale.    That being said, I find it interesting that Star Trek (2009) was set in 2255-2258 and Discovery is currently set in 2256, even though they are ostensibly in different timelines &mdash; the former in the reboot timeline and the latter supposedly in the original timeline.  Also, one of the showrunners for Discovery, Alex Kurtzman, was one of the principal members of the creative team behind the Abrams films.  Why did the creative staff behind Discovery decide to make another prequel?  Does it have anything to do with the fact that Star Trek (2009) and Discovery are set in roughly the same years? This is one of the possible ways I come out:  struct RetrieveKey {     template &lt;typename T&gt;     typename T::first_type operator()(T keyValuePair) const     {         return keyValuePair.first;     } };  map&lt;int, int&gt; m; vector&lt;int&gt; keys;  // Retrieve all keys transform(m.begin(), m.end(), back_inserter(keys), RetrieveKey());  // Dump all keys copy(keys.begin(), keys.end(), ostream_iterator&lt;int&gt;(cout, "\n"));   Of course, we can also retrieve all values from the map by defining another functor RetrieveValues.  Is there any other way to achieve this easily? (I'm always wondering why std::map does not include a member function for us to do so.) Do individual rays of light lose energy via the inverse square law? If you have two envelopes, and ... Suppose you're given two envelopes. Both envelopes have money in them, and you're told that one envelope has twice as much money as the other. Suppose you pick one of the envelopes. Should you switch to the other one?  Intuitively, you don't know anything about either envelope, so it'd be ridiculous to say that you should switch to the other envelope to maximize your expected money.   However, consider this argument. Let $x$ be the amount of money in the envelope you picked. If $y$ is the amount of money in the other envelope, then the expected value equals  $$E(y) = \frac{1}{2}\left(\frac{1}{2}x\right) + \frac{1}{2}\left(2x\right) = \frac{5}{4} x$$  But $5x/4 &gt; x$, so you should switch!    The Wikipedia article says that $x$ stands for two different things, so this reasoning doesn't work. I say this is not a valid resolution.   Consider opening up the envelope that you pick, and finding $\$10$ inside. Then you can run the expected value calculation to get $$E(y) = \frac{1}{2} \cdot \$5+\frac{1}{2} \cdot \$20 = \$12.50$$  This means that if you open one of the envelopes and find $\$10$, you should switch to the other envelope. The $\$10$ doesn't stand for two different things, it literally just means $\$10$.   But you don't have to open up the envelope to run this calculation, you can just imagine what's inside, and run the calculation based on that. This is what "Let $x$ be the amount in the envelope" means. The problem with the argument is not that $x$ stands for two different things.   So what is the problem?    Previous questions on stack exchange have given the resolution that I just said I wasn't satisfied by, so please don't mark this as a duplicate. I want a different resolution, or a more satisfying explanation of why $x$ does stand for two different things.  Apparently there is still research being published about this problem - maybe it isn't so obvious?    I think there's something subtle wrong with the premise. Because there's no uniform probability distribution on $\mathbb{R}$, statements like "random real number" are not well-defined. Likewise, I think "one envelope has twice as much money as the other" assumes some probability distribution on $\mathbb{R}$, and perhaps our expected value calculation assumes that this distribution is uniform, which it cannot be ... I'm not the most experienced person when it comes to commands. I worked out how to do stuff like when holding x you have y effect. I wanted to think of something that gave other people an effect when hit. Here is what I came up with but I got stuck when it said it couldn't execute the command.  /scoreboard objective add nokill dummy  /scoreboard objective add poi dummy  /scoreboard players set [player] nokill 1  /scoreboard players add @a poi 1 {SelectedItem:{id:minecraft:diamond_sword,display:{Name:{Poison sword}}}}  /execute @a[score_poi_min=1] ~ ~ ~ /effect @p[score_nokill_max=1,r=5] {HurtTime:1} minecraft:poison 10 1