Dates in Java

how to get a non-deprecated time in java:

Date dateFromMessage = new Date(msg.getTimeAsMillis());
String expectedDateString = “1/19/05 2:50 PM”;

DateFormat d1 = DateFormat.getInstance();
d1.setTimeZone(TimeZone.getTimeZone(“America/Los_Angeles”));

String dateFromMessageAsString = d1.format(dateFromMessage);

dtm.publishSubtestResult(
dateFromMessageAsString.equals(expectedDateString),
dateFromMessageAsString + ” == ” + expectedDateString
);

Commenting Out Code

I think I scared myself, when in normal conversation(and by normal, I mean normal for a software engineer), I used the word OBERON. Yep, that’s right [the bane of my existence back in compilers class in college]. And not only did I say it, I was complaining that Java is not more like Oberon.

“If only Java allowed nested comments like oberon…”

Because, as it seems, Java does not appear to have any embedded language features that let you quickly and non-destructively comment out a large block of code which includes /* c style comments */, function headers, and does not necessarily compile where you are teleporting it to. If it were C, I could just add a #if(0) around it. Two short lines, and the entire function is commented out, non-destructively.

The only way I’ve successfully commented out entire functions is the macro and/or search and replace beginning of line technique to slash-slashify every single line. But that’s ugly ugly. ESPECIALLY when the file already contains //ified code, which is NOT my doing…and you can’t tell them apart. So then you start having to do something really ugly like //JRW// as the prefix for each line. Couldn’t I just if-zero it all out of my hair? I don’t want to be spending my time right now figuring out what includes I need, and what to do with these paramaters, and local variables I don’t have here…

or if only you could do nested c-style comments like oberon. (* cuz comments like this (* could be nested and *) that made everything happy, cuz you could comment out code with comments in it…and easily and cleanly… *)