I feel like there is some silly syntax error going on here but I can't for the life of me figure it out. I am trying to sort a big list using multiple properties.   Method A:  IOrderedEnumerable&lt;myClass&gt; orderedList = myList.OrderByDescending(e =&gt; e.Tier);  orderedList = orderedList.ThenByDescending(e =&gt; e.Priority[0].Value); orderedList = orderedList.ThenByDescending(e =&gt; e.Priority[1].Value); orderedList = orderedList.ThenByDescending(e =&gt; e.Priority[2].Value);  orderedList = orderedList.ThenByDescending(e =&gt; e.Score);   Method B:  IOrderedEnumerable&lt;myClass&gt; orderedList = myList.OrderByDescending(e =&gt; e.Tier);  for (int i = 0; i &lt; 3; i++) {     orderedList = orderedList.ThenByDescending(e =&gt; e.Priority[i].Value); }  orderedList = orderedList.ThenByDescending(e =&gt; e.Score);   The above Method A works perfectly, but Method B (the way I need to do it) keeps returning an index out of range error, even though it should be the exact same (i.e. 0, 1, 2)  In both instances e.Priority represents a list of 3 KeyValuePairs. I don't understand why Method B is returning an out of range error.
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?
I'm considering buying a solid state drive for my Unibody White MacBook 2010. The trouble is, I have no idea what to look for. What kind of connector am I looking for? (SATA?) What size? I'm told to get the kind that Apple uses so that I don't void my AppleCare warranty. What model/brand(s) would that be? I'm wondering how it is correct to structure sentence and what punctuation should be used. In particular, is the next sentence correct:     I was wondering if there's any progress on the issue.    Or should I put a question mark in the end of it. Also, can it be restructured to:     I was wondering: is there any progress on the issue? Confusion between Voltage gain & Voltage gain in decibels (dB) The definition of voltage gain is \$V_{\text{out}}/V_{\text{in}}\$.  However, I read some articles about the gain in decibels, and I have a confusion now.  Here is an article about it:   Here, I understand the definition of Power gain in decibels, which is $$ \text{Gain} = 10 \log \left( {P_{\text{out}} \over P_{\text{in}}} \right)\text{ dB} $$  However, I can't understand why Voltage gain in decibels is $$ 20 \log \left( {V_{\text{out}} \over V_{\text{in}}} \right)\text{ dB} $$  If \$ 20 \log \left( {V_{\text{out}} \over V_{\text{in}}} \right)\text{ dB} \$ is derived from $$ 10 \log {\left( {V_{\text{out}}^2 \over R_{\text{out}}}\right) \over \left({V_{\text{in}}^2 \over R_{\text{in}}}\right) }\text{ dB} $$ then this is the power gain, not the voltage gain, isn't it? However, the Wikipedia says it is a formula for the Voltage gain in decibels. I thought the voltage gain in decibels would be \$ 10 \log \left( {V_{\text{out}} \over V_{\text{in}}} \right)\text{ dB} \$. Actually, the example section in that linked page uses voltage gain \$ V_{\text{out}} \over V_{\text{in}} \$.  Why did \$V^2/R\$ suddenly come out from the voltage gain in decibels? Script-r Symbol The near-ubiquitous undergraduate reference on electrodynamics, "Introduction to Electrodynamics" by David Griffiths make extensive use of a script-r symbol, defined to be \vector{\scriptr} \equiv \vector{r} - \vector{r}^{\prime} and looks like:    Although the question of how to produce such a symbol in LaTeX is quite a common one I am yet to find a satisfactory solution.  The closest I've found is from the physymb package and uses the Calligra fonts:    Sadly, there is not a bold variant of this character and it is far more cursive than I would like.  I am hence wondering if there are any better facsimiles. What is the joint distribution of $Z=\min(X,Y)$ and $I_{Z=X}$? Has drupal abandoned drush? I've been away from drupal for 2-3 years. I just came back around and installed drush via composer () and now every time I try to use drush I get a message telling me that I should be using composer:  ~/sites/d7 $ drush version  Drush version : 9.0-dev-gd4a3872 ~/sites/d7 $ drush dl drupal-7.x  [notice] dl has been deprecated. Please build your site using Composer. Add new projects with composer require drupal/[project-name]. Use https://www.drupal.org/project/composer_generate to build a composer.json which represents the the enabled modules on your site.   I downloaded drupal 8 following these , but when I try to use drush in that project I get this message:  ~/sites/cfbtv/web $ drush dl devel This codebase is assembled with Composer instead of Drush. Use `composer update` and `composer require` instead of `drush pm-updatecode` and `drush pm-download`. You may override this error by [error] using the --pm-force option.   Is there something wrong with my local env, or is drush a thing of the past now? Don't we have single sign-on for all Stack Exchange sites? I would like to use many sites in the Stack Exchange network, but I need to login to each site separately. Though it's easy, can't we solve this problem? I know each site has a different url :( but is there any way? I am very new to being able to use LaTeX to type up mathematical papers, and I just got my "system" set up. Currently I have installed TexWorks, and MikTex, and I have put together a 'hello world' article which seems to run well.   I have also used the syntax "\usepackage{amsmath}" and "\usepackage{amssymb}" in the beginning of my .tex file to write math symbols, only because some online tutorial said so.   My question is, firstly, are those the only packages I need to use for writing math, and secondly, I remember reading about some shortcuts(?) that can be used for writing math symbols, and/or user defined shortcuts that can be 'set' in the beginning so as to reduce the amount of LaTeX code needed to write mathematical symbols. However, I do not know if this is true, and if it is, how to go about 'installing' such a thing.   Does such a thing exist? Am I able to make my own shortcuts?  Thanks! Finding the limit of $(1-\cos(x))/x$ as $x\to 0$ with squeeze theorem How do I find:  $$ \lim_{x\to0}\frac{1-\cos(x)}{x} $$  Using the squeeze theorem.  Particularly, how would I arrive at its bounding functions?   If possible, please try not to use derivatives. Is infinity a number? Is infinity a number? Why or why not?  Some commentary: I've found that this is an incredibly simple question to ask &#8212; where I grew up, it was a popular argument starter in elementary school &#8212; but a difficult one to answer in an intelligent manner. I'm hoping to see a combination of strong citations and solid reasoning in the answers. Multi armed bandit for general reward distribution Adding values to a C# array Probably a really simple one this - I'm starting out with C# and need to add values to an array, for example:  int[] terms;  for(int runs = 0; runs &lt; 400; runs++) {     terms[] = runs; }   For those who have used PHP, here's what I'm trying to do in C#:  $arr = array(); for ($i = 0; $i &lt; 10; $i++) {     $arr[] = $i; } In what situation do you put a comma before "because"?   And, when do you not put a comma before "because"?   I've always assumed that you put a comma, because the clause introduced by "because" will always be independent, because it cannot stand on its own, because it wouldn't make sense on its own.   Is this the case? Could you think of an example where it doesn't take a comma? Unable to see anything after importing .obj file Let $B$ be a real Banach Space whose dimension is at least $2$, and let $S$ be a subset of $B$ that is an open ball. Is the complement of $S$ (with respect to $B$) always connected?  Idea One could then perhaps make use of the facts that every $2$-dimensional Banach space is homeomorphic to the Euclidean plane and that - for the Euclidean plane - my question has an obvious &quot;YES&quot; answer (since every open ball is the interior of a circle). Should I ask questions I already know the answer to and answer them myself? Propane gas fireplace pilot won't light Effect of switching response and explanatory variable in simple linear regression Let's say that there exists some "true" relationship between $y$ and $x$ such that $y = ax + b + \epsilon$, where $a$ and $b$ are constants and $\epsilon$ is i.i.d normal noise. When I randomly generate data from that R code: x &lt;- 1:100; y &lt;- ax + b + rnorm(length(x)) and then fit a model like y ~ x, I obviously get reasonably good estimates for $a$ and $b$.  If I switch the role of the variables as in (x ~ y), however, and then rewrite the result for $y$ to be a function of $x$, the resulting slope is always steeper (either more negative or more positive) than that estimated by the y ~ x regression. I'm trying to understand exactly why that is and would appreciate it if anyone could give me an intuition as to what's going on there. Why is Cat5/Cat5e Ethernet cable rated 100MHz? As the questions says, is there any specific reason why Ethernet cable is rated 100MHz?  For a 100Mbps Ethernet the data rate is 100Mbps, and the baud rate is 125Mbaud, because of the specific line coding that it uses. What is the relationship between 125Mbaud rating of data transfer and 100MHz rating of cable?  Thank you. Can I be automatically notified of prolonged blocking in SQL server? About once a week I have to resolve a blocking chain on a SQL Server 2005 database, caused by a long-lived read lock from an Access 2003 front-end. The lock is taken out whenever a user opens a certain form and is released once the user has finished scrolling through the form or closes it. Since many of our users open this form as reference, these locks stay around for a while. Any update to the table causes the blocking, and suddenly nobody can select from this table since they're all waiting on the first lock. This is quite a problem for us, since lots of apps rely on this data. I understand that this locking behavior is part of how Access works with linked tables.  I've been solving the problem from Activity Monitor,  whenever I find out about it. This is a problem not only because it takes me time to do it manually, but also because it's reactive. By the time I hear about it, it's already been a problem for a lot of people.  I'd like to know if there is an automatic way to check for these long-lasting blocking chains, and either be emailed or have the problem resolved automatically. The logic seems straightforward enough ("if any process matching this SELECT query has been blocking for longer than a minute, notify me/kill it") but I don't know how to implement this with SQL Server.  For what it's worth, I think the proper solution is to fix or rewrite the app. However, due to departmental politics, this is not an option for the next few months, so I'm looking for a stopgap.