note: sorry about the bad formatting, I'm new to stack overflow If I had a piece of code that started like this,   import java.util.Scanner; public class MyProgram {   public static void main(String[] args)     {     Scanner Input = new Scanner (System.in);     System.out.println( "Write either yes or no." );     String message = Input.nextLine();    and wanted to check the String variable &quot;message&quot;'s contents in an if statements, how would I do that? I am thinking about something like this: if( message == &quot;yes&quot; )  By this, I mean checking what the user wrote when prompted to, which is stored as message.
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?
I want to sort in-text citations by year, but bibliography by name. It sound exactly like .  However, suggested solution (using \usepackage[sorting=ynt]{biblatex} and \printbibliography[sorting=nty]) does not work for me (see MWEB below). Indeed, the list of references remains year-sorted instead of name sorted.  Question: How to force sorting=nty in \printbibliography?      \documentclass{article}     \usepackage[%         backend=biber,%         style=authoryear-comp,%         natbib=true,%         sorting=ynt%     ]{biblatex}     \addbibresource{\jobname.bib}     \usepackage{filecontents}  \begin{filecontents}{\jobname.bib}     @book{key2000,       author = {Author, A.},       year = {2000},       title = {Alphabetical fist \&amp; Year last},       publisher = {Publisher},     }     @book{key1900,         author = {Boathor, B.},         year = {1900},         title = {Alphabetical last \&amp; Year first},         publisher = {Publisher}, } \end{filecontents}  \begin{document}     Citation should be year-sorted, even if \verb+\citep+ is random \citep{key2000, key1900}.% citation NOT year-sorted      \printbibliography[sorting=nyt] \end{document}   P.S.: At the opposite, using  \begingroup     \newrefcontext[sorting=nyt]     \printbibliography \endgroup    overrides the \usepackage[sorting=ynt]{biblatex} option (i.e. LoR is name-sorted, but in-line citations as well). It would be nice to see what users have recently been active. This is somewhat standard with many forum-style websites, showing how active the site has been in the last n-minutes or so. As a functional advantage, this also serves to let you know when is a good time to get a question in. Do you recommend using semicolons after every statement in JavaScript? In many situations, JavaScript parsers will insert semicolons for you if you leave them out. My question is, do you leave them out?  If you're unfamiliar with the rules, there's a description of semicolon insertion on the . Here's the key point:     If the first through the nth tokens of a JavaScript program form are grammatically valid but the first through the n+1st tokens are not and there is a line break between the nth tokens and the n+1st tokens, then the parser tries to parse the program again after inserting a virtual semicolon token between the nth and the n+1st tokens.   That description may be incomplete, because it doesn't explain @Dreas's example. Anybody have a link to the complete rules, or see why the example gets a semicolon? (I tried it in JScript.NET.)   is related, but only talks about a specific scenario. Is it okay to have 100% CPU usage constantly? I often do 3D rendering in the background which consumes 100% of the CPU (I lower the priority of the process so that it does not hinder any tasks I am working on).  My concern/question is whether it is okay to run a computer/laptop with a 100% CPU load constantly.  Could this reduce the lifespan of the system? Is there a measurable set $A$ such that $m(A \cap B) = \frac12 m(B)$ for every open set $B$? The following MWE produces a PDF whose TOC has two entries: “Foo” and “Bar” with correct page numbers. So far, so good. However, upon clicking on the link to “Bar”, I am taken to the page for “Foo” instead.  \documentclass{report} \usepackage{hyperref} \newcommand*\backmatter{\setcounter{chapter}{0}}  \begin{document} \tableofcontents \chapter{Foo} \backmatter \chapter{Bar} \end{document}   (Produced with pdflatex, run twice.)  This MWE is whittled down from a (much!) more complex document but the above does seem to reproduce the error reliably.  Re-setting the chapter count seems to confuse hyperref, even though the page references are still accurate. Notice that in my real document, \backmatter does other things, including setting the numbering style to alphabetical so there’s no chance of confusion even though both chapters are ostensibly labelled as “Chapter 1”.  How do I fix this? Is this a bug? Are there workarounds? At least it's my understanding that AES isn't affected by known-plaintext. Is it immune to such an attack, or just resistant? Does this vary for chosen-plaintext? I am having some issues when rendering an image, my rendering screen is turning into grey even when making a full render. What am I doing wrong? how to loop through arguments in a bash script This one-liner removes duplicate lines from text input without pre-sorting.  For example:  $ cat &gt;f q w e w r $ awk '!a[$0]++' &lt;f q w e r $    The original code I have found on the internets read:  awk '!_[$0]++'  This was even more perplexing to me as I took _ to have a special meaning in awk, like in Perl, but it turned out to be just a name of an array.  Now, I understand the logic behind the one-liner:  each input line is used as a key in a hash array, thus, upon completion, the hash contains unique lines in the order of arrival.  What I would like to learn is how exactly this notation is interpreted by awk. E.g. what the bang sign (!) means and the other elements of this code snippet.  How does it work? What is the maximum length of a URL in different browsers? What is the maximum length of a URL in different browsers? Does it differ among browsers? Is a maximum URL length part of the HTTP specification? Lagrange's theorem I don't understand left coset and Lagrange's theorem... I'm working on some project so please write me anything what could help me understand it better How does a calculator calculate the sine, cosine, tangent using just a number? Sine $\theta$ = opposite/hypotenuse   Cosine $\theta$  = adjacent/hypotenuse   Tangent $\theta$  = opposite/adjacent      In order to calculate the sine or the cosine or the tangent I need to know $3$ sides of a right triangle. $2$ for each corresponding trigonometric function. How does a calculator calculate the sine, cosine, tangent of a number (that is actually an angle ?) without knowing any sides? I have a list of arbitrary length, and I need to split it up into equal size chunks and operate on it. There are some obvious ways to do this, like keeping a counter and two lists, and when the second list fills up, add it to the first list and empty the second list for the next round of data, but this is potentially extremely expensive.  I was wondering if anyone had a good solution to this for lists of any length, e.g. using generators.  I was looking for something useful in itertools but I couldn't find anything obviously useful. Might've missed it, though.  Related question: How do I opt-out of the Social Security system? Principle of Reflection on atomic level This well-observed phenomenon has, besides several others, always been a fascination to me. We are well aware of several theories, experiments, and practical applications of this well-known phenomenon, but is it established what goes on at the grassroots of reflection?  My high school teacher once told me that whenever light is incident on any reflecting surface, its electrons absorb the energy of the photon and release back the same energy. If this is actually true, then I have plenty of questions to continue, but if it is not, then what is reflection, and how and why does it take place? How to set class weights for imbalanced classes in Keras? Asserting that Atheism and Theism are both faith based positions I am recently testing an assertion that I have concluded namely that atheism is a faith based position just like theism is a faith based position.  The reason I arrived at this conclusion is that theists have no proof that God actually exists. It's purely a matter of faith. Yes, there maybe strong implicit proof that God exists in their opinion (scriptures, history, etc) but there is no concrete proof of God's existence. In my view, atheists also suffer from the same problem of providing a proof of their position. Specifically that they cannot prove that God is non-existent.  The typical rebuttal I get is that the burden of proof is on the theists. But I view this as a cop out and they hide behind the wall of burden of proof which is just a bias in the debate.  Given the above, I claim that both atheism and theism are positions based on faith. Would it be incorrect to claim that? We are given two independent standard normal random variables $X$ and $Y$. We need to find out the M.G.F of $XY$.  I tried as follows : \begin{align} M_{XY}(t)&amp;=E\left(e^{(XY)t}\right)\\&amp;=\int_{- \infty}^{\infty}\int_{- \infty}^{\infty}e^{(XY)t}f_X(x)f_y(y)dxdy \\ &amp;=\dfrac{1}{2\pi}\int_{- \infty}^{\infty}\int_{- \infty}^{\infty}e^{(xy)t}e^{\frac{-x^2}{2}}e^{\frac{-y^2}{2}}dxdy \\ &amp;= \dfrac{1}{2\pi}\int_{- \infty}^{\infty}\int_{- \infty}^{\infty}e^{-\dfrac{(x-ty)^2}{2}}e^{\dfrac{-t^2y^2}{2}}e^{\frac{-y^2}{2}}dxdy \\ &amp;= \dfrac{1}{\sqrt{2\pi}}\int_{- \infty}^{\infty}e^{\dfrac{-t^2y^2}{2}}e^{\frac{-y^2}{2}}dy \\ &amp;= \dfrac{1}{\sqrt{2\pi}}\int_{- \infty}^{\infty}e^{-y^{2}(\frac{1}{2}+t^2)}dy \\ &amp;= \dfrac{1}{\sqrt{1+2t^2}} \end{align} Is this correct ? Evaluation of OptionValue[]