I have this method that receives a string that contains an integer at the end, i've tried to extract the characters and the integer this way:  public void findCardPosition(String cardLocation,ImageView cardImage){         String cardName = null;         String cardType = cardLocation.replaceAll("[^a-z]","");         String cardPosition = cardLocation.replaceAll("[^0-9]", "");         int position = Integer.parseInt(cardPosition)-1;         if(cardType=="territory"){             cardName=GameBoard.getTerritoryTower().placeTowerTerritories().get(position).getName();         }          if(cardLocation=="territory1"){             cardName=GameBoard.getTerritoryTower().placeTowerTerritories().get(position).getName();         }         if(cardName!=null){             this.findCardImage(cardName,cardImage);         }     }   In theory both IF should work but the first one doesn't which means that when i apply String cardType = cardLocation.replaceAll("[^a-z]",""); to the string "territory1" it doesn't return the string "territory". The string cardPositionworks, so i don't understand why the stringcardTypedoesn't.
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?
Content replacement from external website This error occurs whenever I try to work with sudo. I changed the permissions of /var/ folder to 777 and I think this causes the error. Please help me get back a functional sudo and /var. How do I reset GNOME to the defaults? I was playing around with some settings, and now I need to reset GNOME to it's defaults - how do I do that? I ajaxly call a route and pass data to it, In my controller, I want to get $_POST['var'] , $_POST['var2'], it seems because of using HttpFoundation in drupal 8, $_POST and $_GET are not exists in old method, How I can access $_POST parameters in custom Controller? Determine which circuits are parallel and which are in series I need to find the Equivalent Resistance across A and B. The problem is, I don't know which one's are in series and which ones are in parallel. How do I identify which ones are parallel or series? HTTP GET request in JavaScript? How do I apply a gradient across multiple objects in Illustrator? I have two separate objects that I have applied gradient fill to.  The gradient fill seems to only apply to the objects as individuals. I tried grouping the shapes, but that doesn't seem to change the gradient.    How do I get one gradient to cover all my shapes? How can I get rid of this black hole in my minecraft world? I have interesting bug that I have experienced before but has gone away on its own. This one is not going away though.  I have a giant stripe or chunks missing from my desert biome, I would say probably 7 chunks long.  I'm guessing the chunks are corrupted or something, what was hoping to figure is whether it can repaired or reverted.  Here is a picture of the problem. Let $X$ be topological space and $A\subseteq X$.   If $E\subseteq X$ is connected, $E\cap A\neq\emptyset$ and $E\cap(X\setminus A)\neq\emptyset$ then $E\cap\partial A\neq\emptyset$.  Assume that $E\cap\partial A=\emptyset$.  If $E\cap\partial A=\varnothing$ then $E=(E\cap\text{int}(A))\cup(E\cap\text{ext}(A))$, i.e. a union of disjoint sets open in $E$.   Also the sets are nonempty because: $E\cap\text{int}(A)=E\cap A\neq\varnothing$ and $E\cap\text{ext}(A)=E\cap A^c\neq\varnothing$.  This contradicts that $E$ is connected.  Fixed. What is time, does it flow, and if so what defines its direction? I am including pages using Ajax but I also need to include their respective javascript files, which requires removing the previous javascript files from memory at the same time.  How can I unload the currently-loaded javascript files (as well as their code in memory) so that I can load the new page's files? They will more than likely conflict, so having multiple independent files' javascript files loaded. How do I configure Apache 2 to run Perl CGI scripts? I would like to configure Apache 2 running on Kubuntu to execute Perl CGI scripts. I've tried some steps that I came across by googling, but nothing seems to work.  What is the right way of achieving this? Who are the users that work for Stack Overflow? The user who first created a tag wiki is treated as owner for suggested edits was declined by the user who created the tag wiki excerpt, who doesn't yet have the reputation to be a trusted user. (The site is still in beta, and the reputation necessary to be a trusted user is 4000.)        Should the user who first proposed a tag wiki, or a tag wiki excerpt be the one who can unilaterally decide about a proposed edit for a tag wiki? The user who first proposed it isn't necessarily the one who knows if the tag's purpose can be better described with different words, nor does that user necessarily know if the tag has been lately used differently from how it was first used. Since a tag wiki is different from other posts, there should be an exception to the rule "the author of a post can unilaterally decide about any edits."  The paradox is then that the creator of a tag wiki still needs two users to approve their suggested edit. That's what happened in .        The funny fact is that in the revisions for the tag wiki, or tag excerpt (as in the screenshot), the tag wiki/excerpt is said to be created from the Community user.        This bug is  definitely . Export/Deploy Drupal site/page to static? (no cache) I wonder if there is an existing  module that can help in the subject. I am not looking for a caching module (like Boost or Varnish), but a way to export my whole site (or only certain pages) into static.  The idea is that I want my web server will be a very simple and light and will only serve static files (html/css/js) - no database on production, no php engine will be installed on server. All the Drupal engine will be on another server, export will be done each time adding/editing/changing a node or view, and a new set of html files will be created in a directory structure.  These files will later on be copied to the production site that will serve always and only static files, no .htaccess that will check requests if file exist etc.   Is there a module for that, or a workaround that this can be achieved with Drupal?  Thanks Why directory with large amounts of entries does not shrink in size after entries are removed? Unintentional mouse movements, am I paranoid? How to configure lightdm to allow manual logins in Ubuntu 14.04 I used to modify /etc/lightdm/lightdm.conf, adding the line greeter-show-manual-login=true, in order to allow login for hidden users and root.  Now I've just installed the new Ubuntu 14.04 and the file lightdm.conf is no longer located in /etc/lightdm. It's in /etc/init and has been totally modified.  How can I force lightdm login screen to show a field to input a login name? Probability density and distribution function I am new to probability course and find concepts very confusing. I am learning maximum likelihood estimation and as a starting point for that do we find the density or the distribution?   In general, do we find the distribution from density or is it vice versa and how does one find it? For example, for Gaussian distribution do we find the density of a variable or the distribution so as to estimate unknown parameter A in the case x[n] = A + w[n] where w[n] are uncorrelated gaussian noise. This may sound too trivial but I am really confused. In many contexts I have come across where pdf = prob. density function and in some areas I find pdf = prob distribution function !! Significance of $\sqrt[n]{a^n} $?! There is a formula given in my module:  $$ \sqrt[n]{a^n} = \begin{cases}  \, a  &amp;\text{ if $n$ is odd } \\  |a| &amp;\text{ if $n$ is even } \end{cases} $$  I don't really understand the differences between them, kindly explain with an example.