- 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
They say the funniest things are true. This is hilarious!
Admin
How much time was lost since the slow down was introduced
Admin
Especially when you could have just called
instead;Admin
Like you say, you don't know the $^&* that is php. While that would work fine in any sensible language, you can't use an index directly on a function call in php, you have to store it somewhere and then index into it. Absolutely no idea why.
Admin
Take the server home and bring in your raspberry pi...
Admin
Admin
Because using a Lexer for your language would make too much sense for Rasmus to do it. Sigh.
Admin
Admin
WTF FAIL : you've put the "echo 'FRIST';" outside the function definition scope.
if the code is from a class then it will generate an error "Parse error: syntax error, unexpected T_ECHO, expecting T_FUNCTION in....", alternatively if the code lifted from a purely functional context it will print "FRIST" immediately ... either way this is a fail
Admin
So this function with a parameter of 1 (seconds) would wait an average of 0.5 seconds before returning, and might even return immediately. Surprised nobody mentioned this yet.
Admin
The best part of this is I had to do something similar in the past. Users crack me up.
Admin
Too ugly!
Can you install a device to slow down the server instead?
Admin
I suppose I am also... but what can you do with stupid php, except make jokes?
Admin
Pizza is for the devs, the managers will get cash bonuses.
Admin
Agreed. The end userbase is clearly comprehension-impaired, but give 'em what they want. I've written loops exactly like that to make "animated art" out of drawing some complicated graph.
Admin
Stupid problems are best solved with stupid solutions... the more stupid solution, the more obvious it should be to the perpetrator why the problem they've caused is stupid, and HOPEFULLY they'll learn something.
The other option is to just suck it up, and do what the morons say every time. Sucks to be you if you do that though.
Admin
I expected the end of the story to be that they needed to re-write it in Java.
Admin
How else would you show you were utilizing 100% cpu usage during processing without a while(true) loop?
Admin
All of this reminds me of the silly voice response things. They voice out "Please wait while I look that up", then emit silly "computer like" sounds that indicate something is happening. Then lo, and behold, they have my account information.
The fact is that they probably have the database query answered by the time "Please" is spoken ("Please wait" if it is windows based).
Why do we put up with this idiocy!
Admin
The users knew what they wanted to see. They wanted to see slow. It's nothing to them how you make it happen -- as long as they see what they want. You can implement that in the stupidest, hardest-to-maintain way possible, or you can cut yourself a break and write a loop or a call to sleep or whatever else you decide is simple and elegant (for lack of a better word).
I suscipit (captcha) that you and your "stupid solutions for stupid problems" attitude might be the one who is stupid.
Admin
Admin
Did no one know how to sleep() and avoid all that busy-waiting overhead? And what about the progressive conditioning?
Bam. Self-improving software (that the next generation won't have to dig up 10 years later).
Admin
Hmm... you think?
I mean, I don't advocate simply throwing a stupid solution at a problem first thing. Obviously you try and solve it properly first.
If you're left with no choice but to do something stupid, you might as well make it obviously stupid, and easily fixable... so its more likely to get fixed that way.
Removing under-clocking from a server is considerably easier than loading up source code, changing it, recompiling, testing and redeploying. So its stupid AND easier to fix. Either way it's not your problem, as you should have the paper trail which demonstrates that you wanted to do it properly and some fool wouldn't let you.
Regardless, I don't generally have this kind of problem. Why? I don't know.
Maybe it's because I'm capable of communicating why something is a bad idea, quickly and effectively, so I don't get forced to implement such things.
Maybe it's because I've never been tempted to join a cowboy company that employs idiots to fuck shit up.
Maybe its because if anyone makes me do something stupid they usually end up with egg on their face, with me sorting the whole problem out and smelling like roses because of it.
Maybe I'm just so stupid that I don't notice the problem? Who knows.
Admin
Admin
Admin
This is still a WTF. They should have used a sleep function. By NOT using a sleep function, while the application is waiting, it is pegging a CPU core at 100%. By using this form of a wait they are reducing the scalability of their application and increasing power usage. They should have used a sleep.
Admin
Many years ago, when an O/S (and associated compiler) upgrade caused our build time to drop from 20 down to 5 minutes, we joked that "they must have removed the delay loops".
Did Arlen work for NCR?
Admin
sleep (PHP 4, PHP 5) sleep — Delay execution
Description int sleep ( int $seconds ) Delays the program execution for the given number of seconds.
Admin
Not my Vauxhall Astra, pal. The gauge is fully accurate, when it shows a quarter, there's a quarter of a tank left. Perfect.
Oh yeah, I see "gas", that must be what it's like in Merrycur.
Admin
I liked the usage of pal; that was textbook. But a Honda Accord would've been a better choice.
Admin
Isn't there in PHP a sleep() function that won't consume the cpu introducing a wait? Even VB had it.
Admin
The problem isn't speed. It was vague feedback to the user. Sure, you don't want a pop up, but there are many ways to tell the user that the save actually saved something, perhaps a small bit of text "Congrats! It Was Saved! YEA!", perhaps another page "it was saved!". Etc.
Admin
Why hasn't anyone mentioned a sleep method?!?!?!!?!?!!?
Admin
Oh god don't get them started *predicts next articles comments will be:
FRIST!
Why hasn't anyone mentioned a sleep method?!
Why hasn't anyone mentioned the presidents daughter?
Why hasn't anyone mentioned a sleeping method with the presidents daughter?!?
IT JUST GOES DOWNHILL FROM THERE.
Admin
Last time I used Turbotax.com, every bit of input was followed by deliberate slow loops to trick you into thinking there is complex logic going on.
Admin
Done lots of these kinds of hacks.
I remember in an older version of Excel, the print to file functionality of the printing API was broken in that you couldn't specify the filename. Instead it would popup a dialog to enter the filename. Not so useful if the dialog is on the server side. The solution - use send keys to simulate key presses and enter the file name. Can't do it too fast though or some key presses would be missed, so you'd have to sleep a bit between them. In the rare event that the dialog lost focus because some stupid random system popup stole it, we had a watchman process keeping track of the open windows and forcibly closing them. So many hacks. I'm glad they fixed this in the next version of Office.
Anyway, I would have suggested putting the delay on the client side.
Admin
Yes, commoners somehow seem to be perplexed by speed. That's what made MS add all the ridiculous flashing animations in Windows - to slow things down. But then when things are too slow they start complaining...
Admin
Bad code by bad programmers is a run-of-the-mill WTF. Awful code by programmers who should know better and that impacts on millions of people… classic.
Admin
As many pointed out, I questionthese programmers that were "sure" the new software was "way better" when they write 10's of lines of code to accomplish something built into the language (usleep).
Admin
Why hasn't anyone mentioned a sleeping method with the president's daughter while she's flicking her Paula bean with a closed frist?
Now, I can only apologise.
Admin
This isn't as uncommon as you think.
I do my taxes every year using the TurboTax online site. There are a number of places where, after submitting some data, you're presented with a "status bar" that advances while you wait. It would display status messages like "checking your return for errors" and whatnot.
No big deal I figured, it's probably just waiting for the server to process something and return a response.
Then I noticed that while I was "waiting" for things to finish, that the "Continue" button was already available. Why would it allow me to continue if it was still waiting for the server to process something? So the next time I saw it I clicked continue, and sure enough it let me advance without watching the pointless "processing" animated gif scroll through pre-canned messages.
Admin
TRWTF is fucking yes-man managers who won't stick to their guns and fob ridiculous shit off to developers.
As manager, you have two jobs: manage your team, and negotiate with the team's clients (internal or external). If you're failing at job #2, that's half your damned job.
Admin
A) They should have just told the superior "sorry about your luck."
B) Their solution to the problem is horrifically bad: http://www.php.net/manual/en/function.usleep.php
Admin
Of course, if anyone bothered to look at the docs for usleep() they'll see that it wasn't available on windows before php5, which I'm guessing was the target platform since they were moving away from an asp classic code base.
Admin
I've never used PHP, but shouldn't there be a built-in delay function that accomplishes the same thing without spinning for several seconds? Maybe I'm just being overly pedantic, but this seems like a waste of CPU cycles
Admin
Why don't they put the server in an overheated dorm room? That should slow it down sufficiently.
Admin
That was option discussed and rejected in favour of looping logic.
Admin
They went to PHP, and that's a good thing?
Why not go to ASP.Net?
(Sits back and watches the cage match.)
Admin
I've seen that elsewhere, too. I remember buying a program to crack MS Word passwords: the actual crack was nearly instant. The developer flat-out said at some point that the status bar was added in to "make it seem like the program was doing something.
Admin
Job security. It pays to maintain the WTFs that PHP introduces in a system.