The code in the following snippet just compares string references.  String str1 = "mystring9"; String str2 = "mystring"+String.valueOf(9);  System.out.println(str1==str2);   In this case, str1==str2 returns false.    The following segment of code also returns false.  String str1 = "mystring9"; String str2="mystring"+str1.length();  System.out.println(str1==str2);     The following code however, returns true.  String str1 = "mystring9"; String str2 = "mystring"+9;  System.out.println(str1==str2);   I think, the expression "mystring"+9 in this code should internally be evaluated to String.valueOf(9) though why do the first two examples return different output than the preceding example?
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 shouldn't I mix tabs and spaces? Can somebody please explain when parent process receives the exit status of a dead child process via wait, who actually reallocates the memory of the child process and removes it from the process table? Where do I find system sounds? After installing gm-notify I see the option of hearing a sound every time a new e-mail arrives in my Gmail inbox, but I don't know where Ubuntu (10.4) stores the system sounds to assign one. Any ideas? Thanks. I have two feature Datasets. Both are Polygons. Dataset A has very big Areas and Dataset B just small ones. Now, B still overlaps in 2 or 3 Zones from Dataset A.   I want to perform a spatial join and put the result comma seperated in just one row like this:  Zone_ID_A  |  Zone_ID_B     1       |   2,3    2       |   2,4    3       |   5    4       |   1,6   I know this is possible with ArcMap but i could not figure out a way to do this in QGIS, any ideas? Determine the exact value of equations involving more two trig variables $2\cos^2x=1+\sin x$.  Determine the exact values of $x$ such that $0 \leq x \leq 2\pi$.    I am experiencing problems with factoring this question.  First I started by getting everything on to the left side so: $2\cos^2x-\sin x-1=0$.  Then seeing as there are two trig variable here ($\cos$ and $\sin$), I used the pythagorean identity and replaced $2\cos^2x$ with $1-2\sin^2x$ to make it into a one variable question: $1-1-2\sin^2x-\sin x-1=0$.   By collecting like terms it then becomes $-\sin^2x-\sin x=0$.  Now you could factor these with $0$ and $-1$, but then it creates uneven brackets so this musn't work.  I don't think the quadratic formula is necessary, but I am wondering if this could be treated as a difference of squares question.    If you replace the $\sin x$ and make the question into $-x^2-x=0$ it is a little easier to look at, however I am not sure if this is the right approach.  If someone could please clarify my answer, that would be appreciated! Asking similar questions - process? Make CMD-Delete a keyboard shortcut in Apple Mail to move a message to the archive? Can I find out which tags I have created? This would be interesting to know.  The tags could be highlighted on the users page for example. Close vote review audit is broken - displays "on hold" while reviewing I just reviewed this:    But while reviewing, it already displays the "put on hold as not a real question" section, and it asked:     Should this question be closed as: ?   So as it stands, the audits are broken, since we already know that the question is "on hold" while reviewing, and it is incredibly hard to miss the huge grey box at the bottom.  Another with screenshot: I stumbled upon an example, which needed to be compiled with the additional option --shell-escape. Using this option it worked just fine, but I'm curious:     Why or when is this option needed and what does it actually do? What are review tests (audits) and how do they work? Slope layer with false results in QGIS? After the DEM creation, I wanted to create slope layer.   However, the result has not satisfied me. I don't think the slope map is correct. Have you ever encountered false calculated terrain map?  This is the DEM:    And this is the slope layer. What is the origin of the word  as in the interjection:     — It's hot in the desert.   — Well, duh!   If it is of onomatopoeic origin and only appears in modern English as some sites suggest, I would be interested to know when it started appearing in English writing. Suppose I define a new theorem "Theorem" and declare that its counter should be reset whenever the subsection counter is incremented or reset:  \newtheorem{theorem}{Theorem}[subsection]   At some point in my (article) document I start a new \section (say, section 2) without starting a \subsection. I expect the first theorem in this section to be numbered with "2.0.1" (which may be considered bad style). However, the theorem is numbered "2.0.2".  Is this "by design" (technically, I didn't start a new \subsection) or a bug? Moreover, what would be a proper workaround? (Such a workaround should not involve manually resetting the theorem counter, and it should work for whatever theorem type I may define in addition to "Theorem".)  \documentclass{article}  \newtheorem{theorem}{Theorem}[subsection]  \begin{document}  \section{bla}  \subsection{blubb}  \begin{theorem} Some text. \end{theorem}  \subsection{foo}  \begin{theorem} Some text. \end{theorem}  \section{bar}  \begin{theorem} Some text. \end{theorem}  \end{document}   EDIT: In response to Seamus' comment: The unexpected counter value also occurs with amsthm and ntheorem. How to know the usage of undocumented function like LinearAlgebra`BLAS? Prove that vector space and dual space have same dimension As an exercise in my textbook, I need to prove that if $V$ is a finite dimensional vector space with dual space $V^*$ over $\mathbb{R}$, then dim$(V)$=dim$(V^*)$.  Let $\omega\in V^*$ and let $\{e_1,...,e_n\}$ be a basis for $V$. Define $e^i\in V^*$ by $e^i(e_j)=\delta_{ij}$. We show that $\{e^1,...,e^n\}$ spans $V^*$. $\omega(v)=\omega(v_1e_1+...+v_ne_n)=v_1\omega(e_1)+...+v_n\omega(e_n).$ If $\omega(e_1)=\lambda_1,...,\omega(e_n)=\lambda_n$, then $\omega(v)=v_1\lambda_1e^1(e_1)+...+v_n\lambda_ne^n(e_n)$=$\lambda_1e^1(v)+...+\lambda_ne^n(v)$.   To show $\{e^1,...,e^n\}$ is linearly independent, suppose that $0=c_1e^1+...+c_ne^n$ is the zero mapping to $\mathbb{R}$. Consider the image of $e_1:$  $0(e_1)=c_1*1+...+c_n*0=c_1$ Hence, $c_1=0$. Repeating the procedure for $e_j$, $2\leq j\leq n$, we see that $c_1=c_2=...=c_n=0$.  Does this proof look correct?  If the proof is correct, I have an additional small question. It seems like this proof is dependent on the fact that $V$ is a real (or complex) vector space, since we define the covectors to have the image set $\{0,1\}$. Is there a proof that works for vectors spaces over general fields? Prove that if $d \mid n \in \mathbb{N}$, then $\varphi(d) \mid \varphi(n)$. I want to prove that if $d \mid n \in \mathbb{N}$, then $\varphi(d) \mid \varphi(n)$.  It's given that $d \mid n$, so we know that $n = dm$, for some $m \in \mathbb{Z}$. Now, I want to show that $\varphi(d) \mid \varphi(n)$, i.e. that $\varphi(n) = k\varphi(d)$, for some $k \in \mathbb{Z}$. Drawing a blank of where to go from here. How do I use a particular font for a small section of text in my document? The standard font packages make global changes to the fonts in my document. What if I want to use a particular font for just a portion of my text?   How do I find the right name of the font? How do I select the font? How do I restrict the scope of the font change?     There are separate answers for different flavors of TeX (quick links): How can I programmatically create a new cron job? I want to be able to programatically add a new cron job, what is the best way to do this?  From , it seems I could dump the current crontab and then append a new one, piping that back into crontab:  (crontab -l ; echo "0 * * * * wget -O - -q http://www.example.com/cron.php") | crontab -   Is there a better way? View history of changes Possible Duplicate:          How do I view the changes made to a question, in the SO-style visual diff?  I'm sure I've seen this before, but the "history" button eludes me. Clicking "edit" gives me a drop down of the revisions, but not the actual diff.    Edit  This edit is a demonstration of the revision history functionality.