int i; i = 2; switch(i) {     case 1:          int k;         break;     case 2:         k = 1;         cout&lt;&lt;k&lt;&lt;endl;         break; }   I don't know why the code above works.  Here, we can never go into case 1 but why we can use k in case 2?
I've always wondered this - why can't you declare variables after a case label in a switch statement?  In C++ you can declare variables pretty much anywhere (and declaring them close to first use is obviously a good thing) but the following still won't work:  switch (val)   {   case VAL:     // This won't work   int newVal = 42;     break; case ANOTHER_VAL:     ...   break; }     The above gives me the following error (MSC):     initialization of 'newVal' is skipped by 'case' label   This seems to be a limitation in other languages too.  Why is this such a problem?
Is there a statement whose undecidability is undecidable? We know there are statements that are undecidable/independent of ZFC. Can there be a statement S, such that (ZFC $\not\vdash$ S and ZFC $\not\vdash$ ~S) is undecidable? Query standard input of lightning-input I want to query standard HTML textarea which is wrapped by lightning-textarea. How can I get it?  &lt;lightning-textarea name=&quot;secret_field&quot; label=&quot;Secret&quot; value={secretFieldValue}&gt;&lt;/lightning-textarea&gt; Natural Sort Order in C# How do I prove the following statement by induction?  $$n^2 \lt 2^n$$  $P(n)$ is the statement $n^2 \lt 2^n$  Claim: For all $n \gt k$, where $k$ is any integer, $P(n)$  (since $k$ is any integer, I assume I have to prove this for positive and negative integers)  So let base case be $P(1)$, and I have to prove $P(n)$ for $n \ge 1$ and $n \lt 1$  $P(1)$ is $1^2 \lt 2^1$ which is clearly true.  Induction hypothesis: $k^2 \lt 2^k$  Inductive step $(k+1)^2 \lt 2^{(k+1)}$  $(k+1)^2 = k^2 + 2k + 1$  $k^2 + 2k + 1 \lt 2^k + 2k + 1$ by inductive hypothesis  Not sure how to proceed. Is my previous intuition that I have to prove this for $n \ge 1$ and $n \lt 1$ correct? I am trying to create a vase that looks similar to this:    If there is another post out there I will happily remove this one or redirect it there.  Specifically, I am trying to create the creased effect in the geometry that looks like it is twisting around the vase.  I have tried using Checker Deselect and extrude->scaling the verts but that really screws up my mesh.  Link to my model if it helps: A sphere of radius R is rolling without slipping with a velocity v and collides inelastically with a step of height h &lt; R. What is the minimum velocity for which the sphere will be over the step?    Relevant equations  Total kinetic energy (maybe): $\frac{1}{2}I\omega^{2}+\frac{1}{2}mv^2$  Gravitational potential energy: $mgh$   Moment of inertia about a point a distance d from the CM from de center of mass: $I=I_{cm}+md^{2}$ Rolling without slliping  $v=\omega R$  A discussion of the problem This problem is confusing to me: I know the collision is inelastic so there is no conservation of kinetic energy, there is torque when the sphere pivots the step so the angular momentum is not conserved either, the linear momentum doesn't give a lot information and even though I tried to see what condition needs the torque about the pivot point (to give a net torque in the direction of rotation and thus passing the step), I'm not able to see which torque can overcome the one from gravity which doesn't let the sphere slide up:    The sphere has an angular velocity, but I'm missing something conceptual because I can't figure out how to formally state that the angular momentum changed the right amount so that the sphere made it past the step.  The attempt at a solution  My (almost certainly wrong) attempt was to say that the sphere lost kinetic energy because of the change on potential energy:  $\frac{1}{2}I\omega^{2}+\frac{1}{2}mv^2 +mgR = mg(R+h)\\ v=\sqrt{\frac{10}{7}gh} $  I hope you can help me :) Database connection close Is there any method to close connection similar to  for  in WordPress?  Is it not necessary to close connection for global $wpdb? How do I blend multiple photos to remove random people from the background? I'm very excited about the new  for Android/iPhone. Let's say you're taking a picture of your friend in front of a landmark with several people walking by. The app allows you to remove the people from the photo, leaving only the background and your friend. The app isn't just doing a clone of the surrounding image to paint over unwanted subjects. It's actually taking multiple images, detecting which objects are moving, and letting you select them for removal. This sounds awesome! But I don't want to be limited to taking pictures with a smart phone.  I would like to take multiple photos of the same scene. (Maybe with a tripod, but it would be better if I didn't have to use a tripod.) Then I would somehow blend them together to remove unwanted elements. How do I do that? I know there are tons of photoshop tutorials out there, but all the ones I find just tell you how to use the clone tool. Ring isomorphism (polynomials in one variable) I found the following question about compactness:     A set $S\subseteq \mathbb{R}^n$ has the following property:   if a sequence of $S$ has exactly one accumulation point in $S$, then it converges in $S$. Prove that $S$ is compact.    We know that in $\mathbb{R}^n$ compact sets correspond to closed and bounded sets.   (1) I am trying to prove that $S$ is closed. The condition in the question says if a sequence of $S$ has an accumulation point in $S$ then it converges in $S$. I think instead the condition should be if a sequence of $S$ has an accumulation point( in $\mathbb{R}^n$, not necessarily in $S$ )then it converges in $S$.  Am I correct?  (2) How to prove that $S$ is bounded?  P.S. I have made an edit (there is exactly one accumulation point).  Source of the question:  of this problem set. Prevent Windows 7 from sleep + power button hook I'm used to not shutdown Windows but to sleeping it. I set up power button (PB) action to do it. When I want to shutdown I must go to start -> Shutdown. That's OK.  Now I think of a mechanism that will be hooked up to a PB. Should be started after I press PB but before OS will go to sleep. Something that will check few conditions (i.e. running backup, running AV scan, ...) and if true (something is running) prevent go to sleep.  Optionally: It would be nice to start the same "mechanism" before restart and shutdown (invoked not only from Start menu, but also by other software (i.e. installers) but with option to allow some sources (i.e. UPS software)  Generally: How to run something after PowerButton but before Sleeping. How to code (C#.NET, vbs, batch (preferred)) sleep prevention (cancellation). I know it's not possible to install a 32-bit driver in the traditional way, but I really cannot find a 64-bit driver for my memory card reader. Is there anyway I can somehow use this device with a 32-bit driver on a 64-bit Windows 7 installation?  I was thinking there might be a way to run a device in compatibility mode? Possibly even have a 32-bit device layer emulator or something?  I'm interested in any method to get this device up and running. Is it possible to reintegrate a Horcrux? As anyone who is familiar with Harry Potter knows, a horcrux is made when someone commits murder and stores a piece of their soul in something. Would it be possible for this someone to later recover and reintegrate their soul piece(s), should they want to? If $x+y+z=xyz$, prove $\frac{2x}{1-x^2}+\frac{2y}{1-y^2}+\frac{2z}{1-z^2}=\frac{2x}{1-x^2}\times\frac{2y}{1-y^2}\times\frac{2z}{1-z^2}$ given that $x^2~,~y^2~,~z^2\ne1$  I came across this question in an ancient ($19$th century) Trigonometry book, and this is the method they use to prove the result (please note: I understand this method fully): Let $x=\tan A$ ,$~y=\tan B$ and $z=\tan C$ which is acceptable without any loss of generality. This means that we are saying that $$\tan A+\tan B+\tan C=\tan A\tan B\tan C$$ Consider $\tan (A+B+C)$: $$\tan (A+B+C)=\frac{\tan A+\tan B+\tan C-\tan A\tan B\tan C}{1- \tan A \tan B- \tan C \tan A - \tan B \tan C}$$ So if $~\tan A+\tan B+\tan C=\tan A\tan B\tan C~~$ then $~~\tan (A+B+C)=0$. Hence, let $~A+B+C=\pi$. Now consider $\tan (2A+2B+2C)$: $$\tan (2A+2B+2C)=\frac{\tan 2A+\tan 2B+\tan 2C-\tan 2A\tan 2B\tan 2C}{1- \tan 2A \tan 2B- \tan 2C \tan 2A - \tan 2B \tan 2C}=0$$ $$\implies \tan 2A+\tan 2B+\tan 2C=\tan 2A\tan 2B\tan 2C$$ $$\implies \frac{2\tan A}{1-\tan^2 A}+\frac{2\tan B}{1-\tan^2 B}+\frac{2\tan C}{1-\tan^2 C}=\frac{2\tan A}{1-\tan^2 A}\times\frac{2\tan B}{1-\tan^2 B}\times\frac{2\tan C}{1-\tan^2 C}$$ $$\therefore\frac{2x}{1-x^2}+\frac{2y}{1-y^2}+\frac{2z}{1-z^2}=\frac{2x}{1-x^2}\times\frac{2y}{1-y^2}\times\frac{2z}{1-z^2}$$ as required.  My question is, is there any other way of proving this without this rather heavy use of trigonometry? I also would prefer not to work through heaps of algabraic manipulation and expansion to obtain the required result, although if that's necessary I will put up with it ;) Thank you for your help. I'd wish to visit Dubai with my girlfriend, but after reading  and  I started to get a little worried about it. How should I book an hotel? Must I book two singles? Could it be a problem if we walk together in the city and go together to restaurants and malls without being married? What's the recommended max width for the main container and for the main column, for large screens? Based on this question,  and its comments and answers, I did some research, but I didn't find a complete answer.   For me it is obvious that it is a good decision to limit the width of the main container, but what is the recommended max-width for the main container for large screens, in 2017, when the screens become larger and larger? What variables should be considered in this decision?  Also, let's say a website has multiple columns in the main container, what is the max-width for the main column?  Update: I have now a related question. I recommended to one client to reduce the width of the main container on the homepage, but I can't convince him. It is a website with photos, like pexels.com. It is in this case important to limit the width if the elements are not one more important than other? What is the difference between a[bc]d and a{b,c}d? Why do people use a{b,c}d when there is already a[bc]d? Prove $-(-a)=a$ using only ordered field axioms Why is a boolean value in JTable showing as true/false instead of a checkbox? It has been a while since I read the Lord of the Rings novels (don't have a copy at the moment) but I seem to recall he went to Hobbiton at least once, as the young hobbits were always excited to see him.   Did he travel there often?