- 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
For Christ's sake people, the code is fine, it's the pure and simply fact that the submitor sent a hard copy of the email and not just forward/submit it.
captcha: craaazy
How apt..
Admin
Not what I said. Save the straw men for the crows, please.
Admin
To those that have responded:
Layout by hand: No I don't just place a control on a form and let it sit, I do have to code all the calculations so it sizes with the form. Yes I'm using MS products here. The only layout help you get is with anchors.
Grid Layout: Sounds good, I wish I had that available to me.
Admin
That's what I though but he said 0 is a valid input which means ANYTHING is a valid input, if the parser can't handle it 0 is returned, "arse" is valid, "" is valid "1/7" is valid, they all return 0, now thats what i call some broken code!
Admin
I think you might have - never mind - here's one of mine "."
(nostalgic wooden table moment - sigh!)
Admin
This code is definitely not fine. It's not nearly as bad as most of the other code posted on this site, but it's full of those small WTFs that tend to accrue in a project run by incompetents.
When a maintenance programmer examines the code for the first time, she will consider these helper functions as black boxes that simply perform the work indicated in their name/signature. This is why proper naming of functions is so important, and "convertControl2Double(Control)" is definitely a WTF.
Writing to a logger in a conversion function. Come on now.
Returning a sensible-looking, valid value upon failure. Sure this probably works in some cases, but this looks like it's meant to be a general-use helper function. Just let the caller deal with the damn exception.
There's no real reason to use this over the TryParse() methods, which incidentally will also assign 0 to the value on failure (though failure will be properly indicated). Even if it was .NET 1, the double type still had TryParse.
The only functional difference between:
double val = convertControl2Double(textBox);
and
double val; double.TryParse(textBox.Text, out val);
...is the lack of the retarded logging behaviour.
Admin
It is.
http://msdn2.microsoft.com/en-us/library/system.globalization.numberstyles.aspx
Admin
Christ..
This is why most WTF's suck, absolutely 0 context is provided with i and just about everything is from the domain model; where the implementation will more than likely be unique. Either that or they are from someone's first "real" (read: more advanced than 'Hello world!') application.
However, I do agree the logging should not be in there - but that's hardly WTF worthy.
CAPTCHA: onomatopoeia
Admin
At several of my client sites, it is impossible to send code through the email system.
At some of my client sites, you don't even get an exception or warning when you try. Anything that looks like code is treated like spam.
Admin
The real WTF is that crazy indentation.
Admin
I've not read all the comments yet, so i don't know if some (highly Brilliant) person has already mentioned this but.
You can convert from hours to millimeters. One misunderstood thing about Einstein's theory of relativity is that c is not speed of light, but rather a constant which is equal to speed of light in a vacuum (more or less). The units m/s represent the proportion rather than speed.
This is due to the fact that Einstein has envisioned the universe as having 4 dimentions: x, y, z, t. So 300 000 000 meters to the left equals 300 000 000 meters forward equals to 300 000 000 meters above equals to 1 second in the future.