So I'm really new to java and I was trying to practice using while and if statements through a guessing game app.   Everything seemed to work until I'm promped to play again. When I type Y, the loop ends. This isn't supposed to happen as the while argument at the beginning of the code says to keepPlaying if true.   I've tried playing with the argument to make it: while (answer == "Y"). I've played around with it but it always keeps exiting. Please help!!  Here's the code:  import java.util.Scanner; public class GuessingGame  {     static Scanner sc = new Scanner(System.in);     public static void main(String[] args)      {         // TODO Auto-generated method stub         String answer = "Y";         int guess;         int number;         String again;         boolean keepPlaying = true;           System.out.println("Let's play a guessing game!");          while (keepPlaying)         {             System.out.println("I'm thinking of a number between 1 and 10.");             System.out.print("What do you think it is? ");             guess = sc.nextInt();             while (guess &gt; 10 || guess &lt; 1)             {                 System.out.print("I said, between 1 and 10. Try again: ");                 guess = sc.nextInt();             }             number = (int)(Math.random() *10 + 1);             if (guess == number)             {                 System.out.println("You're right!");              }             else             {                 System.out.println("You're wrong! the number was " + number);              }             System.out.print("Play again? (Y or N)");             answer = sc.next();              if (answer == "Y")             {                 keepPlaying = true;             }             else             {                 break;             }          }         System.out.println("Thank you for playing");     }  }
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 force Excel (and other Microsoft Office products) to stop opening files in the same application? Whenever I "double click" on an Excel file and another Excel file is open, the newly opened file automatically opens in the same application window as the previously opened Excel file. This isn't limited to just Excel, as I've seen Word do this as well. This poses a problem when wanting to compare documents side by side.    The current solution I have for this is to actually open another Excel or Word instance, and then open the file from within that application window itself. Is there a way to force Office to open a new instance of the application when double clicking on the file icons?  I'm currently using Office 2007 and Windows XP, but I've seen this on Office 2010 and Windows Vista and 7. I'm looking for an overall solution if possible. A gold reviewer badge? For your continued efforts in reviewing posts, even though the system sometimes messes up and doesn't let you actually review things and keeps displaying them over and over and over. So also, for your patience in putting up with the glitches in the review panel too! Haha  Anyways, a gold reviewer badge: 20000 reviews, over 4000 actioned  I just multiplied both numbers by 20. Think those numbers seem challenging? Is anyone up near those numbers or should it be multiplied by 10 instead? I prefer the higher amount because it would be gold and something harder to work for. :) But we also have to consider the longevity of when all these posts are eventually reviewed and it's only new posts being created.  Anyways, my stats for those who are interested (I wouldn't get the badge to start because I only have ~2000 actioned):  Upvoted            189 Downvoted          11 Edited             926 Commented          127 Voted to Close     44 Flagged            447 Reviewed           21609   As far as the name of the badge, I really like "The Owl is Watching" but not sure if that would be too long. Sounds snazzy though. Ideas?    Personally, I was on a quest to try and clear out all the posts in a single tab before it started showing me the same things over and over (and over) and then it got frustrating because I wasn't even making progress. Quest denied. :(    Lately I've noticed a massive build-up of unreviewed posts. When the review panel was first implemented, there would only ever be maybe 50 unreviewed posts at a time (in a given tab) for my monthly view. Now I log in and there's a thousand or two thousand pending. I think a lot of people quit reviewing after the first badge, so having a gold badge with a high threshold would really improve activity in the review panel and keep people going to improve the community. How many spell slots does a Level 3 Warlock have? The Warlock Table in the PHB (p106) states that a Warlock has the following:   1 First-level spell slot at level 1. 2 First-level spell slots at level 2. 2 Second-level spell slots at level 3.   Does this mean that a third level Warlock has a cumulative 5 Spell Slots? (3 First-Level slots and 2 Second-Level slots)  Or do the new slots just replace old slots between levels such that a 3rd-level Warlock ultimately has only 2 second-level spell slots? What are the tools to help import my data into Salesforce I am switching from old CRM and looking for easy to use tools to import my data How can I get bash to perform tab-completion for my aliases? I have a bunch of bash completion scripts set up (mostly using bash-it and some manually setup).    I also have a bunch of aliases setup for common tasks like gco for git checkout. Right now I can type git checkout dTab and develop is completed for me but when I type gco dTab it does not complete.    I'm assuming this is because the completion script is completing on git and it fails to see gco.    Is there a way to generically/programmatically get all of my completion scripts to work with my aliases?  Not being able to complete when using the alias kind of defeats the purpose of the alias. How can I scale all images in a folder to the same width? I want to scale all images in a given folder to the same width (but different appropriately scaled heights). How can I do this using  a GUI-based or command-line tool?  For bonus points, is it possible to restrict which images are scaled based on their initial width (that is, only scale images that have a width > x and/or a width &lt; y)? What do spacelike, timelike and lightlike spacetime interval really mean? Suppose we have two events $(x_1,y_1,z_1,t_1)$ and $(x_2,y_2,z_2,t_2)$. Then we can define $$\Delta s^2 = -(c\Delta t)^2 + \Delta x^2 + \Delta y^2 + \Delta z^2,$$ which is called the spacetime interval. The first event occurs at the point with coordinates $(x_1,y_1,z_1)$ and the second at the point with coordinates $(x_2,y_2,z_2)$ which implies that the quantity $$r^2 = \Delta x^2+\Delta y^2+\Delta z^2$$ is the square of the separation between the points where the events occur. In that case the spacetime interval becomes $\Delta s^2 = r^2 - c^2\Delta t^2$. The first event occurs at time $t_1$ and the second at time $t_2$ so that $c\Delta t$ is the distance light travels on that interval of time. In that case, $\Delta s^2$ seems to be comparing the distance light travels between the occurrence of the events with their spatial separation. We now have the following definitions:  If $\Delta s^2 &lt;0$, then $r^2 &lt; c^2\Delta t^2$ and the spatial separation is less than the distance light travels and the interval is called timelike.  If $\Delta s^2 = 0$, then $r^2 = c^2\Delta t^2$ and the spatial separation is equal to the distance light travels and the interval is called lightlike.  If $\Delta s^2 &gt;0$, then $r^2 &gt; c^2\Delta t^2$ and the spatial separation is greater than the distance light travels and the interval is called spacelike.   These are just mathematical definitions. What, however, is the physical intuition behind them? What does an interval being timelike, lightlike or spacelike mean? Can the Dispel Magic spell be Readied to counter an opponent's spell? When playing as a spellcaster, is it valid the use of the Ready action to prepare Dispel Magic to counter a spell cast by an opponent? In the same vein, when declaring said action, do I have to specify which spell slot I will use when Readying the Dispel Magic spell? If that is the case, does this tactic nullify an opponent's spell? I get the impression that this is basically turning Dispel Magic into a spell with a casting time of &quot;1 reaction&quot;. Is my reading of the rules accurate? Handler frame_change_pre doesn't work in render this works in viewport but not in render.  import bpy from math import *  def frame_handler(scene):     z = scene.objects['Lift'].location[2]     scene.objects['Text'].data.body = str(floor(z / 4.0) - 2)  bpy.app.handlers.frame_change_pre.clear() bpy.app.handlers.frame_change_pre.append(frame_handler)   How to get it working in render? I've read  and changed from "bpy.data.objects" to "scene.objects" as already seen in the script. What am I missing? Blender v. 2.81.16  Edit. Tried that depsgraph thing mentioned in comments and changed to frame_change_post:  import bpy from bpy.app.handlers import persistent from math import *  @persistent  # maybe not relevant but doesn't harm anything? def frame_handler(scene, depsgraph):     z = scene.objects['Lift'].evaluated_get(depsgraph).location[2]     scene.objects['Text'].data.body = str(floor(z / 4.0) - 2)  bpy.app.handlers.frame_change_pre.clear() bpy.app.handlers.frame_change_post.clear() bpy.app.handlers.frame_change_post.append(frame_handler)   Now the Text doesn't show up at all in rendered (but works in viewport). iOS 10 remember to "not trust this computer" Uncheck checkboxes by changing particular checkbox state I have custom fields in contacts form named checkbox1__c, checkbox11__c, checkbox12__c, checkbox13__c.  When I check checkbox1__c then I want checkbox11__c,  checkbox12__c,  checkbox13__c to be unchecked.  When I unchecked checkbox1__c then I want checkbox11__c, checkbox12__c, checkbox13__c to be checked.  Is there any way to do this by using validation-rules? If not no way to this by validation-rules, then what is the best way to do this? theorem numbering: section counter but remove the section number Find $\sum_{n=1}^{\infty}$ $\frac{n^{2}}{\left(n+1\right)\left(n+2\right)\left(n+3\right)\left(n+4\right)}$ $$\sum_{n=1}^{\infty}\frac{n^{2}}{\left(n+1\right)\left(n+2\right)\left(n+3\right)\left(n+4\right)}$$   MY Approach$\sum_{n=1}^{\infty}$$\frac{n^{2}}{\left(n+1\right)\left(n+2\right)\left(n+3\right)\left(n+4\right)}$ = Lim$_{k\rightarrow\infty}$$\sum_{k=1}^{n}\frac{k^{2}}{\left(k+1\right)\left(k+2\right)\left(k+3\right)\left(k+4\right)}$  $\frac{k^{2}}{\left(k+1\right)\left(k+2\right)\left(k+3\right)\left(k+4\right)}$= $\frac{1}{6\left(n+1\right)}$-$\frac{2}{\left(n+2\right)}$+$\frac{9}{\left(n+3\right)2}$-$\frac{8}{\left(n+4\right)3}$  I don't think i can telescope it, And i don't know any other method Can anyone recommend a simple API that will allow me to use read a CSV input file, do some simple transformations, and then write it.  A quick google has found  which looks promising.  I just wanted to check what others are using before I couple myself to this API. What is the derivative of this? I have a function of the following form:  $J = \|W^TW-I\|_F^2$   Where, $W$ is a matrix and $F$ is the Frobenius Norm.  How can I find the derivative of $\frac{\partial J}{\partial W}$ ? We consider the differential equation $y'=x+y^2$ and for any $\eta \geq 0$ we denote by $\phi_\eta:(\alpha_\eta,\beta_\eta)\rightarrow\mathbb{R}$ the unique saturated solution of the Cauchy Problem $y'=x+y^2$, $y(0)=\eta$. I am required to do the change of variable $z(x)=y(-x)$ and I succeded here, obtaining $y'(-x)=y^2(-x)-x$ and so $z'(x)=x-z^2(x)$, then I was required to represent the $0-isocline$ and it was also simple as I obtained a parabolla and also I was required to write the equation of the tangent in the point $(0,\eta)$ which was also pretty simple as I obtained $\phi'_\eta(0)=\eta^2$ and the equation of the tangent is $y=\eta+\eta^{2}x$. Now, I am required to find $\phi^{(5)}_0(0)$( that $5$ indicates the number of differentiations), which puzzles me as I don't know the form of the solution and if it can be found out and also I am told to show that $\frac{1}{\eta}\geq\beta_\eta$ What I did not prove after the first edit : and that for $\eta &gt; 0$, $\alpha_\eta=-\infty$ and for the Cauchy problem $z'=x-z^2,z(0)=\eta$ the saturated solution is defined up to $+\infty$. At this last ones I am lost. Any help, please? Edit: I have passed beyond finding $\phi^{(5)}_0(0)$ and I think I did show that $\frac{1}{\eta}\geq\beta_\eta$, now it remains to prove the last questions. I am trying to make a pirate ship and am trying to attach rope to the sails. my rope is made using a path, and soft body physics. I can not find a way to attach my rope to the sail. and I can not use pinned vertices because this is not a cloth modifier. Is it true every ideal of $\mathbb{Z}[x]$ is finitely generated? Let $I$ be any ideal of $\mathbb {Z}[x]$, and $I=\left&lt;{f_1,f_2 , ...}\right&gt;$.  Without loss of generality, $f_1$ has minimal (absolute value) coefficient of constant term (if there exist).  Then, let $g$ be any element of $I$ .  We have for some integer $m$ that $g - mf_1$ is element of $I$ (minimal coefficient and division algorithm).  I guess this process terminate finitely, but I don't know how can I do next step.  ( ex. $g-mf_1, g-mf_1-nf_2, ...$)  Please help me and thanks for in advance. Upon system restart, dconf editor doesn't save changes I can use the dconf-editor to change my touchpad settings to natural scrolling, but upon system restart the settings get reverted. (But not on sleep or hibernate.) When I open the editor, the option is still orange indicating it has been changed. when I uncheck and recheck the natural scroll option, it is re-enabled. Is there a fix, or am I changing the wrong option? The path is org > gnome > settings-daemon > peripherals > touchpad > natural-scroll.  Currently running 13.10 Will I need any Malaysian Rinngit at Kuala Lumpur airport when I'm leaving the country?