I have an arrayList with a bunch of strings in it. I also have another arrayList with a bunch of strings. I would like to see whether the first array list contains any string from the second arrayList and if so, just to print it out. Should be simple but it doesn't seems to work (and there are definitely strings in common).  Here is my code:   ArrayList&lt;String&gt; che=new ArrayList&lt;String&gt;();  for (int i = 1; i &lt;= rsmd.getColumnCount(); i++) {      System.out.println("COL"+rsmd.getColumnName(i));      che.add(rsmd.getColumnName(i).trim());  }  String key = "";  String keys = "";  for (Entry&lt;String, String&gt; entry : map.entrySet()) {      key = entry.getKey().replace(":","")            .replace("&gt;","MoreThan").replace("__","")            .replaceAll("\\." ,"").replaceAll("\\(s\\)" ,"")            .replaceAll(",$" ,"").replaceAll("%" ,"")            .replaceAll("\\(" ,"").replaceAll("\\)" ,"")            .replace("-" ,"").replace("-" ,"")            .replace("_" ,"").replace("#" ,"")            .replaceAll("\\/", "_").replaceAll("@", "AT")            .replaceAll("&amp;", "AND").replaceAll("\\?", "AND")            .replace("≤","LessThan").replace("≥","MoreThan")            .replaceAll("\\s" ,"").replaceAll("^,","");        for (String n:che){          System.out.println("Che_String "+n);          System.out.println("KEY_String "+key);          if (n==key){              System.out.println("Detected the same: "+key.trim());          }      }  }   I know there are a lot of replaces and I should use StringUtils.repaceEach and I will do so but need to sort this first  The System.out.println output shows that there are several similar strings but they are not being picked up eg  Che_String Gender KEY_String Gender   But my Detected the same: output is empty.  I've also tried che.contains(key) with the same results.
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?
Where are all islands and discoverable locations? After taking off in Simpleplanes and flying around over the ocean for a while, I've found a lots of tiny islands all over the place, and a few really big ones that unlock new spawn locations once found.  Large islands appear to also have many discoverable 'locations' around them as well, like airports, carriers, or landmarks.  These locations automatically become available as start points once discovered.  Where can I find all of these major islands, and once there, where should I look to unlock all of the locations? Why are there only derivatives to the first order in the Lagrangian? Why is the Lagrangian a function of the position and velocity (possibly also of time) and why are dependences on higher order derivatives (acceleration, jerk,...) excluded?  Is there a good reason for this or is it simply "because it works". What is the difference between "Redirection" and "Pipe"? This question may sound a bit stupid, but I can not really see the difference between redirection and pipes.  Redirection is used to redirect the stdout/stdin/stderr, e.g. ls &gt; log.txt.  Pipes are used to give the output of a command as input to another command, e.g. ls | grep file.txt.  But why are there two operators for the same thing?  Why not just write ls &gt; grep to pass the output through, isn't this just a kind of redirection also? What I am missing? ...where each object also has references to other objects within the same array?  When I first came up with this problem I just though of something like   var clonedNodesArray = nodesArray.clone()   would exist and searched for info on how to clone objects in javascript. I did find a  on StackOverflow (answered by the very same @JohnResig) and he pointed out that with jQuery you could do  var clonedNodesArray = jQuery.extend({}, nodesArray);   to clone an object. I tried this though, this only copies the references of the objects in the array. So if I   nodesArray[0].value = "red" clonedNodesArray[0].value = "green"   the value of both nodesArray[0] and clonedNodesArray[0] will turn out to be "green". Then I tried  var clonedNodesArray = jQuery.extend(true, {}, nodesArray);   which deep copies an Object, but I got "too much recursion" and "control stack overflow" messages from both Firebug and Opera Dragonfly respectively.  How would you do it? Is this something that shouldn't even be done? Is there a reusable way of doing this in Javascript? I'm running macOS Catalina 10.15.4 on a 2018 MacBook Pro 15", which has the T2 chip (if anything else is relevant, let me know and I'll update the question.)  I'm a developer and I'm in the process of writing and debugging a C command-line utility that's supposed to take a few miliseconds to run and exit.  My internet connection went down while I was coding (WiFi was still connected, but my ISP was down), and afterwards I noticed that, after compiling the app, the first time I ran it, it took a few seconds to run rather than the expected fraction of a second.  I turned off WiFi (so there was no active network connection), compiled my app again, and ran it -- this time it ran as quick as I would expect.  Turn on WiFi, compile and run again, first run of the app takes longer than expected.  Maybe I'm paranoid, but it sure sounds like macOS is trying to ask Apple's servers for blessing to run my app. Is this the case, or could there be another explanation? If it's indeed the case, can anyone link to an article explaining what's going on under the hood?  UPDATE: as requested, here are timings for an average of three runs of the following command, under different conditions:  touch file.c &amp;&amp; make &amp;&amp; time ./file &amp;&amp; time ./file  The first measurement is the average time for running file for the first time after compilation (the third command in the chain). The second measurement is the average time for running file for the second time after compilation (the fourth command in the chain).  WiFi on, with internet: 347 ms/3 ms.  WiFi on, without internet: 5024 ms/3 ms.  All network connections offline: 24 ms/2 ms. Buster Blader the DDS did not affect Destiny Hero - Decider effect; why so? How come  with  set to dragons didn't stop 's effect from being activated? Understanding minipages - aligning at top I would like to be able to align two minipage at the top, without worrying about what is in the minipage.  I am aware of the optional [t] parameter, but still have some confusion as to how this all works.  I tend to think of a minipage as a regular page in that whatever is placed on it starts at the top and fills the page going across and then down the page, but this does not appear to be the case.  In the MWE example below, I have color coded the sections for reference purposes.   The first case (black) works just as I would expect. The two minipages are aligned exactly as I want with the [t] specifier.  No question here.  The next case (red) only works if the inner minipage also has the [t] specifier. Why is that necessary?  I would have thought that any content would be placed at the top of this page, and since both the outer minipage had a [t] things should have aligned at the top. I would like to place a graphic in the second mini page, and still have the two aligned at the top.   The simple case (blue) of using \includegraphics directly does not result in the content being aligned at the top.  So, then I attempt to put this in a \parbox (green) and this too does not yield the desired results.  I also try to place the graphic inside an inner minipage (brown) and specify the [t] alignment, and even though this worked in the red section, it does not here.  The only difference between the red and brown being that the red section had text, whereas the brown section has a graphic.  I am aware of question regarding  which suggests to place \vspace{0pt} at the top of the minipage, and that does provide the desired alignment (cyan), but adds vertical space at the top.  So, my second question is why is the \vspace{0pt} necessary when a graphic is included, but not when it is text.  This appears to be a hack and wondering if there is a replacement for minipage that works better without having to worry about exactly what is in the minipage?  Also, why did wrapping the figure in a parbox (green) or another minipage (brown) not solve this problem?   Here is the MWE:  \documentclass{article} \usepackage[demo]{graphicx} \usepackage{lipsum} \usepackage{xcolor}  \begin{document} \section{This Works - Aligned at top as desired} \begin{minipage}[t]{0.6\linewidth}     \lipsum[1] \end{minipage} \hfill \begin{minipage}[t]{0.3\linewidth}     \lipsum[2] \end{minipage}  \color{red} \section{Why does inner mini page required the [t]?} \label{Minipage-in-minipage} \begin{minipage}[t]{0.6\linewidth}     \lipsum[3] \end{minipage} \hfill \begin{minipage}[t]{0.3\linewidth}     \begin{minipage}[t]{\linewidth}% Why is [t] required here         \lipsum[4]     \end{minipage} \end{minipage}  \color{blue} \section{Why are These not aligned at top?} \begin{minipage}[t]{0.6\linewidth}     \lipsum[3] \end{minipage} \hfill \begin{minipage}[t]{0.3\linewidth}     \includegraphics[width=\linewidth]{foo} \end{minipage}  \color{green} \section{Why are These not aligned at top?} \begin{minipage}[t]{0.6\linewidth}     \lipsum[3] \end{minipage} \hfill \begin{minipage}[t]{0.3\linewidth}     \parbox{\linewidth}{\includegraphics[width=\linewidth]{foo}} \end{minipage}  \newpage \color{brown} \section{Why does this not work with the [t] as it did in red section?} This worked fine in Section \ref{Minipage-in-minipage}  \begin{minipage}[t]{0.6\linewidth}     \lipsum[3] \end{minipage} \hfill \begin{minipage}[t]{0.3\linewidth}     \begin{minipage}[t]{\linewidth}% Even with [t] here, this does not work         \parbox{\linewidth}{\includegraphics[width=\linewidth]{foo}}     \end{minipage} \end{minipage}   \color{cyan} \section{Adding a \textbackslash{}vspace\{0pt\} works} \begin{minipage}[t]{0.6\linewidth}     \vspace{0pt}% Hack!! But does do the job     \lipsum[3] \end{minipage} \hfill \begin{minipage}[t]{0.3\linewidth}     \vspace{0pt}% Hack!! But does do the job     \begin{minipage}[t]{\linewidth}% Why is [t] required here         \parbox{\linewidth}{\includegraphics[width=\linewidth]{foo}}     \end{minipage} \end{minipage} \end{document} Disable App Update Notifications on OSX? $x^{p-1} + ... + x^2 + x + 1$ is irreducible using Eisenstein's criterion? Eisenstein's criterion says that for a prime $p$ if the following conditions are satisfied for a primitive polynomial, $f(x)$, then that polynomial is irreducible in $\mathbb{Z}[x]$  $p \mid a_0, a_0, ..., a_{n-1}$   $p \not\mid a_n$  $p^2 \not\mid a_0^2$  Now I am almost certain I read somewhere that this lemma can be used to prove that the polynomial $x^{p-1} + x^{p-2} + ... + x^2 + x + 1$ is irreducible.  All coefficients are $1$ though and we have have an awkward amount of terms, $p - 1$ terms as opposed to $p$ terms - so how can Eisenstein's criterion be applied here? Is there a way to check if a file is checked out by another user? I am going trhough a list file by file and would like to avoid the "file is opened by another user" error. Something like this would be nice:  Guid id = new Guid(slideLibrary); // ID of Slide-Library. List list = ctx.Web.Lists.GetById(id); ListItemCollection items = list.GetItems(CamlQuery.CreateAllItemsQuery()); ctx.Load(items); // Loading all the fields System.Security.SecureString pwd = new System.Security.SecureString(); foreach (char c in "pwd".ToCharArray()) pwd.AppendChar(c);  ctx.Credentials = new SharePointOnlineCredentials(login, pwd); ctx.ExecuteQuery();  // Iterating through all the entries. foreach (var item in items) {     String currentID = item["ID"].ToString(); // Getting the ID of the current item.      if (!item.IsCheckedOut()) // This is the part I am looking for.     {        // Do stuff     }     else     {        Console.WriteLine("Item is blocked, skipping it.")     } }   I have yet not been able to find something fitting. How can I get file extensions with JavaScript? C++ Redefinition Header Files (winsock2.h) The units of $\mathbb Z[\sqrt{2}]$ Looking for Scifi Short Story in a Jerry Pournelle edited Anthology I'm looking for the title of the short story, and any of the volumes of anthology it may have appeared in. I know for SURE it's in one of Jerry Pournelle's anthologies, either Star Empires and There will be War, but as I have all the eBook version of THere will be war, I'm almost certain it wasn't there.   Anyway, the book is about a Commodore who went back to the academy to visit. I'm not sure what his name was, but I'm pretty sure he lived at "Mercer Hall". He had 2 roommates, and a butler to take care of all their needs, like putting away their stuff. (He even tried to argue with the hall monitor) The butler once took away their bottle of booze UNTIL they study for mid-term, and only gave it back AFTER they wrote to their mother AFTER the exam.   The book also goes heavily into "Bless you!" or the translated version, "May the great cosmic magnificence be benevolent toward you" or something like that. Basically, it's about as inoffensive as possible, and if you say it enough, and the aliens are reasonable, they will give up and things will resolve peacefully.   My Google-fu is weak and I can't find this particular story, or which volume of anthology was it in.   Little help? A standard document (e.g. scrreprt) uses roman font family for text and Sansserif font family for titles etc. It is the other way round in beamer. How can I switch the two font families? Or why do beamer define the font families in this way?  For the background: I think this is my problem when using formulas, because they use the Sansserif font instead of the roman version. Formulas using the euler package look really poor.  P.S.: I compile with LuaLaTeX using TeXlive 2013. Did Tyrion even have the authority to do this? In Game of Thrones S08E04 (The Last of the Starks) when Tyrion and Jaime are confronted by Bronn, Tyrion attempts to evade poetic justice by offering Bronn Highgarden. Was it even within Tyrion's power to give away Highgarden?    Follow up question: Why would Bronn even risk waiting around to see how things play out? Based on his demeanor during that conversation, he seemed pretty pissed that all he has to show for serving the Lannisters is a lousy title. So, why wouldn't he just take bird in hand and collect the reward from Cersei instead of risking Tyrion dying before all of this is over? I mean, Tyrion even mentioned to him that all of this means nothing until they [the North] take over King's Landing, but it didn't really seem to faze Bronn. Can you win a game of Splendor if you still have cards in reserve? Understanding dummy (manual or automated) variable creation in GLM How to instantiate polymer component programmatically in dartlang? sed append after a line containing multiple unordered strings I'm trying to use sed to append appendstring after a line that contains both Hello and World.  Hello something here World World fsf Hello   This works if I do consider order:  sed -i '/Hello*World\|World*Hello/a appendstring' file   But if I have many strings to match and they are not in order, this is definitely not effective.  Then I tried solutions from another link which discussed deleting a line that contains both strings without considering their order.     However,  sed -i '/Hello/!b;/World/d' file   This does not even work for deletion.   The following one, also one of the answers to that question:  sed -i '/Hello/{/World/d}' file   works, so I tried to implement it to append. Using:  sed -i '/Hello/{/World/a} appendstring' file   But received error:  sed: -e expression #1, char 0: unmatched `{'   Update: The post in the link stated the solution with !b, and it was not working in cshell because of the exlamation mark, but it is working in sh and bash. And it can also be easily extended to inserting many lines when running sed inside a script and the appending a large paragraph.  sed -i '/Hello/!b; /World/a \ addline \ addanotherline ' file