I have this code:  public static void main(String[] args) {     User user = new User("user1","user1",1l);     User user1 = new User("user2","user2",2l);     User user2 = new User("user3","user3",3l);      List&lt;User&gt; list = new ArrayList&lt;User&gt;();     list.add(user);     list.add(user1);     list.add(user2);      for(User user3 : list){         System.out.println(user3.getName());         if(user3.getName().equals("user1")){             list.remove(user3);         }     } }   when executing this code , I get the following error:  Exception in thread "main" java.util.ConcurrentModificationException     at java.util.AbstractList$Itr.checkForComodification(Unknown Source)     at java.util.AbstractList$Itr.next(Unknown Source)   How can I avoid it?
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 do we use the simple past but not the present or future in the following expressions:  Don't you think it's time we went a little further Don't you think it's time we ate Don't you think it's time we went home Accidentally created directory named "~" (tilde) I managed to make a directory literally named ~.  (Apparently, Python's os.mkdir('~/something') does this.)  How do I remove it without nuking my home?  Also, if it helps, I have my real /home on a separate partition. And the duplicate ~ is located in (the real ) ~. Parse JSON using Python? Is there a way to combine custom settings with custom labels ? So that the output from a setting value would be a custom label ?   To explain:  In example, we have an international organisation, and say countries are stored as an ISO code. As this is a limited and stable set of data, using custom settings would be the appropriate way to deal with say the full country name.   The issue arises when I do not just want to store the English country name, but want to have it translatable, presenting the right translation depending on the user's locale. Now, this is the point where I'd like to integrate custom settings with custom labels.  So that say the custom setting with name 'some iso code' doesn't return the full country name, but Label.Country'some iso code', which is than automatically translated in the right version.   Sounds good right. But as custom settings are fixed to certain types, as far as I've gotten is put the label name in the settings as a string value. And then .. i'm stuck :).  No way to cast a string to a Custom label, or have it be interpreted (and translated) as such, or is there ?   I'm aware this can be done in a custom object &amp; apex, I was hoping for a more automated, "cleaner", less resource consuming way, better integrated, configurable way.  Additional clarrification: *The goal is to extend the use of custom labels (translation workbench), by adding a mapping from any data-based value to a custom label.*   While we could do a long matching process in apex, it would be faster &amp; neater if the custom settings mechanism could be used. There are disadvantaged to custom objects, they require soql &amp; apex, while custom settings &amp; custom labels are cached. They too can be used in many other places. Countries were an example, I'd use this mechanism for every variable value that needs to be translatable. cron.hourly sendmail errors even though my scripts do not involve sending mail Prove: The positive integers cannot be partitioned into arithmetic sequences (using Complex Analysis) Difference in meaning of "frustrated at" and "frustrated with" What is the difference in meaning of "frustrated at" and "frustrated with" used in sentences like     He is frustrated with me   or      He is frustrated at me   When is each of these sentences above are used? How come I can't give more than 500 rep? Why can't I give more than 500 reputation as a bounty at a time? The system won't let me choose an option more than 500.  Also, how were some users able to do so? On  the OP has given a single bounty worth 550 rep, but at the moment I have 844 rep and I can't give any more than 500 rep on a bounty.  Can you please tell us if this is a bug or not? How to Start Web Mapping? I want to start working on a web map at work to map some of our statistics by city.    I have an idea, but I'm not exactly sure where to start.   Are there any definitive resources that provide step by step guidance on how to do this? how to calculate $\int_C \frac{2xy^2dx-2yx^2dy}{x^2+y^2}$ using green theorm or directly Calculate $$\int_C \frac{2xy^2dx-2yx^2dy}{x^2+y^2},$$ where $C$ is the ellipse $3x^2 +5y^2 = 1$ taken in the positive direction.   I tried to calculate the integral using green theorm.  now i need to build enclosier that doesn't enclose $(0,0)$ i am having hard time guessing what to build.  a circle and ellipse might be perfect but then the domain is not easy to write. can i have hint please ? Proving that these two sets are denumerable. (a) $S_k=\{A\subset\mathbb{N}: |A|=k\}$ for $k\in\mathbb{N}$  (b) $S = \bigcup_{k=1}^\infty S_k$   Work: For (a), I am not too sure about what approach I should use. I think finding a bijective function between the $S_k$ and $\mathbb{N}$ is hard to do . I also thought about using the Schroeder-Bernstein theorem and find injective functions $f:\mathbb{N}\rightarrow S_k$and $g:S_k\rightarrow\mathbb{N}$ in order to prove that $S_k$ and $\mathbb{N}$ are numerically equivalent. However, I have a hard time finding and proving these injective functions. I haven't really looked at (b) as I have yet to complete (a). So the stories of the Hunger Games are set in , a post-apocalyptic society situated in North America. Is there anything to explain what caused the Apocalypse? Whether from the main books, any extra material or interviews? (No fanfic please.)  As well as the cause, is there any indication of when the apocalypse happened? And how long after the apocalypse are the events of the Hunger Games? What are the differences between a multidimensional array and an array of arrays in C#? Right-click on Touchpad not working after update to 18.04 LTS I have a Lenovo Yoga 910-13IKB. I was running Ubuntu 17.10 with no issues. I upgraded to 18.04 LTS and now my right-click on my touchpad does not register. I can only left-click.  I already tried the steps listed , but they did not fix the issue.  Does anyone know how to fix this?  Thanks. $E|X-m|$ is minimised at $m$=median For a continuous random variable $X$, I want to show that $E|X-m|$ is minimum implies $m$ is the median of the distribution. Assume that the distribution function is $F$ and the density function is $f$.  In this case, we basically need to minimize  $$\int_x |x-m|f(x)\,dx=\int_{x&gt;m}(x-m)f(x)\,dx+\int_{x&lt;m}(m-x)f(x)\,dx.$$  I am finally being left with $2mF(m)-m+E(X)-2\int_{x&lt;m}xf(x)\,dx$. What does it mean to minimise this expression? Is there some way out?  Well, my intuition says that since I have to prove that $F(m)=0.5$, I somehow will need to show that $E|X-m|$ is minimised if $2mF(m)-m=0$ (as then I will get $F(m)=0.5$ How do I delete a board when the admin is no longer part of the group? One of our programmers decided to leave us. We took him off the group, but his board that he is the only admin of is still hanging around. How do I remove it? How to make traces on an universal PCB? I hope this question won't be closed as too subjective. I'd like to know best practice - how to make traces on universal PCB's with individual holes without traces (like the following image). My idea is to bend the ends of discrete components and use them to make traces to other components. Is this approach acceptable, or nasty? Although this is called "prototype" PCB, I'd like to use it for my simple final circuits (low frequency, low current applications), because I hope it will save time. Exterior power "commutes" with direct sum I know that for vector spaces $V, W$ over a field $K$, we have the following identity :  $$ \bigoplus_{k=0}^n \left[ \Lambda^k(V) \otimes_K \Lambda^{n-k}(W) \right] \simeq \Lambda^n(V \oplus W) $$ which holds in a canonical way : for $0 \le k \le n$, the maps  $$ \Lambda^k(V) \times \Lambda^{n-k}(W) \to \Lambda^n(V \oplus W), \\ (v_1 \wedge\cdots \wedge v_k,w_{k+1} \wedge \cdots \wedge w_n) \mapsto (v_1 \wedge \cdots \wedge v_k) \wedge (w_{k+1} \wedge \cdots \wedge w_n) $$ factors through the tensor product's universal properties, which gives us a map $\varphi_k : \Lambda^k(V) \otimes_K \Lambda^{n-k}(W) \to \Lambda^n(V \oplus W)$, and since the category of $K$-modules has biproducts, we get a canonical map  $$ \varphi = \bigoplus_{k=0}^n \varphi_k : \bigoplus_{k=0}^n \left[ \Lambda^k(V) \otimes_K \Lambda^{n-k}(W) \right] \longrightarrow \Lambda^n(V \oplus W) $$  What if I replace $K$ by a (commutative ring with $1$) ring $A$? Does this map have a kernel? I know it is surjective (it suffices to "look at it", i.e generators of the codomain are obviously all hit by $\varphi$). I don't know if it helps, but I am working in integral domains. In the field case, this is obvious if $V$ and $W$ are finitely generated, since one can use dimension arguments. I wouldn't mind if the above identity held only in the finitely generated case either. If it worked in general it would be cool though.   Note that when trying to compute the inverse map with the universal property, there seems to be a problem... my guess would have been $$ (v_1 + w_1,\cdots,v_n + w_n) \mapsto \bigoplus_{k=0}^n (v_1 \wedge \cdots \wedge v_k) \otimes (w_{k+1} \wedge \cdots \wedge w_n) $$ and this map is obviously $A$-multilinear, but there is a problem with the alternating property ; I get some terms left. I'm guessing this is the wrong map... if there is one. How do I remove Windows 7 from my dual boot system with Ubuntu? Warning or confirmation on new tag creation In retrospect of this , I would like to ask the community how they feel about a warning or confirmation (or just special highlighting) on new tag creation.  Everybody hates stock "are you sure?" confirmation, but a lot of tags get created by mistake (and then used ad nauseam).   For example, I think I might have created the  tag by accident. Assuming the right tag was , there would be two tags for c# 4.0, until they are made synonyms. With a warning, some accidental tags could be prevented.