I simply want two progress bar to increment simultaneously on a button click; i have created two progress bars and one button start with two threads t1 and t2 each of which contains different method in order to increment the values of two progress bars (t1 for progressbar1 and t2 for progressbar2 respectively).  Controls I have: Progress Bars: progressbar1, progressbar2 and Button button1.  The code is as follows:      Thread t1, t2;     private void Progressor1()     {         progressBar1.Minimum = 0;         progressBar1.Maximum = 100;          for (int i = 0; i &lt;= 100; i++)                         progressBar1.Value = i;     }      private void Progressor2()     {                     progressBar2.Minimum = 0;         progressBar2.Maximum = 100;          for (int j = 0; j &lt;= 100; j++)                         progressBar2.Value = j;                 }      private void button1_Click(object sender, EventArgs e)  // Start Button     {         t1.Start();         t2.Start();     }      private void MultiThreadedcs_Load(object sender, EventArgs e)// Form Load     {         t1 = new Thread(Progressor1);         t2 = new Thread(Progressor2);     }   At run time it shows me following error:     Error Name = InvalidOperationException   Error Message = Cross-thread operation not valid: Control 'progressBar2' accessed from a thread other than the thread it was created on.   Please help me out with this. I have less idea of threading concepts, i have gone through this solution with no progress in my problem:
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.
I am using two books for my calculus refresher.   Thomas' Calculus  Higher Math for Beginners by Ya. B. Zeldovich   My question is : When applying Integral Calculus for calculation of volumes of solids, generated by curves revolved around an axis, we use slices of 'cylinders' to approximate the volume of the resulting solid and then integrate the sum of those infinitesimal cylinders. However, when we are using the same techniques to calculate the surface area of the surfaces generated by revolving curves around an axis, we consider the 'slope' of the differential length of curve 'dx', calculate the total length of the curve and derive the required surface area.  Are we not supposed to use the same 'slope' for calculating the volumes of the infinitesimal 'cylinders' for calculation of volumes? Shouldn't we use 'sliced portions of 'cones' as the infinitesimal volumes?? When it come to calculation of volumes of solids of revolution, why are we neglecting the slope of the curve for the differential length and simply assume that it is an infinitesimal cylinder??  Ex: Let us say we want to calculate the surface area and the volume of the solid generated when the parabola y = 10 . x^2 is revolved about the y-axis, with limits of x from 0 to 5.  In such cases, when calculating the volume of the solid, we consider infinitesimal 'cylinders', ignoring the 'slope' of the curve for the differential element 'dx', but when calculating the surface area, we consider the 'slope' of the differential element 'dx'. I want to sort in-text citations by year, but bibliography by name. It sound exactly like .  However, suggested solution (using \usepackage[sorting=ynt]{biblatex} and \printbibliography[sorting=nty]) does not work for me (see MWEB below). Indeed, the list of references remains year-sorted instead of name sorted.  Question: How to force sorting=nty in \printbibliography?      \documentclass{article}     \usepackage[%         backend=biber,%         style=authoryear-comp,%         natbib=true,%         sorting=ynt%     ]{biblatex}     \addbibresource{\jobname.bib}     \usepackage{filecontents}  \begin{filecontents}{\jobname.bib}     @book{key2000,       author = {Author, A.},       year = {2000},       title = {Alphabetical fist \&amp; Year last},       publisher = {Publisher},     }     @book{key1900,         author = {Boathor, B.},         year = {1900},         title = {Alphabetical last \&amp; Year first},         publisher = {Publisher}, } \end{filecontents}  \begin{document}     Citation should be year-sorted, even if \verb+\citep+ is random \citep{key2000, key1900}.% citation NOT year-sorted      \printbibliography[sorting=nyt] \end{document}   P.S.: At the opposite, using  \begingroup     \newrefcontext[sorting=nyt]     \printbibliography \endgroup    overrides the \usepackage[sorting=ynt]{biblatex} option (i.e. LoR is name-sorted, but in-line citations as well). The  that is defined as $Y_{t} = Y_{t-1} + e_t$, where $e_t$ is white noise. Denotes that the current position is the sum of the previous position + an unpredicted term. You can prove that the mean function $\mu_t = 0 $, since $$E(Y_{t}) = E(e_1+ e_2+ ... +e_t) = E(e_1) + E(e_2) +... +E(e_t) = 0 + 0 + \cdots + 0$$ But why is it that the variance increases linearly with time? Does this have something to do with it's not “pure” random, since the new position is very correlated with the previous one? EDIT: Now I have a much better understanding by visualizing a big sample of random walks, and here we can easily observe that the overall variance does increase over time,  and the mean is as expected around zero. Maybe this was trivial after all, since in the very early stages of the time series (compare time = 10 with time = 100) the random walkers have not had yet the time to explore as much. When watching US television news or reading US news articles there is this affectation where instead of saying:     "Spotify music-streaming service to launch in U.S. on Thursday" ()   or      "Leading credit rating agency Moody's said on Wednesday that the U.S. government's impeccable credit..." ()   The on preposition is missed out.  Is this just a peculiar US journalistic "news speak" shortcut or do American non-journalist writers write this way too? Background picture does not appear in the render? I'm using Blender 2.74 and have added a picture as a background in the view , it is visible in the view but it doesn't appear in the render ,why is that ? here is the picture    Many thanks, Meri Does there exist a bijective $f:\mathbb{N} \to \mathbb{N}$ such that $\sum f(n)/n^2$ converges? We know that $\displaystyle\zeta(2)=\sum\limits_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}$ and it converges.        Does there exists a bijective map $f:\mathbb{N} \to \mathbb{N}$ such that the sum $$\sum\limits_{n=1}^{\infty} \frac{f(n)}{n^2}$$ converges.      If our $s=2$ was not fixed, then can we have a function such that $\displaystyle \zeta(s)=\sum\limits_{n=1}^{\infty} \frac{f(n)}{n^s}$ converges MLE of $\theta$ when $X_1,\ldots,X_n $ are i.i.d with $P_\theta(x; \theta)=2x/\theta^2$ for $0\le x \le\theta$ Assume the standard situation, that is, let $X_1, \ldots , X_n$ be independent and identically distributed with $X_k ∼ P_\theta(x; \theta)$ , where $P_\theta(x; \theta) = 2x/\theta^2$  if $0\le x \le\theta$ and $0$ otherwise. It is required to estimate $\theta$. Show that the maximum likelihood estimator for $\theta$ is $\hat{\theta} = \max{[X_1, \ldots , X_n]}$ and then show that the cumulative distribution function of $\hat{\theta}$ is $F_\theta(z) = z^{2n}/\theta^{2n}$. Here's what i did so far: Maximum Likehood estimator: $L_x(θ) = \prod_{i = 1}^{n} P_θ(x_k)$ Here we have $P_θ(x_1,...,x_n;θ) = P_θ(x_1,θ).P_θ(x_2,θ)...P_θ(x_n,θ)$ Likehood = $L_{x,θ}(θ) =P_θ(x_1,θ).P_θ(x_2,θ)...P_θ(x_n,θ)= 2x_1/θ^2. 2x_2/θ^2.. 2x_n/θ^2 = [2^n.\prod_{i = 1}^{n}x_i]/θ^{2n}$ Log-likehood: $\sum_{i = 1}^{n}log(P_θ(x_1,...x_n;θ))= \sum_{i = 1}^{n}log(2x_i/θ^2)$ Is this correct so far? Im still not sure how to get to $\hat{θ} = max{[X_1, . . . , X_n]}$ As for the the cumulative distribution part to show $F_θ(z) = z^{2n}/θ^{2n}$: $F(z) = P(max({x_k})&lt;z) = P(x_1&lt;z).P(x_2&lt;z)..P(x_n&lt;z) = 2x_1/θ^2.2x_2/θ^2...2x_n/θ^n = 2^n.\prod_{i = 1}^{n}x_i/θ^2n$ Not sure if this is correct. Would really appreciate some help. Edit: From the answers below, we can deduce the the estimator is biased. What estimator would be unbiased? How can i find it? I have a Win 7/11.10 dual boot system with Grub 2 as the default bootloader. However, I want to make Windows bootloader the default bootloader (grub 'dos' like interface scrares the hell out of my sister) so when I start the PC I will have the following boot options: 1. Windows 7 2. Ubuntu  NB: A process to reverse this operation so Grub can be the default bootloader again will also be appreciated Classical limit of quantum mechanics I have heard that one can recover classical mechanics from quantum mechanics in the limit the $\hbar$ goes to zero.  How can this be done?  (Ideally, I would love to see something like: as $\hbar$ goes to zero, the position wavefunction reduces to a delta function and that the Schrodinger equation/Feynman path integral reduces to the Newtonian/Lagrangian/Hamiltonian equations of motion.) I have a problem with energy conservation in case of interfering waves.  Imagine two harmonic waves with amplitudes $A$. They both carry energy that is proportional to $A^2$, so the total energy is proportional to $2A^2$. When they interfere, the amplitude raises to $2A$, so energy is now proportional to $4A^2$ and bigger than before.  The equivalent question is what happens to the energy with the superposition of two waves that interfere destructively.  Also, if someone could comment on the statement about this problem in my physics book (Bykow, Butikow, Kondratiew):      The sources of the waves work with increased power during the interference because they feel the wave from the other source. Including a relative path to a class file Good Number Theory books to start with? When I include a  \usepackage{forest} all colored text title, section headings disappears with IEEE Access journal template How can I tackle this problem? How to prevent a scrollview from scrolling to a webview after data is loaded? What is the fastest way to create a 90° joint? I often want to create joints like this:    Since I end up making these more than a little, I'd like a fast way to do it (i.e. on the order of &lt; 10 seconds)  I've found a couple tools which come close to being the ideal solution, but I've had some problems with them as listed below:   When using the spin tool I usually end up having to fiddle with the location for a while in order to to get a natural curve:    Are there any techniques to expedite this process of fiddling? The bridge tool is nice because I can precisely specify where both ends of the joint will be, however I often end up with subtly uneven joints, probably due to my initial mesh being not quite square.    Is there a fast way to correctly line up the initial edge loops in a way that will result in an even joint? How can I clear the water out of this area? I've sectioned of this area in the sea near my base, and I need to get rid of all the water from it.  From what I've tried the only way I can see to clear it is fully cover one layer, delete the blocks, then go down to the next layer. Is that the only way I can clear the area or is there a better approach?  Ideally I'd like a survival method (if there is a better one), but any commands what could be used I'd like to hear just so I can learn more commands :) Value of $\frac{\sqrt{10+\sqrt{1}}+\sqrt{10+\sqrt{2}}+\cdots+\sqrt{10+\sqrt{99}} }{\sqrt{10-\sqrt{1}}+\sqrt{10-\sqrt{2}}+\cdots+\sqrt{10-\sqrt{99}}}$ Here is the question:     $$\frac{\sqrt{10+\sqrt{1}}+\sqrt{10+\sqrt{2}}+\cdots+\sqrt{10+\sqrt{99}} }{\sqrt{10-\sqrt{1}}+\sqrt{10-\sqrt{2}}+\cdots+\sqrt{10-\sqrt{99}}} = \;?$$   ()  I think we need to simplify it writing it in summation sign as you can see here:  $$\frac{\sum\limits_{n=1}^{99} \sqrt{10 + \sqrt{n}}}{\sum\limits_{n=1}^{99} \sqrt{10 - \sqrt{n}}}$$  or in Wolfram Alpha input in comments.  I can compute it too! It's easy to write a script for this kind of question. I need a way to solve it. How would you solve it on a piece of paper? Does "Going Infinite" necessarily end the game? Deleting polygon defined area from raster layer in ArcGIS Desktop? Which tool do I use in ArcGIS 10.1 for Desktop to exclude areas covered by vector polygon layers from a raster layer?   I want to keep portions of the raster layers that exclude the portions covered by the vector layer. "matrix is not positive definite" - even when highly correlated variables are removed