I am comparing every entry in a HashMap to every other entry in the same HashMap. While iterating the HashMap I remove some elements based on some conditions. However I keep getting the ConcurrentModificationException.      Iterator&lt;Entry&lt;String, String&gt;&gt; i = map.entrySet().iterator();      while (i.hasNext()) {         Entry&lt;String, String&gt; next = i.next();          for (Entry&lt;String,String&gt; e : map.entrySet()) {              if (e.getKey() != next.getKey()){                                String[] positions_e = fields_e[1].split("-");               int start_e = Integer.parseInt(positions_e[0]);               int end_e =  Integer.parseInt(positions_e[1]);                String[] positions_next = fields_next[1].split("-");               int start_next = Integer.parseInt(positions_next[0]);               int end_next =  Integer.parseInt(positions_next[1]);              if (start_e &lt;= start_next || end_e &lt;= end_next )) {                   i.remove();                    }          }     }
We all know you can't do the following because of ConcurrentModificationException:  for (Object i : l) {     if (condition(i)) {         l.remove(i);     } }   But this apparently works sometimes, but not always. Here's some specific code:  public static void main(String[] args) {     Collection&lt;Integer&gt; l = new ArrayList&lt;&gt;();      for (int i = 0; i &lt; 10; ++i) {         l.add(4);         l.add(5);         l.add(6);     }      for (int i : l) {         if (i == 5) {             l.remove(i);         }     }      System.out.println(l); }   This, of course, results in:  Exception in thread "main" java.util.ConcurrentModificationException   Even though multiple threads aren't doing it. Anyway.  What's the best solution to this problem? How can I remove an item from the collection in a loop without throwing this exception?  I'm also using an arbitrary Collection here, not necessarily an ArrayList, so you can't rely on get.
Why is there no 32 bit ISO for the new Ubuntu 18.04? Slow Network Printing over OpenVPN / Windows Server 2008 Our setup is as follows:  Two offices (A and B) connected with OpenVPN Access Server.  One Windows Server 2008 R2 Standard    Housed in remote datacenter. Terminals at both offices connect through RDP in order to use a particular piece of software concurrently. Network Connected printers (Deployed with GPO) that are connected to separate terminals at each office (and shared) are used with this software to print things throughout the day.   We are experiencing extremely slow printing times.  Opening printer properties can take 30-60 seconds and printing times range from 30-180 seconds with no apparent reason.  File sizes remain &lt; 1mb.  This happens with each of our printers.  All different models.  The server massively underutilized with a 6-core AMD, 16GB ram, 4x 120GB SSDs, and a 100 megabit port.  Our VPN does not seem to be a bottleneck either.  I've been attempting to find ways to increase print speed.  So far no success.  What can you advise? Postgres: Reclaiming Space Global Inbox -> Global RSS feed for all my questions across all the sites? Is there an intelligent way to left-align the parts right of &amp; of the two cases environments shown below (if x >= 0, otherwise, if y &lt; 0, otherwise). I wonder if there is a better way than using manual spaces:  \begin{align*}  u(x) &amp;=   \begin{cases}    0        &amp; \text{if } x \geq 0 \\    1        &amp; \text{otherwise}   \end{cases}   \\  \tau &amp;=   \begin{cases}    a+b+c+d  &amp; \text{if } y &lt; 0 \\    1        &amp; \text{otherwise}   \end{cases} \end{align*} To consume REST services there is a lot of boilerplate code needed:   Build Apex Objects to model the responses Code to deserialize REST responses to those classes Handling of HTTP requests, responses and errors ...   Did anyone come up with patterns or best practices codified into an open source library or framework that one could just reuse in a similar project without reinventing the callout-wheel over an over again?  Like the zillions of trigger-frameworks that exist as repos on Github... Why is df missing 500MB of available space? I've just had a message today from Ubuntu 11.04 that I have only 100 MB left, so I cleaned up some files, and I got 200 MB. Then, after a couple of hours, suddenly I have only 26 MB?! I tried df, du via mount --bind, /forcefsck with reboot - nothing could should what the culprit is - finally I searched big files, realized /var/log/syslog is 100MB+ and /var/log/kern.log is 200MB+ - blanked them with sudo bash -c 'echo &gt; ...' and rebooted, and now I have some spare MB.  But now, I realize I have another problem with df:  $ df -h Filesystem            Size  Used Avail Use% Mounted on /dev/sda5             9,7G  8,8G  385M  96% / none                  963M  696K  962M   1% /dev none                  969M   12K  969M   1% /dev/shm none                  969M  252K  969M   1% /var/run none                  969M     0  969M   0% /var/lock /dev/sda6             9,7G  8,1G  1,1G  89% /media/disk  $ df -h --block-size M Filesystem           1M-blocks      Used Available Use% Mounted on /dev/sda5                9845M     8960M      385M  96% / none                      963M        1M      962M   1% /dev none                      969M        1M      969M   1% /dev/shm none                      969M        1M      969M   1% /var/run none                      969M        0M      969M   0% /var/lock /dev/sda6                9845M     8235M     1110M  89% /media/disk   Note so for /, it says there are 9845M total; and Used 8960M - then remaining would be 9845-8960 = 885 M, however, here I have only 385M Available.  Also, for /media/disk, it says total 9845M, Used 8235M - then remaining would be 9845-8235 = 1610, however, here I have only 1110M Available.  In both cases, there is exactly 500 MB difference.  Where did this difference come from - and can I reclaim it?  Here is also lsof | grep 'deleted' - can't see nothing suspicious here:  $ lsof | grep 'deleted' nautilus  1911 user   21u      REG        8,5   142760     260562 /home/user/.local/share/gvfs-metadata/home (deleted) nautilus  1911 user   22w      REG        8,5    32768     268807 /home/user/.local/share/gvfs-metadata/home-fe882154.log (deleted) python    1919 user    8u      REG        8,5     4096     392258 /tmp/ffiqRK968 (deleted) python    2165 user    5w      REG        8,5        0     132261 /home/user/.[SNIP].lock (deleted) python    2166 user    5w      REG        8,5        0     132261 /home/user/.[SNIP].lock (deleted) python    2185 user   21r      REG        8,5   142760     260562 /home/user/.local/share/gvfs-metadata/home (deleted) python    2185 user   22r      REG        8,5    32768     268807 /home/user/.local/share/gvfs-metadata/home-fe882154.log (deleted) gnome-ter 2279 user   27u      REG        8,5      640     392575 /tmp/vte5KDX2X (deleted) gnome-ter 2279 user   28u      REG        8,5     4936     392605 /tmp/vteKRDX2X (deleted) gnome-ter 2279 user   29u      REG        8,5      648     392947 /tmp/vteMZDX2X (deleted) ubuntuone 2544 user   17u      REG        8,5     4096     392335 /tmp/ffiMErq0V (deleted) bamfdaemo 3235 user   12r      REG        8,5   143868     269077 /home/user/.local/share/gvfs-metadata/root (deleted) bamfdaemo 3235 user   13r      REG        8,5    32768     272310 /home/user/.local/share/gvfs-metadata/root-18092a02.log (deleted) firefox   5291 user   59u      REG        8,5    33288     132262 /var/tmp/etilqs_YdeZiWSd5iQwJ4U (deleted) firefox   5291 user   60w      REG        8,5    32768     132271 /var/tmp/etilqs_MNLXhEaEqoXMm9b (deleted) firefox   5291 user   70u      REG        8,5    34952     132297 /var/tmp/etilqs_yXDdwVeMxmmdpNz (deleted) Switch off Windows Update for a particular program or feature I'm getting really tired of unchecking the same Windows Update candidates so save hundreds of MB's of dowbloads, especially for programs I never use, that are in fact not even installed, and those I don't wish to update.  Is there any way to permanently, or until another explicit change, to turn off certain updates?  There is an option called 'Hide update', but that unsettles me a bit. Highlight a word with jQuery How to disable pylint 'Undefined variable' error for a specific variable in a file? Math-like chaining of the comparison operator - as in, "if ( (5<j<=1) )" Proving a sequence defined by a recurrence relation converges How can I prove that this iterative sequence converges to $2$? Can I use the convergence definition?  $$a_{n+1} = \frac{a_n}{2} + \frac{2}{a_n},\qquad  a_0 = 4  $$  Thanks for the help. Why do we need both the Suffrage and Vox Populi badges? The Suffrage badge is awarded for using 30 votes in the day, and the Vox Populi for using 40.  I understand from  that the idea of Vox Populi is to incentivise voting on questions, but is there any evidence that having two badges does so better than just having Vox Populi? How can I prevent SQL injection in PHP? If user input is inserted without modification into an SQL query, then the application becomes vulnerable to , like in the following example:  $unsafe_variable = $_POST['user_input'];   mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')");   That's because the user can input something like value'); DROP TABLE table;--, and the query becomes:  INSERT INTO `table` (`column`) VALUES('value'); DROP TABLE table;--')   What can be done to prevent this from happening? Is there a difference between Therefor and Therefore? Is there a difference between "" and {} in BibTeX? Ignore citations in captions in list of figures when numbering Disable App Update Notifications on OSX? Why is ridge regression called "ridge", why is it needed, and what happens when $\lambda$ goes to infinity? What article should be used in the following sentence?     He was English by [a/the/] blood.   I feel there should be a zero article here, but I was taught that the zero article is impossible in English.