- 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
Don't worry about it. With the 99942 Apophis impact scheduled for 2036 we'll neatly and conveniently not have to concern ourselves with date rollover issues for a long time... At least not until we rebuild all the way up from the stone age again.
Admin
but you missed
Admin
Admin
Admin
..when all they really had to do was to algorithmically capture one of those graphical perpetual calendars like...say: http://en.wikipedia.org/wiki/File:P%C3%A5sktavla_ur_Liljegrens_Runl%C3%A4ra_(ur_Sverige_Runinskrifter).png
Admin
I've been looking at a legacy system for a replacement.
Turns out that the original designer stored dates as integers and the application didn't enforce any date checking.
The impossible dates such as April 31 I can handle by setting to the first of the next month. But it turns out that sometimes people input dates as y-m-d and sometimes y-d-m.
I guess that if nobody has cared about work being logged too early or too late then I'll just take the data as it is.
Admin
Some of us know what readable code is. For example:
if (! ($a = ($b=getResult($c)) ? (!floor($d/2)==$d/2) : $e^45) ) { // do something doSomething($a); }
This could be easily worded as "if the assignment of a as the result of b getting a result from passing c to getResult check to see that d is an even number and negate or else e to the 45th exponent negated then DoSomething with the result stored in a".
Look at how much I accomplished with a single line of code!
Admin
One of our commercial products takes daylight-saving time into account. A few years ago when the decided to change the dates for DST, we had to make a new release to support the changes. Even though the engineers knew the change was temporary, they replaced the old hard coded dates with new, hard coded ones. That way we needed to re-release a new version once again when the law expired.
Admin
More so than any other line of code, I believe that
describes the skill of our beloved developer best.CAPTCHA: abigo. Y2K was indeed abigo problemo.
Admin
TRWTF are:
Admin
Until recently in Israel, the specific dates when DST started and ended for any year was decided by the Ministry of the Interior. Because of the company's schedule, sometimes it took effect when we weren't open and we'd have to enact it retroactively! Talk about a huge headache.
Admin
Admin
Oh, did you work for DEC^WCompaq^WHP^WWhatever-they're-called-today?
http://h71000.www7.hp.com/openvms/products/year-2000/leap.html
Admin
This article made me want to quote Tyler Durden: "Why would anybody want this shit job?"
Admin
Sure. All you need now is a Runes recognition library.
Admin
With a name like Tim, you're probably from Canada, which is just like the US. Tim Horton's anyone?
We don't care about any other countries and their little problems.
Admin
You forgot the fact that all months start with day 0.
Admin
If they don't know whether the dates are y-m-d or y-d-m, then they have no idea what they mean now, never mind what they mean once migrated into a new system...
Admin
So, have we gotten past the whole "VB is TRWTF" thing yet?
Have I marked this comment for deletion?
Admin
File Not Found
Admin
It only takes 6 weeks after all.
Admin
Confirmed! 29/02/2008 and 02/29/2008 are both valid dates for the IsDate function whereas the original version only allows the mm/dd/yyyy format.
Admin
TRWTF is a bool function with a VARIANT type.
Admin
Admin
Why?
Admin
Well, it's just you and a lot of other people, excluding the programmer. That's kind of the point.
This kind of thing happens in lots of places, some not so obscure: SpamAssassin managed to insert a check that the year of a mail was of the form 200[0-9], AND misdocument it, AND when discovered in january 2010 just change to expire in 2020 instead ... all that just beside the other function that checks that the date is not too far in the past -- that function manages to compare to the day's date!
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6269
Admin
That's called job security. They should get a bonus.
Admin
Admin
Not all of the boxes were on the same version of dst (thanks Congress!). Nor did the installers make a note of which firmware was in use. The work around was to change an offset variable in a table if a box was late with its data on any of the four (thanks again Congress!) dst changeover dates.
Admin
Inconvenience?!?
More like "license to print money!"
Y2K issues were a windfall, if you knew what you were doing in 1999.
Seriously, 2 pages of comments, and not one consultant sounding off here?
Sorry for your lots, y'all. I made out like a bandit!
grin
Admin
Well, on 32-bit machines you ave a problem, indeed. A "bigint" is certainly not so easy to implement there.
Admin
Admin
/facepalm
I love how one of the first comments on there is something along the lines of "yes, the new fix will break in ten years, but we have years to fix it!"
Admin
And of course:
So, 31/00/02010 appears to be valid.
Admin
Admin
Admin
I really liked this the best:
It's a triple WTF.
First, the range of 47 through 57 is obviously intended to pass only digits, but in ASCII, the digits are 48 ('0') through 57 ('9'). So this would pass a "bad character" ...
...except that 47 happens to be the slash ('/'). Which means that, with translation, this boils down to:
...but wait: This can further be written (English) as, "If this character is (not (either a slash or digit)) and (not a slash) then.
It's like it was programmed by Inspector Gadget ... it only works for any date by accident.
I nominate a new code category with this as the type case: Inspector Gadget code.
Admin
If ((myAsc < 47 Or myAsc > 57) And myAsc <> Asc("/")) Then
myAsc < 47 Or myAsc > 57) 11 different allowed characters in this check
myAsc <> Asc("/") 1 allowed character in this check
Total: 12 different allowed characters.
Unless...
Admin
Y2K was a "minor" event because millions of dedicated programmers fixed the bugs ahead of time. I spent much of the summer of 1998 fixing Y2K bugs in all our company's code; when 2000/01/01 came it all worked perfectly.
Admin
I wonder how interesting the daily WTF articles would be if people just wrote unit tests for their code.
You could, for example, have a unit test that takes a date of "now() + 1 year" and tests all the date-fiddling functions with it. This test has a sliding lookahead window and will start failing 1 year before the code becomes a problem.
So if there indeed is a date handling error, you'd have the whole year to fix it.
Admin
Admin
Admin
Certainly this developer's code could be improved upon, but calling the .NET framework directly like this can also be problematic and result in "vendor lock-in" to .NET.
Personally, and this is what I tell all of the developers on my team to do, is if you are going to use a framework function, you should really wrap it in your own library. Over the years I have built up quite a large wrapper library that insulates me from the whims of Microsoft when they decide to change a framework function. This is the way Microsoft intended you to use the .NET framework, which is quite low-level. You really should not let client's call it directly.
Chaining calls together like this is what gives you a nice, scalable n-Tier design, but that discussion is left for another day.
Admin
What makes you think that the original programmer, who used hard-coded dates in the date handling function, wouldn't also use hard-coded dates in the unit test for the date handling function?
Admin
(The programmer in question is scrupulous in following that, using only syntax that will work in vanilla C)
And wrap a few #ifdefs around some blocks of code and you have cross platform code.
Sad fact but sometimes you just have to do it this way
Admin
My favourite part was:
i.e. years can be valid in the ranges -infinity to 9, exactly 100, or 2000 to 2009.This guy doesn't know the difference between "<" and "<=".
Admin
I think there's already a term for this - Cargo Cult Programming. Or rather, you get code like this as a direct consequence of Cargo Cult Programming. Code which superficially appears to work gets committed; the inferior cardboard cutouts which obviously didn't work don't get committed.
Admin
I DESPISE variable names like myVar or similar... they're the comic sans of variable names.
Admin
Du-UH. The whole point of the Y2K exercise was to remove all code which even allowed the treatment of 2-digit years.
Admin
I had a doctor's appointment on 29 Feb 2000 and the reception computer thought I was a day late because it thought it was 1 March. Not everyone tested their systems.