I'm not sure if this is a duplicate question (I can't find anything like it), but I've tested using the == operator on 2 separate strings with the same value in 2 different IDEs and both have worked? I'm especially confused with this snippet of code:       public static void main(String args[]) {         String s1 = new String("aaab");         String s2 = new String("aaa");         System.out.println(Integer.toHexString(s1.hashCode()));         System.out.println(Integer.toHexString(s2.hashCode()));          s2 += "b";         System.out.println(Integer.toHexString(s1.hashCode()));         System.out.println(Integer.toHexString(s2.hashCode()));          Boolean b = s1==s2;         System.out.println(s1==s2);         System.out.println(b);         if (s1.equals(s2)){             System.out.println("this works");         }     }   (sorry if my formatting kinda sucks) For me, the console output is  2d9041 17841 2d9041 2d9041 false false this works   (I know the memory addresses might be different for different people, the point is the similarity between the two) This output doesn't make sense to me? Shouldn't s1==s2 return true because the memory addresses are the same? Is this an OS/Windows thing? Or an IDE thing? Sorry for the long question and thank you for any answers
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?
Say I want to automate making extruded-text or a 3d logo from an image.    An answer that uses extruding a monochrome image of the ubuntu logo to an arbitrary number of units with a python script taking only the number of units and the monochrome image as a starting point will receive extra this was awesome re-posts from me.  This could be useful for lots of things. Tourist Visa (30 days) Dubai valid until date Today I was informed by VFS that my tourist visa for UAE got approved. I'm travelling to UAE on 16th December 2014 and returning on 7th Jan 2015. But when I checked the "valid until" date on the visa it states 30 December 2014.    Does this date mean I should return before December 30th? Should I get it corrected from VFS? Can one do the maths of physics without using $\sqrt{-1}$? The use of imaginary and complex values comes up in many physics and engineering derivations. I have a question about that: Is the use of complex numbers simply to make the process of derivation easier, or is it an essential ingredient, without which it would be impossible to derive some results?   I can identify two different settings where the answer may be different:   It doesn't look like it is mandatory for results in Newtonian mechanics, General Relativity and classical electrodynamics. Can we say the same thing about quantum mechanics either way for sure?   Could this be a difference in quantum mechanics over the classical picture? Would you recommend using a  or a  field, and why (using MySQL)?   I'm working with PHP on the server side. Custom question lists April status update Previous posts:                           After a long hiatus, a new Custom Question Lists update is out with a fresh new design.  What's shipped?  If you are participating in the Custom Question List alpha (by ), you'll see some brand new UI components when viewing question lists:  New tab bar and editor    Based on your feedback, we decided to rethink the whole UI, removing some confusing and redundant components, and bringing back some much loved pieces.  The new design is closer to "the existing question lists with advanced options" than "a radically new experience".  Huge shoutouts to our new designer, , for making this new design possible and to  for picking up development while I was on sabbatical!  Some important notes for existing testers:   The summary is back in its rightful place next to the tab bar.  If bounty or unanswered filters applied, the summary provides a clearer explanation of what you're looking at, inspired by /unanswered. The "Filter" and "Sort" popovers are gone. Sort was too similar to the existing tabs, and Filter was a form in a popover. (how were you supposed to submit or cancel?)  Now there's a dedicated UI for filtering. The complex "Create" and "Edit" modals are gone.  Now you just configure your list with the same UI as if you were filtering and click "Save filter" when you're ready to save. You can preview your changes before updating a filter.  Editing a saved filter and clicking apply shows you your new options while remembering what filter you were looking at.  You can then click "Save filter" to either update your existing filter or create a new one. We handle responsive better.  The tab bar has been set up so it compresses more naturally on narrower browsers and mobile devices.   New sidebar widget    A new right-sidebar widget has been added, similar to Watched Tags, to give you more direct access to your saved lists.  This is where indicators will live in Phase 3 (which I swear we are actually going to ship).  Please give it a try.  If you have any questions, bugs, or feedback, you can reply to this post directly or add a new question with the  tag.  A wider alpha  Since we're nearing launch, we're expanding the alpha out to the whole network.  So feel free to try this out on any site you frequent, to help suss out any site-specific issues.  What's next?  As always, Phase 3 of this project is adding indicators for new content, now in the right sidebar widget.  There's increasing interest in this feature from Enterprise, so I do really expect this to ship and get out of Alpha sooner rather than later and this time, I mean it. $\sqrt{c+\sqrt{c+\sqrt{c+\cdots}}}$, or the limit of the sequence $x_{n+1} = \sqrt{c+x_n}$ (Fitzpatrick Advanced Calculus 2e, Sec. 2.4 #12)  For $c \gt 0$, consider the quadratic equation $x^2 - x - c = 0, x &gt; 0$.  Define the sequence $\{x_n\}$ recursively by fixing $|x_1| \lt c$ and then, if $n$ is an index for which $x_n$ has been defined, defining  $$x_{n+1} = \sqrt{c+x_n}$$  Prove that the sequence $\{x_n\}$ converges monotonically to the solution of the above equation.  Note: The answers below might assume $x_1 \gt 0$, but they still work, as we have $x_3 \gt 0$.    This is being repurposed in an effort to cut down on duplicates, see here: .  and here: . Every infinite subset of a countable set is countable. Here is the proof I tried to weave while trying to prove this theorem:     Theorem. Every infinite subset of a countable set is countable.      Proof. Let $A$ be a countable set and $E\subset A$ be infinite. Then $A\thicksim\mathbb{N}$. This implies that there is a sequence $\left\{x_{n}\right\}_{n\in\mathbb{N}}$ where $x_{n}\in A$. Construct a sequence $\left\{n_{k}\right\}_{k\in\mathbb{N}}$ where $x_{n_{k}}\in A$, $n_{1}$ is the smallest positive integer such that $x_{n_{1}}\in A$, and $n_{k+1}&gt;n_{k}$. Then      $$ E=\bigcup_{k=1}^{\infty}x_{n_{k}}, $$      and $E$ is countable, because $E\thicksim\mathbb{N}$. $\blacksquare$   Is it convincing? Lock questions in the review queue while being reviewed More and more frequently in the review queues, I am spending time either fixing a post or considering whether an edit is valid, etc, only to make changes and have them denied/not count because someone else has blindly hit the approve button in the meantime.  My proposal is for the system to "lock" a post in the review queue once it has been presented to someone for review.  Do not let anyone else (in the review queue) do anything with it until it is released by the last user it was presented to (or a certain amount of time has elapsed).    By "lock" I mean that it won't show up in anyone elses list until released.  I did NOT mean that it would be in multiple queues and be unactionable in some of them.  This would fit well as the queues only present one at a time anyway.  This will allow people trying to make good decisions the time to do it and prevent someone else from making that effort a waste of time.  As support, look to some of the published reasoning behind the auto-question ban.  A large portion of it is that bad questions waste the time of the community.  Taking the time to ensure you are making a good decision in the /review queue only to have it not count because someone was badge-whoring and clicking the approve button as fast as they could also wastes the users time... arguably the more (for lack of a better way to put it) valuable user who is willing to invest some time and thought into making the site better. a command to list all packagas installed on the system and their installed files, how? What's the easiest way to play a sound file (.wav) in Python? By easiest I mean both most platform independent and requiring the least dependencies. pygame is certainly an option, but it seems overkill for just sound. How to minimize $|z_1 - z_2|^2 + |z_1 - z_4|^2 + |z_2 - z_3|^2 + |z_3 - z_4|^2$? If $z_1,z_2,z_3,z_4 \in \mathbb{C}$ satisfy $z_1 + z_2 + z_3 + z_4  =  0$ and $|z_1|^2 + |z_2|^2 + |z_3|^2 + |z_4|^2 = 1$, then the least value of $|z_1 - z_2|^2 + |z_1 - z_4|^2 + |z_2 - z_3|^2 + |z_3 -  z_4|^2$ is $2$.   I solved this by taking two of the values to be $\frac{1}{2}$ and other two as $-\frac{1}{2}$. But I couldn't prove this in an efficient manner. What type of lens will auto-focus on Nikon bodies without a focus motor? I know my D40 doesn't have a motor in it to auto-focus lenses.  What type of lens has the motor in it? How can I know which lenses will and will not work? Python scope: "UnboundLocalError: local variable 'c' referenced before assignment" Find files that a user can write, efficiently with minimal process creation I am root. I would like to know whether a non-root user has write access to some files - thousands of them. How to do it efficiently while avoiding process creation? Getting file names without extensions I've been interested in non-standard analysis recently. I was reading up on it and noticed the following interesting comment on the , right after giving an example of a nonstandard differentiation:     The use of the standard part in the definition of the derivative is a rigorous alternative to the traditional practice of neglecting the square of an infinitesimal quantity... the typical method from Newton through the 19th century would have been simply to discard the $dx^2$ term.   I've never heard anything like this before, and really find it fascinating that Newton's method was to define the relation $dx^2 = 0$. If we actually formalize the above structure by taking $\mathbb{R}$ and adjoining an element $dx^2 = 0$ to it, we get the "dual numbers," isomorphic to the quotient ring $\mathbb{R}[x]/x^2$. I'd seen some things about how this algebra plays into automated differentiation algorithms for some computer software systems, but I've never heard anything about Newton directly working in this algebra. So I have a few questions:   Does anyone have more historical information on the way that Newton performed differentiation, and its relation to the dual numbers? Does anyone know how effectively real analysis can be formalized with the dual numbers? Does the resulting system play nice enough to develop all of the important modern results? If we start with $\mathbb{C}[x]/x^2$ instead, can we likewise develop complex analysis?   Since this idea is so simple, I'm very curious how powerful it is. I'm also curious if it has any major drawbacks too, since I'm not sure why anyone would mess with the foundational baggage involved in defining the hyperreals if this simple 2-dimensional real algebra could really do the trick. Prove that $X^\ast$ separable implies $X$ separable I installed an alpha or beta, am I up to date with the final release if I keep upgrading? I installed an Ubuntu alpha or beta and have been keeping it up to date.   So, Should I presume that my system has automatically updated to the next alpha or beta, and will be running the official release when it's finished? How to make a VGA monitor display a white screen at all time? Cocos2d-x supporting multi-resolution using density independent pixels Is there a way to use Density Independent pixels(dp) in cocos2d-x?  I am developing an Android game using Cocos2d-x 3.0.  The Android reference  tells me not to use pixels in code but use dp when supporting multi-resolution support. It also tells me to provide different images for different screen size groups and different density groups.  However, cocos2d-x tutorials use pixels for multi-resolution support. If I were to use pixels, I think it means I need to have images for all these different resolutions:  240x320, 240x400, 240x432 320x480 480x640, 480x800, 480x854 600x1024 640x960 1024x600, 1024x768 1280x768, 1280x800 1536x1152 1920x1152, 1920x1200 2048x1536 2560x1536, 2560x1600  Even if I don't support every screen resolutions, I think this requires more work than following the Android reference's best practice.  Am I missing something on how supporting multi-resolution works or do I indeed do need to do much more work using cocos2d-x?