I am writing a program that takes a user input and depending on their answer gives them a different answer. How do I use a string that the user entered with an if - else statement?  I have this so far:  import java.io.*; import static java.lang.System.*;  import java.util.Scanner;  class t1_lesson07_template{       public static void main (String str[]) throws IOException {                Scanner scan = new Scanner(System.in);                System.out.print("Hello, welcome to the companion planting guide. ");               System.out.print("Lets get started! To begin, just input the desired plant in the box to learn what plants to grow with it!");               String plant = scan.nextLine();               if (plant == "Asparagus") {                 System.out.print("Tomatoes, parsley, and basil.");               }        }  }   I am wondering about the syntax for the if statement in this case.
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?
Why can't the Klein-Gordon equation with a Couloumb potential describe the hydrogen atom?  Why can the first order Dirac equation explain it? What are the failures? How does editing work? Choosing research ideas to include in a statement of purpose Select an area in rep graph not working on Chrome The "select an area by dragging across the lower chart" thing is not working on Chrome.  Tested with Chrome 13.0.782.220 m, works with Firefox 6.0.1 and IE 8  Quirk: For some reason, if I open an incognito window, it works. Tried clearing the cache and cookies, still not working. I was readng Wikipedia article (English one) about radiation pressure because there is something I still cannot figure out. As I understand it, radiation pressure emerges from conservation of momentum. Photons or electromagnetic waves possess momentum and when they are absorbed, reflected or even emitted, the aborber/reflector/emitter experiences a pressure that is proportional to the irradiance (in watts per square meter). OK. In the case of a perfect reflector that does nothing but reflecting incoming radiation, it would seem the reflector is pushed and the radiation is reflected in opposite directions. But the radiation has not lost anything, it has only changed direction. And I do not understand how something can be set in motion (the reflector), which amounts to do work, yet the source of this work does not lose energy. I mean, if the radiation, after a U turn, meets a second reflector, it would have pushed two reflectors a way, yet it would continue in its original direction as if nothing happened...? What am I missing here? Should not photons lose something? What free Remote Desktop (server) solutions are there? I know Ubuntu comes with a "Remote Desktop" option that appears to be a straightforward VNC server, and I'm trying to understand the alternatives. Here are the possibilities I've heard about so far:   VNC  VNC + SSH Tunnelling NX Server, free edition FreeNX NeatX X2Go X11 Forwarding over SSH xrdp    I'm coming at this from a Windows user's perspective: To the best of my experience, RDP (aka Terminal Services) is a reasonably secure (barring mitm/server spoofing), efficient desktop sharing protocol with well-supported clients, that can be exposed to the internet when necessary without major fears of intrusion. To the best of my knowledge straight VNC is none of those things, which is where I get confused - why wouldn't a better desktop sharing technology be developed or used in the open-source world? I know VNC can be wrapped with SSH, but that seems beyond the reach of a casual user. X11 forwarding over SSH may be more or less efficient, I have no idea, but is definitely even more complicated, and doesn't (as far as I know) give you access to already-running stuff (no desktop sharing as such, just remote application running).  So, I'd like any feedback/preferences amongst these or any other "Free" desktop sharing options, using these criteria and/or any others:   Security (esp. for access across internet) Efficiency (bandwidth usage, responsiveness, etc) Free-ness, as in Speech (not sure where RDP or FreeNX lie for this) Free-ness, as in Beer (are there any commercial solutions with usable dependable free offerings?) Ease of use (server and client side) Cross-OS Client availability Cross-OS Server availability Support for independent sessions and shared (and/or "Console") sessions Ongoing support/maintenance/development   Thanks! Recurrence relation for the determinant of a tridiagonal matrix Let  $$f_n := \begin{vmatrix} a_1 &amp; b_1 \\ c_1 &amp; a_2 &amp; b_2 \\ &amp; c_2 &amp; \ddots &amp; \ddots \\ &amp; &amp; \ddots &amp; \ddots &amp; b_{n-1} \\ &amp; &amp; &amp; c_{n-1} &amp; a_n \end{vmatrix}$$  Apparently, the determinant of the tridiagional matrix above is given by the recurrence relation   $$f_n = a_n f_{n-1} - c_{n-1} b_{n-1}f_{n-2}$$  with initial values $f_0 = 1$ and $f_{-1} = 0$ (according to Wikipedia). Can anyone please explain to me how they came to this recurrence relation?  I don't really understand how to derive it. I am currently writing my thesis and need to include a bunch of email conversions. I am using classicthesis. I wonder, how you would format stacked conversions. Moreover, how would you deal with the email header, signatures and line breaks: why do I need to add \\ all the time? This is the configuration I am currently experimenting with:  \documentclass[ oneside, openright, titlepage, dottedtoc, numbers=noenddot, headinclude, footinclude=true, cleardoublepage=empty, abstractoff, BCOR=5mm, paper=a4, fontsize=11pt, ngerman, american ] {scrreprt}  \PassOptionsToPackage{utf8}{inputenc} \usepackage{inputenc} \usepackage{blindtext}  \usepackage{framed}  % Vertical line that highlights quotations in an email. % Use \begin{leftbar} and \end{leftbar} environment. % Width of the line = 0.4pt % Space between the line and the text = 10pt % Requires \usepackage{framed} \renewenvironment{leftbar}{%   \def\FrameCommand{\vrule width 0.4pt \hspace{10pt}}%   \MakeFramed {\advance\hsize-\width \FrameRestore}}% {\endMakeFramed}  \usepackage{nicefrac} \usepackage[english]{babel} \usepackage[pdfspacing]{classicthesis}  \begin{document} \selectlanguage{ngerman} % american ngerman % Disable paragraph indentation. \setlength{\parindent}{0pt}     \begin{verbatim} From: john.doe@yahoo.com Subject: Your inquiry from 20042012 Date: Thu, 3 May 2012 11:34:54 +0200 To: Jane Doe &lt;jane.doe@hotmail.com&gt; \end{verbatim}  Jane Doe wrote: \begin{leftbar} \begin{leftbar} \begin{leftbar} \begin{leftbar} There are a couple of questions I like to ask. Please forward them if you cannot do so. \end{leftbar} I hope I can answer them after holidays. \end{leftbar} I am back from holidays now and will look through your questionaire the next days. \end{leftbar} Thank you, Mr. Doe - I am awaiting your answers. \end{leftbar}  Dear Mrs. Doe,\\ \ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut molestie placerat pharetra. In quam leo, tincidunt ut consequat eget, malesuada sit amet urna. Morbi et interdum arcu. Nullam nisi nunc, ullamcorper vitae pulvinar eu, suscipit ut augue.\\ \ Donec risus mi, accumsan ac interdum id, molestie sed mauris. Suspendisse porttitor luctus justo in ullamcorper. Proin in neque magna. Mauris quis arcu eget enim mattis pharetra vitae a dolor. Nam aliquam consectetur mollis. Ut at sem quis dolor faucibus fringilla. Quisque cursus vehicula odio, vitae placerat ipsum dapibus id.\\ \ Best regards\\ John Doe\\ \ (See attached file: Questions\_Doe.doc)  \begin{verbatim} _______________________________________________________ Administration New York John Doe Mainstr. 3 11111 New York  T:        (011) 212-4301 F:            (011) 212-954301 M:         john.doe@yahoo.com \end{verbatim}  \begin{leftbar} My question I looking forward to reading the answers to my questions:\\ \ 1. Is the world analog or digital? \end{leftbar} digital  \begin{leftbar} 2. How long does the world exist?  \end{leftbar} analog since 1984, digital since 1999  \end{document}     This is what the above latex example looks like.    I also saw  but I do not want to use &gt; or colors. My settings are inspired by this  and this . How to simulate artificial data for logistic regression? I know I'm missing something in my understanding of logistic regression, and would really appreciate any help.  As far as I understand it, the logistic regression assumes that the probability of a '1' outcome given the inputs, is a linear combination of the inputs, passed through an inverse-logistic function. This is exemplified in the following R code:  #create data: x1 = rnorm(1000)           # some continuous variables  x2 = rnorm(1000) z = 1 + 2*x1 + 3*x2        # linear combination with a bias pr = 1/(1+exp(-z))         # pass through an inv-logit function y = pr &gt; 0.5               # take as '1' if probability &gt; 0.5  #now feed it to glm: df = data.frame(y=y,x1=x1,x2=x2) glm =glm( y~x1+x2,data=df,family="binomial")   and I get the following error message:      Warning messages:   1: glm.fit: algorithm did not converge    2: glm.fit: fitted probabilities numerically 0 or 1 occurred    I've worked with R for some time now; enough to know that probably I'm the one to blame.. what is happening here? Analogy: "as if" vs. "as though" This is something that confuses me from time to time. When making an analogy in literature, is it better to use the phrase "as if" or "as though", or is it completely a style thing?  E.g.      She looked frazzled, as if she had just gotten off of a roller coaster.   or     She looked frazzled, as though she had just gotten off of a roller coaster. What happens to the holes in the skull where teeth were developing? In Skeptics.SE, a question regarding the skulls of children arose. Depicting a scary skull where the permenent teeth are "hidden" inside the jaws and the milk teeth are in the their place.  After all milk teeth fall out, and the permanent teeth "rise", do the holes left by them filled up, or do we go around with holes in our jaws?    The picture: How do I find the right size of filters for a lens? I was looking to get a circular polarizing filter and an UV filter for my Canon 550D, 18-135mm lens. When I checked online I found these filters came in different sizes, like 62mm, 67mm, 72mm, 77mm. How do I know which is right?  Also, will there be any degradation of photo quality if I put both these filters on the lens? Where are the Unity desktop wallpapers located? I'm currently working on a scene containing 1000+ objects which all need to be set to a different draw type to save on computationally expenses in the viewport. But doing this for every object separately is really tedious. Therefor I'm wondering if there's a way to change the maximum draw type of multiple objects simultaneously. Preferably only the selected objects. Java: Difference between the setPreferredSize() and setSize() methods in components Reading grep patterns from a file Visiting Greece with back-to-back Schengen visas (One from Germany, other from Italy) I have a Schengen Visa issued by Germany, which expire on 11th Jan 2014, and I can remain in the zone till 11th Jan 23.59 PM. I have already visited Germany in the past with this visa, so I can travel whenever in Schengen zone directly from my country (Turkey).  I have a second Schengen Visa issued by Italy, which START on 12th Jan 2014, such that I can remain in Schengen zone from 12th Jan 00.00 AM onwards (I'm putting times to clarify which dates are inclusive).  I would like to travel to Greece with this visa: Entering the country on 6th January, and leaving the country on 19th January.  Is this allowed? Or do I have to leave the country first, and then re-enter through Italy? A lot of my scripts stopped working after installing Ubuntu 15.10 and I have trouble remembering this new name as I was used to ethx and wlanx for years. Is there a reason for this change? Do I have to get used to this or can I just rename it and go back to good old eth0?  $ ifconfig  enp0s25   Link encap:Ethernet  HWaddr 77:5a:5e:a6:86:d5         inet addr:192.168.31.239  Bcast:192.168.31.255  Mask:255.255.255.0       inet6 addr: fe80::725a:b6ff:fea6:86d7/64 Scope:Link       UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1       RX packets:4833 errors:1332 dropped:0 overruns:0 frame:666       TX packets:5589 errors:0 dropped:0 overruns:0 carrier:0       collisions:0 txqueuelen:1000        RX bytes:3266446 (3.2 MB)  TX bytes:1046654 (1.0 MB)       Interrupt:20 Memory:d3500000-d3520000 Getting ssh to execute a command in the background on target machine This is a follow-on question to the  question.  If I want to execute a command on the remote machine that runs in the background on that machine, how do I get the ssh command to return?  When I try to just include the ampersand (&amp;) at the end of the command it just hangs.  The exact form of the command looks like this: ssh user@target &quot;cd /some/directory; program-to-execute &amp;&quot;  Any ideas?  One thing to note is that logins to the target machine always produce a text banner and I have SSH keys set up so no password is required. Bug in editor for numbered lists? I noticed what seemed to be a bug in the way the stackoverflow editor handles numbered lists. I did a search on meta for this and it didn't come up, but if it is a duplicate, I'll delete the question.  Consider the following code:  Here are some points:  1. One 2. Two 3. Three  Here are some more points which continue the theme:  4. Four 5. Five   When you actually type this into the text editor, this is the result:  Here are some points:   One Two Three   Here are some more points which continue the theme:   Four Five   In this case, the ordered list resets after the break. This is probably just an edge case (and not necessarily worth fixing), but I ran into the problem today and figured this would be a good place to raise the topic! My workaround was to use back-ticks around the numeral, but then you lose the hanging indent. (ie, 1. One)  Might this be worth fixing? Is it expected behavior? Or am I doing it wrong?