The program is supposed to be a user inputting his chosen category, but when I tried running it, I typed "African", the command on the else statement appeared.  package finalProject;  import java.util.Scanner;  public class Lol {     static String category;      static Scanner x = new Scanner(System.in);     public static void main(String[] args) {          System.out.println("Welcome to Shang-ri La Plaza Mall Restaurant Inquiry! \n");         System.out.println("Choose from below which cuisine do you prefer. \n" +             "African or American");         category = x.next();          if (category == "African") {              System.out.println("Options are found below with their corresponding price range. \n" +                  "Wendy's Hamburger - P199 &amp; Below");         } else {              System.out.println("Options are found below with their corresponding price range. \n" +                  "Clawdaddy's Great American Picnic - P500 - P999 \n" +                  "California Pizza Kitchen - P200 - P499 \n" +                   "Tender Bob's - P200 - P499 \n" +                  "Steak Escape - P200 - P499 \n" +                  "Balboa - P200 - P499 \n" +                  "Billy Rock Bar &amp; Restaurant - not found \n" +                  "Clawdaddy Osteria Americana - P500 - P999 \n" +                  "Gourmet To Go - P200 - P499 \n" +                  "Maple - P500 - P999 \n" +                  "Quiznos - P200 - P499 \n" +                  "Texas Roadhouse Grill - P500 - P999");         }     } }
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?
Equality holds in triangle inequality iff both numbers are positive, both are negative or one is zero How do we show that equality holds in the triangle inequality $|a+b|=|a|+|b|$ iff both numbers are positive, both are negative or one is zero? I already showed that equality holds when one of the three conditions happens. Why does the following hold:  \begin{equation*} \displaystyle \sum\limits_{n=0}^{\infty} 0.7^n=\frac{1}{1-0.7} = 10/3\quad ? \end{equation*}  Can we generalize the above to      $\displaystyle \sum_{n=0}^{\infty} x^n = \frac{1}{1-x}$ ?   Are there some values of $x$ for which the above formula is invalid?  What about if we take only a finite number of terms? Is there a simpler formula?     $\displaystyle \sum_{n=0}^{N} x^n$   Is there a name for such a sequence?    This is being repurposed in an effort to cut down on duplicates, see here: Coping with  duplicate questions.  and here: . Swapping right shift and delete key using xmodmap I'm unsure how to swap these 2, this is the thought process I had but am unsure how to get it working:  remove sh = Shift_R remove dl = Delete  keysym Delete = Shift_R keysym Shift_R = Delete  add sh = Delete add dl = Shift_R   This is based on the code I use to swap caps lock and control.  Any thoughts?  xmodmap output:  dan@lantea:~$ xmodmap -pke | grep Shift_R keycode  91 = Shift_R NoSymbol Shift_R keycode 119 = Shift_R NoSymbol Shift_R dan@lantea:~$ xmodmap -pke | grep Delete keycode  62 = Delete NoSymbol Delete Looking for a classic sci-fi short story about a boy who discovers pods growing in a field For years, I've been looking for a short story about a boy who discovers alien pods in a field that are growing replacement people. If I remember right, he sees the pod creature eat his mother and then become her, and no one believes him. The story ends with him going in to see his dad, one of the few real people left until that point, and seeing something (an empty pod maybe) that lets him know his dad has been taken and he's next. I'm thinking that the title was something like Father Figure, but I may be remembering wrong.  The story was part of several collections of classic science fiction stories that we had on our bookcase when I was growing up, so I'm guessing that the story could be from the 70's or any time earlier. Can I store my pixels somewhere so I don't lose them when I die? I die all the time. My pixel balance hovers around zero as a result. I'm trying to save up for armor but my nonstop deaths are making that difficult.  Is there anywhere I can store my pixels so that when I die, I won't lose a bunch of them? Can you break up your Attack action for a bonus action? You can do it to move:     If you take an action that includes more than one weapon attack, you can break up your movement even further by moving between those attacks. For example, a fighter who can make two attacks with the Extra Attack feature and who has a speed of 25 feet could move 10 feet, make an attack, move 15 feet, and then attack again. (PHB 190)   It would be necessary for the Great Weapon Master feat:     On your turn, when you score a critical hit with a melee weapon or reduce a creature to 0 hit points with one, you can make one melee weapon attack as a bonus action   As a level 17 Fighter, if I can not place a bonus action between attacks, there are two possibilities:   I have to wait until I finished all 4 attacks of the action, to make another attack as a bonus action the bonus action attack is wasted unless the kill or crit happens on the 4th attack   So can I take a bonus action in the middle of the attacks of an action? bash if -a vs -e option Both about -a and -e options in  is said:  -a file     True if file exists. -e file     True if file exists.    Trying to get what the difference is I ran the following script:  resin_dir=/Test/Resin_wheleph/Results  if [ -e ${resin_dir} ] ; then     echo "-e "; fi  if [ ! -e ${resin_dir} ] ; then     echo "! -e"; fi  if [ -a ${resin_dir} ] ; then     echo "-a"; fi  if [ ! -a ${resin_dir} ] ; then     echo "! -a"; fi   /Test/Resin_wheleph/Results exists and is a directory. And this is what I get:  -e -a ! -a   which seems to be a little strange (notice -a and  ! -a). But when I use double brackets (e. g. if [[ -e ${resin_dir} ]]) in the similar script it gives reasonable output:  -e -a   So:    What is a difference between -a and -e options? Why -a produces a strange result when used inside single brackets? Proving the inequality $\frac{n^k}{k^k}\leq\binom{n}{k}\leq\frac{n^k}{k!}$ involving binomial coefficient. What is the best way of proving inequalities including binomial coefficients in general? Lets look at this example:     $$\frac{n^k}{k^k}\leq\binom{n}{k}\leq\frac{n^k}{k!}$$   What I started with is:  $$\binom{n}{k}\frac{1}{n^k}\leq\frac{1}{k!}$$ $$\frac{n!}{k!(n-k)!}\frac{1}{n^k}\leq\frac{1}{k!}$$ $$\frac{(n-1)!}{(n-k)!n^{k-1}}\leq1$$ This is where I got stuck. How can I prove that is is lower than or equal to 1? Could you give me a hint? Changing permissions on serial port I'm using the Arduino IDE in Ubuntu, and am having issues with the serial port. It has worked in the past, but for reasons that may be unnecesary, I felt the need to change the ownership of some of the files from root ownership to my users ownership.  This made the IDE work correctly, but I lost the ability to use the correct serial port.  In the dev folder, the port I need is listed as permission 166. Someone (who is no longer in the area to help me) swapped the permissions to 666, which made it all work gloriously.  However, it reverted back as soon as I restarted my computer, and if I now try to use the command:  sudo chmod 666 ttyACM0   nothing happens. No error messages, but no permission change either.    How can I change it, and how can I get it to change permanently.  I apologize if this question is overly simplistic or unclear, I'm an ubuntu noob, and I wouldn't begrudge feedback! So i have this $3\times 3$ matrix  $$     \begin{pmatrix}     -2 &amp; 0 &amp; 0 \\     3 &amp; 1 &amp; -6 \\     0 &amp; 0 &amp; -2 \\     \end{pmatrix} $$  I want to check if the matrix is diagonizable. First thing i do is find the roots : namely $\lambda_1 = −2$ of multiplicity $2,$ and $\lambda_2 = 1$ of multiplicity $1.$  In order to ensure that the matrix is diagonalizable we need to find a basis of $\mathbb{R}^3$ whose elements are eigenvectors for $A.$ In particular, since we have the eigenvalue $\lambda_1=-2$ having multiplicity $2$ we need to check that the dimension of the eigenspace $E(\lambda_1)$ is equal to $2.$ We compute the eigenspaces of $A.$  $\DeclareMathOperator\Nul{Nul}$On the answer sheet is says that we need to find $\Nul(A+2Id)$... but why $2Id?$ Isn't is supposed to be $-2,$ so $\Nul(-2Id-A)$??   I do not understand this $\Nul(A+2Id).$ I always thought that we should compute $\Nul(-2Id-A),$ so what do i need to do ?   $\Nul(-2Id-A)$ gives me a different result from $\Nul(A+2Id).$  Does that mean that since $-2$ has a multiplicity of $2,$ we need to work with $2$ and not $-2$?  Somebody please help with a clear and simple explanation ! Thanks! What should I do if a user posts sensitive information as part of a question or answer? I've observed several incidents where users inadvertently posted detailed, sensitive information. For example, a Server Fault user who posted a question with working login credentials to his actual production server, or the Stack Overflow user who posted actual medical records as example data for his question.   What should be the procedure for handling such cases? We always change subject and verb positions in whenever we want to ask a question such as "What is your name?". But when it comes to statements like the following, which form is correct?        I don't understand what are you talking about.   I don't understand what you are talking about.      Another example        Do you know what time is it?   Do you know what time it is?      Another example        Do you care how do I feel about this?   Do you care how I feel about this? Simple UV Mesh Unwrapping Scale issue I'm having problems using the UV mapping in blender 2.67. Specifically, I am trying to unwrap a really simple mesh, but the UV map is still giving me a net where some of the boxes are completely out of proportion to the others, which causes the texture to stretch horribly. Here is a picture to illustrate:    The mesh only has those three faces you can see in the picture, and the single seam on the front corner. It's a trivially simple mesh, so I really don't understand why the two side faces are being stretched in the UV map to be the same size as the top face. I've tried clicking the average islands scale button as suggested by some of the answers to other questions but that has no effect. It's frustrating because it seems so simple.  Hopefully someone can show me the presumably simple mistake I am making!  Edit: Just to make this clearer, I have already added a seam as the first answer suggests i do. Hopefully this picture will make that clearer, the yellow arrow is pointing to the edge i seamed. The mesh is only three faces so should only need this single seam. The image shows the mesh from infront and behind/underneath so it should make more sense.    Double Edit: One more picture for clarity on the seam issue. The mesh is unfolding correctly, it is just the scale of the unfolded map that is incorrect (in relation to one another) Here is the problem setup  \begin{equation} \begin{array}{c} \text{min} \hspace{4mm}  \mathbf{b}^{T}_{}\mathbf{A}^{}_{}\mathbf{b}^{}_{} \\ s.t \hspace{5mm} \mathbf{b} \in \mathbb{R}^{N} \\ \hspace{9mm}b_0=1\\ \hspace{62mm}b_i=b_{i-2}b_{i-1} \hspace{5mm} \forall \hspace{5mm} 2&lt;i\leq N-1 \end{array} \end{equation}  where $\mathbf{A}$ is a $N\times N$ positive semi-definite matrix  To handle $b_0=1$ constrain, I know I can introduce Lagrange multiplier in objective function  \begin{equation} \begin{array}{c} \text{min} \hspace{4mm}  \mathbf{b}^{T}_{}\mathbf{A}^{}_{}\mathbf{b}^{}_{} + \lambda(\mathbf{b}^{T}_{}\mathbf{u}^{}_{}-1) \end{array} \end{equation}  where $\mathbf{u}_{}^{}$ is a $N\times 1$ column vector and $u_0=1$ and $u_i=0 \forall 1&lt;i\leq N-1$.  But I dont know how to handle second set of constraints?   EDIT: Example  Let $N=4$. Therefore I am looking for $\mathbf{b}=[b_0 \quad b_1 \quad b_2 \quad b_3]^T = [1 \quad b_1 \quad b_2 \quad b_1b_2]^T$. How do I include $b_3=b_1b_2$ constraint in objective function How to view/erase images from both CF and SD cards on Canon EOS 5D mk3? I've been trying to setup my Canon EOS 5D mk3 to shoot in "backup mode". I have two cards:    32GB CF  8GB SD   I've set it like the following:  SET UP1 menu ------------ Record func.:       Rec. separately Playback:           1 [CF]  SHOOT1 menu ------------ Image type/size CF: RAW 22M Image type/size SD: JPEG 9,8M   It works ok, except I have one problem. Since I have only these two cards, on some large shoots I need to erase some in order to free some space to make the card last till the end of shoot.  When viewing images and deleting the ones I want to delete, it seems that I can only see the contents of the CF card, and when I delete an image I delete only the RAW file saved on the CF.  Is there a way to delete the JPEG from the SD card along with it's RAW "parent" on the CF card? How do I use an NBT editor to modify item properties? Why is the Centroid of a Triangle Shared with Its Midpoint Triangle How do you teleport a certain player to spawn after they win a 1v1 I managed a KitPvP server in Minecraft and everything works fine except when players wants to duel each other. They get sent to a room where they will be dueling. The main problem is when the winner wins, I have no idea how to teleport them back to spawn. Comaximal ideals in a commutative ring Let $R$ be a commutative ring and $I_1, \dots, I_n$ pairwise comaximal ideals in $R$, i.e., $I_i + I_j = R$ for $i \neq j$. Why are the ideals $I_1^{n_1}, ... , I_r^{n_r}$ (for any $n_1,...,n_r \in\mathbb N$) also comaximal? How to change default action for file types? There is a certain text editor that I would like to set as the default editor for certain file types but if I try selecting it on the “Open With…” menu, that does not work. However, it has put an explorer context menu item in, which does work. How could I make this menu item the default double-click action, for certain file types?  Thank you SSRT and Josh R. Both good answers. It's a pity I can't give you both best answer.  For what it's worth, I found the answer today (twenty-four hours after asking this question).