- 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
Or other languages for that matter
Admin
MyComment = Replace(MyComment, "FRIST", "")
frist
Admin
The spec only asked to strip the Greek and English languages. lang=FR is fine, as is LANG=fR.
It really seems like there should be a regular way to express this without hardcoding all the different possibilities. Oh well.
Admin
lAng=frist
this is still funny right?
Admin
Better hope you never get a URL where the lang parameter is the first of several parameters.
Admin
I love how the second section of replaces will break any query string by removing the vital "?" mark.
Admin
No. "Frist" was never funny to begin with. It's just beating a dead horse. A very, very, very dead horse.
Admin
I sense some EN-Gr in his co-worker...
Admin
Varg aurait dû être inquiets que la solution ne fonctionne pas ... Que? Je ne peux pas parler Anglais. Quelle domage!
Admin
Also, it should have replaced the "?lang=xx" forms with "?" if a "&" followed, otherwise "bla.php?lang=en&img=true" would turn into "bla.php&img=true" which wouldn't du what it was supposed to.
Admin
Admin
Brute force string replace - now that's a classic WTF. A bit boring, but classic nonetheless.
Admin
Admin
That looks like some perfectly normal VB to me. Yes it would be atrocious in other languages, but again, perfectly fine VB!
Admin
Admin
I dunno... I think once you have more than 3 dead horses it becomes less funny and more sad.
Admin
Boooo...
Admin
I would love to see how he would handle "Replace any 6 digit numbers with their hexadecimal equivalents."
MyPage = Replace(MyPage, "000000", "00000") MyPage = Replace(MyPage, "000001", "00001") MyPage = Replace(MyPage, "000002", "00002") MyPage = Replace(MyPage, "000003", "00003") MyPage = Replace(MyPage, "000004", "00004")
...
MyPage = Replace(MyPage, "999999", "F423F")
Admin
Avoid the common caveat of not uppercasing the strings ... because if "999999" translates to "F423F", then surely uppercase("999999") should also translate to "F423F". And just for good measure do a lowercase("999999") as well...
Unless you're supposed to return "f423f" ... or "f423F" ...
Hmmmm
Admin
You have to love how VB.Net has its own special namespace with slightly different implementations of already available string methods.
Admin
Acarily I actually came quite close to writing this today, seeing as I can't be bothered to learn .NET regexes.
My solution is as follows, where I want to replace the value of the parameter:
Admin
It's a shame they weren't using TDD. It might be fun to keep adding an additional failing case once a day, assuming Varg's colleague had to keep fixing it. (And who knows, after a few months, the colleague might actually fix it correctly.)
Admin
I get asked to do this literally ALL the time.
Admin
Why? Didn't you do it right the first time?
Admin
No, GR is greek and SP is Spanish! You might think that because they suck at regular expressions, they are resourceful enough to get the correct language abbreviations. It seems the incompetence is uniform throughout all facets though.
Admin
I guess one dead horse would have to be very small so it could be wielded as an instrument to beat the other dead horse. Like one of those miniature horses, which is still classified as a horse and not a pony. It would have to be quite fresh too, and not too decomposed, otherwise it would fall apart early during the beating process. The other horse can be any size and level of decomposition, so there's a bit of leeway there.
Even then, typically in the IT industry one doesn't find that many dead horses lying around. In my career, the closest I could have ever gotten to this is beating a dead pigeon with a dead fish, or vice versa.
Admin
This is an instantly fire-able offense.
Admin
TRWTF is being called Varg and no varg jokes yet
Admin
Using the brute force method he could still be doing it for the first time. I hope your boss is relaxed about deadlines, Bobbo1
Admin
The source of many a good WTF. Looking forwards to seeing yours!
Admin
FTFY
Admin
Admin
QFTFY
Admin
"We've just added 3 more languages to our webpage and we need you to tidy up a bit the code your predecessor left. Huh, what's a front controller? Why would we do that, we just copy-paste the code to every page, it's simple. Anyway, get started, this shouldn't take you more than an hour"
Admin
A bonus meta-WTF:
Can't wait to hear that..."My page equals replace open bracket my page comma double quote and lang equals E N double quote comma double quote double quote close bracket"
"My page equals replace open bracket my page comma double quote and lang equals G R double quote comma double quote double quote close bracket"
...
Admin
FFS.
This is the 21st Century. We're even a decade in.
Are there really any sensible languages that DON'T have regular expression support?
Oh wait. You said VB, right? :P
Admin
on an embedded system with no file-system, only Irish Girl can mix metaphors with memes
Admin
Hmm... I see your point in here, people. Correct me if I'm wrong here, but TRWTF here is that, instead of manually generating all possible cases for the replaces... he should have used a CASE tool to generate all that code, that automatically considers all poosible cases for him... right?
Admin
To be fair, learning regexes is also a source of many good WTFs.
Admin
HTML 4 is speced (and carries over, in essence, to XHTML and HTML5) to use RFC 1766 for languages, however. RFC1766 specifies using ISO 639 two letter codes which, indeed, are "el" for Greek and "es" for Spanish.
Admin
No, TRWTF is that he didn't write a .bat (batch?) file to generate the different cases automatically from an Excel spreadshit.
Admin
Bah. I'm not impressed. Lyle could have come up with twice as many Replace permutations, in the same amount of time!
Admin
+1 sir
Admin
Admin
Why are we beating a dead horse with another dead horse? Let's start beating the guy beating the dead horse with another dead horse.
Admin
Why not just convert the query string to all lower (or upper) case and then just remove the "lang=el" part of it?
Admin
Err...wait. You're a troll, aren't you? Blast!
Admin
Not relaly, lAng=Fritz is funnier.
Only though if you're in Metropolis.
CAPTCHA=enim : Not quite a rap star. Yet.
Admin
How would you put it back to its previous capitalization? ;)
Admin
Perhaps you didn't notice the name of the poster?