I'm writing a program that reads in a text file line by line - then stores each sentence in a HashMap with the sentence as the key and number of letters in that sentence as the object. This is the code I wrote, with comments:       FileReader reader = new FileReader(new File("src/test.txt"));     BufferedReader br = new BufferedReader(reader);     HashMap&lt;String, Integer&gt; map = new HashMap&lt;String, Integer&gt;();     StringBuilder builder = new StringBuilder();     String line, sentence;     int letters = 0;     try {         // While there are more lines to read          while ((line = br.readLine()) != null) {             String[] words = line.split(" "); // split line into words, add to array             for (int i = 0; i &lt; words.length; i++) { // loop through array                 letters += words[i].length();                  // if the word ends with "." then we have reached end of sentence                 if (Character.toString(words[i].charAt(words[i].length() - 1)) == ".") {                      for(String word : words) {                         if(builder.length() &gt; 0) {                             builder.append(" ");                         }                         builder.append(word);                     }                     sentence = builder.toString(); // store sentence                     map.put(sentence, letters); // add to HashMap                     letters = 0; // restore letters back to 0                 }             }         }     } catch (IOException e) {         e.printStackTrace();     }      for(String key : map.keySet()) {         System.out.println(key + " has " + map.get(key) + " letters");     }   For some reason in that little for-loop at the end nothing gets printed. I notice that if I write a print statement before the for-loop to print out the size of my HashMap it prints out "0" - so I'm assuming that my HashMap isn't being populated.   Does anyone know why this might be the case? This is the text file I'm using:   this is a test.  this is a test.  this is not a test.  this is a test.  this is not a test.  not not not not not not not   Really appreciate any insight, cheers.
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?
Noise in JPEG file after processing RAW file in photoshop Recently i started shooting in RAW after understanding its advantages over JPEG format.   While processing the RAW file there is an option to reduce noise in a captured picture. It works great when i am working on RAW file. But as soon as I save file in JPEG format, noise comes back.  I understand that while converting from RAW to JPEG compression techniques will be applied. But how can i handle this situation (while doing post processing)? Check all dependencies of a Record Type in the Organisation before deactivating it I am looking forward to delete a Record Type in my Salesforce organisation. However before I go ahead and do the same I would love to know all of its dependencies in the entire org.  Please help me in finding a tool or a method to easily get all the list of dependencies associated with that particular record type.This may include ,  a)      Workflows/Process Flows b)      Validation Rules c)       Apex Triggers/Classes d)      Any other dependencies if we deactivate the record type.(including Picklist and Page layouts)  Thanks in advance. Is there a relationship between regression and linear discriminant analysis (LDA)? What are their similarities and differences? Does it make any difference if there are two classes or more than two classes? Fetching all (javascript) global variables in a page iOS 7 Locked Bug via Ubuntu 13.10 I wanted to bring up an issue with the latest Ubuntu release that I hope can be solved. Although I will agree with the community that iOS 7 is not the most open platform release, it still is my desire to be able to grab Photos, Music, and Files off my Phone similar to what I would do to any other device.  Every time I connect my device to Ubuntu, I receive the following notification:  The device "Justin's iPhone" is locked. Enter the passcode on the device and click "Try again".   On my iPhone, I select the following   Unfortunately, this is where problems start to arise. It appears that Ubuntu either does not recognize the permissions from my iPhone or the iPhone is not allowing itself to truly be unlocked. As we can see the permissions are   Browsing askubuntu, I encountered the following   After running the code, I receive the following error:  justin@justin-CT15:~$ idevicepair unpair &amp;&amp; idevicepair pairERROR: Device d1fea2c56e51199f901eb34020a1581ea31a2a50 is not paired with this host   If I call the command again, i receive another error:  justin@justin-CT15:~$ idevicepair pair ERROR: Could not pair with the device because a passcode is set. Please enter the passcode on the device and retry.   Ultimately, I am stuck to experiment with solutions that end up not working. I am troubled by the lack of information and support for the iOS 7 platform on Ubuntu's latest release. If anyone has a workable solution or experiment for a workaround, I am happy to try  Thanks for reading and have a wonderful day! New SSD problem I've just installed a new SSD replacing an HDD in my old (late 2008) iMac. When I switched it on all I got on screen was a question mark.   On the advice of my son I tried cmdR during switch on with no result.   I then tried alt which at least got me a cursor on the screen, but nothing else. Any suggestions? I've got everything backed up on an external Hard Drive, by the way. I've only seen The Force Awakens once, but I'm as far as I can remember, Phasma doesn't really do much, except:      get taken hostage that one time and disable the shields around the Starkiller after being asked twice   Was she originally supposed to play a bigger role?  I was really expecting to see much more of her, or at least see her in combat. Another phrase for "a chicken and egg situation" Is there any other phrase that conveys the same meaning as  the phrase "a chicken and egg situation" especially if one has to use this phrase in an official/corporate set up? C# Lambda expressions: Why should I use them? I have quickly read over the  documentation.  This kind of example has helped me to understand better, though:   delegate int del(int i); del myDelegate = x =&gt; x * x; int j = myDelegate(5); //j = 25   Still, I don't understand why it's such an innovation. It's just a method that dies when the "method variable" ends, right? Why should I use this instead of a real method? Hello [Comma?] John, I have a follow up question to this question:   My question is: when should you add a comma when starting a letter/email with     Hello John,      It was fun to see ...   I am pretty sure that a comma goes after the name, but lately I have seen several people (academics) write      Hello, John,       It was fun to see ...   with a comma after the Hello.  I am wondering when a comma there is appropriate.    I see this question  but I am wondering about the situation where you have a comma after the name also. I found this interesting problem in :     Given a point $P$ in space, and given a piece of malleable material of constant density, how should you shape and place the material in order to create the largest possible gravitational field at $P$?   Any ideas? Prove $\gcd(a+b,a^2+b^2)$ is $1$ or $2$ if $\gcd(a,b) = 1$ Assuming that $\gcd(a,b) = 1$, prove that $\gcd(a+b,a^2+b^2) = 1$ or $2$.   I tried this problem and ended up with $$d\mid 2a^2,\quad d\mid 2b^2$$ where $d = \gcd(a+b,a^2+b^2)$, but then I am stuck; by these two conclusions how can I conclude $d=1$ or $2$?  And also is there any other way of proving this result? Identical creatures entering the battlefield If I have two cards called  in hand and I play my first, Sin Collector (A). I use its triggered ability.   "When Sin Collector enters the battlefield, target opponent reveals his or her hand. You choose an instant or sorcery card from it and exile that card."  Now, I play Sin Collector (B), I use B's triggered ability.  But now my question. Does Sin Collector (A)'s ability trigger again as well? 'Sin Collector' entered the battlefield again, right? Reverse DNS - how to correctly configure for SMTP delivery I started a new service and we need to send emails to our customers (new account confirms, etc).   My server is known as prod01.bidrodeo.com and resolves to 97.107.134.38 .  For reverse DNS, 97.107.134.38 resolves to prod01.bidrodeo.com . However, all our email addresses are in the form of user@bidrodeo.com. Should I make the reverse DNS point to bidrodeo.com instead?   My emails are getting delayed or rejected by certain systems and i am not sure if my reverse DNS is not set up correctly. What is the difference between DX format and FX format lenses, and which to choose for what purpose?  What are the pros and cons of both? What goes wrong if we add a mass term for gauge bosons without the Higgs mechanism? In the season 8 episode finale of Game of Thrones the highest important lords met with Grey Worm to free      Tyrion and Jon. While it was pretty clear why they wanted to free Jon it was unclear to me why they also asked for Tyrion.   To make things even more strange, they asked about his opinion of a potential solution which becomes the actual final one in the end      (choose king and nominate someone).   I thought they (besides Sansa and Bran) don't like him and wanted to judge him? Or am I missing something? Bootstrap with Salesforce I am trying to create a simple page using Bootstrap within salesforce. I need this page to have the standard salesforce header and sidebar.  When I use the standard bootstrap library via a CDN and the page is affecting all the CSS styling for my standard salesforce headers and side bars. Any help on how to prevent this ? What is wrong with this fake proof $e^i = 1$? $$e^{i} = e^{i2\pi/2\pi} = (e^{2\pi i})^{1/(2\pi)} = 1^{1/(2\pi )} = 1$$  Obviously, one of my algebraic manipulations is not valid. Ubuntu installation is slow, why? I am currently installing Ubuntu 12.04.3. Everything was going fine until I came across this...     Installing System   It is sssooooooo close to being finished! Like 1/6 of the way there! I just wanted to know if this is normal or if something is wrong. I'm installing it through a flash drive if that helps   Also,what will happen if I press the skip button that pops up when I click Installing System?