I wrote this piece of code of simple if statement and the out put is not it should be it gives   What is your Gender? male male The user did not answer the Question.  strong text public static void main(String args[]) {      Scanner userInput = new Scanner(System.in);     System.out.println("What is your Gender?");     String gender = userInput.nextLine();      System.out.println(gender);      if (gender == "Male" || gender == "male") {         System.out.println("Go to Room M1.");     } else if (gender == "Female" || gender == "female") {         System.out.println("Go to Room F1.");     } else {         System.out.println("The user did not answer the Question.");     }      userInput.close(); }
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?
Mutineers force captain to record instructions to spaceship's computer but he leaves out "please" The crew mutinies on a spaceship whose captain controls it with verbal orders. They test whether they can control the ship with recordings of the captain's voice with an order to increase orbital speed (currently orbiting a planet). It works, so they force the captain to record all the possible orders they may need, and execute him. Only then do they realize that the ship obeys only orders couched in polite language, and only the test recording was like this, but the other recordings are not. They will die once the ship's faster orbit somehow causes it to run out of fuel, or something like that. I seem to remember the ship's &quot;computer&quot; following the captain around on robotic legs. I read the story circa 1980, but it might have been published much earlier. Testing Classification on Oversampled Imbalance Data I am working on severely imbalanced data. In literature, several methods are used to re-balance the data using re-sampling (over- or under-sampling). Two good approaches are:   SMOTE: Synthetic Minority Over-sampling TEchnique () ADASYN: Adaptive Synthetic Sampling Approach for Imbalanced Learning ()   I have implemented ADASYN because its adaptive nature and ease to extension to multi-class problems.  My question is how to test the oversampled data produced by ADASYN (or any other oversampling methods). It is not clear in the mentioned two paper how they performed their experiments. There are two scenarios:  1- Oversample the whole dataset, then split it to training and testing sets (or cross validation).  2- After splitting the original dataset, perform oversampling on the training set only and test on the original data test set (could be performed with cross validation).  In the first case the results are much better than without oversampling, but I am concerned if there is overfitting. While in the second case the results are slightly better than without oversampling and much worse than the first case. But the concern with the second case is if all minority class samples goes to the testing set, then no benefit will be achieved with oversampling.  I am not sure if there are any other settings to test such data. Percentage of overlapping regions of two normal distributions I was wondering, given two normal distributions with $\sigma_1,\ \mu_1$ and $\sigma_2, \ \mu_2$   how can I calculate the percentage of overlapping regions of two distributions? I suppose this problem has a specific name, are you aware of any particular name describing this problem?  Are you aware of any implementation of this (e.g., Java code)? Does "singular" have a common meaning across matrices, decomposition, vectors and values? Verbless sentence I thought I heard my teacher said: 'Don't construct a sentence without a verb.'  Is there such rule in english grammar?     She looks like 70 years old. Perhaps older.   How about the question above? Is it correct? Is there any book that can be used references for wide range of topics in grammar(including syntax, morphology et cetera)? I have finished oxford grammar in use recently and think it wasn't enough for me. Select Input Texture file name as parameter/node I am trying to create a material node group for triplanar mapping, but I am not sure how I can parameterize the image texture name.   I have 3 image texture nodes, which all use the same file with the same settings, the only difference is the vector input.  Is there a way I can make it so that I only have to select the texture name once, possibly as a input for a group? Get material and color of material on a face of an object in Python I want to iterate over the faces of a mesh and get the diffuse color of the material that is assigned to the face. How can I get the material that is assigned to the face of the object and the diffuse color of that material? Is 45 mins enough in Newark airport terminal C to change the plane for connecting flight? I have a dataset in csv file format that I'm loading into pgfplotstable. I can't change the format of the original csv, and being financial data it has a column of item names and two or three explanatory data points at the top of the table. e.g.  \documentclass{article} \usepackage{array,datatool,pgfplotstable}   \begin{filecontents}{sample.csv}     item,2008,2009,2010,2011      ,Actual,Actual,Forecast,Forecast      ,GBP,GBP,GBP,GBP      ,('000),('000),('000),('000) rounded     Area 1 OP, 1000000,1500000,1750000,250000     Area 2 OP, 400000,500000, 450000,-50000     Area 51 OP, 300000,375000,390000,15000     No P, 1250000, 1000000, 950000, 50000     Residuals, 800000, 80000, 90000, 10000   \end{filecontents}  \pgfplotstableread[col sep=comma]{sample.csv}\mystuff   I'm stumped at the next stage which is to typeset \mystuff so I have comma separators and can add a row that sums the 'Area' columns. At the moment to display the table I have to do something like  \begin{document}  \pgfplotstableread[col sep=comma,header=false]{sample.csv}\mystuff  \pgfplotstabletypeset[   columns/0/.style={string type},   columns/1/.style={string type},   columns/2/.style={string type},   columns/3/.style={string type},   columns/4/.style={string type}]\mystuff  \end{document}   How do I tag the top three rows as string and the rest of the last four columns as integer type so I can format and transform them? Place label in middle of line with TikZ What is the best way to place a label in the middle of a line with TikZ? I mean smack dab in the middle of the line, not above or below it. The following is close  \begin{tikzpicture} \draw[|-&gt;, color=red] (-4cm, 0.5cm) -- (2.5cm, 0.5cm) node[midway, color=black] {$\tau_{r}$}; \end{tikzpicture}   But the line crosses right through the node and its text, which is bad.  I don't know if there is an option to choose the background color of a node, which I think would solve the problem (e.g. background=white). fill doesn't seem to work. I know that the product of two Gaussians is a Gaussian, and I know that the convolution of two Gaussians is also a Gaussian. I guess I was just wondering if there's a proof out there to show that the convolution of two Gaussians is a Gaussian. I am getting these warnings every time I update my initramfs image(-s) with  on my Dell PowerEdge T20 server running    10.0. Is there a fix?    W: Possible missing firmware /lib/firmware/i915/bxt_dmc_ver1_07.bin for module i915 W: Possible missing firmware /lib/firmware/i915/skl_dmc_ver1_27.bin for module i915 W: Possible missing firmware /lib/firmware/i915/kbl_dmc_ver1_04.bin for module i915 W: Possible missing firmware /lib/firmware/i915/cnl_dmc_ver1_07.bin for module i915 W: Possible missing firmware /lib/firmware/i915/glk_dmc_ver1_04.bin for module i915 W: Possible missing firmware /lib/firmware/i915/kbl_guc_ver9_39.bin for module i915 W: Possible missing firmware /lib/firmware/i915/bxt_guc_ver9_29.bin for module i915 W: Possible missing firmware /lib/firmware/i915/skl_guc_ver9_33.bin for module i915 W: Possible missing firmware /lib/firmware/i915/kbl_huc_ver02_00_1810.bin for module i915 W: Possible missing firmware /lib/firmware/i915/bxt_huc_ver01_07_1398.bin for module i915 W: Possible missing firmware /lib/firmware/i915/skl_huc_ver01_07_1398.bin for module i915 I've been testing PCA via SVD to decompose a simple time series data matrix, $X$.  I have two signals $x_1(t)$ and $x_2(t)$ in a data matrix where $M$ rows represents each timepoint sample and each column represents $x_1$ and $x_2$.  The mean signal, $\hat{x}$, is defined as the mean along the row axis (average of $x_1$ and $x_2$ along each timepoint).  I normalize each column of $X$ by subtracting its mean and dividing by the standard deviation.  When I use [U S V] = svd(Xz) in matlab, regardless of how the variables are distributed (whether they are correlated or uncorrelated), one of the columns of the right singular matrix, V, always points in the same direction (to a multiplicative constant) as the mean vector $(1/2, 1/2)$.  But when add an additional third time series, this is never the case (where the mean vector is $(1/3, 1/3, 1/3)$.  Because I normalize the standard deviation for each vector, it does make sense that the direction of most variance given by PCA would be the diagonal 45 degree line.  But if both variables $x_1$ and $x_2$ are independent gaussians, couldn't the PCA direction be any direction since the distribution is radially symmetric?  MATLAB Code:  s = RandStream('mcg16807', 'Seed', 0); RandStream.setDefaultStream(s);  G = zeros(1000,2); G(:,1) = 40*randn(1000,1)-100; G(:,2) = tan(G(:,1)) + randn(1000,1); X = G - repmat(mean(G),[size(G,1), 1]); Xz = X./repmat(std(G),[size(G,1), 1]); [U S V] = svd(Xz); G_mean = mean(Xz,2); corrcoef(G_mean, U(:,1)) corrcoef(G_mean, U(:,2)) Show the series $a_n/(1+a_n)$ converges absolutely What packages do you use and recommend for creating graphics in your LaTeX documents?     As this is a community wiki post, please add your package to the accepted answer (or add a comment, and someone with >100 rep will add it to the CW answer), and include a brief description of what differentiates it from others and how it can be used (GUI drawing tool which generates code, type in raw text, or generates image for inclusion in document).   We'll eventually sort these answers under headings. For valuation rings I know examples which are Noetherian.      I know there are good standard non Noetherian Valuation Rings. Can anybody please give some examples of rings of this kind?    I am very eager to know. Thanks. Java multiline string Create violine plots I use pgfplots for most of my plots. Now I need to add a . Is this possible with pgfplots or any other package? Calculation of $\int_0^{\pi} \frac{\sin^2 x}{a^2+b^2-2ab \cos x}\mathrm dx$ Calculate the definite integral      $$ I=\int_0^{\pi} \frac{\sin^2 x}{a^2+b^2-2ab \cos x}\;\mathrm dx $$      given that $a&gt;b&gt;0$.   My Attempt:  If we replace $x$ by $C$, then  $$ I = \int_{0}^{\pi}\frac{\sin^2 C}{a^2+b^2-2ab\cos C}\;\mathrm dC $$  Now we can use the Cosine Formula ($A+B+C=\pi$). Applying the formula gives  $$ \begin{align} \cos C &amp;= \frac{a^2+b^2-c^2}{2ab}\\ a^2+b^2-2ab\cos C &amp;= c^2 \end{align} $$  From here we can use the formula $\dfrac{\sin A}{a} = \dfrac{\sin B}{b} = \dfrac{\sin C}{c}$ to transform the integral to  $$ \begin{align} I &amp;= \int_{0}^{\pi}\frac{\sin^2 C}{c^2}\;\mathrm dC\\ &amp;= \int_{0}^{\pi}\frac{\sin^2A}{a^2}\;\mathrm dC\\ &amp;= \int_{0}^{\pi}\frac{\sin^2 B}{b^2}\;\mathrm dC \end{align} $$  Is my process right? If not, how can I calculate the above integral? How can I reduce screen brightness below the minimum without an app? I have an Optimus Elite, and it has a minimum brightness setting. In certain apps, I can reduce the brightness below the safe minimum, but when I leave the app, the brightness is increased to the system-wide minimum.  Using , I can permanently set the brightness below the safe amount, and it will stay even after going to other apps. Or using , I can accomplish almost the same thing even without needing root (it displays a translucent 'filter' over the whole screen, reducing brightness/contrast but not actually changing the backlighting power amount).  What I want to know is where the minimum screen brightness is stored. I have a rooted phone with CyanogenMod 9, so I have permissions to edit anything and could change a config or sqlite entry, but I don't know where this value is stored. What I would like to do is use the status bar brightness slider to be able to slide to the actual minimum of the screen, rather than the OS-controlled minimum. Having an app is useful, but having the functionality without the app seems to be within reach, if only I knew where the OS is getting it's safe minimum setting.  Where is this "safe minimum brightness" setting stored? If I can change it, I can remove my apps and use native controls.