This Java code below is not returning true in if else statement...  public class DecimalComparator {      public static void main(String[] args) {         System.out.println(areEqualByThreeDecimalPlaces(25.367876,25.367873));     }      public static boolean areEqualByThreeDecimalPlaces(double a, double b){          DecimalFormat threePreshizen = new DecimalFormat("###.###");         String aNew = threePreshizen.format(a);         String bNew = threePreshizen.format(b);          System.out.println(aNew);         System.out.println(bNew);          if (aNew == bNew){             return true;         }else {             return false;         }     } }   I expect it to return "true".
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 convert seconds to hours, minutes and seconds? Change the URL in the browser without loading the new page using JavaScript Why aren't all the badges shown on the track menu? I like using the 'Track Badges' menu on my profile a lot (I know what you're going to say, I just have a knack for these things), but I keep noticing something a bit unusual.  Many of the Badges featured on the actual list do not get featured on this menu. For example, I've been hoping to be able to track progress for the Pundit badge (ten comments with score of five or more), but it doesn't show up in the menu.  Why not? I had this "almost bonus" question on the final in Group Theory recently: prove that there is no such group $G$ which would satisfy Aut$(G)\cong \mathbb{Z}_n$, where $n$ is an odd integer. I don't have much certainty if this proof is OK, and one's opinion would be appreciated.  Here's my attempt:     Suppose that there exists such a group $G$ that satisfies the above condition. Since $\mathbb{Z}_n$ is cyclic, Aut$(G)$ is also cyclic and $G$ is abelian, which implies that Inn$(G)\cong \{e\}$. Thus Aut$(G)=$Out$(G)$. (I don't think this fact is important here though). Now, since an automorphism sends a generator to a generator, and since each automorphism is completely determined by such mapping, |Aut($G$)| must be of factorial order. But an integer factorial is always even. However, $|\mathbb{Z}_n|$ is odd, which is a contradiction. Therefore, no such $G$ exists.   I'm afraid that my proof is not very nice, but at least a genuine attempt was made. What is the procedure followed by game programmers for saving and resuming game state? like files/mappings. I want to save it for tower defense game and I am using unity3D game engine. Flag apron shows superfluous closing anchor tag I awoke this morning to a spam flag on a site I moderate, and noticed this when I went to read the post.    Notice answered&lt;/a&gt;, which I imagine isn't meant to have the &lt;/a&gt; there.  I also confirmed that this displays asked&lt;/a&gt; for other types of flags (namely, closed without comment).   I looked around for a duplicate of this but can't seem to find it, so maybe it's a recent change? Non-numerical citation mark like [Str91] [Samar] [Tro77] How do I manually install Adobe Flash player for Chromium? Use of Website Category Landing Pages OK, here's the situation: A reasonably simple website with a primary navigation menu including drop-down list of sublevels on hover. Each navigation level may have 3 - 6 sublevels below it, none more important than the other. For example see this mockup:    My question is: What should happen if the user Clicks on one of the primary navigation options (such as 'News') instead of just hovering over and choosing a sublevel?  My instinct tells me that I should allow a click of this navigation option; it's expected user behavior to be able to click navigation options. If clicked then a landing page of some sort will be present listing all the sublevels (latest news, blog posts, case studies'). However there is no content to add to this landing page other than presenting a list of links, which is pretty useless. I could pad it out by adding iconography and descriptions of the sublevels, but that's just content for the sake of it; does 'Latest News' really need a description in order to understand what it is?  If I don't include a landing page then clicking this primary navigation will have to open something but if I open the 'Latest News' page that risks the user not knowing about the other sections of the site.  (The landing page will be useful for breadcrumb navigation too, so I don't really want to do away with it).  Is my thinking that a landing page showing the list of sublevels actually useful even though there is no actual content to display, or is there a better alternative to go with? Prove that a non-empty closed convex $S$ has an extreme point iff it does not contain any line I am wondering how to prove the following theorem: Let $S \subset \mathbf{R}^{n}$ be a non-empty closed convex set. Then $S$ has at least one extreme point iff $S$ does not contain any line. Extreme point $x \in S$ means that there is no couple of points $y, z \in S$ and $\lambda \in (0;1)$ such that $x = \lambda y + (1-\lambda)z$. I know that every non-empty closed convex set can be represented as an intersection of all closed half-spaces containing the set but I do not know if it is helpful in proving the theorem. While I was investigating a problem I had with lexical closures in Javascript code, I came along this problem in Python:  flist = []  for i in xrange(3):     def func(x): return x * i     flist.append(func)  for f in flist:     print f(2)   Note that this example mindfully avoids lambda. It prints "4 4 4", which is surprising. I'd expect "0 2 4".   This equivalent Perl code does it right:  my @flist = ();  foreach my $i (0 .. 2) {     push(@flist, sub {$i * $_[0]}); }  foreach my $f (@flist) {     print $f-&gt;(2), "\n"; }   "0 2 4" is printed.  Can you please explain the difference ?    Update:   The problem is not with i being global. This displays the same behavior:  flist = []  def outer():     for i in xrange(3):         def inner(x): return x * i         flist.append(inner)  outer() #~ print i   # commented because it causes an error  for f in flist:     print f(2)   As the commented line shows, i is unknown at that point. Still, it prints "4 4 4". I have a few satellites and stations orbiting my planets, but I'd like to add onto them. I've seen numerous videos on using docking clamps to attach my new ship to the existing station, but can I do that on a part-by-part basis? For example, I take an extra fuel tank up there, can I attach just the tank to my station, then send my vessel back to Kerbin? I'm not talking about refueling, but rather transferring individual parts from my ship to the station in orbit.  I'd prefer to not have to use an unmanned probe and jettison everything but the desired part in space after docking if possible, but if that's the only way I guess I don't have a choice. Upgrade SQL Server 2000 database to 2008 R2 and enable new features Map matrix element to string I have created the custom setting with the hierarchy type    I have added some fields to the custom settings  phone field is added to the custom settings  custom setting Name:Order_Configuration__c  Phone :12345 - one profile  phone:456798 - another profile   Is it possible to access the different values for different profiles in custom settings using apex trigger code Sum of the series:$\frac{1}{1\cdot 2}+\frac{1\cdot3}{1\cdot2\cdot3\cdot4}+\cdots$ I have a question where i couldn't find any clue. The question is  $$\frac{1}{1\cdot 2}+\frac{1\cdot3}{1\cdot2\cdot3\cdot4}+\frac{1\cdot3\cdot5}{1\cdot2\cdot3\cdot4\cdot5\cdot6}+\cdots$$  I could get the general term as $t_n=\frac{1\cdot3\cdot5\cdot7\cdots(2n-1)}{1\cdot2\cdot3\cdot4\cdot5\cdot6\cdots2n}$  I have also tried it to form the sequence in the telescopic form.But couldn't get. Any hint will be appreciated. Counterexample: $G \times K \cong H \times K \implies G \cong H$ I am having a hard time finding a counterexample for the statement: $G \times K \cong H \times K \implies G \cong H$  I think this should be true for abelian, finite groups. But is this true in general? What would be a counterexample?  Any hints appreciated!  Thanks I would like the user to have full rights on this folder (as well as all sub-directories and files in it):  ~/.blabla   currently owned by root.  I have found numerous posts (in this forum and elsewhere) on how to do this for files but I can't find a way to do it for whole folders. I have what seems to me a very simple proof that $A_{n}$ is the only subgroup of $S_{n}$ of index 2.  Since I've seen other people prove it with what feel like really complicated methods (), I'm wondering if I've overlooked something.  Proof: Let $H$ be any subgroup of index 2 in $S_{n}$.  Then $H\cap A_{n}$ is a normal subgroup of $A_{n}$ and since $A_{n}$ is simple, $H$ is either the trivial or the improper subgroup of $A_{n}$.  If it's the trivial subgroup it doesn't have index 2 in $S_{n}$, and otherwise the theorem is proved. Android reject incoming call