I'm trying to set the elements of an array to be equal to the square root of their index using threads. I know this can be easily done without threads, but I am trying to learn about threading.  When I run this code, A lot of the elements do not change from the default value of 0. And I can't figure out why.  class Program {     static double[] array = new double[100000000];      static void Main()     {         int threadCount = 8;         Thread[] threads = new Thread[threadCount];          for (int i = 0; i &lt; threadCount; i++)         {             threads[i] = new Thread(() =&gt; SquareRoot(i, threadCount));             threads[i].Start();         }         for (int i = 0; i &lt; threadCount; i++)         {             threads[i].Join();         }     }      static void SquareRoot(int start, int incrementSize)     {         for (int i = start; i &lt; array.Length; i += incrementSize)         {             array[i] = Math.Sqrt(i);         }     } }
I met an interesting issue about C#. I have code like below.  List&lt;Func&lt;int&gt;&gt; actions = new List&lt;Func&lt;int&gt;&gt;();  int variable = 0; while (variable &lt; 5) {     actions.Add(() =&gt; variable * 2);     ++ variable; }  foreach (var act in actions) {     Console.WriteLine(act.Invoke()); }   I expect it to output 0, 2, 4, 6, 8. However, it actually outputs five 10s.  It seems that it is due to all actions referring to one captured variable. As a result, when they get invoked, they all have same output.  Is there a way to work round this limit to have each action instance have its own captured variable?
There are two 'Library' directories in my OS X 10.11 installation, one being /Library/, the other being /System/Library/. What is the difference between different Library folders? It is possible to press ⎇ Backspace on macOS in order to delete the previous word (left of the cursor), and ⌘ Backspace to delete the previous line (left of the cursor). If you have an external keyboard with a "delete" key (or the "forward delete key"), or are able to emulate the delete key via software, it is possible to press ⎇ Delete to delete the word to the right of the cursor. However, perhaps surprisingly, it is not possible to press ⌘ Delete in order to delete the line to the right of the cursor.  Now, I have only been able to make this possible by emulating a ⌘⇧→ and then a Backspace with BetterTouchTool. However, I want to avoid doing something like this because BTT does not work at a "low enough level" for me – that is to say, the action is not entirely reliable.  Is there any official macOS way to delete the line to the right of the cursor? What should be in the sources.list for Kali Rolling Linux? This is exact content from my sources.list:  #  # deb cdrom:[Debian GNU/Linux 2016.1 _Kali-rolling_ - Official Snapshot amd64 LIVE/INSTALL Binary 20160830-11:29]/ kali-rolling contrib main non-free #deb cdrom:[Debian GNU/Linux 2016.1 _Kali-rolling_ - Official Snapshot amd64 LIVE/INSTALL Binary 20160830-11:29]/ kali-rolling contrib main non-free   I couldn't install the Synaptic package manager and was told to modify sources.list.  I googled a lot and added some repos into it and ran update and upgrade command only to see Kali crash... I had to recover it.  Please mention the exact content that should be there to ensure that Kali Linux works. Why are text format commands used inside braces? Most commands in Latex are written with the arguments inside braces following the command: \command{arguments}. But text formatting options, like \em, or \scriptsize are usually written inside the braces, like {\em some italicised text}. Why is this? What makes these commands different? I'm particularly asking because it seems to make standardisation - of which LaTeX really appears badly in need - more difficult. Antiresonance of multiple parallel decoupling capacitors: use same value or multiple values? My quesiton: Is it better practice to put same-valued capacitors in parallel of capacitors of different values to decouple the high-frequency noise caused by digital ICs? Background Digital IC need a decoupling capacitor close to their supply pins to ensure a stable voltage during power transients and to deal with noise (mostly to prevent noise generated by the IC to affect neighboring circuitry). It seems sensible to place a bulk capacitor (say 10-100uF), to act as an energy reservoir, and several smaller capacitors to deal with higher frequencies. The reason to place several small capacitors instead of just one is to deal with their Equivalent Series Inductance (ESL), which in practice, causes them to behave like an LC circuit. The effect of anti-resonance Yet, here is where best design practices and electronic myth seem to get mixed up and confusing to me. Most electronic engineers I have met like placing several decoupling capacitors of different values in parallel (with the smaller capacitors closer to the IC). The logic behind it is that the each capacitor takes care of a different noise frequency as depicted in Figure 1.  Figure 1: Impedance over frequency of three different value capacitors in parallel (cyan) vs their individual contribution (brown, blue, red). Image taken from . Note the small anti-resonance peak. It seams no major trouble , and the overall behavior of the three different capacitors in parallel is vastly superior to their individual decoupling capabilities. However, I have read in  by [Henry W. Ott] that placing capacitors of different values may cause a much greater antiresonance-peak which can be very harmful for our designs (see Figure 2). In fact, it amplifies any noise that falls into the anti-resoance frequency range, which is corroborated by .  Figure 2: from Electromagnetic Compatibility Engineering, by Henry W. Ott, section 11.4.4. The 15nH inductance makes reference to the capacitors ESL. I'm on ub20LTS and I really dislike how much top space the topmost bars use. Any idea on how to remove or reduce their numbers?  Edit: Thanks to everybody's support, this is how my workspace looks like now. I've :  Installed gnome-extensions for firefox. Turned off menu bar in ff. Installed dash to dock. Installed hide top bar.  This way you can better utilize your screen space. My WiFi adapter is not working at all, how to troubleshoot? When updating, I get the following error message:   W: The repository 'http://ppa.launchpad.net/mc3man/trusty-media/ubuntu xenial Release' does not have a Release file.   Here, I find another statement on this error:   This recommends removing certain PPAs; and, I'm not sure if I should do that since it might mean not getting the updates that I need.    Is this what I should do? Are these gerund sentences grammatically correct? I bought this book titled 2 Hari Taklukan Grammar, written by Edward Rahardian in Bahasa (Indonesian language) and mostly talk about gerund and infinitive. And these are some examples of the gerund sentences that I found.        His mother suggested having lunch before we leave.     I will try studying harder.     The car needs washing.     Your hair needs washing.     My teacher disliked me coming late.        Somehow those words sound unnatural for me because I've never heard those in daily conversations. As a learner, I only get exposed with English by watching TV series and any other entertainment resources.  So in my thought, they sound more natural like this:        His mother suggested to have lunch before we leave.     I will try to study harder.     The car needs to be washed.     Your hair needs to be washed.     My teacher disliked me to come late.       Are those sentences in the first group grammatically correct? And, is it normal for one to say them in normal/daily conversations? I have a laptop that has Windows 8 which I use for playing Minecraft. However when using the inventory, I have to hold my mouse to drag and pick the items and I don't like that.   I have tried switching mouses but that didn't work, is this possible to fix? Can we balance the whitespace above/below headings? In January, some additional whitespace  below h1, h2 and h3 headings,  more whitespace below the headers than above them.  Could we have the whitespace above the headings be more than the whitespace below them?  I find some posts a bit hard to read, like the current rendering on the left:   &nbsp; &nbsp; &nbsp; How to solve configure: error: readline library not found? I have an Ubuntu 10.04 LTS server with a minimal install that I want to compile postgres on. With the minimal install the server did not have gcc so I had to do an apt-get install gcc but now I keep getting this error from the postgres ./configure.  configure: error: readline library not found   I can't seem to find the name of the package that contains the readline library. So I have two questions.   What is the name of the package that contains readline? Is there some way given the error message above for me to find the associated package from its standard name? Is it touch(1) from coreutils-8.4-37.el6.x86_64 or my brain which is broken?  $ touch abc $ LANG=C stat abc   File: `abc'   Size: 0               Blocks: 0          IO Block: 4096   regular empty file Device: fd04h/64772d    Inode: 10485773    Links: 1 Access: (0664/-rw-rw-r--)  Uid: (3060399/ nodakai)   Gid: (  418/   quant) Access: 2016-10-14 18:42:06.189751847 +0800 Modify: 2016-10-14 18:42:06.189751847 +0800 Change: 2016-10-14 18:42:06.189751847 +0800 $ touch -a abc $ LANG=C stat abc   File: `abc'   Size: 0               Blocks: 0          IO Block: 4096   regular empty file Device: fd04h/64772d    Inode: 10485773    Links: 1 Access: (0664/-rw-rw-r--)  Uid: (3060399/ nodakai)   Gid: (  418/   quant) Access: 2016-10-14 18:42:17.374235446 +0800 Modify: 2016-10-14 18:42:06.189751847 +0800 Change: 2016-10-14 18:42:17.374235446 +0800 $ touch --help | grep 'access time'   -a                     change only the access time   As you see, it was not only atime but also ctime which was updated by touch -a !?!?  The filesystem is ext4 over LVM if that makes any differences. Since there are  complex numbers (2 dimensions) and quaternions (4 dimensions), it follows intuitively that there ought to be something in between for 3 dimensions ("triernions").   Yet no one uses these. Why is this? Compact subset in colimit of spaces I came up some definitions I have sort of difficulty to distinguish. In parentheses are my questions.   $\dfrac {x}{0}$ is Impossible (  If it's impossible it can't have neither infinite solutions or even one. Nevertheless, both $1.$ and $2.$ are divided by zero, but only $2. $ has infinite solutions so as $1.$ has none solution, how and why ?) $\dfrac {0}{0}$ is Undefined and has infinite solutions. (How come one be Undefined and yet has infinite solutions ?) $\dfrac {0}{x}$ and $x \ne 0$, it's okay for me, no problem, but if someone else wants to add something about it, feel free to do it. How do I add myself back as a sudo user? I clean-installed Ubuntu 11.10 today, and then installed VirtualBox.  This required me to add myself to the vboxusers group, and since 11.10 seems to no longer have a graphical app to add users to a group, I ran the following command:  sudo usermod -G vboxusers stephane   This is a problem.  I now see what I should have run instead is:  sudo usermod -aG vboxusers stephane   The end result is I'm no longer in the groups I should be in.  Including whatever group is required to run "sudo".  When I run any command as sudo now, I get the following:  $ sudo ls [sudo] password for stephane:  stephane is not in the sudoers file.  This incident will be reported.   Is there a way to fix this, or do I need to re-install from scratch again? I have used quite some time searching for a solution to my compile problem. The document worked fine untill yesterday. After adding some new references, compiling stoped working properly. I have however used latex only for a few months, so the error might be an easy fix.   My error code in the blg file is:    [836] Utils.pm:209&gt; ERROR - BibTeX subsystem:  C:\Users\andre\AppData\Local\Temp\yb9w7ETEpQ\thesisbiblo.bib_16800.utf8,  line 1375, syntax error: found ",", expected one of: number, name (entry  type, key, field, or macro name), end of entry ("}" or ")") or quoted string  ({...} or "...").    I have biber 2.11 and miktex 2.9 and thought it could have been the cache file as suggested in a previous thread with 2.11 versions, but it did not do the trick to delete that either.  Thanks  This is how my "main" document looks like:  \documentclass[man,12pt,a4paper,babel,english]{apa6}  \usepackage{babel,duomasterforside} \usepackage[utf8]{inputenc} \usepackage[hidelinks]{hyperref}  % Math syntax  \usepackage{siunitx} \usepackage{upgreek} \usepackage{gensymb} \usepackage{amsmath} \usepackage{mathtools} \DeclarePairedDelimiter{\abs}{\lvert}{\rvert}  % Figures \usepackage{graphicx} \graphicspath{{Figures/}} \usepackage{float} \usepackage{subcaption}  % Biblography and citing \usepackage[style=apa,backend=biber,sortcites=true,sorting=nyt,autocite=inline,uniquename=false]{biblatex} \addbibresource{thesisbiblo.bib}  % Frontpage \usepackage{pdfpages}   \begin{document}  % Frontpage      \includepdf[pages=1-]{titlepage.pdf}  % Abstract \input{Abstract} \newpage  % Table of contents \tableofcontents \newpage  % Document \input{Introduction.theory} \newpage \input{Methods} \newpage \input{Results} \newpage \input{Discussion} \newpage \input{Conclusion} \newpage  % References                         \printbibliography  \end{document} Schengen area 90 days limit: Can I leave on the 91st day? Can anyone tell me if the 90 days is in fact 90 nights? Can you leave the Schengen area on the 91st day? Or are you only allowed 89 nights and you are required to leave on the 90th day? How do you become friends with someone?