I'm new to JAVA programming and right now I'm facing a strange case. I set the confirmation variable to the type of String , it will hold the user input. When the user type "yes" The program should create a new user, but it didn't . Instead, it rise the false alarm "Process is canceled by user". It seems the convirmation variable didn't evaluated correctly. Any advice guys. thanks.  This is my code (it's pretty simple though):  import java.util.Scanner;  public class CreateUser {     public static void main(String[] args)     {         Scanner input = new Scanner(System.in);         String firstName;         String lastName;         String confirmation;          System.out.println("Create new user");         System.out.print("Enter first name : ");         firstName = input.nextLine();         System.out.print("Enter last name : ");         lastName = input.nextLine();          System.out.println("Are you sure?");         confirmation = input.nextLine();          System.out.println(confirmation); // this line is to make sure that the variable value is "yes"          if(confirmation == "yes")         {             Users newUser = new Users(firstName, lastName);             System.out.printf("User %s %s has been created\n", firstName, lastName);             System.out.println("Total active users now is :"+Users.getRegisteredUsers());         }         else         {             System.out.println("Process is canceled by user");         }          input.close();      } }   And this is the output :  Create new user Enter first name : fin Enter last name : fin Are you sure? yes yes Process is canceled by user
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?
C non-blocking keyboard input I would like to configure Apache 2 running on Kubuntu to execute Perl CGI scripts. I've tried some steps that I came across by googling, but nothing seems to work.  What is the right way of achieving this? I am working on a web application where I want the content to fill the height of the entire screen.  The page has a header, which contains a logo, and account information. This could be an arbitrary height. I want the content div to fill the rest of the page to the bottom.  I have a header div and a content div. At the moment I am using a table for the layout like so:  CSS and HTML    #page {     height: 100%; width: 100% }  #tdcontent {     height: 100%; }  #content {     overflow: auto; /* or overflow: hidden; */ } &lt;table id="page"&gt;     &lt;tr&gt;         &lt;td id="tdheader"&gt;             &lt;div id="header"&gt;...&lt;/div&gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td id="tdcontent"&gt;             &lt;div id="content"&gt;...&lt;/div&gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt;     The entire height of the page is filled, and no scrolling is required.  For anything inside the content div, setting top: 0; will put it right underneath the header. Sometimes the content will be a real table, with its height set to 100%. Putting header inside content will not allow this to work.  Is there a way to achieve the same effect without using the table?  Update:  Elements inside the content div will have heights set to percentages as well. So something at 100% inside the div will fill it to the bottom. As will two elements at 50%.  Update 2:  For instance, if the header takes up 20% of the screen's height, a table specified at 50% inside #content would take up 40% of the screen space. So far, wrapping the entire thing in a table is the only thing that works. If I want to display the IP address that is assigned to eth1, how can I do this in Bash? How to parseInt a string with leading 0 Unable to install LanguageTool 2.5 extension for LibreOffice 4.2 on Ubuntu 14.04 I am not able to install LanguageTool extension for LibreOffice. Getting exception when I try to install it.   p.s. Somebody says that the solution is installing openoffice.org-java-common package but Ubuntu 14.04 does not have this package in its repository.  System details:  OS: Ubuntu 14.04 LTS  LibreOffice: 4.2 (4.2.3.3)  LanguageTool: 2.5  Java: Oracle JDK 1.8.0_05     Exception message: Whenever I click on software updater it says Failed to download repository information.  It's been saying this for the past few days now and I don't know why, my Internet connection is fine, I am able to manually download software.  Sometimes it crashes when I click okay, then attempts to look for updates again and gives me the same message.  Any ideas?  [EDIT] I just tried an answer posted where I reset where the downloads come from, but I was left with this message:  W:The repository 'http://ppa.launchpad.net/noobslab/noobslab-conky/ubuntu xenial Release' does not have a Release file.,  W:Data from such a repository can't be authenticated and is therefore potentially dangerous to use.,  W:See apt-secure(8) manpage for repository creation and user configuration details.,  W:https://content.runescape.com/downloads/ubuntu/dists/trusty/InRelease: Signature by key AAC9264309E4D717441DB9527373B12CE03BEB4B uses weak digest algorithm (SHA1),  E:Failed to fetch http://ppa.launchpad.net/noobslab/noobslab-conky/ubuntu/dists/xenial/main/binary-amd64/Packages  404  Not Found,  E:Some index files failed to download. They have been ignored, or old ones used instead. Overview of basic facts about Cauchy functional equation The  asks about functions $f \colon \mathbb R \to \mathbb R$ such that $$f(x+y)=f(x)+f(y).$$ It is a very well-known functional equation, which appears in various areas of mathematics ranging from exercises in freshman classes to constructing useful counterexamples for some advanced questions. Solutions of this equation are often called . Also a few other equations related to this equation are often studied. (Equations which can be easily transformed to Cauchy functional equation or can be solved by using similar methods.) Is there some overview of basic facts about Cauchy equation and related functional equations - preferably available online? What does this residuals versus fitted plot mean about my model? Is it possible to set the GPU fan speed using the default free ati driver?  My card (X1900) was deprecated in the fglrx drivers a while back.  The free drivers seem to work with 3D, Compiz and such, but running graphics intensive programs makes my GPU heat up and produce artifacts, while the GPU fan never seems to increase. (When set to 100% in Windows it makes a massively louder noise.) Giving edit reputation bonus for same user for same post multiple times On Stack Overflow, I saw some users editing the same question multiple times, and getting the 2 point reputation bonus for each time.  I saw it during review of a suggested edit (some months ago, I forgot the question that's why I'm unable to paste the link here). I rejected it and gave the reason in the "Other" reason field.  Most of the time I saw that users first formats the code, and then after approval they edit the title and fix the grammar.  Why is this allowed?  My point is, if an user gained 2 reputation points for a particular edit, then why give another 2 points again for the same post? Because the second edit on same question/answer means that there were some mistakes or misses in their previous edit. How to skip kernel update? I am running Ubuntu 12.04.1 LTS i686 on VirtulBox. Every time I check the updates, there's a new Linux kernel. If I install the new kernel, I have to install the Virtulbox Guest Additions again and reboot the server. I don't want to do this every week. I know I can manually uncheck the kernel packages from update manager, but is there a way to skip the kernel update automatically? I found an answer here, but it's for Ubuntu 10. Thanks. How to make partitions mount at startup? I've had my HTC Desire for a couple of months now and it is awesome! (A huge improvement to my previous phone... Nokia 3315)  Though recently, I've realised that the phone semi-freezes more and more often - ie. when swiping between homescreens it will either pause/freeze and I will have to re-swipe to get it to change screens. Or worse, it just won't respond to any further swipes and I have to lock the screen then unlock to get the phone back into action.  Got quite annoyed at this (was probably happening once or twice a day) so I thought it might help to turn it off and on again. So I did - not sure if it was a placebo effect but it seems to have helped a bit?  So given that this is my first smartphone, I was wondering if it is 'normal' to need to restart the phone every so often. If so, how often is 'normal'? If not, what can I do to diagnose/fix this problem? I was running a Python script that malfunctioned and used sudo to create a file named &gt;.  How can I get rid of this file?  Of course, when I try sudo rm &gt;, I get the error bash: syntax error near unexpected token 'newline', because it thinks I'm trying to redirect the output of rm.  Its permissions are -rw-r--r--. Deriving the conditional distributions of a multivariate normal distribution Prove that $\mathcal{P}(A)⊆ \mathcal{P}(B)$ if and only if $A⊆B$. Here is my proof, I would appreciate it if someone could critique it for me:  To prove this statement true, we must proof that the two conditional statements ("If $\mathcal{P}(A)⊆ \mathcal{P}(B)$, then $A⊆B$," and, If $A⊆B$, then $\mathcal{P}(A)⊆ \mathcal{P}(B)$) are true.    Contrapositive of the first statement: If $A \nsubseteq B$, then $\mathcal{P}(A) \nsubseteq \mathcal{P}(B)$  If $A \nsubseteq B$, then there must be some element in $A$, call it $x$, that is not in $B$: $x \in A$, and $x \notin B$. Since $x \in A$, then $\{x\} \in \mathcal{P}(A)$; moreover, since $x \notin B$, then $\{x\} \notin \mathcal{P}(B)$, which proves that, if $A \nsubseteq B$, then $\mathcal{P}(A) \nsubseteq \mathcal{P}(B)$. By proving the contrapositive true, the original proposition must be true.    To prove the second statement true, I would implement nearly the same argument, so that isn't necessary to write. So, does this proof seem correct? Also, was the contrapositive necessary? Or is there another way to prove the initial statement? When should I create a new tag? How do I request a new tag if I don't have enough rep? I have a JavaScript object. Is there a built-in or accepted best practice way to get the length of this object? const myObject = new Object(); myObject[&quot;firstname&quot;] = &quot;Gareth&quot;; myObject[&quot;lastname&quot;] = &quot;Simpson&quot;; myObject[&quot;age&quot;] = 21; Can the Surface Area of a Sphere be found without using Integration? When we were in school they told us that the Surface Area of a sphere = $4\pi r^2$  Now, when I try to derive it using only high school level mathematics, I am unable to do so. Please help.