ConcurrentModificationException with ArrayLists and HashMaps
Iterating through a Collection, avoiding ConcurrentModificationException when removing objects in a loop
WinForms: How to programmatically fire an event handler? I want to programmatically invoke an event handler for a control. For example:  DateTimePicker dtpLastConsummated;   I want to trigger the TextChanged event handler for the dtpLastConsummated, how can i do it?  In other languages I would call something akin to:  dtpLastConsummated.TextChanged(this, new EventArgs());   but in .NET you can have multiple event handlers:  dtpLastConsummated.Click +=new EventHandler(dtpLastConsummated_TextChanged); dtpLastConsummated.Click +=new EventHandler(dtpLastConsummated_AnotherHandler); dtpLastConsummated.Click +=new EventHandler(dtpLastConsummated_MoreHandlers); ... dtpLastConsummated.Click +=new EventHandler(dtpLastConsummated_Nminus1);   so you need a way to trigger all the attached event handlers.    Answer  The following code will fire the event:  Toolkit.FireEvent(dtpLastConsummated, "TextChanged", new EventArgs());   And here's the code of the static toolkit function:  /// &lt;summary&gt; /// Programatically fire an event handler of an object /// &lt;/summary&gt; /// &lt;param name="targetObject"&gt;&lt;/param&gt; /// &lt;param name="eventName"&gt;&lt;/param&gt; /// &lt;param name="e"&gt;&lt;/param&gt; public static void FireEvent(Object targetObject, string eventName, EventArgs e) {    /*     * By convention event handlers are internally called by a protected     * method called OnEventName     * e.g.     *     public event TextChanged     * is triggered by     *     protected void OnTextChanged     *      * If the object didn't create an OnXxxx protected method,     * then you're screwed. But your alternative was over override     * the method and call it - so you'd be screwed the other way too.     */     //Event thrower method name //e.g. OnTextChanged    String methodName = "On" + eventName;     MethodInfo mi = targetObject.GetType().GetMethod(          methodName,           BindingFlags.Instance | BindingFlags.NonPublic);     if (mi == null)       throw new ArgumentException("Cannot find event thrower named "+methodName);     mi.Invoke(targetObject, new object[] { e }); }     Note: I'm not creating a subclass of every control in the .NET framework, and every 3rd party control, and convincing an enterprise worth of developers to retrofit every form to use my custom controls. The following question is taken from Royden's Real Analysis $4$th edition, Chapter $3,$ question $28,$ page $67:$     Question: Show that Egoroff's Theorem continues to hold if the convergence is pointwise a.e. and $f$ is finite a.e., that is.       Assume $E$ has finite measure. Let $\{f_n\}$ be a sequence of measurable functions on $E$ that converges pointwise almost everywhere on $E$ to the real-valued function $f$ which is finite almost everywhere. Then for each $\varepsilon&gt;0,$ there is a closed set $F$ contained in $E$ for which    $$\{f_n\}\to f \text{ uniformly on }F \text{ and }m(E\setminus F)&lt;\varepsilon.$$   My attempt:   Let $A = \{ x\in E: f_n\not\to f \text{ pointwise} \}$ and $B=\{ x\in E: |f|=\infty \}.$  By assumption,  $$m(A)=m(B)=0.$$ So $A$ and $B$ are measurable.  Note that  $$m[E\setminus (A\cup B)] = m(E) - m(A\cup B) = m(E).$$ Fix $\varepsilon&gt;0.$ Since $\{f_n\}$ converges to $f$ pointwise on $E\setminus (A\cup B)$ to the real-valued function $f,$ by Egoroff's Theorem, there exists a closed set $F$ contained in $(E\setminus (A\cup B))\subseteq E$ for which  $$f_n\to f \text{ uniformly on } F \text{ and }m[(E\setminus(A\cup B)) \setminus F] &lt; \varepsilon.$$ Since $E$ has finite measure and $F\subseteq E,$ by monotonicity,  $F$ has finite measure. As $F$ is closed, it is also measurable.  Therefore, by Excision property, we have $$m(E\setminus F) = m(E) - m(F) = m[E\setminus(A\cup B)] - m(F) = m[(E\setminus(A\cup B)) \setminus F]&lt;\varepsilon.$$  Is my proof correct? I ask for verification because in this  Kenny's comment about countable union of null sets. I do not use this anywhere in my proof. So I wonder whether my proof miss out something. Accused of cheating on online exams I was working on a problem that resulted in the calculation: $20 \equiv 10x \pmod{11}$.  I got the answer $x \equiv 2 \pmod{11}$ with the thought process: Since $10$ is a factor of $20$ I can rewrite $20 \pmod{11}$ as $10x \pmod{11}$ with $x=2$. But isn't this basically the same as using division, which we aren't supposed to do in modular spaces?  If I solve by multiplying $20$ by the multiplicative inverse of $10 \pmod{11}$ which is $10$, I get $200 \pmod{11}$ which simplifies to $2 \pmod{11}$ anyway. Did these numbers just happen to be the same or is my original method valid? How to change the order of the subcategory and category in a post? I guess it is something simple which I'm not able to see. Any help would be much appreciated. Best, M. Evaluation of OptionValue[] I'm planning to fly from Ulaanbaatar to Melbourne via Seoul (and Kuala Lumpur).  However, can I actually enter South Korea using this visa waiver? I'm hoping to meet a friend there for a few hours before flying. Also, would traveling via Malaysia affect this policy?  Transit tourists bound for another country Eligible countries  Applicable to all countries (save for Macedonia, Cuba, Syria, Sudan and Iran) that are not granted visa-free entry into Korea.  Applicable to…  Those with a visa (excluding Japanses Group Visa, excluding e-visa) or a re-entry permit for U.S., Japan, Canada, Australia, or New Zealand (5 countries) and traveling to any one of those countries through Korea.  Those traveling from any one of the five countries mentioned above, whose final destination is not Korea.  However, please note that the first bullet points are not applicable to those travelling to/from Guam and Saipan, which are unincorporated territories of the United States.   Requirements  Must have a confirmed onward flight ticket for departure within 30 days after entering Korea, in addition to having no record of criminal offence in the five countries mentioned above. HTML favicon won't show on google chrome Inverse of this $3\times 3$ matrix using the Cayley–Hamilton theorem Find the inverse of the matrix $$\begin{pmatrix} -1 &amp; 2&amp; 0 \\ 1&amp; 1 &amp;0 \\ 2 &amp; -1&amp; 2 \end{pmatrix}$$ using the Cayley–Hamilton theorem.  Thanks! Several ways to prove that $\sum\limits^\infty_{n=1}\left(1-\frac1{\sqrt{n}}\right)^n$ converges How can I set up password-less SSH login? I want to be able to login to a remote via ssh without having to enter the password all the time.   How do I set it up? Is a different command required to execute a password-less session? Can matter be described as the result of the curvature of space, instead of vice versa? Can matter be described as the result of the curvature of space, rather than the curvature of space being the result of matter, and energy being the cause of the curvature of space? Dynamic loading of python modules Foolproof way to ensure Google news pulls the correct image for its thumbnails? Google news results have an acompanying thumbnail next to articles that show up in the results.    If Google's crawler can't find a thumbnail to pull from our site, it uses its next best guess from another site, therefore linking the image to another site but still uses our headline.  Example:  Headline from Reuters, Image from Livemint:   Our pages absolutely have images, they are not massive in file-size or dimensions, yet we are not having them pulled / crawled correctly.  We have read up on the suggestions from Google, and from others around the web and nothing is panning out.  Has anyone had any experience where they can ensure Google news will pull a thumbnail of our choosing? Rewrite rules goes away I have a query which selects a max value over all the values of in a datetime column (dtimesent).  select dtimesent, max(ResponseTime) AS maxtime FROM allrequests  where Request like '%Requestsa%' group by dtimesent   I need to get the value of the request colmn for each max response time in each group by. Is there any easy way to do this?  There can be multiple rows per dtimesent value so I can't just include the request column in the group by,  Many thanks, I have a ASUS R500A notebook.Original OS is Windows 7 64bit.Few days ago I tried to Install Windows 8.1 64 bit version.But it failed &amp; error message is,     windows cannot be installed on this disk. The selected disk is of the GPT partition style.   My Steps: First i Deleted C: Partition ( Already installed windows 7 ). Then i Formatted that partition. Tried to install Windows 8.1 64bit.  In this hard disk i have another several partitions with Important data.  How do i Install Windows 8.1 without loosing Data from the Other partitions ? Hello everyone interested. Here's a seemingly simple problem.  Suppose $G$ is a complete, simple graph with vertices $\{1,2,..,n\}$, $n\geq k\geq 3$.  How many cycles of length $k$ can we have on $G$?  The statement seems simple but I have trouble putting everything together.  So I say fix a vertex and start forming cycles with length k. But I get nowhere... What is the proper approach to this problem since counting is not easy? Is there a relevant theorem that I am unaware of?  Thanks for any help... I have to prove that $$\lim_{n\to\infty} \left(1+n^2\right)^{\frac1n}$$ converges and give its limit. What I did was the following: $$\lim_{n\to\infty} \left(1+n^2\right)^\frac{1}{n} = \lim_{n\to\infty}(n^2)^{\frac1n}\lim_{n\to\infty}\left(\frac1{n^2} + 1\right)^\frac1n= \lim_{n\to\infty}(n^2)^{\frac1n}$$ Now that is where I am stuck - how to I continue with $\lim_{n\rightarrow\infty}(n^2)^{\frac{1}{n}}$? I really don't have any ideas left... Thank you very much! FunkyPeanut I'm trying to show that for $b&gt;1$, $x&gt;0$ and $x$ irrational, that $$\sup \{b^p:p\in Q,\;0&lt;p&lt;x\} = \inf\{b^q:q\in Q,\;x&lt;q\}$$ I know this follows immediately if we define $b^x=\exp(x\log(b))$ and use the fact that the exponential function is strictly increasing and continuous over $\mathbb R$, but I'm not allowed to do that. In fact, I only have that $b^{m/n}=(b^{1/n})^m$, where $b^{1/n}$ means the positive $n^{th}$ root of $b$; $b^x$ is not yet defined for irrational $x$.  I know that the supremum and infimum both exist because if $b&gt;1$ and $p&lt;q$, then $b^p&lt;b^q$. Also, by assuming that the inf $&lt;$ sup, I got a contradiction. The part I'm stuck on is deriving a contradiction from assuming that sup $&lt;$ inf. Does anybody have any ideas?  Thank you.