How to stop console from repeating loop over and over? I'm trying to make the incorrect password start the loop over until the right password is inputted (which it does) but System.out.println statements repeat infinitely in the console. A break statement just terminates the code, but I want it to keep going except only printing the statements once. Any solutions?      public static void main(String[] args){      System.out.println("What is the password?");      Scanner passwordScan = new Scanner(System.in);     String pass = passwordScan.nextLine();     String password = "JohnnyRoberts123";       while(password != pass) {         System.out.println("Wrong password!");         System.out.println("Try again, what is the password?");          continue;
How do I compare strings in Java? I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?
How do I delete data for one game in the iPad Game Center? Trim string in JavaScript? How accurate is the GPS on the iPhone's Find My iPhone app?  I used Find My iPhone app to track a friend. The first 3 stops were dead on but when it refreshed it showed them to be several streets over from actual location. What could cause that? Nonstandard normal distribution Moment of inertia of a hollow sphere wrt the centre? I've been trying to compute the moment of inertia of a uniform hollow sphere (thin walled) wrt the centre, but I'm not quite sure what was wrong with my initial attempt (I've come to the correct answer now with a different method). Ok, here was my first method:  Consider a uniform hollow sphere of radius $R$ and mass $M$. On the hollow sphere, consider a concentric ring of radius $r$ and thickness $\text{d}x$. The mass of the ring is therefore $\text{d}m = \frac{M}{4\pi R^2}\cdot 2\pi r\cdot\text{d}x$. Now, use $r^2 = R^2 - x^2:$ $$\text{d}m = \frac{M}{4\pi R^2}\cdot 2\pi \left(R^2 - x^2 \right)^{1/2}\text{d}x$$ and the moment of inertia of a ring wrt the centre is $I = MR^2$, therefore: $$\text{d}I = \text{d}m\cdot r^2 = \frac{M}{4\pi R^2}\cdot 2\pi\left(R^2 - x^2\right)^{3/2}\text{d}x $$ Integrating to get the total moment of inertia: $$I = \int_{-R}^{R} \frac{M}{4\pi R^2} \cdot 2\pi\cdot \left(R^2 - x^2\right)^{3/2}\ \text{d}x = \frac{3MR^2 \pi}{16}$$  which obviously isn't correct as the real moment of inertia wrt the centre is $\frac{2MR^2}{3}$.   What was wrong with this method? Was it how I constructed the element? Any help would be appreciated, thanks very much. A half covered lens Let's say there's an object in front of a convex lens. I have a piece of paper behind the lens at the right location such that it will the lens will form an image on the paper. The object is illuminating.  Now if I put another piece of paper right before the lens, and cover up half of the lens. The image, instead of only half being visible, it will actually remain the same. The only difference is that it will be dimmer.  Now, the question is what if I remove the paper at the location where the image forms, and put my eye there. What will I see? Will I see the piece of paper which is blocking half of the lens at all? Does that mean I will just "see through" the paper?  I wanted to try this out myself, but unfortunately I don't have a lens besides me. Second law of Newton for variable mass systems Frequently I see the expression  $$F = \frac{dp}{dt} = \frac{d}{dt}(mv) = \frac{dm}{dt}v + ma,$$ which can be applied to variable mass systems.  But I'm wondering if this derivation is correct, because the second law of Newton is formulated for point masses.   Furthermore if i change the inertial frame of reference, only $v$ on the right side of the formula $F = \frac{dm}{dt}v+ma$ will change, meaning that $F$ would be dependent of the frame of reference, which (according to me) can't be true.   I realize there exists a formula for varying mass systems, that looks quite familiar to this one, but isn't exactly the same, because the $v$ on the right side is there the relative velocity of mass expulsed/accreted. The derivation of that formula is also rather different from this one.   So my question is: is this formula, that I frequently encounter in syllabi and books, correct? Where lies my mistake. Why catch Exceptions in Java, when you can catch Throwables? We recently had a problem with a Java server application where the application was throwing Errors which were not caught because Error is a separate subclass of Throwable and we were only catching Exceptions.  We solved the immediate problem by catching Throwables rather than Exceptions, but this got me thinking as to why you would ever want to catch Exceptions, rather than Throwables, because you would then miss the Errors.  So, why would you want to catch Exceptions, when you can catch Throwables? Is it possible for moderators to review more than the daily limited count? Coefficient changes sign when adding a variable in logistic regression In my logistic regression the sign of coefficients of a variable (location distance of an amenity) changes based on other variables (with time -ve, with travel distance +ve) in the model. When the location distance is the only variable in the model, it has +ve sign.    Should the variable need to maintain the +ve sign no matter what other variables are added in the model? Does changing sign signify a multicollinearity issue? Some IVs are gaining significance while in a bivariate model, they didn't show significance and vice versa. Is it okay to add variables that don't have much significance (ex: travel distance has a significance of 0.33 individually, but 0.05 when added with other variables) but becomes significant in the model? thanks. Can I have multiple background images using CSS? Is it possible to have two background images?  For instance, I'd like to have one image repeat across the top (repeat-x), and another repeat across the entire page (repeat), where the one across the entire page is behind the one which repeats across the top.  I've found that I can achieve the desired effect for two background images by setting the background of html and body:  html {     background: url(images/bg.png); }  body {     background: url(images/bgtop.png) repeat-x; }   Is this "good" CSS?  Is there a better method?  And what if I wanted three or more background images? Error: 'else' without 'if' How important are headings in SEO I have a website that sells music artists posters. Each artists has a page containing a small bio, and a list of posters we are selling representing the artist.  Currently our HTML looks like that  &lt;h1&gt;{Artist name}&lt;/h1&gt; bio &lt;h2&gt;Posters&lt;/h2&gt; &lt;ul&gt;   &lt;li class="poster"&gt;...&lt;/li&gt;   ... &lt;/ul&gt;   We are redesigning this page, and we have a new template that we really like. Problem is that in this new version the &lt;h2&gt;Posters&lt;/h2&gt; does not appear anywhere on the page.  As you might expect, a significant part of our traffic comes from people typing something like : "{Artist name} poster" on Google.  I fear that, by removing the word "poster" from the page, we will reduce our chances of getting these people to come to the site, since Google might down rank us.  I see several options here :   Give Google a slightly altered page that contains the H2 tags. But I think this falls into the "Black Hat SEO" category. And I don't want that. Put the heading. Hide it with CSS. Everyone wins, including accessibility tools which can determine the structure of the page using the "invisible" heading. But I do not know if this is considered a good practice. Forget about the heading, and find other ways to tell Google that we really are about posters. (via keywords, but do they really have the same "weight" as an H2?) Adapt the design to our SEO need, and find a way to put that heading nicely.   Are there webmasters out there that have been facing the same issue, how did you resolve it? When to use \par and when \\, \newline, or blank lines What is the difference between \par, \newline, \\ and blank lines? When should I use which one? The Sitemap Paradox We use a  on Stack Overflow, but I have mixed feelings about it.  Web crawlers usually discover pages from links within the site and from other sites. Sitemaps supplement this data to allow crawlers that support Sitemaps to pick up all URLs in the Sitemap and learn about those URLs using the associated metadata. Using the Sitemap  does not guarantee that web pages are included in search engines, but provides hints for web crawlers to do a better job of crawling your site.  Based on our two years' experience with sitemaps, there's something fundamentally paradoxical about the sitemap:  Sitemaps are intended for sites that are hard to crawl properly. If Google can't successfully crawl your site to find a link, but is able to find it in the sitemap it gives the sitemap link no weight and will not index it!  That's the sitemap paradox -- if your site isn't being properly crawled (for whatever reason), using a sitemap will not help you! Google goes out of their way to make :  &quot;We cannot make any predictions or guarantees about when or if your URLs will be crawled or added to our index&quot;  &quot;We don't guarantee that we'll crawl or index all of your URLs. For example, we won't crawl or index image URLs contained in your Sitemap.&quot;  &quot;submitting a Sitemap doesn't guarantee that all pages of your site will be crawled or included in our search results&quot;   Given that links found in sitemaps are merely recommendations, whereas links found on your own website proper are considered canonical ... it seems the only logical thing to do is avoid having a sitemap and make damn sure that Google and any other search engine can properly spider your site using the plain old standard web pages everyone else sees. By the time you have done that, and are getting spidered nice and thoroughly so Google can see that your own site links to these pages, and would be willing to crawl the links -- uh, why do we need a sitemap, again? The sitemap can be actively harmful, because it distracts you from ensuring that search engine spiders are able to successfully crawl your whole site. &quot;Oh, it doesn't matter if the crawler can see it, we'll just slap those links in the sitemap!&quot; Reality is quite the opposite in our experience. That seems more than a little ironic considering sitemaps were intended for sites that have a very deep collection of links or complex UI that may be hard to spider. In our experience, the sitemap does not help, because if Google can't find the link on your site proper, it won't index it from the sitemap anyway. We've seen this proven time and time again with Stack Overflow questions. Am I wrong? Do sitemaps make sense, and we're somehow just using them incorrectly? $\varepsilon$-number countability without choice Let $\alpha\mapsto\varepsilon_\alpha$ be the enumeration of the $\varepsilon$-numbers--that is, those $\alpha$ such that $\omega^\alpha=\alpha$--by the ordinals.  If we know that countable unions of countable sets are countable, (slightly weaker than countable choice), then we can show fairly easily that $\varepsilon_\alpha$ is countable iff $\alpha$ is countable.  I think I saw a result at some point that $\varepsilon_0$ is countable without relying on any choice principle (though I can't recall where I saw that). Is this true? More generally, for which $\alpha$ can we conclude that $\varepsilon_\alpha$ is countable in ZF?  Update: I have been able to prove (in ZF) that if $\varepsilon_\alpha$ is countable, then $|\alpha|&lt;\aleph_1$, so that's one direction. I'm still a bit uncertain about the answers I've got so far. Words that mean ''to say something unintentional'' I am looking for words that mean ''to say something unintentionally'' Customizing the output of Compass sprites Command-line completion from command history So, I've looked at history and at Ctrl+R, but they are not what I thought I knew. Is there a way that I can type in the beginning of a command, and cycle through the matches in my history with some bash shortcut?  # mysq(some shortcut key)   Gives me:  # mysqldump  --add-drop-table -e -q -n -C -u  (some shortcut key) #  mysql -u ben.dauphinee -p LaTeXiT is cropping the pdf I am using LaTeXiT (pierre chachatelier, www.chachatelier.fr) - latex equation editor for Powerpoint for mac.  It's producing pdf that appear to be "cropped" on top (see attached) - I've tried already with changing the "margins" option (Preferences>General) but unsuccessfully - don't think that's the problem.   Any hint?   Thanks