Newbie need some help on threading I'm a new student and basically just got into the topic threading.  What I have to do seems rather simple. I have to make a combobox, but I need to fill it using a different thread. And thats where I ran into trouble, cause;  Additional information: Cross-thread operation not valid: Control 'ComboBox' accessed from a thread other than the thread it was created on.  So I did some research, and it seems you cant fill UI elements outside the main thread. So I'm sitting here scratching my head thinking what would be the best thing to do.   Help would be appreciated.  Oh btw, its C# and in windows forms.           public Customer()     {         InitializeComponent();         Thread red = new Thread(Fill);         red.Start();     }     public void Fill()     {         Thread.Sleep(5000);         ComboBox1.Items.Add(1);         ComboBox1.Items.Add(2);         ComboBox1.Items.Add(3);         ComboBox1.Items.Add(4);         ComboBox1.Items.Add(5);         ComboBox1.Items.Add(6);         ComboBox1.Items.Add(7);     }
Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on 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.
Has 'Ubuntu Software' been renamed to 'Snap Store'? Displaying two XML listings side by side. I have two XML outputs from a program that I would like to include in a LaTeX document. I would like them to appear side-by-side each in its own box. So that a reader can compare the two outputs while reading the document. Can't seem to find a way to do this, without making images for each output and adding both as images/graphics. Could there be a better option? Cannot vote to close immediately after edit Synchronize Clocks I need to develop a system where there are 4 sensor boxes powered by USB and they have their internal clock. Each of these boxes are connected to a Linux pc and all these PCs are linked with WiFi. API of the sensor box allows me to read their internal precision clock (uSec accuracy).   I like to synchronize all four clocks of the sensor boxes as close as possible. Hopefully within a few micro seconds of each other and compensate for drift over time. The idea is to use the sensor data that is collected at the same time (The data I receive is time stamped with the boxes' internal clock). The latency on usb bus, WiFi, pc timing are all indeterministic.  Is this possible given my setup? Why can't variable names start with numbers? I was working with a new C++ developer a while back when he asked the question: "Why can't variable names start with numbers?"  I couldn't come up with an answer except that some numbers can have text in them (123456L, 123456U) and that wouldn't be possible if the compilers were thinking everything with some amount of alpha characters was a variable name.  Was that the right answer?  Are there any more reasons?  string 2BeOrNot2Be = "that is the question"; // Why won't this compile? USB flash drive not working or is appearing as an empty disk drive, Disk Management reports "No Media" with 0 bytes size I have a USB flash drive which is no longer recognized by my computer. Windows Disk Management and DiskPart report No Media with no storage space (0 bytes) on the drive and I cannot partition or format the drive:     If the drive appears in Windows Explorer, trying to access it returns an error message indicating that there is no disk inserted, such as the following:     Please insert a disk into drive X:.   Various disk partitioning and data recovery utilities don't recognize the drive or only give a generic name for the drive and cannot access the contents of the drive.  What can I do? How do I recover data from the drive?     This question comes up often and the answers are usually the same. This post is meant to provide a definitive, canonical answer for this problem. Feel free to edit the answer to add additional details. $\sum a_{n}$ is convergent, $\sum a_{n}^2$ is divergent. Prove $\sum a_{n}$ is conditionally convergent. Suppose that the series $\sum_{n=1}^{\infty}a_{n}$ converges while $\sum_{n=1}^{\infty}a_{n}^2$ diverges. Prove that $\sum_{n=1}^{\infty}a_{n}$ converges conditionally. Since I have an onboard Intel graphics card, and a ATI Radeon display controller, I was wondering if I could switch between the two as my graphics in use, as I could in 14.04 LTS through ATI Catalyst?  16.04 LTS is using the onboard, and the hardware listing lists ATI as well as display controler, but not in use. Additional drivers don't provide anything.   So is AMDGPU being used, or is ATI disabled?  lspci:  00:02.0 VGA compatible controller: Intel Corporation Broadwell-U Integrated Graphics (rev 09) 04:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Venus XTX [Radeon HD 8890M / R9 M275X/M375X] (rev ff)   lspci -nnk | grep VGA -A1  00:02.0 VGA compatible controller [0300]: Intel Corporation Broadwell-U Integrated Graphics [8086:1616] (rev 09)     Subsystem: Lenovo Broadwell-U Integrated Graphics [17aa:3824] I have downloaded an ISO file recently.  How do I burn it to a CD or DVD or mount it? What is the difference between an Intel i7 and a Xeon quad core processor? I know the  processors have been around for a long time and are mostly used in servers, but I am curious, why do people not use the Xeons in a high performance desktop?    As far as I know about the best desktop processor out there now is the  line. The i7's and Xeons are both quad-core processors, what is the main difference in these? I just saw that the MacBook Pro's are using the quad core Xeons instead of the i7's. Apache on MacOS Sierra: AH00557: httpd: apr_sockaddr_info_get() failed for Macbook-Pro.local AH00558: httpd: Could not reliably determine… I updated MacOS Sierra's Apache and PHP, and now whenever I $ sudo apachectl restart I get this:  AH00557: httpd: apr_sockaddr_info_get() failed for My-MacBook-Pro.local AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message   Things I've tried so far that didn't work:   Setting ServerName localhost in /etc/httpd.conf Setting ServerName localhost:80 in /etc/httpd.conf Setting ServerName 127.0.0.1 in /etc/httpd.conf Setting ServerName 127.0.0.1:80 in /etc/httpd.conf Ensuring 127.0.0.1       localhost is set in /etc/hosts Repeatedly restarting Apache "In here", "from here", and "at here" I just read the discussed topic "look here vs. look at here":  It's got me wondering.  What is the reason for not using the preposition at before here?  Is it because here is an adverb and it is wrong to use a preposition before an adverb?  What if we use here with its nominal meaning, as in "get away from here", or "It's really hot in here", and then say "Look at here" meaning "Look at this place"?    If it is wrong and there is some other reason why at here is incorrect but in here and from here are correct, what is it? Change multiple filenames by replacing a character If $X$ is distributed $N(\mu_X, \sigma^2_X)$, $Y$ is distributed $N(\mu_Y, \sigma^2_Y)$ and $Z = X + Y$, I know that $Z$ is distributed $N(\mu_X + \mu_Y, \sigma^2_X + \sigma^2_Y)$ if X and Y are independent.  But what would happen if X and Y were not independent, i.e. $(X, Y) \approx N\big( (\begin{smallmatrix} \mu_X\\\mu_Y \end{smallmatrix}) , (\begin{smallmatrix} \sigma^2_X &amp;&amp; \sigma_{X,Y}\\ \sigma_{X,Y} &amp;&amp; \sigma^2_Y \end{smallmatrix}) \big) $  Would this affect how the sum $Z$ is distributed? Portable Ruby on Rails environment I got myself a new 8 gig USB key and I'm looking for a decent solution to have a portable RoR environment to learn on. I did the google on it and found a few possibilities, but I'm curious to hear some real life experiences and opinions. Thanks! What issues / pitfalls must be considered when overriding equals and hashCode? Voldemort couldn't kill Harry as long as he called the Dursleys home. Why didn't he just murder the Dursleys? This would prevent Harry from being able to live there. What to include in my portfolio? I am a relatively recent graphic design graduate. I have been working at a small printing house for about two years, but will soon be interviewing for a different position in another city.  My question is about what to include in my design portfolio. When I was in school, my professors all insisted that work included in a portfolio should be 100% original: my original photography, my original logos, my original layout, my original written content etc. However, at my current office, we rely heavily on client-supplied logos, type content, and photography—and stock photography (shutterstock, etc).  What do other designers include in their portfolios? Has anyone else had this issue and can I reasonable include these more recent projects in my portfolio if I label them appropriately (something like "layout design")? How to set up beamer to grey out past items but hide future items? I know about beamer's  feature \setbeamercovered{invisible} and \setbeamercovered{transparent} to hide or grey out upcoming item's . But is there some way to have past items greyed (transparent) and future items hidden (invisible), so that only the current item is black/highlighted? And the best would be if on or 1 slide after the last all the item's could be visible highlighted. Something like this:   [grey] past 1 [grey] past 2 current [hidden] future 1 [hidden] future 2 [hidden] future 3   Is there any easy way of doing this? Conformally Map Region between tangent circles to Disk