- 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
I woulda been Fr1st but I slept on it.
Admin
Looks like Alvin substituted his own lack of sleep with Perl code...
Admin
I had the first comment, but I had to sleep five seconds before posting it.
Admin
Oh yeah, I remember the days when, after some handling, I would perl all over the place and have to sleep on it... mom always wanted the dry space for herself... now I do the same to my kids, so I guess balance has been brought to the force.
Admin
I want to know what wtf behavior was covered up by the sleep(6)!
Admin
WTF? I gotta know right now!
Admin
They are important.
Big Budget Meeting
Beancounter: "Why do you need money for optimization?" Alvin: "If we can make our programs work faster, we can make more money." Beancounter: "Well I expect results!" Alvin: Change sleep(5) to sleep(4) "We've improved efficiency 20%!" Beancounter: "Shut up and take my money!"
Admin
Your basic ass.
Admin
And why Dave's never rolled out change somehow necessitated adding an extra second? Seriously, it sounds like there was at least a mildly amusing WTF here, but it got left out of the article completely. Kinda seems like Remy knew this, since the best "Easy Reader Version" he could come up with was ALLLLVIIIIIIIN!
Admin
What's a fire handle?
Admin
s/sleep([0-9]*)/sync()/ ??
Admin
At a previous job we had a dial setting that we had on the framework that we could set from 0 to 1000. As a client got further and further behind on their service bills we recieved change requests to the effect of "Increase IncompeTech's dis-service factor by 10 points" The disservice factor represented how many miliseconds after significant portions of code (Database query, Input Processing, Page rendering) we waited before moving on to the next step. This might not have been bad for some applications, but on some pages you were waiting upwards of 20 seconds on dissatisfaction time to get your page.
Needless to say, no client ever hit the magic 1000 (We usually discontinued service before that point)
Admin
We've had The Stare (TM), Remy's cornified the article (sleep there), and your efficiency code essentially makes the process flow 20% cooler.
I feel deeply satisfied.
Admin
This time i know!!
Alvin looks like to be the "perl trainer", when he gets his first trainnee, he showed him a script that, ran across the codebase could add sleep(1) after each close(HANDLE). the he gets the second padawan, who asked why there were sleep(1) and made a script to remove them to prove it was useless... and so on Dave is the fifth padawan to achieve his perl formation i guess
Admin
You're next job will be here. [image]
Admin
Admin
I'd tap that Alvin every day of the week until he gave up in exhaustion, cuz I'm Man Mountain Dean!
Admin
Best to let sleep()ing dogs lie.
Admin
Admin
Might be my fault, but I just don't get it. What's the point of this story? The veteran is always right, even when he's wrong?
Admin
Admin
And the new guy could always point to CVS to say "ALLLLLLLLLLLVIIIIIIIIIIN!"
Admin
Ellen was parodying Meat Loaf's song "Paradise by the Dashboard Light", where part of the dialogue runs along the lines of
Girl: "Will you love me forever?"
Boy: "Oh baby, baby, let me sleep on it"
Girl: "I gotta know right now!"
Admin
This one really is more of a "wtf" than usual. Typically when we see bad code we can understand what the schmuck was getting at or trying to accomplish. As stated above, this guy is just your garden-variety ass, and we'll never truly understand his motivation.
Admin
You need to escape your parentheses.
Or maybe you did, and the comment system ate it.
Admin
That's just the most frustrating DailyWTF ever...
Admin
Brillant! Punish the customer by making them think your service is shittier than it is, while also consuming a slightly greater amount of your resources!
Admin
Admin
No, it's not a violation of a code of ethics to decrease performance for non-paying customers. They're not trying to be awesome by improving performance later, they're punishing customers who haven't been paying the bill. They would be fully ethical in turning off the service all together. Just making it slow is being nice.
Admin
Oh, I'm sure there was someplace where buffered file I/O was biting them, and the sleep() allowed time to finish the write. Probably once Dave went home, Alvin stumbled back upon that case and added all the sleeps back, with an extra second "just in case". Someone needs to whack him upside the head with the man page (or perldoc page) for sync().
And "been using Perl since version 4"? Frickin' n00b.
Admin
Read #6.
Higher quality is reason India is ading job and US is losing them.
Admin
What version of perl do you have, that has a sync() function?
Admin
Man, I'm glad somebody caught that.
Admin
Admin
Admin
Admin
He needed the extra second of sleep() to allow time for the cargo plane to land.
Admin
AFAIK the Linux kernel has had a 5 second period where it wrote back the whole caches. This wasn't guaranteed but usually worked. Of course this is very bad coding style and a fsync() or sync() call should be used, but it probably worked most of the time.
Admin
Admin
I'm pretty sure the reason he increased the sleep from 5 to 6 was so he could say the new guy was making the script slower and to have an excuse to keep the new guy away from it and prevent the new guy from having any more opportunities to make him look bad.
Admin
First, I am glad to see that the new guy insisted on testing his changes before assuming he knew a better way to write the code.
Too often people try to prove they have a better way and want others to use without finding out if there is a real valid reason why the code is written the way it was.
However, I am writing some kernel code for an OS still in alpha-state (Haiku-OS) and I find if I write a number of larger files (16MB+) in a row that the files end up corrupting each other.
Use of SYNC() does not fix the problem. Use of SLEEP(9999) does. Use of SLEEP(999) usually does but on rare occasions the corruption still happens. Note SLEEP() is in microseconds.
Bet the environment has changed and in the past the sleep function was needed, but now things have changed the old-timer is sticking to the "old and true" despite tests showing it is no longer needed.
Admin
This is PERL, there's a module for anything!
http://search.cpan.org/~brianski/File-Sync-0.11/Sync.pm
Admin
Admin
AFAIK there are two reasons to believe this.
He mixed up socket and file handling, at least windows "locks" sockets for some time after they are closed to avoid stray packages.
They use some broken maleware scanner which would check the files after they where changed (blocking access while doing so), leading to an error if the program tried to access the file again at the same time.
Admin
That depends on whether your TOS informs them that you will be decreasing their QOS in that manner for non-payment. If so, dial away. But if not, then it's nothing but pissy, immmature, passive-aggressive bullshit, and probably illegal too.
Admin
Try sync(); sync();
On some systems, the sync() system call is non-blocking, but also non-reentrant, so the way to ensure that all i/o is complete is to call sync() twice.
Admin
Hahahahahahaha!
As someone who deals with outsourcing in India on a daily basis, this is hilarious; thanks for the laugh :) The reason India is adding jobs and the US is losing them isn't because of quality. It is happening because you pay literally pennies on the dollar for Indian engineers to crap out some code that is brittle, hard to use, and only sort of works.
Indian engineers that know what they are doing come to America where they can make actual money. I've worked with lots of intelligent people like this. But I've never worked with any outsourced "talent" that could pass Programming 101. The old saying "you get what you pay for" is especially true in this case.
Admin
Look, a future Daily WTF article!
Admin
TRWTF is Perl
Admin
Civilised perlmongers use FileHandle anwyay, which also has sync.