- 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
And we wonder why adblock/ghostery/priv3/noscript are popular...
Admin
OK, I call shenanigans on this one - that's got to be written specifically to get onto TDWTF. There's some remarkable stuff in there...
for a starter... Oo
Admin
Nice browser compatibility work too (look at the original):
alert("do stuff for firefox 4");
Admin
I'm going to start using GUIDs, generated each page load, to name my form elements.
Admin
OMFG, just realised - this is a pattern! A few lines earlier there's an "if ( 1==1 && ....) too! So presumably they're checking that the basic foundation of maths hasn't changed before committing their scraped data back to the homeworld?!?!
Argh, I have to stop reading that code ... it get worse every line... shudder
Admin
Thanks for breaking autocomplete, myfriend
Admin
most likely it's meant as an easy way to disable/enable conditions with a change of a single character. Because
is too big a change, and is not auto-scoped (it also messes up else if chains)Admin
Looks auto-generated to me.
Admin
... that being said, I still prefer
or, if you want to obfuscate, you can try some beauties like
(without the comments of course)
Admin
Autogenerated indeed. That's why you get blocks that are ignored by the 1 == 0 lines.
I never liked this way of generating as, imho, it adds bloat, non executed bloat, but bloat nevertheless.
Admin
Well at least, if you subcontracted your development to an Elbonian company, with Elbonian naming specs, the tracker would be fooled!
Admin
Guess how they sleep in javascript? That's right, just loop a bit!
setTimeout is too hard and too asynchronous?
Admin
I found it amusing that while they check for a single field named 'Organization' and 'organization', 'Organisation' isn't in there.
That's not even a sleep, that's a CPU burner. I have JS disabled by default, glad to see yet another reason to keep it that way.Admin
Google would never be evil. Trust your Google.
Admin
Actually, given that Google knows lots about me, sites using Google Analytics and telling Google which page I visit and when is probably just as much of a privacy problem. Given the three-letter agencies are known to be slurping up data from Google (and similar very large companies), this is definitely an issue.
I suspect what makes it OK is that Everybody Is Doing It; am I right?
Admin
Admin
Admin
I'd buy that if there weren't clearly manual amendments to the code, like commented out lines, dubious debugging code, a mix of both (i.e. commented out debugging lines!) etc. There is no way you'd autogenerate stuff like that.
I'd stick by my first assumption that this is someone deliberately trolling TDWTF, if I hadn't googled Trackalyzer and found indications that this is actually used. Best bet is that it's legacy and hasn't been maintained for a long time, and that most of the companies who used it are now defunct (or have abandoned their old websites) but it's still scary to think that this has actually been used, seriously, at some point.
Admin
This reminds me of this article I came across the other day...
http://dotnet.dzone.com/articles/automatically-collect-and
I had to check the date on it wasn't 1st April
Admin
It was definitely generated by a complete and utter tool
Admin
THAT was not worse than THIS!
Admin
Autocomplete is the Devil anyway! Baaaaad autocomplete!
Captcha: inhibeo -- Autocomplete should be inhibeo in the browsers!
Admin
Admin
"If they say they've solved their problem, NEVER ask how".
Admin
Original code:
Delivered code:
This is quote common in fact.
Admin
Admin
You know it's a good example of a true WTF when the code does the talking and you don't need a Hanzo story wrapped around it.
Admin
Admin
Actually, asynchroneous programming with Javascript is really simple as plenty of AJAX-driven webpages prove.
Admin
Yes, but it counts more because they felt the need to share it with the world....and I read it, which hurt my eyes.
Admin
You should've seen the original code. It took 60 seconds to analyze a page. That was unacceptable, so Adam tried Google Analytics and it completed the task in only a few milliseconds. Nigel insisted that he could rewrite the code and not be beholden to Google. Now it only takes 20 seconds to analyze a page.
Admin
CAPTCHA: modo - modo is a polygon and subdivision surface modeling, sculpting, 3D painting, animation and rendering package developed by Luxology, LLC....wait, what?
Admin
rightly or wrongly, thats just how it was back then. Meanwhile, the president's daughter...
Admin
I think the original purpose of that method is to send off an Ajax request and ensure that the request was actually sent out before allowing navigation to the next screen. If the user navigates away, often the Ajax request isn't sufficiently far along for the server to actually receive it before it's killed, and it gets lost. Another project I was on unfortunately did this in order to ensure the user was logged out when they closed their browser. The only other real option to be really really sure is to open a popunder window which closes itself, which is no less of a WTF.
More of a WTF is that pausecomp seems to be used in totally random situations that have nothing to do with what I just described.
Admin
Admin
Admin
Admin
Admin
the that foo is global is not needed in the example. Even if
callback
is outsidetest
, you can do this:or even, in ES5,
If you want recursion, you can use nested functions, even immediately invoked functions
Closures are an amazing stuff.
Java doesn't let you close over non-final variables, but you can still close over instance fields or do
In C, you'd probably pass a pointer to a structure where you can keep your data. When the library finishes doing the asynchronous stuff, it then passes the sole pointer as an argument to the callback.
Admin
Admin
Admin
Oh thanks. I almost forgot there's a way to get a revenge for all those lame stories:
thedailywtf.com:
Admin
Why go to that effort, when you could just choose to, you know, not visit the site if it's so lame?
I'd've thought that anyone who visits the site regularly wouldn't mind supporting its continued existence by ignoring a couple of unobtrusive banner ads as they slag off Hanzo stories in the comments threads... ;)
Admin
Now that my office firewall is after-hours, I found it at http://xkcd.com/763/
Admin
Wow. Just wow. I think the thing that offends me the most is those enormous if || chains. Holy fuck, lrn2loop. Something like:
where firstnametable is a big JSON array with values to search for and an optional second field for matching llfrmid for the really specific matches. Then all the matching is done in a loop, and all you see in the main code is just essence of what you're trying to match.
After being being subjected to horribly ugly "example code" related to bringing up a new chip (I do embedded systems programming), I've started to use the term "weeds" to refer to all the garbage that makes code hard to read, including things like "} /* FunctionName */" at the end of functions and short if blocks. If your code wasn't so full of weeds to begin with, you wouldn't need to add those other weeds to make it more "readable"!
One of my favorite WTFs was code that I had to maintain that was compiled with a specially hacked up GCC 2.95 for ARM (and we didn't even know how it was hacked up help us get away from it). One function had about 50 array elements initialized like "a[1]=0x123; a[2]=0x456; a[3]=0x789; ..." At some point the code generator would get confused and the register allocator would run out of registers trying to compile it. Once I got to be in charge of that code, lots of things went to loops using constant arrays. That bastard version of GCC was a lot happier.
I take particular pride in things like making initialized array tables where each element fits in one 80-column line of code, with only very simple macro usage (for shrinking commonly repeated stuff like "(void*)" or "|FLAG" in individual elements). Code is so much easier to maintain when it contains as little repeated fluff as possible, by applying the DRY principle to the maximum.
Admin
Sure, you could also figure out how to write the whole thing as a web worker, but that's as much work as just making a bunch of variables global or passing them as arguments and then making it recursive.
Admin
Admin
You know, there may be a 1000 line function somewhere in our codebase, and if we don't, you know, put an ending comment at its end, the programmer needs to, well, SCOLL UP to see the function name (unless the IDE has better support, but anyway). So you see that's why it's so urgently needed. And if we do it once, we need to do it everywhere because, you know, CONSISTENCY! CONSISTENCY! That's important! CONSISTENCY!
How dare you ... <headasplode> /* end of comment */
Admin
After you enable JavaScript on thedailywtf.com, then Ghostery also notes the Google Analytics tracking:
Admin
But it only scans 3000 DOM elements by name. :(