That can be silly question but I really don't know the reason.         // i is compiled as an int     var i = 5;      // s is compiled as a string     var s = "Hello";      // a is compiled as int[]     var a = new[] { 0, 1, 2 };      // expr is compiled as IEnumerable&lt;Customer&gt;     // or perhaps IQueryable&lt;Customer&gt;     var expr =         from c in customers         where c.City == "London"         select c;      // anon is compiled as an anonymous type     var anon = new { Name = "Terry", Age = 34 };      // list is compiled as List&lt;int&gt;                                  var list = new List&lt;int&gt;();   If so, why C# needs integral types like int, string, int[], List&lt;&gt; ? If we can do that only with var keywords, why are there integral types?   Another way,  What is the difference between these ?  var s = "Hello"; string s = "Hello";
After discussion with colleagues regarding the use of the 'var' keyword in C# 3 I wondered what people's opinions were on the appropriate uses of type inference via var?  For example I rather lazily used var in questionable circumstances, e.g.:-  foreach(var item in someList) { // ... } // Type of 'item' not clear. var something = someObject.SomeProperty; // Type of 'something' not clear. var something = someMethod(); // Type of 'something' not clear.   More legitimate uses of var are as follows:-  var l = new List&lt;string&gt;(); // Obvious what l will be. var s = new SomeClass(); // Obvious what s will be.   Interestingly LINQ seems to be a bit of a grey area, e.g.:-  var results = from r in dataContext.SomeTable               select r; // Not *entirely clear* what results will be here.   It's clear what results will be in that it will be a type which implements IEnumerable, however it isn't entirely obvious in the same way a var declaring a new object is.  It's even worse when it comes to LINQ to objects, e.g.:-  var results = from item in someList               where item != 3               select item;   This is no better than the equivilent foreach(var item in someList) { // ... } equivilent.  There is a real concern about type safety here - for example if we were to place the results of that query into an overloaded method that accepted IEnumerable&lt;int&gt; and IEnumerable&lt;double&gt; the caller might inadvertently pass in the wrong type.  var does maintain strong typing but the question is really whether it's dangerous for the type to not be immediately apparent on definition, something which is magnified when overloads mean compiler errors might not be issued when you unintentionally pass the wrong type to a method.
Up until now, I implemented all-against-all collision detection in my games. It worked fine.  But I reached a point where implementing this kind of collision detection, makes the game run poorly, because there are two many objects to iterate through and check for collision.  I have searched this site and found something about 'uniform grids'. But I didn't completely understand what it is and how to implement it. Tried to Google it but nothing easy enough to understand came up.  I am a beginner to 2D-game programming. Do you mind trying to explain to uniform-grids, or link me to some good tutorial?  Thanks a lot Coupon collector problem with partial collection of a specific set of coupons I am very new in probability and combinatorics and have a naive question around a variation on the coupon collector problem with partial collection.   Lets assume we have a box with 45 coupons labeled 1-45. Now in this case I would like to adjust the CCP such that I can calculate the expected value (amount of draws necessary) to collect 10 specific items. For example item 1-10. How do I adjust my model such that I can calculate the amount of draws necessary to collect each item n times.   I assume that I have to adjust CCP2 in following post () to include the probability that I catch one item is 10/45.   All tips and tricks are welcome!  Thanks for your help How much to tip in the United States? Google Chrome PPA upgrade invalid signature QR factorization of complex matrix If you have two complex numbers $a,b$ how can you find the QR factorization of   $ M = \begin{bmatrix}        aI_n\\          bI_n \end{bmatrix} $,  I can't seem to be able to do it. I tried an earlier trick, but I now know it's not necessary true for complex numbers. Is there anyway to do this?  I think if I use a Givens algorithm I should be able to reduce it to a QR factorization. Carry over long sequence of missing values with Postgres I have a table like this:  create table foo (foo_label text, foo_price int, foo_date date);  insert into foo (           values           ('aaa', 100,  '2017-01-01'),           ('aaa', NULL, '2017-02-01'),           ('aaa', NULL, '2017-03-01'),           ('aaa', NULL, '2017-04-01'),           ('aaa', 140,  '2017-05-01'),           ('aaa', NULL, '2017-06-01'),           ('aaa', 180,  '2017-07-01')         );   As you can see a few values on the foo_price column are missing.  What I need is that missing values get filled up with the "previous" available value in this way:   foo_label | fixed_foo_price | foo_date -----------+-----------------+------------  aaa       | 100             | 2017-01-01  aaa       | 100             | 2017-02-01  aaa       | 100             | 2017-03-01  aaa       | 100             | 2017-04-01  aaa       | 140             | 2017-05-01  aaa       | 140             | 2017-06-01  aaa       | 180             | 2017-07-01   My attempt:  select      foo_label,      (case when foo_price is null then previous_foo_price else foo_price end) as fixed_foo_price,     foo_date from (   select        foo_label,        lag(foo_price) OVER (PARTITION BY foo_label order by foo_date::date) as previous_foo_price,        foo_price,       foo_date       from foo ) T;   As you can see from here:    It doesn't fill completely the '100' series.  Any idea how can I get the wanted result? What is the result of $ \lim_{n \to \infty} \frac{ \sum^n_{i=1} i^k}{n^{k+1}},\ k \in \mathbb{R} $ and why? What damage will powering down instead of shutting down do? Let G be a group, where $(ab)^3=(a^3)(b^3)$ and $(ab)^5=(a^5)(b^5)$. Prove that $G$ is abelian group.  Thank you in advance. Any help is appreciated. Simultaneously merge multiple data.frames in a list Polygon label repeated for each tile Stripped out bottom bracket The bottom bracket of my bike was completely stripped to the point that when you push the left side crank arm, the right crank moves and you can see the bottom bracket lock move out the frame. The bike shop tried putting Teflon tape but it's temporary. It's a 26' xc hard tail. For all I know both sides of the bottom bracket(square tapered) are stripped clean hence the Teflon tape put by the previous owner. Can I fix the problem by changing into a hallow tech cranks because it works like a thread less bb, or should I just buy a thread less square tapered bb? Any suggestion on what to do? Press space to continue How do I stop a bash script until a user has pressed Space?  I would like to have the question in my script     Press space to continue or CTRL+C to exit   and then the script should stop and wait until Space is pressed. How many RSA keys before a collision? I was wondering how many possible private/public keys exist? If a million people – for whatever reason – would try to generate 5 keys each in the same minute (on the same date and time) is there a high chance of collision? I believe GUID would suffer from that problem as many bits are reversed for date/time (and GUID version) and isn't meant to be used in that way.  Would RSA suffer from collisions if many keys were to be generated in the same moment? Is the amount of possible keys known? I know RSA is based on prime numbers and small numbers are to be rejected. I’m sure values above a certain amount of digits/bits are rejected because software may not be able to support those large values?  So: How many RSA keys before a collision? And if you would try to make many at the same time, would that give you a high chance of collision? How do I enable or disable the global application menu? I have read both two uses:   The combinations of a, b and c, taken two at a time, are ab, bc, ac. We can not help but noticing a harmonious combination between classic and contemporary.   Are both uses interchangeable? Perhaps substitute combinations among for combinations of in the first sentence? Any idea is appreciated. I want to show for $x\in\mathbb{R}$, the following inequality holds. $$ \left|\sin x\right|+\left|\sin (x+1)\right|+\left|\sin (x+2)\right|&gt;8/5. $$ This trigonometric inequality has been verified by Mathematica using the Plot commend. However, using the sum formula for the sine function seems doesn't work, and I cannot give a rigorous proof of it. Any suggestion, idea, or comment is welcome, thanks! Hide parameterless constructor on struct How to get all Perfect or Near-Perfect Matchings of a graph Bash script copy file to user's (wildcard) home dir