- 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
DEV: So what if someone actually lives in October Road?
BA: Uh ... well ... hang on ...
I've found over the years that it sometimes helps against stupid requirements to give silly counter-examples (which is why I've become quite good at making up such examples on the spot).
Admin
Maybe this was the poor programmer's way of subverting the stupid requirement with plausible deniability ...
Admin
I actually went through reading this, and said "I'm going to understand this one before I read the evalutation".
Then I got to: processingClient.StreetAddress.Line1 != null and I said "okay, an irrelevant if statement, that's fine, a mistake, but nothing to quibble over
Then I got to: processingClient.StreetAddress.Line1.Contains(month) If your street address contains a month... but only a 3 letter abreiviation (first letter cap)... throw an error?
Not only does this code have no point, but it uses a bad practice, and doesn't even test what it was trying to. For example, "OCTOBER ROAD" gets through while "October Road" doesn't, and "--Martin Luther King Blvd" makes it while "Martin Luther King Blvd" doesn't.
True Worse Than Failure! Best one in a while, Alex, kudos!
Admin
I wonder why I wonder why nobody has commented on the double "Aaron adds" so far ...
Admin
Admin
// maybe I needing later string[] months = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
if (processingClient.StreetAddress != null && string.IsNullOrEmpty(processingClient.StreetAddress.Line1)) { for (String month : months) { if (processingClient.StreetAddress.Line1 != null && processingClient.StreetAddress.Line1.Contains(month)) { writeError(processingClient, errorList, "Street address line 1 is in date format (" + processingClient.StreetAddress.Line1 + ")."); } if (processingClient.StreetAddress.Line2 != null && processingClient.StreetAddress.Line2.Contains(month)) { writeError(processingClient, errorList, "Street address line 2 is in date format (" + processingClient.StreetAddress.Line2 + ")."); } if (processingClient.StreetAddress.Line3 != null && processingClient.StreetAddress.Line3.Contains(month)) { writeError(processingClient, errorList, "Street address line 3 is in date format (" + processingClient.StreetAddress.Line3 + ")."); } } }
Admin
It's a good thing they don't have any customers living in March.
Admin
I'm so happy that I live on 05/12/2007 Avenue.
Admin
Good example, just about every major US city has an MLK.
Admin
Go to love Wikipedia:
http://en.wikipedia.org/wiki/List_of_streets_named_after_Martin_Luther_King,_Jr.
(At the same time, go to hate Akismet for being so retarded)
Admin
The software under discussion would also error out on Lennon's touching lament for his mother ("Julia"), so let's hope it's confined to street addresses and not Spotify streams.
(Incidentally, if you really had to do this, what's wrong with checking for (a) the full name of the month (b) a suffixed whitespace or (c) a suffixed period? It's still utterly useless, but at least it is canonical and unimpeachable uselessness.)
Admin
Admin
[quote user="Keith Brawner"]Not only does this code have no point, but it uses a bad practice, and doesn't even test what it was trying to. For example, "OCTOBER ROAD" gets through while "October Road" doesn't, and "--Martin Luther King Blvd" makes it while "Martin Luther King Blvd" doesn't.[/quote]
"--Martin Luther King Blvd".Contains("Mar") == true "--Martin Luther King Blvd".StartsWith("Mar") == false
Users["Kieth Brawner"].Education <= EducationLevels.SomeCollege
hmmm...
[quote user="Keith Brawner"True Worse Than Failure! Best one in a while, Alex, kudos![/quote]
I agree, Alex's ability to find real WTFs for articles without making himself TRWTF is daily getting worse...
Admin
Admin
[quote user="md5sum"][quote user="Keith Brawner"]Not only does this code have no point, but it uses a bad practice, and doesn't even test what it was trying to. For example, "OCTOBER ROAD" gets through while "October Road" doesn't, and "--Martin Luther King Blvd" makes it while "Martin Luther King Blvd" doesn't.[/quote]
"--Martin Luther King Blvd".Contains("Mar") == true "--Martin Luther King Blvd".StartsWith("Mar") == false
Users["Kieth Brawner"].Education <= EducationLevels.SomeCollege
hmmm...
[quote user="Keith Brawner"True Worse Than Failure! Best one in a while, Alex, kudos![/quote]
I agree, Alex's ability to find real WTFs for articles without making himself TRWTF is daily getting worse...[/quote]
Oh great. Not only is Bowytz incapable of proof-reading his own submissions; now it's spreading to respected contributors.
(As a non-respected contributor, I got mine wrong too.)
Admin
At this point the best thing the developer can do is obey. That is, until you get a chance to replace your ignorant manager.
Admin
The obedient programmer should've come up with a more elegant solution. Like I posted earlier, DateTime.TryParse() (if this is .net) or some equivalent could easily inverse-validate for unwanted dates.
Admin
Complaining about someone's education while misquoting and mistyping his name. Classic Muphry's ...
Admin
Oops... I missed a brace... didn't I?
Addendum (2010-03-03 12:04):
I know... I'm such a n00b... :-/Admin
Or "Market Square"?
Admin
This sort of thing is quite common on embedded devices with no filesystem in which to host proper date validation.
Admin
Or 28. října in Prague (and several other towns/villages in Czech Republic). It translates to '28 October', or 'October 28' for Americans. There's a few other simlar street names, just can't think of them now.
Admin
Admin
Yeah, I used to live in Argentina, and I saw plenty of that. Just about every town, no matter how small, has a 9 de Julio street, (their Independence Day,) and a handful of other important dates.
Admin
Other Prague street names doubling up as dates include:
5 Kvetna (5 May)
and
17 Listopadu (17 November.
Various streets are named after public holidays.
</Useless Trivia>
Admin
Hey, you think this is bad. You should see their date validation function. It begins:
Admin
Short and sweet.
Oh, and lmfao:
Admin
Aaron adds, Aaron adds, “I’m not exactly sure what thought process lead to this, but the powers that be aren’t too keen about changing it, leaving our end users to adding random hyphens and spaces for those unfortunate enough to live on ‘October Road’.”
Aaron wants to be very sure that we know that it's HIM adding this.
Also, I hope I never have to order anything from these guys, they'll be so messed up when they are told to turn onto JUNor avenue, and then once they figure it out they'll bring broadswords and shields when they're told to "go to WARd road", and then they'll probably get some kind of logic error when they finally turn onto "geORge road".
Admin
Database integrity belongs somewhere in the database. If an address field has a date, then some date field (i.e. type DATE) must have a non-date. The database server should fail to load the incorrect fields based on type-mismatch.
There is no good reason to write detection code to sanitize a database. SQL handles this for you via type-safety, constraints, & CAST functions.
Admin
Admin
Or the function that validates that the address is not a CC number:
Admin
You mean that you mean... "Oh please, there&rsqou;s nothing wrong with the writing in today&rsqou;s WTF."
Admin
I should add that I'm not exactly sure what thought process lead to this. It's just what I think causes Alex's writing WTFs.
Admin
Well that works if and only if we assume that a date appearing in a non-date (string) field means that a real date field contains a non-date. It wouldn't catch a case where say an extra date appears in a usually non-date field
Admin
Specifying the solution, not the problem. Happens all the time, and that is (drum roll) TRWTF.
(Next time you hear a non-technical person say "I want to redirect the user to..." you'll remember and understand.)
Admin
Fucking arrogant as I am, I also pointed out that I buggered up my own contribution. In the spirit of true humility, I will now come clean: I buggered it up twice. The first one I can blame on this crummy keyboard. The other one -- well, I have no defence for that.
Frankly, if I was part of a small team delivering tech humour to the Web on a punishing schedule, I'd bugger up far more often than either of them.
Admin
EDIT: zomg! Someone else already mentioned the shithole!
Admin
Admin
It's still C++0x, just now it's C++0xB
Admin
The only thing I can think of, is this function never runs. And when address line1 is actually null, it's used to see if a date was passed into one of the other fields. I am going to guess they're trying to sanitize some data they parsed from somewhere else.
That first inner if can never run.
Admin
But now, back to the big issues of life.
Admin
That's basically what I meant. In other words, does "some random string".Contains("") return true or false? In some sense it's trivially true that it contains the empty string (that is, you can find a substring that matches the empty string--take any zero-length substring), but it's not necessarily a useful test. From what you said, it seems that it returns false.
I know, I know, RTFM. I was just too lazy to go to MSDN.
Admin
I've seen two good suggestions as to wtf this is for: catching improperly parsed fields, and catching Excel formatting text as dates.
It could also be part of a half-ass temporary address scheme: 123 Maple Street Smegmaville OH (Mar 2-Mar 4) Your mom's bedroom
It wouldn't work, but with no idea what the application is supposed to do, this is as good a guess as any.
Admin
Admin
Two things, first I can't remember the last time I had to type in a month into any form, since they are all pull down selections, making this whole thing null and void. Second I am reminded of my retail days with a customer named Dawn Blow, who happened to live on Seaman Circle. Real name, real street, and yes she was real hot.
Admin
"Kvetna" would be "of April", I'm quite sure of that. Even tho I don't speak Czech, only a similiar Slavic language.
Admin
Bloody hell, C++ can go fuck itself. Is there anyone on the planet who understands and uses 100% of its features? It's like marching the Chinese in single file, you'll never reach the end.
Admin
Not to mention PHP (which is woeful) and Perl (which is the very definition of <100%).
You got a problem with this?
Admin
|S| does not have an impact on whether A is a member of S.
Admin
I knew someone who had to make this move. She had a hard time getting a moving company to believe her for some reason.