The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

12

In the .NET Framework (of which the C# language is a part), most ordinary indexes (with the notable exception of file positions, which use a 64 bit signed long) are standardized to a signed, 32 bit int. So, for example, when you get the length of a string, you're being returned a number that can hold negative values, but in practice, will never be ...


8

The idea is that each iteration sets the least significance bit that isn't zero to zero -and only it. Since each iteration converts exactly bit from 1 to 0, it'll take as many iterations as there are non-0 bits to convert all the bits to 0(and thus v == 0 and the loop finishes). So, how does this work? Lets say that the bit at index n is 1 and that the bits ...


3

You can use Any which will return as soon as if there is an item in the collection, whereas using Length will actually iterate through the whole collection and count it, which is a bad idea. So Any is lazy, Length is eager. Most of the cases, Any is sufficient.


1

I'm answering my own question because I think I have found a way to avoid storing huge quantities of data. Of course it implies an approximation but, as I said, that is not important to have the exact number of unique visitors. What I need is a table that maps, for each place, the total number of visits. So, following the example I gave in the question, I ...


Only top voted, non community-wiki answers of a minimum length are eligible