Hello I am building a version of Craps where it randomly rolls two dice and stores the information in two different rolls, where how many times it rolled a 7 and how many times it rolled an 11 in 100 rolls. I have managed to get it where I can output how many rolls I got for each and how many wins altogether, but now when I prompt the user if they want to play again I cant see to get it to execute the while method I created for the rolling loop. Is there a way I can get it to re-execute that in the last if statement and if so what would I put in that if statement to achieve this or is there some other kind of method I should be doing here instead? It was recently closed and pointed me to a string comparison page on stack that didn't answer my question. I understand how to compare strings and what == does. However that doesn't tell me why  or what is needed to re-execute a previously performed while loop after prompting the user for action.  import java.util.Random; import java.util.Scanner;  public class Craps_ws7 {     public static void main(String args[])     {         Scanner keyboard1 = new Scanner(System.in);         System.out.println("Welcome to my Craps Game!");         boolean stop = false;         int sevenRoll = 0;         int elevenRoll = 0;         int totalWins = 0;         int gameCount = 0;         while(gameCount &lt;= 100)         {             gameCount = gameCount + 1;             Random generator = new Random();             int die1 = generator.nextInt(6) + 1;             int die2 = generator.nextInt(6) + 1;             int dieTotal = die1 + die2;               if (dieTotal == 7)              {                 System.out.println("You rolled: " + dieTotal);                 System.out.println("You Win!");                 sevenRoll++;                 totalWins++;              }              else if(dieTotal == 11)              {                 System.out.println("You rolled: " + dieTotal);                 System.out.println("You Win!");                 elevenRoll++;                 totalWins++;              }              else              {                 System.out.println("You rolled: " + dieTotal);                 System.out.println("You lose!");              }         }     System.out.println("You rolled a total of " + sevenRoll + "  sevens and " + elevenRoll + " elevens for a total of " + totalWins + " wins out of 100!" );     System,out.println("Would you like to play again? [y/n]");     string ans = keyboard1.nextLine();     if (ans = "y" || ans = "Y")     {      }     else      {         System.out.println("Thank you for playing, Good Bye!");     }     } }
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?
Installing QGIS on Ubuntu 14.04? Following the QGIS installation guide I have tried both UbuntuGIS and QGIS stable, but both fail with the error message:  The following packages have unmet dependencies:  python-qgis : Depends: python-qgis-common (= 2.6.1.1+trusty1) but it is not going to be installed             Depends: libqgispython2.6.1 but it is not going to be installed            Depends: libqgis-analysis2.6.1 but it is not going to be installed            Depends: libqgis-core2.6.1 but it is not going to be installed            Depends: libqgis-gui2.6.1 but it is not going to be installed            Depends: libqgis-networkanalysis2.6.1 but it is not going to be installed   qgis : Depends: libgdal1h (>= 1.8.0) but it is not going to be installed      Depends: libqgis-analysis2.6.1 but it is not going to be installed     Depends: libqgis-core2.6.1 but it is not going to be installed     Depends: libqgis-gui2.6.1 but it is not going to be installed     Depends: libqgis-networkanalysis2.6.1 but it is not going to be installed     Depends: qgis-providers (= 2.6.1.1+trusty1) but it is not going to be installed     Recommends: qgis-plugin-grass but it is not going to be installed     Recommends: qgis-plugin-globe but it is not going to be installed   E: Unable to correct problems, you have held broken packages.    I had QGISv.2.4 running on my machine with Ubuntu 12.04. After upgrading to Ubuntu 14.04 I was getting error message that pyqgis could not be loaded.  So I uninstalled QGIS using the Ubuntu Software Center and also run  sudo apt-get purge qgis   After that I tried to install the latest version of QGIS Debian Stable and UbuntuGIS unstable but getting the error messages described above.  The weird thing is that neither Ubuntu Software Center nor apt-get list have QGIS listed as installed, but if I run a search for qgis on my file system qgis and all its dependencies are still there. That's why I getting told to have broken packages. Find the exact value of the infinite sum $\sum_{n=1}^\infty \big\{\mathrm{e}-\big(1+\frac1n\big)^{n}\big\}$ What is the effect of the number of cross-type focus points on sharp focus? Why would Mystique's DNA allow for Sentinels that can duplicate mutant powers? What space does the spell Cloud of Daggers fill? I am trying to workout what template  (PHB, p. 222) would be on a grid. The spell states:     You fill the air with spinning daggers in a cube 5 feet on each side, centered on a point you choose within range.   So does that mean it would look like this:     Or like this:    From what I've read online, there seems to be some suggestion that it is a single square (tile) though this does stack with the spell description of "a cube 5 feet on each side".  Clearing this up for my group would be great, and I am sure our DM will be pleased as his monster were nicely diced by this spell. Thanks. When I get a notification on android that someone had posted an answer or comment, if I click the notification, it opens the Stack Exchange app but shows the main view with the inbox opened, not the comment or answer that was in the notification.  If there is only one notification pending, when you tap it it should show you the actual contents rather than just the inbox. Evaluate $\prod \frac {2k - 1} {2k}$ I came across to this: evaluate $$\prod_{k = 1}^{n} \frac {2k - 1} {2k}.$$  I brought it to a closed-form expression in asymptotics but I suspect my asymptotics is bad and I also want to see different solutions, hence the question.  My original solution: Write   $$\begin {eqnarray} \prod_{k = 1}^{n} \frac {2k - 1} {2k} &amp; = &amp; \exp \left (\sum_{k = 1}^{n} \log \left (1 - \frac {1} {2k}\right) \right) \nonumber \\ &amp; = &amp; \exp \left (- \sum_{k = 1}^{n} \sum_{m = 1}^{\infty} \frac {1} {(2k)^m m}\right). \end {eqnarray}$$  Let $$S = \sum_{m = 1}^{\infty} \frac {1} {(2k)^m m} \tag {1}.$$ Multiply both sides of $(1)$ by $2k$ to get $2k S &lt; S + 1$, and by $4k$ to get $4kS &gt; S + 2$. Hence, $$\frac {2} {4k - 1} &lt; S &lt; \frac {1} {2k - 1}.$$ Then, $$\frac {1} {2} \left( \log (4n - 1) - \log 3 \right) - 2 + O \left(\frac {1} {n^2}\right) &lt; \sum_{k = 1}^{n} \sum_{m = 1}^{\infty} \frac {1} {(2k)^m m} &lt; \frac {1} {2} \log (2n - 1) - 1 + O \left(\frac {1} {n^2}\right).$$ Hence, $$\sqrt {\frac {c} {2n - 1}} &lt; \prod_{k = 1}^{n} \frac {2k - 1} {2k} &lt; \sqrt {\frac {3 c^2} {4n - 1}},$$ where $c$ is a constant. Any better approach? Is there any text editor which supports Markdown (Ask Ubuntu's formatting style)? How can one prove that the series $\displaystyle \sum\limits_{n=1}^\infty \frac{1}{(n!)^2}$ converges to an irrational number? There's no need to use Taylor expansion, integrals or any advanced/professional techniques. It can be proved using only basic techniques. My first attempt was to assume that the series does converge to a rational number $ \frac{p}{q}$ and then it follows by definition that for every positive epsilon there exists an integer k such that $ {\sum_{n=1}^{k} \frac{1}{(n!)^2} -\frac{p}{q}}&lt;=\epsilon$ I tried to get a contradiction but I failed. Full file date (without GNU utilities) I am relatively fresh to the DI party and am struggling to get my head around how exactly to use Dependency Injection. I understand that I can pass requirements as part of a service, but what about in my own class?  Say I have the below class where I want the language manager service to be injected:  class Foo implements ContainerInjectionInterface {    protected $languageManager;     public function __construct(LanguageManagerInterface $languageManager) {     $this-&gt;languageManager = $languageManager;   }    public static function create(ContainerInterface $container) {     return new static(       $container-&gt;get('language_manager')     );   } }   When I call new Foo() I am required to pass an instance of LanguageManagerInterface. That makes sense in terms of a normal constructor method, but that would require me to instantiate the class like the below:  $languageManager = \Drupal::service('language_manager'); $foo = new Foo($languageManager)   That just doesn't feel right to me.  Is there something I am missing, or would this class always have to be a service to take advantage of dependency injection? In an ordered field we have $x^2 \ge 0$, hence the equation $-1 = x^2 + y^2$ has no solution. But what about finite fields in general? What is the solutions set $$  -1 = x^2 + y^2 $$ of this equation? As an Indian citizen, can I apply and have both a B1 and F1 visa? Here's an example of a short conversation between me and a native speaker via text messages:  A: I'm so exited for this app B: Yeah, me too A: We start tomorrow B: OK   Shouldn't it be "We are starting tomorrow"?! Switching a DIV background image with jQuery A and B disjoint, A compact, and B closed implies there is positive distance between both sets How to install clang++? I'm having trouble getting clang++ to work as I compile my code. Specifically, I'm getting a make: clang++: Command not found error.  I've run sudo apt-get install llvm, and also sudo apt-get install build-essential and sudo apt-get update. What do I have to do to get clang++ installed? E.g.  I know that I can browse the chat when I'm not logged on. But what if I am logged on and want to spare the inconvenience of logging off/multiple browsers? Vector spaces for the irreducible representations of the Lorentz Group EDIT:  The vector space for the $(\frac{1}{2},0)$ Representation is $\mathbb{C}^2$ as mentioned by Qmechanic in the comments to his answer below! The vector spaces for the other representations remain unanswered.  The definition of a representation is a map (a homomorphism) to the space of linear operators over a vector space. My question is: What are the corresponding vector spaces for the   $(0,0)$ Representation $(\frac{1}{2},0)$ Representation  $(0,\frac{1}{2})$ Representation $(\frac{1}{2},0) \oplus (0,\frac{1}{2}) $ Representation $(\frac{1}{2},\frac{1}{2})$ Representation infinite dimensional Representation? What if the Earth stops in its orbit and instead falls straight towards the Sun? The Earth orbits around the Sun because it has angular momentum. If we stopped the Earth in orbit and then let it fall straight towards the Sun, how long would it take to reach the Sun in seconds?  Details and assumptions  The mass of the sun is 2*10^30 Kg. The mass of the earth is 6*10^24 Kg. The earth is 149,600,000 Km from the Sun. You may treat the Earth and Sun as point masses.