I'm not sure what I'm doing wrong here. I'm trying to create a basic command line using JFrame, which in future I want to create a bunch of functions that will be done based on the user's input, however, when I try to compare the ActionCommand to a string or variable, it doesn't seem to work:  `      import javax.swing.*;     import javax.swing.JFrame;     import java.awt.*;     import java.awt.event.*;     import java.io.*;       public class GUI extends JFrame{  private JTextField cmd;   public GUI(){     super("Command Line V2");       //Window title     setLayout(new FlowLayout());            //Set layout      cmd = new JTextField("Enter Command");  //Make cmd a JTextField     add(cmd);                               //Add cmd to the screen      //Adding action listeners     cmdHandler handler = new cmdHandler();     cmd.addActionListener(handler);   }  private class cmdHandler implements ActionListener{     public void actionPerformed(ActionEvent event){           String butt = "Whut";          if(event.getSource()==cmd){             if(event.getActionCommand()==butt){                  System.out.println("Yay");             }else{                 System.out.println("uh dear");                 System.out.println(event.getActionCommand());             }           }         } }`   This is the GUI.java page, but just incase it's needed, here's the main.java page:          import javax.swing.*;     import java.awt.*;     import java.awt.event.*;     import java.awt.FlowLayout;      public class Main {  public static void main(String args[]){      GUI g = new GUI();     g.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);     g.setSize(275,180);     g.setVisible(true);     g.setResizable(false); }      }   When opened, a window opens and a JTextBox appears: "Enter Command" once I write in the command line EXACTLY what the if statement is trying to compare the "event.getActionCommand()" to, it still outputs "uh dear" (Which is what it does if it doesn't compare it to anything)  How am I supposed to fix this? Thank you.
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 am working on a racing game in Unity3d and I have to show the rank as the winners touch the winning point.  As the winners reach at the winning point the image of the winner number should pop up for 1-2 seconds that is it.  How do I do it? Can anyone sort out this problem? Any help would be appreciated.  Thanks in advance :) Setting a fill and border is pretty easy in apps like Illustrator and Gravit Designer but in Blender. I've found it to be more tedious as I can't find anything online to solve this problem.  The picture above is a simple 2d mouth with lips. I would like to be able to move the lips and still have a fill but in Blender I needed to add another path for the mouth. Is there anyway I can move my lips path while having it also take the exact same shape (but not material) as my mouth's path?    (454.2 KB)  I work in Blender 2.79 cause 2.8 doesn’t run well on my laptop at all. Thats my . I loaded this to PostgreSQL DB using PostGIS shape file loader. I ran pgr_anlayzeGraph() on it and found it had a lot of isolated segments.  Next I ran pgr_nodeNetwork() to create a new table 'ways_ways'. I made the topology  for it and ran the following query in Qgis sql window.   SELECT * FROM ways_ways JOIN (SELECT seq, id1 AS node, id2 AS edge, cost FROM  pgr_astar('SELECT id, source, target, cost, x1, y1, x2, y2 FROM ways_ways',  1, 108, false, false) )AS route ON ways_ways.id = route.node;   Given below are the screenshots: Original floorplan and the prescribed route  query ouput   Clearly , I don't have a continuous output. I ran pgr_analyseGraph on ways_ways to find that it has no more isolated segments . It has 51 deadends, which is acceptable.   Did I miss any step in pgrouting? Is there anyway to see which node has id 1 and id 108 in qgis?  i ran the same query in another map(which i downloaded) and got output for all possible source and target ids. So how can i create a way(a route) that is completely noded? Is there a statement whose undecidability is undecidable? We know there are statements that are undecidable/independent of ZFC. Can there be a statement S, such that (ZFC $\not\vdash$ S and ZFC $\not\vdash$ ~S) is undecidable? I am looking for a term which clearly defines somebody as a non-geek, without being derogatory. The best example I have seen is muggle, but it needs context to be understood, as in "You don't meet many muggles at a comic convention", or "even my muggle friends like my autologlyph fractal decal". But while "muggle" makes it clear that he is a part of the "majority which is different", it is often hard to guess who the minority is.   There are also more specific words, but they are mostly so derogatory that I would consider them rude even in a joke, like luser or n00b. I definitely don't want to use them in a normal conversation.   A search in antonym dictionaries didn't bring up anything. Is there really no such word? Is every open subset of $ \mathbb{R} $ uncountable? Is every open subset of $\mathbb{R}$ uncountable?  I was crafting a proof for the theorem that states every open subset of $\mathbb{R}$ can be written as the union of a countable number of disjoint intervals when this question came up.  I feel like the answer is yes, but I'm not sure how to go about proving it or whether there is a crazy construction (like the Cantor Set)  that creates a countable, open subset of $\mathbb{R}$. Any ideas? Since 17.10 I got familiar with Wayland and I really need the per-monitor-scaling!  How can I start a wayland session after dist-upgrade to Bionic? There is no option in GDM available out-of-the-box.  I do not see what is described as     The Wayland session will still be available, pre-installed Why is this quotient space not Hausdorff? Is a diode needed for this simple mini solenoid circuit? Is it possible to find power armor in the wasteland? Write18: capturing shell (script) output as command/variable? Let's say I compile the following file with pdflatex -shell-escape test.tex:   \documentclass{minimal}  \begin{document}  File listing is:  \immediate\write18{ls /usr}  \end{document}   This will send the output of the command ls /usr to report/log of pdflatex (primarily to stdout).   There are then two cases I'd like to utilize:    The output of ls /usr being included directly in the document (LaTeX stream). The output of ls /usr becoming the contents of a \newcommand (by this I mean, that I'd like the script to be executed when the \newcommand is executed first - and upon subsequent calls to the new command, the shell code should not be executed anew).    I have read through , but I'm not sure if this "pipe input" can be applied to \newcommand.   I have also read through  - and it seems that Tex' file I/O should be used; but I'm quite disliking the fact that I'd still have to redirect the script output (actually, in this case, the ls /usr output) to a file, and then read it in, to have it as contents of a command.   So, is there an easier way to achieve what I'd want (hopefully, illustrated through an example based on the above code)?     EDIT: Ehm, I should have asked one more question earlier :) I'll try with an edit here, although it will probably get missed .. :)   I originally asked for a \newcommand that will execute shell code only upon its definition (i.e., in a sense it is "cached"); and the answer from @egreg does exactly that. But then - would it be possible to have a different \newcommand definition, such that each time this newcommand is called, the shell command is executed anew? I.e. executing something like \@@input|"cat tempfile" (which cannot be executed as such), where tempfile changes between calls? Is there a way to export my artwork as PDF so that it has a transparent background? Something like exporting objects only... whenever I try to save my .ai as pdf, it always comes with a full white background. If I try to save as eps, I get a chunky white background (where it has white rectangles behind the artwork only where the artwork exists, so there are transparent chunks).  If I export as png, I get an image like what I'm looking for. Is there any way to do that in a vector format? Wired connection not working Ubuntu 12.04 If ${n \choose 3} + {n+3-1 \choose 3} = (n)_3$, compute $n$.  Just making sure I am on the right track...  Do I expand each piece out and solve algebraically? Seeking feedback on downvoted question? What is the difference between re.search and re.match? MWE needs to be compiled with LuaTeX to reproduce the problem:  \documentclass[11pt]{report}% \usepackage{amsmath,mathtools} \usepackage{breqn}                          \begin{document} $J^{\ast} = \text{JFK} \to \text{NO} \to \text{SFO}$ \[ J^{\ast} = \text{JFK} \to \text{NO} \to \text{SFO} \] \end{document}   Gives (no compile error or any warning) the following strange output    I have to use breqn package. If I remove it, then I get the expected output    Is there a way to work around this, so I can use breqn and get correct output?  TL 2015. filelist: (compiled with lualatex)  This is LuaTeX, Version beta-0.80.0.1 (TeX Live 2015) (rev 5863)   *File List*   report.cls    2014/09/29 v1.4h Standard LaTeX document class   size11.clo    2014/09/29 v1.4h Standard LaTeX file (size option)  amsmath.sty    2013/01/14 v2.14 AMS math features  amstext.sty    2000/06/29 v2.01   amsgen.sty    1999/11/30 v2.0   amsbsy.sty    1999/11/29 v1.2d   amsopn.sty    1999/12/14 v2.01 operator names mathtools.sty    2015/11/12 v1.18 mathematical typesetting tools   keyval.sty    2014/10/28 v1.15 key=value parser (DPC)     calc.sty    2014/10/28 v4.3 Infix arithmetic (KKT,FJ)  mhsetup.sty    2010/01/21 v1.2a programming setup (MH)    breqn.sty    2015/08/11 v0.98d Breaking equations    expl3.sty    2015/12/20 v6326 L3 programming layer (loader)  expl3-code.tex    2015/12/20 v6326 L3 programming layer  l3pdfmode.def    2015/11/11 v6250 L3 Experimental driver: PDF mode flexisym.sty    2015/08/11 v0.98d Make math characters macros   cmbase.sym    2007/12/19 v0.92 mathstyle.sty    2015/08/11 v0.98d Tracking mathstyle implicitly graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) graphics.sty    2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)     trig.sty    1999/03/16 v1.09 sin cos tan (DPC) graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live   pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)  ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO) supp-pdf.mkii pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO) ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)    ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO) luatex-loader.sty    2010/03/09 v0.4 Lua module loader (HO) epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf   grfext.sty    2010/08/19 v1.1 Manage graphics extensions (HO) kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO) kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO) kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO) etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live  ***********   Update  I found another case of duplication when using breqn, which does not involve \text at all. But the solution provided below also fixes this issue. I am adding this second case here for reference just in case it might be useful. Here is MWE  \documentclass[11pt]{article} \usepackage[T1]{fontenc} \usepackage{amsmath,mathtools} \usepackage{breqn} \begin{document} \[ \underset{\mathbf{S}} {\operatorname{arg\,min}}      \sum_{i=1}^{k} \sum_{\mathbf x \in S_i}       \left\| \mathbf x - \boldsymbol\mu_i \right\|^2  \] \end{document}   The output is    After adding the patch in the answer below the correct output is now given, which is Is B1 visa in perfect condition valid on old damaged passport? I got my US B1 visa last month on my Indian passport. Someone in my family wrote a phone number on one of the blank page of my passport. As my passport is damaged now, can I travel with my current passport to US or I should apply for new passport? Also, will B1 visa be valid on old damaged passport if I get new passport? To do a patch manually I must type this command   sudo ./playback_delete_data_patch.sh 09_delete_old_data_p.sql     There is a space just before the 09:   sudo ./playback_delete_data_patch.sh [space] 09_delete_old_data_p.sql   How can I run this inside a script?  There are also several other commands but this one is giving trouble. How do they decide Blu-ray/DVD release date? I think my question is different from .  Some movies' productions release Blu-ray/DVD so early after theatrical release, others will take time. How do they decide for the Blu-ray/DVD release date?