- 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
Actually in the UK it's Happy Spring Bank Holiday!
Captcha: First! (not)
Admin
shesh, slow day!
captcha - doom
Admin
At least it's kind enough to beep when it's done :)
Admin
So......many......Variants......
Admin
Poor Amy.
Admin
Something inside me just hurts when I look at it.
Admin
Oh god, what happens if Amy leaves the company?
Admin
"TO BE SPECIFEID" - the real WTF is that he can't spell. If Amy leaves the company, they'll just search-and-replace her name for her replacement. Ah... business logic.
Admin
CHeck with the Vatican: It's Whit Monday
Admin
The real WTF has gotta that no-one's yet ripped into the use of VB(A) again, for a change.
A good programmer can code well in any langauge, just as surely as a bad one can write c&^p like this...
Admin
The interesting side is that this is probably part of some in-house programming language they built for parsing documents. Think of the mind-boggling HORROR! I fear this system :/
Captcha: (a) pointer (misuse is better than this)
Admin
I really want to know what this was used for...
Captcha: craaazy...yeah, no kidding
Admin
Yet another failed attempt at job security...
Admin
This function is used only from Monday to Thursday. On Fridays the system calls another similar funcion with the text "Pass to Amy next Monday"
Admin
No way. I'm flabbergasted that someone would put that into production. I wonder if they feel bad about what they've done?
Admin
How about happy pentecost?
Admin
Hey, this secures the job of both the programmer and Amy
Admin
I sure hope he wrote unit tests
Admin
Can somebody tell me how I set Firefox's Adblock extension to block lines of comment text which start with 'Captcha' please?
Admin
Anyone want to rewrite this in a C-style pseudocode for those of us who don't speak this language?
Admin
How do you know Amy isn't the programmer?
Admin
It's really not that bad: Select Case works like a switch statement. The Excel.Worksheet.RoundUp is using Microsoft Excel for some reason. If statements are the same. calculatethenumbers = "whatever" is equivalent to return "whatever" And beep as you may have guessed is a reserved word in VBA that beeps.
That series of if statements confuses me though, I didn't know you could have if without an end if for one line statements, good to know.
Admin
Cool. Truly classic, and truly a WTF?!!
Admin
No variable naming, no function naming, no typing (the function's return type changes!!), hard coding customer names... looks like a classic case of function-does-too-much
I really, really hope this isn't used deep down in the system.
Admin
Oh, crap. Now, this is a nice one....
Admin
You can do that with Greasemonkey.
...
CAPTCHA: onomatopoeia
Admin
Admin
It's a great day for us Canadians too. We had last Monday off, and this Monday we have no customers calling.
Admin
Well, it's the 7th monday after easter: http://en.wikipedia.org/wiki/Public_holidays_in_Belgium.
Of note is that the official founding of the Christian church was yesterday.
Admin
In Delphi there's the "Result" implied variable for any function that does the same thing, it's just more obvious especially in recursive functions.
Result := Result + ThisFunction(Number - 1);
is a lot more obvious than the VB equivalent:
ThisFunction = ThisFunction + ThisFunction(Number - 1)
And even more so for functions that take no input parameters (which I'd almost say are a WTF all on their own, but do have their uses sometimes). In both languages, if you want to actually return that value right then, you have to say so explicitly.
Admin
In Delphi there's the "Result" implied variable for any function that does the same thing, it's just more obvious especially in recursive functions.
Result := Result + ThisFunction(Number - 1);
is a lot more obvious than the VB equivalent:
ThisFunction = ThisFunction + ThisFunction(Number - 1)
And even more so for functions that take no input parameters (which I'd almost say are a WTF all on their own, but do have their uses sometimes). In both languages, if you want to actually return that value right then, you have to say so explicitly.
Admin
Bobbo -- if you missed this, please see http://userscripts.org/scripts/show/7631 (something sjs posted to another thread). Works a charm, and uses the Greasemonkey extension. Bow before sjs (if it's his work)
Admin
Admin
Silly Yarr. Amy isn't a person. Amy is the name of another function!
Admin
Out of all that, you decided the spelling was the biggest issue?
Admin
I am sure this Whitsuntide wtf is evidence that the Holy Spirit has come among us. Such coding is surely beyond the capabilities of one not inspired by Divine Grace.
Admin
My best guess is that x and y are Excel spreadsheet coordinates and that depending on what field we're in, it'll return some output... v, w and z probably some values from the same spreadsheet (w looks like a dropdown to me).
I think it's called from inside a loop where it's running thru all the fields (all the possible x and y values). If I were Amy I'd change that "Pass to Amy tomorrow" phrase to "Pass to Amy when hell freezes over"....
Admin
What i really like is the "beep" at the end! I hope this function is called multiple times to drive the user into madness
Admin
This probably isn't as bad as it looks. My guess is that calculatethenumbers() gets called for each cell of an Excel spreadsheet, and does different things based on the coordinates.
It's probably a way of taking a really convoluted legacy spreadsheet that Marie in Accounts has produced in exactly the same way since 1992 and refuses to change, and turning it into something usable. A custom function used in exactly one place for exactly one purpose.
Admin
Admin
Admin
Admin
Here goes:
I think that preserves the insanity of the VB code, although I don't understand what that switch like statement does.
Admin
You'd be surprised to learn how many critical applications in the finance sector are actually appalling hacks written in VBA. It seems every bank tries to avoid writing standalone applications by getting a semi-IT person to knock up something with Excel or Access. In fact, that's what the highly paid consultant sitting opposite me does. With a copy of "Excel VBA For Dummies" on his desk I might add.
Admin
'Happy' Memorial Day?
Admin
-Harrow.
Admin
Are you sure you didn't take that code from one of the OMG WTF entries?
Admin
This example demonstrates that it is possible to write bad VBA code in any language.
Admin
Admin
As has been suggested, this code is an Excel macro, in VBA.
As you guessed, "Select Case" is like a switch block. The Range function reports the value of the given spreadsheet cell. So, there you go.
This function probably is called by one cell at the end of the row in in each row of a selection of rows. The variables are from cells from that row (some specific columns, of course), and it takes the bizzare pattern of input in those cells, and produces a column of values that (once the rows are sorted) might very well speed up or make easier the work of some poor clerical worker (a subord of Amy, no doubt).
Its very likely that the source input is some "MUST NEVER BE CHANGED" mainframe database report, cut-and-pasted via 3270 emulator text screen-captures into a text file (possibly by a macro written in the 3270 emulator package's own macro language), then manually imported into Excel, then munged further with this macro.
You probably can't believe that before caculatethenumbers, their jobs were even harder. I can. I've been there, done that, and made some pretty bizzare, but utterly useful and utterly specific-purpose spreadsheets to help the poor bastards out.
You see, (customer facing) production is one thing. That's where the money is, all the spit and polish and unit testing. But then there's what some poor clerical worker in the basement has to do. Nobody cares about the clericals, or how to make their jobs easier with the fancy tools they have. They all have Excel, but none of them really knows how to use it. So, some sympathetic IT support fellow spends a few hours whipping up some monstrosity macro/template to try to ease their burden. It probabaly knocks 3 hours off the job every day. Then, they in the basement happily use that bizzare, single-purpose tool for the next 7 years, and hail the IT guy as a genius for ever after. ( At least, until the forced upgrade to the next version of Excel that breaks the macro, and the IT guy hasn't touched Excel macros in 7 years deserts them, and they go back to the old, hard, slow way, that nobody remembers how to do)
Poor, piteous things.