While doing my assignment i ran into a rather strange error and can't find why my HashMap gets emptied every time. Im in no way asking for a solution for the named assignment i just need help with this HashMap. So what i am trying to do is to read a RSS Feed with the SAX API and save every match into a HashMap called 'results'. The second hashmap is for storing the current item i am reading. public class SAX extends DefaultHandler{     HashMap&lt;Integer, HashMap&lt;Integer,String&gt;&gt; results = new HashMap&lt;Integer, HashMap&lt;Integer, String&gt;&gt;();     HashMap&lt;Integer, String&gt; current_item = new HashMap&lt;Integer,String&gt;();     int flag = 0;     String[] filter = {&quot;Corona&quot;};     String current = &quot;&quot;;     int cnt_results, cnt_item = 0;     public static void main(String[]args) throws ParserConfigurationException, SAXException, IOException {         Init of the Sax Stuff here. This is normal stuff.         But i use the SAX Class as a Handler.     }          public void startDocument() {         System.out.println(&quot;Started the RSS Feed...&quot;);     }          public void endDocument() {         for(int i = 0; i&lt;this.results.size();++i) {             Map&lt;Integer,String&gt; map = this.results.get(i);             for(int i2 = 0; i2&lt;map.size();++i2) {                 System.out.println(map.get(i2));             }         }         System.out.println(&quot;Seems like we hit the end.&quot;);     }          public void startElement(String uri,String localName, String qName, Attributes attributes) throws SAXException {         if(localName == &quot;item&quot;) {             flag = 1;         }     }          public void endElement(String uri, String localName, String qName) throws SAXException {         current_item.put(cnt_item, current);         cnt_item++;                  // Filters if description contains one of the Keywords         if(localName == &quot;description&quot;) {             for(int i = 0; i&lt;filter.length;++i) {                 if(current.contains(filter[i])) {                     flag = 2;                     break;                 }             }         }                  if(localName == &quot;item&quot;) {             if(flag == 2) {                 if(this.results.containsValue(current_item)) {                 ;                 }else {                 this.results.put(cnt_results, current_item);                 cnt_results++;                 }             }             flag = 0;             cnt_item = 0;             current_item.clear();         }     }          public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {              }          public void characters(char[] ch, int start, int length) throws SAXException{         current = new String(ch,start,length);     }      }  The Reader should then go over the RSS Feed and find every Item that has a description containing the filter word and save them into the results Map. When trying to read these saved results i just get blank lines. Maybe that's not the best way to express what it means so i just gave you the whole code. Glad for your help. Thanks!
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?
Do sensors wear out? We all know that shutters wear out and they have a limited number of actuation's.  The question I have is, do sensors wear out too? Do they suffer any kind of damage after each shot?  Should I be concerned about this or is the sensor lifespan way longer than the shutter lifespan? Show that the quotient space is homeomorphic to the n-disc Is there a way to forget node names between TikZ pictures? I have a document with several TikZ pictures in it.  I generally use simple names for the nodes such as:  \node (A) at .....  \node (B) at .....   and so forth.  Because of this I have name clashes between the various pictures.  That's generally not a problem.  However I find myself in a position where I may or may not have defined a certain node within a given picture.  So I use the following snippet to test whether the node has been defined:  \makeatletter \long\def\ifnodedefined#1#2#3{%%   \@ifundefined{pgf@sh@ns@#1}{#3}{#2}} \makeatother   Unfortunately this fails if I've already created a node by the same name in another picture.  Is there a way to scope the definitions of nodes or is there a way to undefine nodes once you no longer need them?  P.S.  I'm aware that I could embed each picture in a standalone file and import it using \includegraphics.  Unfortunately, this approach will not work for the document I'm creating.  MWE  \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc}  \makeatletter \long\def\ifnodedefined#1#2#3{%%   \@ifundefined{pgf@sh@ns@#1}{#3}{#2}} \makeatother  \setlength{\parindent}{0pt} \pagestyle{empty} \begin{document}   There's no node \textbf{D} here, so I draw a triangle:\par \begin{tikzpicture}    \coordinate (A) at (0,0);   \coordinate (B) at (1,0);   \coordinate (C) at (1,1); %  \coordinate (D) at (0,1);    \ifnodedefined{D}     {  \draw (A) foreach \myn in {B,C,D} {  -- (\myn) } --cycle;  }     {  \draw (A) foreach \myn in {B,C}   {  -- (\myn) } --cycle;  }  \end{tikzpicture}     There is a node \textbf{D} here, so I draw a square:\par \begin{tikzpicture}    \coordinate (A) at (0,0);   \coordinate (B) at (1,0);   \coordinate (C) at (1,1);   \coordinate (D) at (0,1);    \ifnodedefined{D}     {  \draw (A) foreach \myn in {B,C,D} {  -- (\myn) } --cycle;  }     {  \draw (A) foreach \myn in {B,C}   {  -- (\myn) } --cycle;  }  \end{tikzpicture}      There isn't supposed to be a node \textbf{D} here.  I'm expecting a triangle, but get a square.\par \begin{tikzpicture}    \coordinate (A) at (0,0);   \coordinate (B) at (1,0);   \coordinate (C) at (1,1); %  \coordinate (D) at (0,1);    \ifnodedefined{D}     {  \draw (A) foreach \myn in {B,C,D} {  -- (\myn) } --cycle;  }     {  \draw (A) foreach \myn in {B,C}   {  -- (\myn) } --cycle;  }  \end{tikzpicture}  \end{document}   produces: What is the formula for percent of frame filled at a specific distance and focal length? I am thinking about buying a new lens specifically to take photos of distant targets (birds, bears, etc). I currently own the Canon 70-300 IS USM, which is a nice lens, but I find that if I want to take a photo of anything further away than about 10 meters, the target does not fill a large amount of the frame (meaning I have to significantly crop in post production).  I am currently looking at the Canon prime 400mm, however I would like to determine at what distance an object will fill a reasonable proportion of the frame.  Is there a formula or rule of thumb I can apply that will help me in this situation? I realise the size of the target I am shooting will play a role here, so if we need to make an assumption about the size of the target please let me know. How can I upgrade Ubuntu LTS to the next one offline? I'm using Ubuntu 12.04 on my computer and I want to upgrade to Ubuntu 14.04.  I do not have internet at home, so I need to do the upgrade offline.  On openSUSE there a way to make the upgrade offline simple and effective way is by using  the iso DVD.  My question is: Is there any way to make Ubuntu upgrade offline as in openSUSE ? How to specify the SMTP server in PHPMailer? What does it mean if a professor does not answer your email in time? I recently joined a research group as a postdoc. I wrote the professor an email to ask quick but important questions including asking him when when he wanted me to start. It's been over a week and I haven't received get an answer. Other emails I've sent previously have also gone unanswered for long periods as well.   With that background, my question is: do professors sometimes (intentionally or otherwise) not respond to emails in a timely manner? Vi on Linux: show ^M line endings for DOS-format files On Solaris, if you open a file in vi that has Windows line endings, this shows up as ^M at the end of every line.  On Linux, vi is cleverer and understands the Windows file format, and does not display ^M.  Is there a setting to make Linux vi behave the same as Solaris in this respect?  A common problem for us is copying a shell script off a (Windows) dev box and forgetting to dos2unix it, and then being confused when it doesn't work properly. On Solaris the problem is obvious as soon as you vi the file, but not on Linux.  Thanks. OrderBy and OrderByDescending are stable? Would time freeze if you could travel at the speed of light? Should the personal/research statement be technical? Related:   I know I must describe my past and current research in my personal/research statement or statement of purpose. But do I use technical terms?  I was given the advice that since the people reading my statement are mathematicians (I am applying to US for applied mathematics), they should know what I am talking about.  Although I am applying to applied mathematics, it would also be nice to hear from other fields (biology, computer science, engineering etc) about this. Can not add image inside SVG via jQuery:  tag becomes How to include jQuery and JavaScript files correctly? I'm doing it right now with the following code:   function uw_load_scripts() {     // De-register the built in jQuery     wp_deregister_script('jquery');     // Register the CDN version     wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', array(), null, false);      // Load it in your theme     wp_enqueue_script( 'jquery' ); } add_action( 'wp_enqueue_scripts', 'uw_load_scripts' );   This works, but should I do this for everyone, like this, or for everyone but admin (so that backend uses the WordPress version?):  if (function_exists('load_my_scripts')) {   function load_my_scripts() {       if (!is_admin()) {       wp_deregister_script( 'jquery' );       wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', array(), null, false);      wp_enqueue_script('jquery');        }   }   }   add_action('init', 'load_my_scripts');   This version doesn't work at all actually, I get the WordPress jQuery-version and not the Google one.  Therefore, should I deregister the jQuery that is included in WordPress at all?    Also, how do I add my own scripts (slider scripts, modernizr and my own custom.js) the correct way? I guess I should do this via functions.php as well and not in the header like I'm doing it now, but I'm unsure of how I would do that. Why won't my taskbar display on my secondary monitor? On my secondary monitor (currently using Windows 10), my taskbar will barely show up. I've tried adjusting the resolution to lower ones (it recommends 1920x1080) and it doesn't do much. Is there a way to adjust the taskbar so I can see it?  That is about what I see. I could make it bigger via Snipping Tool and see my entire desktop on the picture but not normally. Boolean b1 = true; Boolean b2 = true; String b3 = 'b1 &amp;&amp; b2'; Boolean b4 = Boolean.valueOf(b3); system.debug('test Bool '+ b4);   Given a string how can you convert into expression without breaking the sting. Which mathematical operation does the right hand rule for current come from? I am currently wondering about the famous .  Where does it come from mathematically that when you point with your thumb in the direction of the current, your curved fingers will point in the direction of the $B$-field? In other words, which mathematical operation does it come from? Probably it has to do with some vector product or Stokes theorem application, but I am not quite sure about it. Excel: identifying if all values in a row are not equal Warning when battery is fully charged I would like to get an alert (with sound) when my laptop battery is fully charged.  How can I do that? I think this is a duplicate of an old question without a good answer:  My child was doing schoolwork on her school-issued Macbook Air. Suddenly lighter greys are totally white. This generally gives the images on the screen a vague feeling of being &quot;off&quot;, and pixellates all curved edges. The biggest problem is that text on some of her sites is unreadable. I've checked the following:  Color profiles - it looked like it was using the default, but a cycled through a few built-ins. I could see noticeable changes to color balance, but the light greys remained the same as white. Also deleted contents of ~/Library/ColorSync/. Accessibility - my child has accidentally inverted colors before, this isn't that. No other accessibility settings seemed related to color. Display settings - Modifying brightness was also fruitless. The screen overall got brighter or darker, but still couldn't distinguish between light grey and white Rebooting - colors look fine until shortly after logging in - seems connected to user profile somehow.  Here are some images to demonstrate the issue. This is a generic color test image:  On the Mac, it looks like this (simulated with photoshop):  Any solution would be appreciated, but if there is a keyboard shortcut that can cause this, it would be the most likely explanation (8 year old says they &quot;might have rested their arms on the keyboard&quot; during a class meeting) Can't understand a proof: Let $a,b,c$ be integers. If $a$ and $b$ divide $c$, then $lcm(a,b)$ also divides $c$  Proof I've been shown:  Since $c$ is a common multiple of $a,b$, it means that $lcm(a,b) \leq c$.  So: $c=q\cdot lcm(a,b)+r$, $q \in \mathbb Z$ and $0\leq r \leq lcm(a,b)$  Since $c$ and $lcm(a,b)$ are common multiples of $a,b$, then so is $r$. But $m$ is the least common divisor, then it means $r=0$.   [Proof taken from: http://www.math.utah.edu/~wood/4400/hw1sol.pdf]  I cannot understand the last step... Why does it imply that $r=0$?   Thank you!