I use Cefsharp.Winform (). I Try Form.Close() but it error: System.InvalidOperationException: 'Cross-thread operation not valid: Control 'Form2' accessed from a thread other than the thread it was created on.'  Form1.cs  using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;  namespace TEST_CEF {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();         }          private void button1_Click(object sender, EventArgs e)         {             Form2 frm2 = new Form2();             frm2.Show();         }     } }   Form2.cs  using CefSharp; using CefSharp.WinForms; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;  namespace TEST_CEF {     public partial class Form2 : Form     {         public Form2()         {             InitializeComponent();             InitBrowser();          }          public ChromiumWebBrowser browser;         public void InitBrowser()         {             Cef.Initialize(new CefSettings());             browser = new ChromiumWebBrowser("www.google.com");             this.Controls.Add(browser);             browser.Dock = DockStyle.Fill;              browser.FrameLoadEnd += WebBrowserFrameLoadEnded;         }          private void WebBrowserFrameLoadEnded(object sender, FrameLoadEndEventArgs e)         {             if (e.Frame.IsMain)             {                 if (browser.Address.IndexOf("google") &gt; -1)                 {                     timer1.Start();                 }             }         }          private void Form2_FormClosing(object sender, FormClosingEventArgs e)         {             browser.Dispose();             Cef.Shutdown();         }         int time = 0;         private void timer1_Tick(object sender, EventArgs e)         {             time++;             if (time==3)             {                 this.Close();             }         }     } }
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.
The expected value of $1/(1+X)$ where $X$ has geometric distribution Let $X$ be a random variable with a geometric distribution with parameter $p$.       Calculate $\Bbb E[1/(1+X)]$   I've looked at answers online but still do not understand how to solve this.   Specifically, I do not understand how to to get from $$\frac{p}{1-p} \sum_{x=0}^\infty (1/(1+x))((1-p)^x+1)$$  to  $-p\ln(p)  /(1-p)$. Gmail, how to forward email to group using a filter How Does One Transfer A Steam Game? I have a failure to transfer my game from one HDD to another, and one PC to another. I copied the entire Skyrim folder from one HDD to another. And told where to find it also. Steam did a huge check of my HDD.  But it ended up downloading most of the files anyway. It took a week to download Dawnguard, Hearthfire, and Dragonborn files along with my Hi-Res textures.  I did ask about it in chat. But I feel this could help me or somebody else.  This is the screen I am looking at after transferring my entire hard drive to to new one. Steam downloaded my games, including Skyrim even though my Skyrim data folder had all the data files for Dawnguard, Hearthfire, Hi-Res and Dragonborn.  I have my copied files and have got rid of everything not steam related. I just have my DLCs and they include my hires files.  This is what it looks like.    But I still get this :     What could be causing this? How can I rectify? And in future when one is migrating to a new PC, how can this be avoided?  EDIT::::::::::::::::: Removed everything : Here is how it looks :  Still the prompt as before Steam Error 15  (Side Note : I transferred all my Origin games just by copy/pasting. This really is not nice.)    EDIT 2 :::::::::::::::::::::  And one more EDIT  I tried getting game cache up to speed, but this is prompt I am getting. But I played the game, it was working, I could pick out my character and all, and escape from Helgen.  EDITED 3 :::::::::::::::::  How does one transfer a Steam game? A game that is heavily modded, will the backup a Steam Game option suffice? "Home page" or "homepage"? Is there a convention for the spelling of the name of the main page of a website? Should it be home page, with a space between the two words; or homepage, all one word? I would like to know if there are any other tenses or grammatical structures to use for speaking about the future apart from will (perfect tense included), going to, simple and continuous present.  I mean not the obvious ones. For example, simple present (I could never have imagined it could be used for the future).     My mom arrives tomorrow.   I go to the doctor at 4 o'clock this afternoon. I have 28,000 files of size 6.7 GB in the directory aaa/input. I need create TAR files in the directory aaa/output, such that each TAR file cannot exceed 1.9 GB, so I have to tar the 28,000 files into 4 TAR files (6.7/1.9) as Log_(current date)_01.tar Log_(current date)_02.tar ... etc.  such that each tarball is less than 1.9 GB. Is there a way to do this using a Unix script? I recently made my pen-drive bootable with Ubuntu 14.04. But I need to unboot my pen-drive now. I formatted my pen-drive once,But the size of the pen-drive still shows 2.25 MB. Whereas,this is an 8GB pen-drive. How can I get rid of this problem. I'm still using Windows 7. Get week of year in JavaScript like in PHP This question was recently split into different questions for each workaround. See   meta posts for more information.   Can you use NBT tags in commands? I’ve tried commands that normally work in Java Edition like: give @s minecraft:planks 30 1 {display:{Lore:[&quot;Wooden planks&quot;]}} give @s stone_pickaxe{Unbreakable:1b} give @s item_frame{EntityTag:{Invisible:1b}} summon villager ~ ~ ~ {Offers:{Recipes:[{buy:{id:&quot;emerald&quot;,Count:5b},sell:{id:&quot;diamond_sword&quot;}}]}} summon tnt ~ ~ ~ {Fuse:20s} How to fade one material into the other? Hello blender community.  Could someone please let me know how to fix this issue? I have one material for the whole face and a different one for the lips.  there's a noticeable edge that I want to get rid of. I just want it to have an ease fade instead of a sharp edge.   what's the best way to go about this?  Thank you in advance!    Finished Update  I wanted to give an update on how it was fixed with @hexbob6 and @Lemon 's help.    I needed two textures. One is the actual colored version and the 2nd is the black and white masked version. Hexbob6 described very well on the process here:   A: The node process on how to do it.    The B/W masked texture is going to be connected to the Fac of the mixed shader along with its UV coordinates. Make sure the image is on clip instead of repeat. the 1st shader is going to be the black part of the B/W masked texture. An important thing to note is if you have a texture already for the object, be sure to connect the other UV coordinates! the 2nd shader will be the white part of the B/W masked texture.   B: This section is the UV layout called "mainUV" where all the color goes.  C: This section is the B/W masked texture to focus on the lips.  D: Just the render view  E: Best way to texture something is to be able to see it in 3D view and texture paint.  F: Just showing that there are two textures to keep track of. One is the main UV and the 2nd is to focus on the lip.   That was it. Once again thanks to those who replied and helped me figure this problem. In the process I learned other things that I didn't know about blender even though I've been using it for years. Analysing Bounce Rate and Time on Page How would I import/export Blender's preferences? I constantly stay up to date with each new release of Blender, but this means my preferences are wiped clean each time. How do I export/import these preferences to avoid loosing my carefully crafted set up each time? Further customize color of hyperref links I have tried to find a way to customize how internal links are colored, but I don't yet have the expertise in finding and redefining commands. In the LaTeX example below, I describe how I would like to change the colors of various links. Any ideas or examples are much appreciated.  \documentclass{article}  \usepackage[backref=true]{biblatex} \begin{filecontents}{refs.bib} @book{cit1, title = {The backreferences should be yellow}, author = {Last, First} } \end{filecontents} \bibliography{refs.bib}  \usepackage{color} \usepackage[usenames,dvipsnames,svgnames,table]{xcolor} \usepackage[colorlinks=true,             linkcolor=red,             urlcolor=blue,             citecolor=gray]{hyperref}  \begin{document}  \title{Title} \maketitle \tableofcontents \listoffigures  \section{Table of content's links should be green} \label{s1} All text, captions, and section headers after the list of figures should be black. The citation links should be gray.\autocite{cit1} \subsection{Table of content's subsections links should be orange} Internal links like this section link \ref{s1}  or this figure link \ref{f1} should be blue.  \begin{figure}[h] \caption{List of figures links red} \label{f1} \end{figure}  \printbibliography  \end{document} How can I modify the advanced search form when my hook runs too early? I'm using  to modify the content of the form on the search page &mdash; I want to remove the "phrase" and "not" fields, and restrict the "only of the types" checkboxes to a hand selected list of types.  I have the following code, which is being called and which I think should work:  function MYMODULE_form_search_form_alter(&amp;$form, &amp;$form_state, $form_id) {     unset($form['basic']);     unset($form['advanced']['keywords']['phrase']);     unset($form['advanced']['keywords']['negative']);     unset($form['advanced']['type']);     $form['advanced']['type'] = array(         '#type' =&gt; 'checkboxes',         '#title' =&gt; t('Only of the type(s)'),         '#options' =&gt; array(             'blog' =&gt; 'Blog entry',             'event' =&gt; 'Event',             'news' =&gt; 'News article'         )     );     // print_r($form);     // die; }   Except  gets to the search form after my form alter hook runs, so I don't get a chance to modify any of the form elements that it's adding.  I'm running Drupal 7.22.  How can I modify the advanced search form when my module hook runs before the hook that defines the advanced search form? What CMYK values should I use for rich black, and how should I handle tints/shades? I'm working on a full color piece in Illustrator which has a few large black and grey areas.  I'd like the black to be a rich black. I was thinking c30 m30 y30 k100. What is the best ways to match my gray areas? Beamer continue block in next column Why are hard drives never as large as advertised? From all the hard drives I have bought, they never seem to be as large as the advertised size; from 320 GB down to 290 GB, from 500 GB down to 450 GB, etc. Is there a technical reason for this? How can I make a bootable, unattended USB restore disk? I have a load of 14.04 kiosk systems, halfway across the country. These are horrible little integrated devices. I need to upgrade them all to 16.04 to support a new software stack. do-release-upgrade works half the time. The other half it destroys the install. In addition, the CPUs are really slow and  network connections at some sites are also pretty shoddy. So even when it works, upgrading takes a long time.  So new plan. I can make a fully-installed system image for each kiosk in Virtualbox, or LXC, or whatever. I need a way to get these images unpacked onto the systems.  The main problem here is there are very few technical people available at the other end. And I don't want to fly 200 miles to do this myself. I need something that is almost completely automated and doesn't require a keyboard.  I'm imagining a scenario where:   I make a system image for each kiosk I make a bootable USB drive for each kiosk and copy on the kiosk image. I label each and post them. At the other end, a staff member with physical access to the USB ports just plugs in the right drive and reboots. The bootable element of this then writes and expands the disk image.   It's that "bootable element" that I'm looking for. I was expecting that something like this might already exist (for bulk reimaging installations) but it's possible I'm in new territory. Anything that gets my images installed without manual interference (past plugging it in) gets points.  As far as I know, options like Clonezilla require somebody with a keyboard to tell it what to do. I need something that doesn't require a keyboard, just gets on and does it. How do the Hat Dash points work? How to write the Fibonacci Sequence? I had originally coded the program wrongly. Instead of returning the Fibonacci numbers between a range (ie. startNumber 1, endNumber 20 should = only those numbers between 1 &amp; 20), I have written for the program to display all Fibonacci numbers between a range (ie. startNumber 1, endNumber 20 displays = First 20 Fibonacci numbers). I thought I had a sure-fire code. I also do not see why this is happening.  startNumber = int(raw_input("Enter the start number here ")) endNumber = int(raw_input("Enter the end number here "))  def fib(n):     if n &lt; 2:         return n     return fib(n-2) + fib(n-1)  print map(fib, range(startNumber, endNumber))   Someone pointed out in my Part II (which was closed for being a duplicate - ) that I need to pass the startNumber and endNumber through a generator using a while loop. Can someone please point me in the direction on how to do this? Any help is welcome.    I'm a learning programmer and I've run into a bit of a jumble. I am asked to write a program that will compute and display Fibonacci's Sequence by a user inputted start number and end number (ie. startNumber = 20 endNumber = 100 and it will display only the numbers between that range). The trick is to use it inclusively (which I do not know how to do in Python? - I'm assuming this means to use an inclusive range?).  What I have so far is no actual coding but rather:   Write Fib sequence formula to infinite Display startNumber to endNumber only from Fib sequence.   I have no idea where to start and I am asking for ideas or insight into how to write this. I also have tried to write the Fib sequence forumla but I get lost on that as well.