- 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
So, on top of a rats nest of undocumented, convoluted code, they had a security problem as well?
Admin
The best WTFs are the WTFs so bad users begin to work around it, creating a WTF wrapper.
Admin
Perhaps there was a currency conversion going on? During the race to Euroify back in the late 90s or early 2000s or whenever it was, the rates were still being input in native currency (whatever that was) and converted to Euros on the fly using some vague guess at what the exchange rate might have been at one point, that is, 140 bodelscheisers to the Euro.
Admin
Sir your engine leaks oil and tires are bald. However that's not why your car doesn't start; the problem is you've been using the wrong key and fuel is empty.
Admin
This code has more casts than Evel Knievel after a crash.
Admin
I can almost see the fnords in that code
Admin
/140*100: 30 years ago Germany had a VAT of 14%.
Admin
Let's see here...
Divide by 140, then multiply by 100. That is a really odd way of computing ~71%.
Cast that to fixed point to make sure it only has three decimal places. Then cast it to a string.
Recalculate that same 71% value and get the length of its string representation. Subtract one. Get the left-most substring of that length. Effectively, get all the characters, except that third decimal place.
Recalculate that 71% value a couple more times in order to get only the third decimal place. Change that value to be either '5' or '0'.
Assuming MSSQL so that the '+' is a string concatenation operator. Tack that truncated third decimal place back onto the end of the truncated 71% value. Then use that value to update the database table row.
Nope. No WTFs here. Calculating that particular value using only mathematical operators would be incredibly difficult. And of course you couldn't change the value calculated. Every half penny counts.
Granted there are some performance improvements that could be made. Notably, storing the 71% value instead of recalculating it four times. But let's not do any premature optimization. We can instead leave that as an employee performance validator - make sure that all employees who change code are completely paranoid about making sure that they change all instances of a complex calculation.
Admin
Ignoring the WTF of using SQL, in't the real issue that there's someone out there who doesn't check that code is called before investigating it?
Admin
What the hell is that Discordia wiki actually about?
Admin
So… the POSIX shell, basically?
Admin
This might be a case of someone using the actual meaning of the word cost. Note that what is passed in is the fee, i.e. what the customer pays. Recorded in the table is the cost, what the business paid for the merchandise. So the dividing by 140 etc is to undo the markup.
Or it could just be monkey code.
Admin
Huh?!? You are going to calculate the actual cost of shipping based on the shipping price charged to the customer?
I think that is a bit backwards.
Admin
Oddity. In France, when you get a receipt in a shop / store / restaurant, it's fairly common to see the equivalent price in francs included, just in case 20 years later there's someone who really wants to know that.
Admin
UpdateCartonCost plays no role in the outcome of the costs. If it weren't in the code, the developers would have still found the table, started updating it, misfire an update, and zeroed all, just like they did.
Admin
Discordianism is a religion. The Wiki is about it. https://en.wikipedia.org/wiki/Discordianism
Admin
I've been using the phrase 'munging' for years, so was quite surprised to see the really absurd and disturbing definition some wacko decided to put in for this word in Urban Dictionary. Look it up for yourself, so long as not easily offended or shocked!
Admin
My favorite WTF since a long time. Caught me totally off guard!