- 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 agree the correct way to do this in C would be:
int days(int h) {
d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--; return d ? days(d + 'D'-'-') + 1 : 1; }
float HtoHAD(int d) { return days(d) / 100.f + h - d * 24; }
The real WTF is why nobody else gave an answer in a real language :/
Admin
ElseIf totalHours <= 24 Then
dayCount = 1
hourCount = 0
ElseIf totalHours <= 36 Then
dayCount = 1
hourCount = 12
ElseIf totalHours <= 48 Then
dayCount = 2
hourCount = 0
You should write a macro:
for i = 24 to 9999 step 12
Print "ElseIf totalHours <=" + i
...
next
So you don't need thousand coders!
Admin
The only thing I'd ever have against simply going ahead and re-coding this bit to be more 'granular' is that you usually find that it then breaks something even more horrible further down the line ...
Admin
I preferred R Flowers' old avatar. It was sexy.
Admin
PHP is awesome in the sense that driving nails through your penis is awesome.
The world isn't split between either crappy PHP pages or full J2EE stack and *shudder* Struts, there's stuff in between.
Admin
Djinn,
YOU DA' MAN!!
Admin
VB6 (and if I remember correctly VB5 too) didn't steal the focus either if you'd taken the time to configure it correctly. Which is a breeze: Menu tools -> Options -> Uncheck "Auto Syntax Check". Voila.
Ok, so no "cool blue wavy underline", but it DID (does) color the line red if an error was (is) found.
Admin
Oh, come on. Neither VB nor PHP are anybody's "weapon of chice". The only reason there are sooo many dumb programmers going on with VB it's because of the IDE. Or what button do you bind all that PHP stuff to, huh? huh?!? There's nowhere, that's where :D
Admin
I don't know. One less than did make it through just fine, while some semicolons did not. Even in your corrected version some lines are missing, and the less than that made it through in my version didn't in yours. Truely WTF.
Thanks for trying though.
Admin
thats the name of a band in England 8-|
Admin
Admin
OK, how in the hell do you quote someone?
Admin
Most of the "programmers" in such companies are people who've had some programming at school (likely QBasic) and therefore know more about it than the rest.
They therefore get given the job by default.
This is true of most software companies as well...
Admin
I've done it two times, this is the third... The two first times I just pressed the 'Quote' button and wrote after the quoted message, that seemed to work. This 3rd time I do the same, no idea if it will work... Did it?
Admin
Yepp, it worked... Can't say it seems too difficult ;)
(Is it browser-dependent?)
Admin
Not really, more like Heisenberg-dependant.
Admin
lol :D
I love you guys I am joining!
Admin
Here is a tuffy can anyone right that in one line?
Admin
<warning>Another "THIS IS WHAT IS WRONG WITH THE WORLD TODAY! rant...."</warning>
sigh
I'm starting to lose hope in humanity.
Any programmer that produces code like this should be taken out back and shot. Seriously though, someone who produces code like this has such a lack of fundamental programming skills that they should be looking for a different career. I could go on and on how it's because of VB that stuff like this exists, but I won't. I will however point out that lots of code like this exists. I'll bet Windows has some code in it's codebase that looks like this. I'll also bet that it's one of the main reasons MS will never open up all of the Windows source. If they did, we could have a Daily Windows Coding WTF.
sigh
Admin
Seriously how can a "professional" programmer code something this bad. A person without any programming experience could look at that and see what crap it is. Any where you have hard coded number, not to mention rounding up using a hard coded number has to be wrong. expecially if there are more then like 2 if statments. There are many ways he could have fixed this.
Anyone who knows a little math should realize that you can get the number of days by dividing the hours by 24. and the remaining hours are simply the remainder of the division.
Admin
Actually, in a sense it is; there are some browsers it never works in (i.e. Konqueror, unless it's imitating IE), and the rest it sometimes works in (probably depending on the phase of the moon, the timce since most recent goat-sacrifice, etc.) Or should it be the other way round?
Admin
Correction: using PHP rather than VB is only a tertiary indicator of cluelessness. The choice of PHP over VB is a much better predictor of having no money; having no money is a fair predictor of being non-serious; being non-serious is a good predictor of being stupid.
I feel compelled to say this being a fairly serious guy who was forced to work as a one-man development shop with zero budget, and using less than a quarter of my available time. PHP was the path of least resistsance, and I used it to write some pretty nasty stuff (nothing as bad as what I've seen here), but I at least understood that what I was doing was bad and wrong and full of bad wrongness. So - no money, fairly serious, but not stupid.
Admin
I had a scathing reply ready, but I can't figure out how to get it posted...
Admin
I have no idea.
Admin
Easy. Ask Sly Stallone. . .
"To be. . . or what. . ."
Admin
Definite .sig fodder. Maybe even bumper sticker or t-shirt.
And BTW, the monitor needed cleaning anyhow, so the caffeine spray is no big deal....
Admin
Works for me about 50% of the time, using Safari. Let's see if this time is one of them...
Admin
Dang, I guess not. Maybe this time...
Admin
OK I give up.
Sincerely, Paula
Admin
Not to mention caffeine free diet Coke there is a true WTF
Admin
I also think that the position of Jupiter relative to Venus when Mercury is in the ascendant may come into consideration.
That and how you hold your tongue.
Admin
Worked for me about 0% of the time in Konqueror, until I told it to pretend to be IE. Had a 100% success rate so far since. Maybe if I set it to imitate Safari, I can make every quoted reply a gamble too... nah, can't be asked.
Admin
Really, I'm shocked. Has no one here read the Bastard Operator from Hell series? I just wonder how long the guy laughed over this before dissapearing. Probably left citing recent sunspot activity as a factor...... right after redirecting his boss's email to /dev/null.
Admin
You typed a lot of words, but you haven't said anything. What, besides lexical scoping, does your holiness not approve of? What's this stuff in between? Ruby (loser)? Python (quiche eater)? I expect you'd go for CGI.
Don't mess with the bull - you'll get the horns.
Admin
After seeing this I might just join a monastery.
Admin
In my experience (which involves tutoring VB as well as having to use it) the handholding is less of a problem than the inconsistencies and horrendous unhelp system. The students get into a cargo-cult programming mindset that is difficult to break when they learn a different language in the following semester.
Admin
That looks like something written by a 11 year old in their first week of learning VB... So Script-kiddieish
CAPTCHA: unreal
Admin
Hmmm... Will me quoting your garbled posts make them suddenly look good???
Admin
That is just freaky in a curius IT pervertion way..
Admin
in java:
dayCount = (totalHours - (hourCount = totalHours % 24)) / 24;
captcha: hamburger
Admin
Yeah but try finding cheap hosting for web-based applications that offers anything other than PHP / MySQL, is not Windows / IIS / ASP based (security and reliability are problematic) and doesn't lock you in to just a few providers...
Admin
As long as you don't want free hosting it's actually not that hard to find CGI/Perl, CGI/Python and more and more CGI/Ruby due to RoR gaining ground, often with FastCGI option (rarely mods though).
Admin
Sure.
that
Awrighty then.
CAPTCHA: uh, never mind, I bothered to register ... dweeb me
Admin
True iff the rounding is at an exact .5 mark. Anything else, it rounds to the nearer side. That's called "bankers' rounding," and has usefulness (in particular, it does not introduce biases in rounding off large numbers of items).
Admin
The problem is simple--division is one of those new-fangled unreliable things!
Admin
this saved my day.
Admin
I just can't resist throwing in a plug for the web host I'm using, Dreamhost. They've currently got Perl 5.8.4, Python 2.4.1, Ruby 1.8.2, Ocaml 3.08.3, Ruby on Rails. And gcc 3.3.5 if you feel like compiling and using something else. I haven't actually written any CGI scripts in Ocaml ... yet. Let's see, what else? Linux 2.4, fcgi, mod_rewrite, PHP, MySQL, ssh access, easy installs of MediaWiki or WordPress on your site, good prices, excellent support.
Sorry for the blatant commercialism. I don't work for them, I'm just a very satisfied customer.
Admin
Well, also being a (satisfied) DH customer, I don't have any issue with your (shameless) plug myself, but others may feel otherwise ;)
(you forgot to say that they have an ass-kicking admin panel, too)
Admin
Honestly, when I look at that, I just wanna cry.
Then I think that I'm not really afraid of indian and chinese people "taking our jobs" because of all the outsourcing.
I become afraid of *this* kind of people (such as the author of this tasty piece) taking our jobs.
Then again, maybe it was outsourced work after all.
Admin
Or maybe indians or chinese ppl are "taking your jobs" because some of you do code like this? Not that the indian/chinese would be any better :))