My txt data is : 2,1  cloud,0,100,1000,1000000,10240,10.0,FOG_DEVICE mobile_0,1,1000,1000,1000,1024,0.0,FOG_DEVICE mobile_1,1,1000,1000,1000,1024,0.0,FOG_DEVICE  1.0,2.0,3.0   2.0,3.0,4.0  While running this program, the compare function is not called. Can somebody tell me what I am doing wrong? package org.fog.examples;  import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Spliterator;  import org.fog.entities.FogDevice; import org.fog.entities.Sensor;  public class Read {   static List &lt;FogDevice&gt; fogDevices = new ArrayList &lt; FogDevice &gt; ();   static List &lt;String&gt; Mylist = new ArrayList &lt; String &gt; ();   static List &lt;Sensor&gt; sensors = new ArrayList &lt; Sensor &gt; ();   static List &lt;String&gt; fogNode = new ArrayList &lt; &gt;();   static List &lt;String&gt; linkNode = new ArrayList &lt; &gt;();   static List &lt;String&gt; moduleNode = new ArrayList &lt; &gt;();   static List &lt;String&gt; fd = new ArrayList &lt; &gt;();   static String str,   str1;   static String level;   static String[] ss,   ss1;    public static void main(String[] args) {     File file = new File(&quot;/home/madhu/Desktop/data.txt&quot;);     BufferedReader reader = null;     try {       reader = new BufferedReader(new FileReader(file));       String data[] = reader.readLine().split(&quot;,&quot;);       String s;       int nbline = 0,       i = 0,       block = 0;       while ((s = reader.readLine()) != null &amp;&amp; block &lt; data.length) {         if (s.equals(&quot;&quot;)) {           block++;           nbline = Integer.parseInt(data[block - 1]);           i = 0;         }         for (; i &lt; nbline; i++) {           s = reader.readLine();           if (s == null) break;           else if (s.equals(&quot;&quot;)) {             block++;             break;           }           switch (block) {           case 1:             fogNode.add(s);             break;           case 2:             linkNode.add(s);             break;           default:             moduleNode.add(s);           }         }       }     } catch(IOException | NumberFormatException ex) {       System.err.println(ex.getStackTrace());     } finally {       closeReader(reader);     }     System.out.println(&quot;nodes: &quot; + fogNode);     System.out.println(&quot;Links : &quot; + linkNode);      Iterator &lt; String &gt; nodeString = fogNode.iterator();     Iterator &lt; String &gt; nodeString1 = linkNode.iterator();     while (nodeString1.hasNext()) {       str1 = nodeString1.next();       System.out.println(str1);       String[] ss1 = str1.split(&quot;,&quot;);     }     while (nodeString.hasNext()) {       str = nodeString.next();       System.out.println(str);       String[] ss = str.split(&quot;,&quot;);       System.out.println(ss[0]);       compare(ss[0]);     }   }    public static void compare(String level) {     if (level == &quot;1&quot;) {       int link = setupLatency(Integer.parseInt(ss1[0]));       System.out.println(link);      } else if (level == &quot;2&quot;) {       int link = setupLatency(Integer.parseInt(ss1[1]));       System.out.println(link);     }   }    private static int setupLatency(int i) {     int Latency = i;     return Latency;   }      public static void closeReader(BufferedReader reader) {     if (reader != null) {       try {         reader.close();       } catch(IOException e) {}     }   } }  I am reading from a text file. For each line, I want to compare the second value in order to set the latency value, which is present in the 2nd set of lines.
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?
Why didn't Voldemort murder the Dursleys? Voldemort couldn't kill Harry as long as he called the Dursleys home. Why didn't he just murder the Dursleys? This would prevent Harry from being able to live there. What is going on with pgfpages and page labels? I’m using a feature of beamer that shows notes beside slides, but the page numbers that are coming out are crazy, making it impossible to extract specific slides into other documents with \includegraphics[page=n]{presentation.pdf}.  For example, in this MWE, there are two frames that are each 1 slide, and then one frame that is four slides. The PDF page labels that show up in Acrobat are, as indicated, 2, 3, 3, 3, 3, and 7. It starts at page 2 instead of 1, and then there are four page 3s, but they don’t even all belong to the same frame!  \documentclass{beamer} \usepackage{pgfpages}  \setbeameroption{show notes on second screen=left} \setbeamertemplate{note page}{frame \insertframenumber \\ \insertnote} \def\pg#1{pgfpages says this is page #1 but it is really page \arabic{page}}  \begin{document}  \setcounter{page}{0}  \frame{hi \note{\pg{2}}}  \frame{there \note{\pg{3}}}  \frame{how \pause are \pause you \pause today \note&lt;1-3&gt;{\pg{3}} \note&lt;4&gt;{\pg{7}}}  \end{document}   Here’s what the output looks like:    I know that the manual says, “pgfpages will produce wrong page numbers in the .aux file” and gives a manual workaround. But the page counter still works, so shouldn’t there be some way to pass that through to the PDF? I’d like to fix this, but don’t know where to start. Specifically, when the manual says that “TeX instantiates the page numbers when writing an .aux file only when the physical page is shipped out,” what exactly is it talking about? Where is the source code for that? What exactly do \csname and \endcsname do? What exactly do \csname and \endcsname do? What are their job? I have glanced at the Texbook and some other books, but none of them was clear enough to me. Can anyone please give a simple example to clarify this issue? I am looking for a book that goes through the mathematical aspects of neural networks, from simple forward passage of multilayer perceptron in matrix form or differentiation of activation functions, to back propagation in CNN or RNN (to mention some of the topics).  Do you know any book that goes in depth into this theory? I've had a look at a couple (such as Pattern Recognition and Machine Learning by Bishop or Deep Learning by Goodfellow, Bengio and Courville) but still have not found a rigorous one (with exercises would be a plus). Do you have any suggestions? Validate/verify PDF files integrity Is there any tool which I can run on the PDFs archives (all directories) and finally it lists/identifies the corrupt/invalid PDFs? I have hundreds of PDF files (related to documentation etc.) on my computer (Windows machine), and very often I receive/have to send dozens of PDFs via email. It is now a normal routine that the PDF I receive or send is corrupted. This creates serious trouble sometimes, when the source file (e.g. Word file or the Tex file) is missing/not available instantly. Checking these thousands of PDFs is not possible in finite time, so I have searched for a tool which I can run once and it would scan all PDFs (in directories and sub-directories), and finally I would get a list of files which I should re-create. Up to now, it seems there is no such tool. I have a USB drive that I can see/access/modify/etc in Linux/Ubuntu but it doesn't show up on my Mac OSX.  I did sudo fdisk /dev/sdb (where my USB is) and then g to create a new GPT partition table, n to make a new partition, used all default settings, then w to save and exit.  Then I did sudo mkfs.fat -F32 /dev/sdb1 to format the partition with a FAT32 filesystem.  I ejected the USB and put it in my Mac and it doesn't show up / get detected.  What did I miss? How to view CD key for a Steam game? I have purchased a game on Steam and can not find out the details of the file or purchase. How does one find their CD Key from a game purchased in Steam? Drafts for edits get lost on leaving the Android app When editing in the Stack Exchange Android app and navigating away to get some reference URLs the text is gone when I go back into the app.  Seems like the edit isn't kept in memory. Can you please save them in memory? (drafts) Show Kripke's model proving that the following formula isn't tautology in intuitionistic logic. $ \neg ( p \wedge q ) \implies (\neg p \vee \neg q) $  Please help/hint me ;) I'm planning to travel to France a few times in the next few months (tourist). Since I need a Schengen visa, I just don't know how to fill out the forms (which only have questions about travel dates of ONE single trip).  How do I report that I am traveling a few times, because if I don't they might only give me a single entry visa (or a visa not valid long enough for my next trips). I can only see that I'm requesting a multiple entry visa, nothing else about how long I need it to be valid.  Do I need to provide proof of hotel/flight reservations and travel insurance for all the trips or would the first one suffice?  How do I approach this issue so that I get a Schengen visa for at least 4.5 months? I am applying in the UK at their London application centre. How do I split a string so I can access item x? When is it appropriate to end a sentence in a preposition? Like many others, I commonly find myself ending a sentence with a preposition.  Yes, it makes me cringe.  I usually rewrite the sentence, but sometimes (in emails) I just live with it.  To, with... you know who you are.  Should I keep fighting myself on this one, or is it okay in some circumstances? Given a function:  function x(arg) { return 30; }   You can call it two ways:  result = x(4); result = new x(4);   The first returns 30, the second returns an object.  How can you detect which way the function was called inside the function itself?  Whatever your solution is, it must work with the following invocation as well:  var Z = new x();  Z.lolol = x;  Z.lolol();   All the solutions currently think the Z.lolol() is calling it as a constructor. How to cite own unpublished work in text and reference? I would like to cite one of my own unpublished work (under review). Is it okay to cite as following?  In text According to author et al. (year of submission)................. In reference authors list, year of submission, title, name of the Journal (status)   How about the results?   How will the reviewer access those results cited here?   Is it okay to provide them as supplements?   If I provide couple of figures as supplements, whether it will violate the copyright of the under reviewed paper? What is Stack Overflow's deployment process? I'm looking for some insight into how Stack Overflow releases are deployed and managed.   What software/tooling is used? What time are releases generally performed? How many and what steps are involved?   I'm assuming it's not too stringent given the light team working on the codebase. But considering the high rate of change, I could see some kind of tooling and automation becoming increasingly relevant, so I'm curious to learn what kind of decisions are being made to deal with the changes in scale and feature set over time.  Is this information available somewhere? Proof of "Dual normed vector space is complete" I have start point and end point of a polyline. How can I get a point on that polyline from end points specified by the given distance.    How can I get this by using arcpy provided that this script should work on ArcView without importing any modules (). I'm trying not to hard code values.  Related Question: Dataset collapsing/reducing Asking the user for input until they give a valid response Using trickle to limit the bandwidth of a VirtualBox VM I'm trying to limit the bandwidth of a virtual machine running via VirtualBox.   trickle -d 5 virtualbox doesn't work, I believe because of an issue with child processes (trickle -d 5 sudo apt-get upgrade doesn't work either)  How can I limit the download/upload bandwidth of VirtualBox's VMs?