I am trying to create a program, that takes asks the user to enter a Contact name, and a contact number, and then stores that contact in my ArrayList entries. Once the user has entered the first contact, they are given the choice to add another contact to the array list, or to not add any more contacts, exiting the loop, and simple displaying all of the contacts stored in entries.  I am currently having trouble exiting my while loop, the first contact adds correctly to the array list, and then displays the "Add Another?" message, however from there it falls apart, if i type Y, the console simply just hangs with the cursor flashing, instead of asking for the next contacts name and number, and if i type N, it once again just hangs and does nothing, instead of exiting the loop and displaying the contents of  my ArrayList like intended.  Any help towards solving this issue would be much appreciated! I have a feeling it may be something to do with my loop, but can't for the life of me see what!  Thanks in advance!  while (addMore != false)     {         System.out.print("Contact name: ");         String name = sc.nextLine();         System.out.print("Contact Number: ");         String TelNo = sc.nextLine();          // add the user inputted contact to ArrayList entries.         entries.add(new TelEntry(name, TelNo));           System.out.print("Add Another?(Y/N): ");         if(sc.nextLine() == "N")         {             addMore = false;             break;         }          else if(sc.nextLine() !="Y" &amp;&amp; sc.nextLine() !="N")         {             System.out.println("Please Select Y or N");         }          addMore = true;      }      // FOR LOOP TO PRINT ALL ENTRIES IN ARRAY     for(int i=0; i&lt;entries.size(); i++)     {         System.out.println(entries.get(i));     }
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?
The number of divisors I am reading a math book. It states the following rule:      For an integer $n$ greater than 1, let the prime factorization of $n$ be $$n=p^a_1p^b_2p^c_3...p^m_k$$    Here $a, b, c,..., m$ are nonnegative integers, and $p_1,p_1,...,p_k$ are prime numbers. Then the number of divisors of $n$ is: $$d(n)=(a+1)(b+1)(c+1)...(m+1)$$   I can use the rule to solve problems correctly, but I don't understand the rule. How to prove it? If I'm on a page that has web notifications (like Slack or others), Firefox asks me if I want to enable them. However, my choices are "Yes" or "Ignore for now". The problem is, if I select "Ignore", every time there is a notification it asks me again. This is incredibly annoying.   How do I disable this completely? (I would accept disabling this feature entirely if that's easiest.) Let $\gamma:[0,1] \to \mathbb R^n$ be a smooth closed curve, such that $\gamma(0)=\gamma(1), \gamma'(0)=\gamma'(1), |\gamma'(a)|=1$ and let $B_r=\{x| \exists t, |\gamma(t)-x|&lt;r\}$. How can i show that the volume of $B_r$ is equal to $br^{(n-1)}$ for $r &lt;\varepsilon$ for some $\varepsilon&gt;0$. And how can I find $b$? It is intuitively obvious. But how can one prove it? I have no idea. This is a  about DNS/Hostnames resolution to IPs/Ports   Example 1  I'm running a web server on port 80 and another on port 87. I would like to use DNS so that www.example.com goes to port 87. How can I accomplish this using DNS only?  Example 2  I'm running a service on my server on a non-standard port. How can I get clients to connect to this non-standard port automatically? Can I use DNS? Is there some application specific support where DNS could indicate the IP and Port?   Example 3  Do some application protocols specifically support hostname awareness, and allow special actions to be taken based on this information? Are there other questions on Server Fault that cover some of these?  Commandeering: This question was originally asking about running IIS and Apache on the same server, but the same concepts can be applied to any server software receiving connections from clients. The Answers below describe the technical problems and solutions of using DNS and application protocol support to assign a port number for a client to connect. Consider this question on .  I put out a 200 bounty on the question, but did not get an answer from anyone other than myself that worked.    In fact, my answer is also the highest up-voted on it at this point.  I know that allowing OP's to retract a bounty can be a slippery slope; in fact I think that once the bounty is put up it should stay up.  But why not allow the OP to answer their own questions with a bounty and reward it to them if they receive the same up-votes as others?  Yes, I am fully aware that bounties are a risk.  People will use them for numerous reasons such as trying to draw extra attention to their issues.  However, in my specific question, the only valid answer is the one that I gave.  Had it been anyone else's question, I would have received the bounty, but since it was my own I did not. Why does unlocking the bootloader wipe phone? Is there a setup where I can leave the water on all summer? We regularly get questions about wormholes on this site. See for example  and . Various wormhole solutions are known, of which my favourite is  because it's closest to what every schoolboy (including myself many decades ago) thinks of as the archetypal wormhole.  The trouble is that Visser has pulled the same trick as  of starting with the required (local) geometry and working out what stress-energy tensor is required to create it. So Visser can tell us that if we arrange exotic string along the edges of a cube the spacetime geometry will locally look like a wormhole, but we know nothing about what two regions of spacetime are connected.  My question is this: suppose I construct a Visser wormhole by starting in Minkowksi spacetime with arbitrarily low densities of exotic matter and gradually assembling them into the edges of a cube, how would the spacetime curvature evolve as I did so?  I'm guessing that I would end up with something like Wheeler's bag of gold spacetime. So even though I would locally have something that looked like a wormhole it wouldn't lead anywhere interesting - just to the inside of the bag. I'm also guessing that my question has no answer because it's too hard to do any remotely rigorous calculation. Still, if anyone does know of such calculations or can point me to references I would be most interested. Showing that $\displaystyle\lim_{s \to{1+}}{(s-1)\zeta(s)}=1$ I need prove the following: ($\zeta(s)$ is the Riemann zeta function)  $\displaystyle\lim_{s \to{1+}}{(s-1)\zeta(s)}=1$  I really don't know, I have tried hard, but have obtained nothing for now. How do regular expressions differ from wildcards used to filter files $11$ out of $36$? I got this by writing down the number of possible outcomes ($36$) and then counting how many of the pairs had a $6$ in them: $(1,6)$, $(2,6)$, $(3,6)$, $(4,6)$, $(5,6)$, $(6,6)$, $(6,5)$, $(6,4)$, $(6,3)$, $(6,2)$, $(6,1)$. Is this correct? How to plot ROC curves in multiclass classification? In other words, instead of having a two class problem I am dealing with 4 classes and still would like to assess performance using AUC. Where can I find the location of folders for installed programs? Commenting out large sections To &quot;comment out&quot; a line, I need to insert a % at the beginning of the line (so that the line will not be compiled). Is there a way to comment out a large section without having to manually place % in front of each line? I have a php file which I will be using as exclusively as an include. Therefore I would like to throw an error instead of executing it when it's accessed directly by typing in the URL instead of being included.  Basically I need to do a check as follows in the php file:  if ( $REQUEST_URL == $URL_OF_CURRENT_PAGE ) die ("Direct access not premitted");   Is there an easy way to do this? If a sports team is down by 1-2 in a best of 7 series, what is their chance of winning (if both teams have a 1/2 chance of winning every game)? I know that the team has to win 3 of the 4 remaining games. So I thought that from the 4 remaining games, there are a total of $2^4 = 16$ total different outcomes.   Could someone point me towards the right direction to determine the probability of the team winning 3 of the 4 remaining games? Would it be 4C3/16 since the three wins can be chosen amongst the 4 games left? I often find  syntax very helpful, e.g. process substitution like in diff &lt;(sort file1) &lt;(sort file2).  Is it possible to use such Bash commands in a Makefile? I'm thinking of something like this:  file-differences:     diff &lt;(sort file1) &lt;(sort file2) &gt; $@   In my GNU Make 3.80 this will give an error since it uses the shell instead of bash to execute the commands. Editing LaTeX generated PDF Is there an application (in Windows, Unix, or Mac) that allows you to edit the LaTeX generated PDF. I know there is pdfsync, but it only gives you the line, and then you have to search where in the line you want to make the change. This is OK sometimes, for a couple of changes, but when there are lots of changes it becomes really tedious.  I would really like to accelerate this process of correcting mistakes (mostly grammar, missing commas etc.). in my document, without going through all the markup. I have recently been reading about Quantum Electrodynamics which I found very interesting, but even more confusing.  I understand photons mediate the electromagnetic force and interactions between charges can be described by virtual photon exchange. And that in Quantum Mechanics particles paths can be evaluated by sum over all paths...  An electron travelling from one point to another will take all paths, emitting and reabsorbing virtual photons. Does the electrons take all paths including those that involve faster than light velocities?  Is this question null, Does it mean anything to ask about properties of virtual particles?  Do I have the wrong idea about what virtual particles are? So basically as it stands I have a laptop which has no cd/dvd drive, and I don't have a usb drive.  The laptop has windows 7 installed with ubuntu 11.04 installed through wubi.  What I want to do is remove windows completely, and make ubuntu the only OS installed on the system.  Is there a way to do this without re-installing ubuntu? (i.e. can I take my wubi install away from windows?)  or is there a way to from inside ubuntu have it run the ubuntu iso somehow so I can just wipe the system and install it fresh? (even if it means I need to have an e.g. 2gb partition just for the image to reside in).