- 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
Wait, what?
Admin
Admin
Someone please explain what's happening in the code - I'm feeling very lazy today. Also, dNames[frist++] = Four;
Admin
Admin
From what I can tell all that happens is
and the wtf is that everything except that is just one massive noop.Admin
This is not pretty at all, but slow? I can't see anything there would be noticably slow.
Admin
The sample code alone doesn't explain the slowness, because the if statement with the repeated trim calls will never be entered. Something else will be slowing things down massively. Plus, even if it was entered, you should be able to apply regex and append array elements a hundred times over in milliseconds, not seconds.
The sample is more like an example of how the author is capable of massively screwing things up in other places. I'm interested to know just how the author managed to fail that really did make things so slow.
Admin
As soon as I saw iDRAC on the page I knew this was going to be a good one. Dell makes decent hardware, but any software they make is slow and buggy as hell. Most of the time it is faster to take the 5min walk to the server room then to use the DRAC, and never ever run the linux unpackers for their firmware unless you have backup.
Admin
Admin
I like the "i" argument on the regexes:
This definitely makes the code future-proof: should anyone introduce something like an uppercase blank, the my_trim() function will still work!Admin
Admin
"You pesky lowercase blanks! Geroff me lawn!"
Admin
Please show a little sensitivity. I had a son who had a nasty case of lower case blanks. Let me assure you, it was no laughing matter.
Admin
We work with DELL servers too, so I am familiar with DRAC. I always imagined the source code would look something like that, however have been too afraid to take a look.
The way the pages render in anything but IE is, as usual, a good indicator of the quality of code.
Admin
...of Dell's landing page (which oddly enough can be found at http://www.vbaspnet.com/2011/03/c-aspnet-crawl-pages-behind-a-login-crawl-php-login-authentication-website-for-https-authentication-the-idrac-card-to-take-equipment/ ), I see a loadXMLDocument() function that retrieves XML via AJAX-requests.
And I see a getXMLValue() that looks like a roll-your-own XML-parser. One that parses an xml string everytime a value from that xml string is needed.
So Nav: yes, the never-to-be-executed if-clause with all those my_trim() calls is certainly hilarious and definitely worth a submit to TDWTF, but it is not the reason for the slow loading of Dell's landing page.
Admin
I'm not sure this is that big a WTF. I'm guessing he viewed the source in the web browser, so AFTER it has been processed by the server.
So, the source on the server probably says something like:
or whatever. So, here they're doing work in Javascript that could be done in PHP, but maybe their real server can't do clever things like PHP, so can just do text substitution, in which case Javascript has to do the work - so, it's not that big a problem.
The delay must be somewhere else
Admin
Admin
Right or wrong, people get offended over stupid $h1t.
Admin
Articles like this make me embarassed that I tell people to read TDWTF, let alone to read it myself.
Why do we have writers who either can't read code or can't apply critical thinking?
You got a classic code snippet, I'm with ya. You needed a compelling reason for it to be found, so you took your writers liberties, reached into the bag of common motivators, and pulled out "sluggish response time". Why didn't you bother to think about whether you could attribute the response time to the code??
I understand that there must be new content every day to keep the site alive, but it's really frustrating to see articles of this quality.
Captcha - ludus: We continuously try to chase down great articles, no matter how often they 'ludus.
Admin
Right or wrong, that's just how string trimming was done back then.
Admin
The only explanation I can come up with is based on a suspicion I've had for a while: some coders get paid by the line and nobody has let me in on this lucrative arrangement.
Yesterday, I found this in some code: (variable names changed to protect the innocent):
This was then dutifully cut-n-pasted all over the code including just yesterday but a colleague. I asked him why he didn't delete those two lines and he explained that "I don't want to change the style of the code because that makes it harder to maintain." This is the stupidest coding practice I know (i.e. "Let's persist bad coding practices so that we don't muddle the style."). It's also further evidence of my theory about pay-per-line.
Admin
Admin
Admin
Yeah... frists seem to be getting moderated these days.
Thank fuck.
Admin
Add to that the fact that the trims in the JS never ran, and this definitely wasn't the cause of the slow-down. It was more likely the server-side code that generated this JS.
Admin
Can all you dicks who're getting offended by stuff, stop getting offended by stuff? Thanks!
Admin
Probably only the sceond frists... the frist frists seem to stick around.
Admin
This is just loop unrolling!
Admin
Admin
I find your tone offensive.
Admin
What gave you the impression I was offended? It was a polite request!
Admin
Admin
Admin
May the highly paid consultants of the badlands spray VB, Access & Excel all over your code base.
Admin
Admin
Admin
Let's see; invariant block optimization time! But yeah, this does not appear to slowing down the client. The server generating this mell of a hess appears to have some inefficiencies, but I doubt that this is the source of slow response.
Admin
Exactly. The entity on the LHS of such a declaration needs to be an interface to adhere to best coding practices. Forcing it to be a HashSet makes it less flexible.
Admin
What about the man who travelled on the subway with a case of diarrhoea? He accidentally left it on the platform.
Admin
All I can think is that this must be the slowdown loop. It sure serves no other purpose.
Admin
Where is the point in politely requesting people to not get offended, if you DON'T simultaneously call them dicks? That would just be crazy!
Admin
Wow. What a piece of DRAC.
Admin
DRAC? http://www.drac.org.uk/
Admin
Maybe he's an extreme horder waiting to corner the marketplace during a diarrhoea drought. Seems legit.
Admin
I don't like your alf, but I don't make a song and dance about it.
Admin
Admin
I figured he meant my skin tone; which happens to be puce, so fair enough.
Addendum (2013-07-25 14:55): (Hmm... puce is a different colour than I thought it was... and now I appear to be bit racist.)
Admin
Someone should tell the poor programmer about the elegance of loops.
The colde would be much more readable as
(cf. http://forums.thedailywtf.com/forums/p/26004/288214.aspx)
Admin
Here is a brief discussion on the geek community and racism, sexism, and other -isms, full of gross generalities and blanket statements:
The geek community tends to be very male, very white, mostly straight, and very convincved that they're not racist, sexist, homophobic, ageist, ableist, or otherwise discriminatory. And they mostly mean well. Nevertheless, they are often unintentionally racist, sexist, homophobic, et cetera. And when you call them on that, they get pissed, 'cause they think "meaning well" is enough. And it's really not. So they get defensive, and say it was just a joke, and people shouldn't be so sensitive, which is terribly easy to say when you're not the one being made fun of. So, when I see such things here, I'm gonna call people on it.
(Lengthy discussion of "privilege" skipped for space reasons.)
Admin
Isn't it possible that there are absurdities about any sub-sub-sub-sub-sub-sub-sub-culture you care to find, and that geek-ish personalities are more likely to find them humorous and less likely to care about social reaction to their amusement? While we're at it, let's ban physical humor - after all, it's not funny when you're the one falling down the stairs or getting an anvil dropped on your foot.
And isn't it possible that a particular large cultures tend to align with geek culture to differing extents, resulting in a naturally varying likelihood to have geeks?
No, you're right - everyone's just insensitive and privileged. After all, the fact that I can't see that I'm being insensitive proves that I'm both insensitive and privileged, which makes me unable to see that I'm insensitive and privileged. Q.E.D.