I have created an app in c#, which sends SMS after a defined time gap, for this I am using timer and a label which count number of record(sent messages). now when I click on submit button to start sending sms, it fetches records from DB but when it come to that label portion which shows number of sms it shows an error message  System.InvalidOperationExecution Cross-thread operation not valid control 'lblXXX' accessed from a thread other than the thread it was created. My Code is  For Button  private void btnSend_Click(object sender, EventArgs e)         {             this.btnSend.Enabled = false;             this.starttimer();         }   For Timer  private void starttimer()         {             System.Timers.Timer timer = new System.Timers.Timer();             timer.Start();             timer.Interval = 3000;             timer.Elapsed += new ElapsedEventHandler(this.time_elapsed);          }   for Lable  while (this.dr.Read())                         {                             this.lblWeightSMS.Text = Convert.ToString(Convert.ToInt32(this.lblWeightSMS.Text) + 1);
I have a scenario. (Windows Forms, C#, .NET)   There is a main form which hosts some user control. The user control does some heavy data operation, such that if I directly call the UserControl_Load method the UI become nonresponsive for the duration for load method execution. To overcome this I load data on different thread (trying to change existing code as little as I can)   I used a background worker thread which will be loading the data and when done will notify the application that it has done its work.   Now came a real problem. All the UI (main form and its child usercontrols) was created on the primary main thread. In the LOAD method of the usercontrol I'm fetching data based on the values of some control (like textbox) on userControl.    The pseudocode would look like this:  CODE 1  UserContrl1_LoadDataMethod() {     if (textbox1.text == "MyName") // This gives exception     {         //Load data corresponding to "MyName".         //Populate a globale variable List&lt;string&gt; which will be binded to grid at some later stage.     } }   The Exception it gave was     Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on.   To know more about this I did some googling and a suggestion came up like using the following code  CODE 2  UserContrl1_LoadDataMethod() {     if (InvokeRequired) // Line #1     {         this.Invoke(new MethodInvoker(UserContrl1_LoadDataMethod));         return;     }      if (textbox1.text == "MyName") // Now it wont give an exception     {     //Load data correspondin to "MyName"         //Populate a globale variable List&lt;string&gt; which will be binded to grid at some later stage     } }   BUT BUT BUT... it seems I'm back to square one. The Application again  become nonresponsive. It seems to be due to the execution of line #1 if condition. The loading task is again done by the parent thread and not the third that I spawned.  I don't know whether I perceived this right or wrong. I'm new to threading.  How do I resolve this and also what is the effect of execution of Line#1 if block?  The situation is this: I want to load data into a global variable based on the value of a control. I don't want to change the value of a control from the child thread. I'm not going to do it ever from a child thread.   So only accessing the value so that the corresponding data can be fetched from the database.
How do I run a program with commandline arguments using GDB within a Bash script? Is it possible to "hack" a MacBook so as to be able to install macOS Mojave? Show that $X^2$ and $X^3$ are irreducible but not prime in $K[X^2,X^3]$.   My reasoning is as follows:  Since the only ways $X^2$ and $X^3$ can be factored in $K[X^2,X^3]$ are $X^2 = X^2 * 1$ and $X^3=X^3*1$ it follows that $X^2$ and $X^3$ are irreducible.  To show that they are not prime in $K[X^2,X^3]$ I argue that $X^2\mid X^3*X^3$ but $X^2\nmid X^3$ and $X^3\mid X^4*X^2$ but $X^3\nmid X^4$ or $X^3\nmid X^2$.  Is that correct? Within 300 km of Tokyo: Where for flora, landscape, nature? I've been writing C and C++ code for almost twenty years, but there's one aspect of these languages that I've never really understood. I've obviously used regular casts i.e.  MyClass *m = (MyClass *)ptr;   all over the place, but there seem to be two other types of casts, and I don't know the difference. What's the difference between the following lines of code?  MyClass *m = (MyClass *)ptr; MyClass *m = static_cast&lt;MyClass *&gt;(ptr); MyClass *m = dynamic_cast&lt;MyClass *&gt;(ptr); Is there any difference in equals and == for String variables? if ('text'.equals(str))   or   if ('text' == str)   Is there any difference? If yes, then what is it?   Added, after answered.  String q = 'teXt'; system.debug('teXt'.equals(q)); // true system.debug('teXt' == q);      // true system.debug('text'.equals(q)); // false system.debug('text' == q);      // true Free UML drawing library for .NET How can I find such a $z$? (Injectivity of $T(z) = \lambda z + \mu\bar{z}$) We consider $T:\mathbb{C}\to\mathbb{C}$ defined by $T(z)=\lambda z+\mu\overline{z}$, where $\lambda ,\mu\in\mathbb{C}$. I want to prove that if $T$ is injective, then $\lambda\cdot\overline{\lambda}\neq\mu\cdot\overline{\mu}$.  Clearly, if $\mu =0$, then $\lambda\neq 0$ because $T$ is injective.  Now, if $\lambda\cdot\overline{\lambda}=\mu\cdot\overline{\mu}$ and $\mu\neq 0$, then I wanted to find a $z\in\mathbb{C}\setminus\{0\}$ such that $z=-\dfrac{\overline{\lambda}}{\overline{\mu}}\overline{z}$, because we would have that:  $T(z)=-\lambda\dfrac{\overline{\lambda}}{\overline{\mu}}\overline{z}+\mu\overline{z}=\overline{z}(-\lambda\dfrac{\overline{\lambda}}{\overline{\mu}}+\mu)=0$  ('Cause this would prove that $\lambda\cdot\overline{\lambda}=\mu\cdot\overline{\mu}$ implies $T$ is not injective.)  So, the question is, can we always find such a $z\in\mathbb{C}\setminus\{0\}$? Disable Screenshot Security I'm using the beamer miniframes theme (with subsection=false) and the compress option. Currently the navigation shows the dots for each subsection side-by-side. I would prefer if there would be a horizontal space (e.g. with the width of a dot) between the dots of each subsection. Is this possible? Right now it looks like:  Section 1 oooooo  And I would prefer it to look like:  Section 1 ooo ooo  MWE: \documentclass[compress]{beamer}   \useoutertheme[subsection=false]{miniframes}   \begin{document}   \section{Sec 1}   \subsection{}   \begin{frame}[t]     hi   \end{frame} \subsection{}   \begin{frame}[t]     hi   \end{frame} \end{document}` Understanding integrals double meaning I would like to understand why the integrals represent 2 things:   If we only do an integral without bounds on $f(x)$, the integral gives us the function $F(x)$ that, when differentiated, gives us the original function $f(x)$. If we do an integral with bounds $[a,b]$ on $f(x)$, it gives us the area under $f(x)$ by evaluating the difference $F(b) - F(a)$.   Why does $F(x)$ represent the area under $f(x)$ as well as the first point? Can't reach wi-fi signal on Ubuntu, but can do it on other OS/devices (ath9k) Low-RAM Linux Distro Specifically for serving static sites I'm looking for a near-zero-configuration linux distro that is designed specifically for serving static web sites and nothing else on a low-RAM machine (I'm planning on 128MB, but the option of less would be nice).  Any ideas of a linux distro specifically tuned for serving static sites in a small footprint? How do users navigate to Meta? What's the difference between the apt packages: 'cinnamon' and 'cinnamon-desktop-environment'? I have a fresh Ubuntu install and want to install Cinnamon as the desktop environment. When I do apt search cinnamon, I get multiple results, but two seems like they are the correct one.   The first is just   cinnamon/xenial 2.8.6-1ubuntu1 amd64 all     Innovative and comfortable desktop (Common data files)   while the other is   cinnamon-desktop-environment/xenial,xenial 2.8.0 all     Cinnamon desktop environment - full desktop with extra components   What's the difference between the two? What does the cinnamon-desktop-environment package contain that the cinnamon doesn't? Integral around unit sphere of inner product For arbitrary $n\times n$ matrices M, I am trying to solve the integral  $$\int_{\|v\| = 1} v^T M v.$$  Solving this integral in a few low dimensions (by passing to spherical coordinates) suggests the answer in general to be  $$\frac{A\,\mathrm{tr}(M)}{n}$$ where $A$ is the surface area of the $(n-1)$-dimensional sphere. Is there a nice, coordinate-free approach to proving this formula? Can I use Wilcoxon Signed-Rank Test to test pairs of data in a time series? I have a dataset of measurements (non-normally distributed). Each line of this dataset is composed of two measurements of the same variable at a specific time (i.e. XYY [time, meas1, meas2]). This dataset contains 24 lines.  Is it correct to use the Wilcoxon Signed-Rank Test to compare these two measurements? Is it correct to use this test to compare the mean value of these measurements between different experiments?  Thanks A function $f : I \rightarrow \mathbb R$ on an interval $I$ is convex   if $f((1-t)x+ty)\le (1-t)f(x)+tf(y), \forall x,y \in I, t \in [0,1]$      Assume now that $I$ is an open interval.  Show that if $f$ is convex   then for each $c \in I$ there exists $m \in \mathbb R$ such that $m(x  − c) + f(c) \le f(x)$ for all $x \in I$ , and if in addition $f$ is   differentiable at $c$ then $f'(c)$ is the unique $m$ that works. In   general, must m be unique?   (we have previously shown that convex functions are continuous)  I think I'm missing the point of the question.  Surely, by the mean value theorem we can find some $y\in (x,c)$ such that $f'(y)=\frac{f(x)-f(c)}{x-c}$ setting $m=f'(y)$ we get $m=\frac{f(x)-f(c)}{x-c}, m(x-c)+f(c)=f(x)$ such an $m$ fits the inequality we're asked to show.  I also cannot see why $f'(c)$ would be the unique solution or why we would ever get a unique solution of the inequality at all for that matter.  Clearly I'm misunderstanding the question, so if someone could point out where I would appreciate that.  Thank you To Find Large Powers in C++ Schengen Business visa without a business invitation letter