I wanted to make simple Notepad program that can be used with password, I mean that it can only run if correct password is typed. However, it looks like it appends some trailing spaces! Here are some screenshots:   Here's my code: File passFile = new File(System.getProperty(&quot;user.dir&quot;)+&quot;\\jdata\\password.txt&quot;);                 if (passFile.exists()) {                     if (passFile.length() != 0) {                         String password = JOptionPane.showInputDialog(window, &quot;Enter password or Click 'Cancel' to quit:&quot;, &quot;Password&quot;, JOptionPane.QUESTION_MESSAGE);                         password = password.replaceAll(System.getProperty(&quot;line.separator&quot;), &quot;&quot;);                         try {                             Scanner scan = new Scanner(passFile);                             String correct = scan.nextLine();                             if (password != correct) {                                 System.out.println(password);                                 System.exit(0);                             }                             scan.close();                         } catch (Exception e7) {                             if (e7.getClass().getCanonicalName() != &quot;java.util.NoSuchElementException&quot;) {                                 System.exit(-1);                             }                         }                     }                 }  Any ideas?
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?
Start new chapter on same page Long lay over in Seoul. Do I need a visa as a Filipino citizen? I'm a Filipino immigrant from USA about to visit home in December.  I have a 14-hour lay over in Seoul,  South Korea.  Do I need a visa to leave the airport to do a little sightseeing? How to end paragraph text in an inverted pyramid shape? In many old books, the final paragraphs of chapters end in an inverted pyramid shape, like this:    I think this is beautiful, so I would like to imitate this for my book. I've found the code for a triangle in this post   \documentclass{article} \usepackage{microtype,shapepar}  \def\triangleupshape{% {0}% {0}b{0}\\% {8.66}t{-5}{10}\\% {17.32}t{-10}{20}\\% {17.32}e{0}% }      \begin{document} \shapepar{\triangleupshape}A ipsum dolor sit amet, consectetuer    adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. \par \end{document}   Which results in this:    But I'd like it to be inverted and the first part of the paragraph need to be full line width. Only the last few lines should end in an inverted pyramid like in the example above.  Is there a way to do this? Thanks in advance for your help. How to combine two strings together in PHP? What are turret connectors? While working on a project recently, I noticed that Digi-key has a product category . I've never seen connectors like this before, and they don't look like any kind of contact I've seen before. What does the mating connector look like? I can't envision any mating contact that makes any sense for these.  On top of that, they look like they have to be individually machined, which can't be a cost-effective process. An Open Interval and a Half-open Interval are not Homeomorphic Why aliases in a non-interactive Bash shell do not work Snapping in PyQGIS3.0 The following expression enables snapping for PyQGIS 2.0 :  QgsProject.instance().setSnapSettingsForLayer(layer.id(), True, 2, 1, 10, True)   What is the equivalent expression in PyQGIS 3.0? How can I prevent 'grep' from showing up in ps results? When I  search for some process that doesn't exist, e.g.  $ ps aux | grep fnord                           wayne    15745  0.0  0.0  13580   928 pts/6    S+   03:58   0:00 grep fnord   Obviously I don't care about grep - that makes as much sense as searching for the ps process!  How can I prevent grep from showing up in the results? Find $F$-related vector fields on $M\times N$, where $F(x)=(x, f(x))$ I am reading Lee's book on Differential geometry. In Chapter 4, Lee has this exercise.  Let $M$, $N$ be smooth manifolds, and let $f:M\to N$ be a smooth map. Define $F : M\to M \times N$ by $F(x) = (x, f(x) )$. Show that for every smooth vector field $V$ of $M$ , there is a smooth vector field on $W$ on $M \times N$ that is $F$-related to $V$.  I can understand that we must have $W_{(x,f(x))}=V_x\oplus Df(x)V_p$ for all $x\in M.$ The set $\{(x,f(x)):x\in M\}$ is a closed set in $M\times N.$ Therefore, if we can show that for all $(p,f(p))\in M\times N$ there is a neighbourhood $U_p$ and a smooth vector field on $U_p$ extending $V_x\oplus Df(x)V_x$ we are done by partition of unity. But I cannot show that. Can someone help me out? Possible Duplicate:          Is there some rule governing the following, or similar, subject-auxiliary inversions (*"Rarely they do see the light of day", *"Never I have been so insulted")?     In fancy sit-down restaurants, you can order a large meal and halfway through the main course, take a little dead cockroach or a piece of glass out of your pocket and place it deftly on the plate. Jump up astonished and summon the headwaiter. "Never have I been so insulted. I could have been poisoned" you scream slapping down the napkin. You can refuse to pay and leave, or let the waiter talk you into having a brand new meal on the house for this terrible inconvenience. ()      Rarely do they see the light of day; it's generally judged to be in no one's commercial interest that they should. Just occasionally, however, like a seemingly dormant volcano, they explode into the open. () I have seen this many times, a question is being asked because a previous, duplicate question was asked and answered a few years ago and has no longer relevant answers.  The  is to edit the old question, or add new answers to it, but it is not always happening.  I was wondering, should I still mark it as duplicate and vote to close it? Or just leave it as is? How do they film the mirror scenes in movies? What is the simplest way to convert char[] to/from tchar[] in C/C++(ms)? This seems like a pretty softball question, but I always have a hard time looking up this function because there seem there are so many variations regarding the referencing of char and tchar. I can not see how mathematically one can divide the numerator and denominator by theta. Can some one explain this in a different way. When you divide two fractions you multiply the first fraction by the reciprocal of the second. This is not the case here.     Divide numerator and denominator by $\theta$. ($\sin\theta$ also works.) $$\eqalign{\lim_{\theta\to0}\dfrac{\sin\theta}{8\theta+\tan\theta}&amp;= \lim_{\theta\to0}\dfrac{\dfrac{\sin\theta}\theta}{8+\dfrac{\sin\theta}\theta\cdot\dfrac1{\cos\theta}}\\&amp;=\dfrac{\lim\limits_{\theta\to0}\dfrac{\sin\theta}\theta}{8+\lim\limits_{\theta\to0}\dfrac{\sin\theta}\theta\lim\limits_{\theta\to0}\dfrac1{\cos\theta}}\\&amp;=\dfrac1{8+1\cdot1}\\&amp;=\dfrac19.}$$ If Newton's third law is true, why can we sink in sand? Newton's third law of motion states that every action has an equal and opposite reaction. That is the reason we do not sink into the earth, because when our weight exerts a force on the earth it also exerts an equal and opposite force on us.  But when we stand on quicksand or on fluids we can sink in. How is this possible? Does it not exert an equal and opposite force on us? Or are Newton's laws different in the case of fluids and substances of low densities? How does a lurker gain reputation to receive privilege for commenting? I want to crop (as in, take a subset of each frame, like when you crop a photo) a video in Windows Live Movie maker. Is there a way to do this, and failing that is there another free tool i can use to do that? If $f$ is continuous on $[a,b]$, $f(x)≥0$ on $[a,b]$ and $$\int_{a}^{b} f(x) =0$$   then prove that $f(x)=0$ for all $x \in [a,b]$.  I tried with Riemann's definite integral definition but couldn't proceed What exactly is TLP doing that default system config wouldn't? All the info about TLP on the surface looks more like advertisement and marketing to me, I can't see any detailed comparison to default configurations. What are the precise differences compared to default (K/L)Ubuntu installs under the hood, are they really effective?  Update: And if they really are, why aren't they a part of a default config?