Browsing 7239 questions and answers with Jon Skeet
You're assuming that you'll have one packet for each Send call. That's not stream-oriented - that's packet-oriented. You're sending multiple pieces of data which I suspect are coalesced into a single packet, and then you'll get them all in... more 2/24/2014 9:57:28 PM
You can't. int is a primitive value type - there's no such concept as a null value for int. You can use null with Integer because that's a class instead of a primitive value. It's not really clear what your method is trying to achieve,... more 2/24/2014 9:49:22 PM
It sounds like you want the total number of hours, in that 1.92 hours is 115 minutes (ish). In that case you want: double hours = (ts2 - ts1).TotalHours; ... you can then format that how you wish (e.g. to 2 decimal places). For... more 2/24/2014 9:14:53 PM
You've included the HTTP headers in your JSON string - you don't want those. Your json value should just be this: {"name":"test44","age":"66","gender":"B","dob":"10\/10\/2003","file":null} I've tested your code, and when including the... more 2/24/2014 8:55:32 PM
You're parsing "true," which is not the same as "true". Get rid of the comma in your invocation: java ScraperTestRunner1 true "/Desktop/imputfile.txt" Command line arguments aren't specified as a comma-separated list; they're... more 2/24/2014 7:48:47 PM
You can't explicitly catch the right exception type, but you could catch Exception and then check that it's a ContractException using reflection (rethrowing otherwise). That would be ugly to do everywhere, but you just need to do it... more 2/24/2014 7:18:44 PM
They're equivalent (assuming you actually change the values in the first one to 0, 1, 2, 3, 4.) Indeed, they'll even compile to nearly the same bytecode; Java bytecode doesn't have anything cunning to make this simpler, so the compiler... more 2/24/2014 6:34:20 PM
You're running into the common problem of what gets captured in an anonymous function. You're capturing i in the delegate, and that value changes over the course of your loop. You need a copy of i: for (int i = 0; i < count; i++) { ... more 2/24/2014 11:44:15 AM
It sounds like you just need to box each value, right? That's as simple as: object[] objectArray = boolArray.Select(b => (object) b).ToArray(); Or even: object[] objectArray = boolArray.Cast<object>().ToArray(); (As Cast... more 2/24/2014 11:22:11 AM
As soon as you look at HttpFileCollection's documentation, it becomes clearer... The indexer has a declared type of HttpPostedFile. Whereas GetEnumerator states: This enumerator returns the keys of the collection as strings. So... more 2/24/2014 10:11:43 AM