Browsing 7239 questions and answers with Jon Skeet
Is it comparing based on datatype? Yes, exactly as it's documented to. From BigDecimal.equals: Returns true if and only if the specified Object is a BigDecimal whose value and scale are equal to this BigDecimal's. And from... more 2/12/2015 10:12:36 AM
You're subtracting component-wise (i.e. "this hour-of-day minus that hour-of-day, this minute-of-hour minus that minute-of-hour"). Don't do that - it won't work if the current hour-of-day is earlier than the hour-of-day of lastDate, or the... more 2/12/2015 8:39:59 AM
The problem is the version of Hadoop you're compiling against. You're compiling against hadoop-0.20.1-dev-core.jar. I've just downloaded that, and javap shows the following for the UserGroupInformation class: public abstract class... more 2/12/2015 8:37:29 AM
Yes, if userDomain is null, then userDomain.DomainName will fail. In C# 6, you can get over this with the null conditional operator: string userDomainName = userDomain?.DomainName ?? "None"; Before C# 6, you need: string... more 2/12/2015 8:15:55 AM
The two strings represent the same instant in time - it's just that one has a different UTC offset than the other. That's to be expected - a Date only represents a point in time, and it looks like you've set up your SimpleDateFormat using... more 2/11/2015 7:57:11 PM
You're specifying a SqlDbType of Date - that doesn't have a time. So when the driver is converting the parameter value into the desired type, it's removing the time part. You're also converting DateTime.Now into a string for no obvious... more 2/11/2015 6:10:09 PM
Look at your constructor: SnakeBody(int x, int y){ x = this.x; y = this.y;} That's copying the value from your instance field to the parameter, in both cases. In other words, you're overwriting the useful data (the value... more 2/11/2015 5:31:34 PM
No. You can't create user-defined conversions which don't convert either to or from the type they're declared in. The closest you could easily come would be an extension method, e.g. public static bool ToBoolean(this string text) { ... more 2/11/2015 5:04:37 PM
Will the re-thrown exception maintain the exception type that originally entered the catch clause? Yes - it will rethrow the exact same exception object. You need to differentiate between the compile-time type of ex (which is... more 2/11/2015 4:35:09 PM
rtserver-id isn't a valid identifier - so if you want it as a field/property name, you need to quote it. You can see this in a Chrome Javascript console, with no need for any Java involved: > var aClientEnv = { sessionId: "",... more 2/11/2015 12:56:10 PM