Why does (("+k").split("k"))[0] not equal "+"? I am so confused.  Program:  //The Control Test String a = "+"; System.out.println(a); System.out.println((byte) a.charAt(0)); System.out.println(a == "+");  //The Error a = (("+k").split("k"))[0]; System.out.println(a); System.out.println((byte) a.charAt(0)); System.out.println(a == "+");   Output:  + 43 true + 43 false  -- Why?   So why in the world does a "+" not equal a "+"?!
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?
Does the alarm work when my phone is turned off? Will the alarm still go off if I turn off the phone before?  Example: when I have low battery, I have to go to sleep and wake up at X o'clock, and there is no charger around. Should I turn off the phone?   Note: If it makes any difference my phone is Galaxy S running froyo javac command not found I am trying to compile a java program I found on the internet and it says that I must check if javac is installed. I installed the JDK a long time ago so it should be working but I get command not found error:    how can this be resolved? How can I take shallow depth of field photos with a point-and-shoot camera? I have a compact digital camera, and in macro mode I can manage to achieve a blurred background, if the background is far enough away. Can this be done when taking non-macro pictures, and if not, is there a way to simulate it?  When I shoot portraits with my brother's DSLR, it is quite easy to fade out the background. But with my point and shoot camera, I haven't been able to take such photos.   I choose a large aperture for my camera but it still doesn't work. I know that standing further and zooming will result in a smaller depth of field, but it doesn't seem to be enough to get the really nice "bokeh" look. I've tried macro mode, and that will work if the subject is close enough and the background far enough away, but how can it be done with non-macro pictures?   Why are DSLR cameras are so much better in this area? What are the general recommendations to do this using a compact or super-zoom camera? Trying to attach a file from SD Card to email I am trying to launch an Intent to send an email. All of that works, but when I try to actually send the email a couple 'weird' things happen.  here is code   Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.setType("image/jpeg"); sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Photo"); sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://sdcard/dcim/Camera/filename.jpg")); sendIntent.putExtra(Intent.EXTRA_TEXT, "Enjoy the photo"); startActivity(Intent.createChooser(sendIntent, "Email:"));   So if I launch using the Gmail menu context It shows the attachment, lets me type who the email is to, and edit the body &amp; subject. No big deal. I hit send, and it sends. The only thing is the attachment does NOT get sent.  So. I figured, why not try it w/ the Email menu context (for my backup email account on my phone). It shows the attachment, but no text at all in the body or subject. When I send it, the attachment sends correctly. That would lead me to believe something is quite wrong. Do I need a new permission in the Manifest launch an intent to send email w/ attachment? What am I doing wrong? Have a look at   One of the bolds works, and the other one just turns up as ** in the actual post.  This is the string that isn't working: **x**ml n**ib**  Which renders as: xml nib Change the URL in the browser without loading the new page using JavaScript How would I have a  action that may have some effects on the current page but would also change the URL in the browser so if the user hits reload or bookmark, then the new URL is used?    It would also be nice if the back button would reload the original URL.  I am trying to record JavaScript state in the URL. A locally constant sheaf on a locally connected space is a covering space; Proof? Adding script conditionally Is it true that $\mathbb{R}$ and $\mathbb{R}^2$ are isomorphic as abelian groups? I think the answer is yes.   Sketch of the proof Consider $\mathbb{R}$ as a vector space over $\mathbb{Q}$. Let $\{e_\lambda:\lambda\in\Lambda\}\subset\mathbb{R}$ be its Hamel basis. Then $\{(e_{\lambda_1},e_{\lambda_2}):\lambda_1,\lambda_2\in\Lambda\}\subset\mathbb{R}^2$ is a Hamel basis of $\mathbb{R}^2$. Consider set theoretic bijection $i:\Lambda\to\Lambda\times\Lambda$ define map $\varphi:\mathbb{R}\to\mathbb{R}^2$ by its action on element of Hamel basis of $\mathbb{R}$ by equality $\varphi(e_\lambda)=(e_{i(\lambda)_1},e_{i(\lambda)_2})$. This is an isomorphism between $\mathbb{Q}$-vector spaces $\mathbb{R}$ and $\mathbb{R}^2$.  Question Could you tell me is this proof correct, and if it is not, where is the mistake?  EDIT: Thanks to GAJO we found that this proof is wrong. The correct one basis is  $$ \{(e_\lambda,0):\lambda\in \Lambda\}\cup\{(0,e_\lambda):\lambda\in\Lambda\} $$ So we had to look at bijections of the form $i:\Lambda\to\Lambda\coprod\Lambda$ and the desired linear operator is defined by equalities $\varphi(e_\lambda)=(e_{i(\lambda)},0)$ if $i(\lambda)$ lies in the first copy $\Lambda$ and $\varphi(e_\lambda)=(0,e_{i(\lambda)})$ otherwise. Does there exist a symmetric matrix $A$  such that $2^{\sqrt{n}}\le |\operatorname{Tr}(A^n)|\le2020 \cdot2^{\sqrt{n}}$ for all $n$? I think no. The trace of $A^n$ equals $\sum\limits_{i=1}^n\lambda_i^n$ where $\lambda_i$ are the eigenvalues of $A$. Now, if the absolute value of trace of $A$ is bounded below by $2$, then I think the trace of $A^n$ will grow infinitely. Am I right? Thanks beforehand. If $a > b$, is $a^2 > b^2$? Given $a &gt; b$, where $a,b ∈ ℝ$, is it always true that $a^2 &gt; b^2$? Why is it "description" but "describe" (b and p)? I've just wondered by it is "description", but "to describe". It looks as if "to descripe" would be a more consistant choice. Is there any other explanation besides "this is how it is written for years"?  edit: Or alternatively "to describe" and "describtion". How do I add new wallpapers? I have Ubuntu 11.10 installed and want to download and install additional wallpapers on my desktop.   How do I do this? How do I replace this cast iron toilet flange? Order a MySQL table by two columns How do I sort a MySQL table by two columns? What I want are articles sorted by highest ratings first, then most recent date.  As an example, this would be a sample output (left # is the rating, then the article title, then the article date)  +================+=============================+==============+ | article_rating | article                     | article_time | +================+=============================+==============+ | 50             | This article rocks          | Feb 4, 2009  | +----------------+-----------------------------+--------------+ | 35             | This article is pretty good | Feb 1, 2009  | +----------------+-----------------------------+--------------+ | 5              | This Article isn't so hot   | Jan 25, 2009 | +================+=============================+==============+  The relevant SQL I'm using is: ORDER BY article_rating, article_time DESC  I can sort by one or the other, but not both. Is there a way to determine how many digits a power of 2 will contain? Is there a direct way to determine how many digits a power of 2 will contain without actually performing the multiplication?  An estimation would help as well if there is no absolute solution.  EDIT: In both decimal and binary bases. EU flight compensation distance for connecting flight I recently had a flight from Valencia to London, going through Düsseldorf, cancelled. According to EU regulations there are different levels of compensation for flights below and above 1500 km in distance. I assume that this distance refers to start and end airport regardless of connection. Is this the case? I haven't found a proper definition online. Here, it would make a difference as VLC to LHR is around 1350 km, but the complete itinerary is above the 1500 km threshold. What if the universe is rotating as a whole? How to include a document into another document? The units of $\mathbb Z[\sqrt{2}]$