Browsing 7239 questions and answers with Jon Skeet
If it's going to be available to the client via Javascript, it's got to be available to the client in general. Now you could encrypt it, then decrypt it in the Javascript - but that's more of an obfuscation technique than anything else...... more 1/10/2014 12:41:26 PM
I don't think this does what you think it does: temp - size+2 I suspect you expect it to mean: temp - (size + 2) But it's really equivalent to (temp - size) + 2 I suspect you really want the call to be: size += nsgsout.Read(buf,... more 1/8/2014 2:42:32 PM
So if I call new Date().getTime() I will get a long value(time stamp) as UTC, not as local time, right? Well, it will give you the number of milliseconds since Jan 1st 1970 00:00:00 UTC, yes. It's not "in" UTC particularly; it's just... more 1/8/2014 4:02:03 AM
The only problem here is the brackets. An if statement is of the form: if (condition) body Currently you've got if (condition1) || (condition2) body which isn't valid. You just want: if (e.getSource() == start || e.getSource()... more 1/8/2014 2:11:11 AM
Well, you can create a new dictionary: Dictionary<string, MyObject> myNewObjectDictionary = myObjectDictionary.Skip(startNumber) .Take(count) .ToDictionary(pair => pair.Key, pair... more 1/7/2014 9:03:31 PM
Remember, I have no a priori knowledge of the input file encoding. That's the fundamental problem to solve. If the file could be using any encoding, then there is no concept of reading "line by line" as you can't possibly tell what... more 1/7/2014 8:20:53 PM
My question is, how does this actually cache the Array variable? The CLR caches it per type argument. Basically, EmptyHolder<int> is a different type to EmptyHolder<string> etc, and the type initializer is invoked... more 1/7/2014 5:51:33 PM
You're never populating the DataSet - you're creating a SQL command, but never executing it. You're not querying the database at all. It's not clear whether you really need a DataSet, to be honest - you could potentially just use a reader... more 1/7/2014 4:41:04 PM
int a; static int a; Both takes same memory No, they don't. The first takes up four bytes per instance of your class. The second takes up four bytes, whether there are 0 instances or 100 instances. The field is related to the type,... more 1/7/2014 2:27:17 PM
In your client code, you're reusing the same byte array over and over, then enqueuing a reference to it. You need to create a new byte array for each buffer: public void FillBuf(object sender) { var handler = (Socket)sender; ... more 1/7/2014 12:43:00 PM