- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
The WTF is fine and all, but why hasn't this problem been fixed after the first time it was caught? It's literally copy pasting one line of code into the return value.
Admin
Quite a lot of French there, really. But you go ahead with your fixation on Minorca -- Spanish cuisine needs all the help it can get.
Besides, any fule no that mayonnaise was, in fact, invented by Hellman's, and is thoroughly disgusting.
Admin
Yeah, right. This might've been true years ago. In the meantime - depending on context and usage of course - you can have Java code that runs faster than C code on modern processors.
How can this be, you ask?
The JVM's JIT (Just In Time) compiler can optimize the instruction set for the processor it's running on.
You can't do this for natively compiled code, because you'd risk that your code won't run if not used on the, say, Pentium Dual Core it was compiled for. More likely you'd have to compile for the original Pentium or even in 386 mode to assure backwards compatibility. The only system where this does not hold true is probably Gentoo Linux, where everything is always built from scratch (and optimized for the present processor) :o)
Admin
You are from the US and have never been outside them, right?
The most important reason for deprecating the getters of java.util.Date is that more than half of the people living on this planet are not using the gregorian calendar. This is a fact that somehow seems to escape many people, especially when they themselves come from so-called "gods own country"...
The most important reason for deprecating the setters is that Date was originally (and stupidly!) made mutable, despite the fact that it is thought of and used as a value object (i.e. nearly like a primitive value) by most people.
If you do not know why this is a problem (or why e.g. String thankfully is immutable in Java) I recommend the great book "Effective Java" by Josh Bloch.
Admin
If you're talking about read access (i.e. getters) to java.util.Date, you might have a point if not more than half of mankind (your "minorities"!) used other calendars than the gregorian one... and Date was not designed to support other calendar formats.
might be true for you and in this moment (and for a few years to come), but this is very likely to change. You can only pray that the average chinese or indian developers in the future will not be such ignorant blockheads, because otherwise you will have to learn their calendars, because they are "all almost everyone needs"...The setters of java.util.Date are deprecated for a still better reason: Date (like String for example) should by all means be immutable. And by deprecating the setters it now thankfully is.
Admin
The proper way to invalidate the cache would be to set a timer to trigger at the change of year. This being Java, you'd naturally do this using another thread, and unavoidably somebody's going to either create one for every call, or forget to reset it for the next year...
Admin
// this is about as retarded i can make a caching of a integer representing the currentyear. // Sad thing is, I have almost made one of these to optimize an old crappy application. // You can actually use the HttpRuntime cache in a normal winforms app too :p
public static Cache Cache { get { if( HttpRuntime == null ) HttpRuntime = new HttpRuntime(); if( HttpRuntime == null ) return FILE_NOT_FOUND; return HttpRuntime.Cache; } }
private static object _cacheLock = new object(); public static int GetCurrentYear() { object o = Cache.Get("CurrentYear"); if( o == null ) { lock(_cacheLock) { o = Cache.Get("CurrentYear"); if( o == null ) { int currentYear = DateTime.Now.Year; DateTime nextYear = new DateTime(DateTime.Now.Year, 1, 1); Cache.Add("CurrentYear", currentYear, null, nextYear, TimeSpan.Zero, null, null); return currentYear; } } } return o as DateTime; }
Admin
...and all this crap just to get the year from the system date. They could actually open a cmd-window in the background, type in "date" and extract the year from there. That could be quite Javaish WTFery.
Admin
When will they ever find out that the world doesn't consist solely of The States. WTF!
Admin
I would expect that from Bruce Schneier. But maybe by looking at that sentence the words would just disassemble to make the sentence more secure.
http://geekz.co.uk/schneierfacts/
CAPTCHA: bene - benvenuti in Italia
Admin
Not entirely true. While regulation may not have been a problem per se, I believe he ended up avoiding the Spanish Inquisition (who felt that Cerenkov radiation was downright luciferous, even though Cerenkov wasn't born yet.)
He avoided them by booking passage with his equipment on a Portuguese sailing ship, transferring the entire region to Gabon.
However, after a spate of accidents in later years, the entire Oklo facility was abandoned.
Admin
http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnorm&lang=all
Admin
That's probably because people who can't spell are almost as common here in the UK as in the USA. http://en.wikipedia.org/wiki/R%C3%B9m http://en.wikipedia.org/wiki/Rum#Etymology
Admin
Years ago, whilst working as tech support for a macintosh database system, I had a user who's date/time fields were not working.
It seems she was making a database of tombstones, some of which had dates before Jan 1st, 1900 (or was it 1901?)...
Just as the Y2K bug had to be delt with by banks in 1970, for 30 year mortgage end dates.
Admin
ROFL! No kidding man. For any decent sized table doing an SQL query to MySQL is FASTER than looking it up in a hash... And 'decent sized' is surprisingly small, like maybe 10k rows.
Admin
What it boils down to is moron programmers.
They are common, and should be treated as such.
Peasants! Burn 'em!
Admin
This is correct. especially in today's dev enviornment. With parallel computing it might be easier to recalculate the value than to to wait for a release of a value used by another core.
Admin
Three pages, and no one found TRWTF:
Why didn't someone just fix the damn issue?
Admin
TRWTF is that if it's known that it needs rebooting every 1/1, why does someone spend hours tracking someone down to explain the problem and ask them to reboot? Why isn't there a note in someone's diary (or better yet a chronjob) to reboot ASAP after midnight on New Year's?
Better yet (assuming you want it to cache the year), is there any problem with adding another method to the class?
Then it surely can't be that difficult to arrange for setCurrentYear() to be called once a year at 01/01 00:00 to fix it without a reboot