- 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
In that vein, then - coming soon, TDWTF...2.
Admin
Admin
Hey, don't knock it, Alex does the same thing here with comments. Notice how each comment gets an incrementing number? The code looks something like this:
update wtf.article set c1440513 = 'In my country...' where article=1961720010330;
(Of course I'm assuming each comment is another column in the article row. That way you can fetch them all at once instead of having to loop through SELECT results.)
Admin
FINALLY... a REAL WTF! It has been days since I had a good vomit!
I wish I could see the entire workflow that made it necessary to update a single row, one column at a time :p. I am guessing it was tied to the onchange event on an html form, causing an ajax post every time a form element value was modified. Would be interesting to see if this "ENGINEER" had bothered to sanitize the input.
Admin
Admin
hey... don't pick on Alex. If he wants to go to huge lengths just to wtf us with HTML comments... then that just shows his level of committment to fuckery!
Admin
Well at least if there's an SQL injection hole (and there most likely is) you don't have to worry about the hacker figuring out your data structure when he downloads your database.
Admin
yea... because then if there really is a power failure... all the person updating the form has to do to finish up is remember that the ID is 1961720010330, and know where to put it to prepopulate his old data. How hard can that POSSIBLY be?
Admin
Admin
NULL
Admin
update allvars set f1903 = 1961720010330 where rowname = 'users_last_active_row';
Admin
This is not a WTF:
Admin
O man, this is so inefficient. I've already described the db on which I had the pleasure to work: it had a similar design, but had a "vtypeid" which indicated how to interpret the row of data. Obviously, there were vtypeids that overlapped.
However, it was way more efficient than this one. We had 5 columns, and didn't have to add columns, we just added another row with a different vtypeid and then ... (wait for it) ... joined multiple queries that shared the same source id and timestamp. If the above design made someone vomit, this one will have him slash his wrists (remember: across the arm, not across the wrist).
That didn't hinder anyone in creating databases with 4, 9 or 13 columns, of course. It did hinder everyone though in writing portable queries.
Admin
I like the Dutch word "bestaand" in there, which means "existing". As a string...
Admin
This reminds me of a company standard from a former job, to add an extra 10 parameters to every asp/vbscript function just in case they will be used later. As a result, you would have:
function chokeYourself(secondsToDeath, numberOfHands, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8, parameter9, parameter10, parameter11, parameter12) ... code end function
then, if you decided you wanted to specify the number of spectators later, you could simply substituted the name "parameter3" for "numberOfSpectators" without breaking any of the function calls. The vbscript (obviously) would already be expecting the correct number of parameters, so nothing could possibly go wrong... right?! <YAKKK!>
Admin
oh, how I miss TopC0der.
Admin
I'm always wanting to use the most cryptic parameter names possible to that nobody will be able to follow what I have done.
Admin
a design pattern something like this?:
public class enum1 { public enum VOID { ZERO = 2 ONE = 0 TWO = 1 } public int StringProperty1 {get; set;} public string IntProperty2 {get; set;} public VOID Event( string boolValue ) { if( boolValue == "ZERO" ) return VOID.ONE; else throw new NullReferenceException( "YOU SUCK!" ); } }
Admin
There's always room for another thousand columns. As long as you can store the data somehow, somewhere, you're good.
Admin
TRWTF is not knowing the difference between a database and a spreadsheet. Or PHP.
Admin
I am not sure If this is WTF or not. I just happen to stumble on it.
Try double click on the code in the article. And see what happens.
BTW I am using FF14 on Win7 64bit
Admin
sub chokeYourself { my ($secondsToDeath, $numberOfHands) = @_; ... }
Caller passes extra params? No problem. Update sub to receive $numberOfSpectators, but some callers don't know? No problem again. Just make sure the sub's code gracefully deals with a null $numberOfSpectators.
Admin
Admin
Proven fact: if the database doesn't want to process your request, you can trick it by hiding the request among a bunch of other requests.
In other words, this whole block of code is just a ruse to get the database to do this:
Admin
Admin
Admin
I invite all interested parties to look at an ExpressionEngine database.
After you stop screaming, you may take your meds and go back to your life, knowing that you don't have to deal with it.
Admin
Yup, it's a dutch system alright. The postal codes are stored in the dutch "9999 ZZ" format.
Admin
You could easily restore the user's state by reading a cookie or having them login when they return.
Admin
Admin
Admin
Admin
Admin
it is vbscript
optional params myArg
Admin
Admin
and I might add that this actually resulted in a lot of silent errors in their app. They had several cases where they did not remember that certain regions of code were calling a method that was modified. At times, the new parameter was relavent information that was supposed to be deposited into a field on their new database (as they moved from foxpro to SQL Server). They didn't get any errors, so they assumed everything was functioning correctly... not realizing all the while that certain billing items were not associated with the client to whom the bill was to be sent.
There is a good reason to invalidate calls to functions that preceed said modifications... and unflatulantly they learned this lesson too late.
Admin
that is... errr... an interesting observation... by some standard :p
Admin
Now for something a bit off topic...
Is is just me, or is anyone else getting script exceptions (Java coloring or some such) when the current WTF loads. This just started happening for me a few days ago. It seems to correlate with the code lines displayed. Hitting 'OK' (many times) seems to work around it.
We now return you to the standard WTF commenting drivel that we all wish we could find "FILE NOT FOUND" in a binary return set. Hi Paula Bean, etc...
Admin
There must be some NOT NULL constraints that mess up this beautiful design pattern, requiring the INSERT to address three columns at once. That clearly needs to be refactored.
Could be worse, though, at least the database isn't based on the EAV abomination.
Admin
The first line suggests that there's always room to add another row, as well as adding another column.
Looking at the ID...
Which makes this truly a 2nd order WTF, which is a whole new level of WTF.
Just think, we cold have rows 1961020010330 thru 196190010330; and then 1961A20010330 thru 1961Z20010330; and then 1961a20010330 thru 1961z20010330; and then rows like 1961!20010330, 1961$20010330, 1961_20010330, and 1961{20010330. We could even have rows containing an 0x07 character in that position.
Why, we could have lots of rows!
Admin
[quote user="Carl"][quote]update tmp set f75 ='' where f0=1961720010330;[/quote]Yeah, because it we didn't set it to '' it would have defaulted to, um, what? Blank?[/quote]
haha - Carl thought for himself, let me say something that everyone will think it's cool, so that I clearly show that I'm mocking the original coder just like they're all obviously doing - even though I have no clue why everyone is laughing, but I will laugh with them so that they don't think I stupid - ok, let me say this [SARCASTICALLY, OUT LOUD]:
"update tmp set f75 ='' where f0=1961720010330;[/quote]Yeah, because it we didn't set it to '' it would have defaulted to, um, what? Blank?"
What Carl didn't realize was that he just showed us all how he doesn't understand even the basic SQL syntax or how values are stored in table. It has to be set to something - what? am I supposed to skip it, only because you don't like empty strings, and somehow remember that it's really blank while it's still equal some value, only because you don't like empty strings?
The NULL guy did try to help Carl understand, but we cannot assume that the field was nullable; so, I still stand behind this: Carl, shut the fuck up, you have a lot to learn.
Admin
It's just you. IE user? Now, THAT'S a real WTF today.
Admin
undef, you insensitive clod!
Admin
Admin
Admin
This isn't a WTF. It's worse.
It's an EAV, which is a horrible, horrible idea, but it is thoroughly documented horribleness that anyone who has worked with databases for a while has seen.
I say thoroughly, not well, because the majority of writing on EAV is total waffle-think that will spend twenty thousand words on metadata and clouds without ever touching on what anything is supposed to mean or why the hell you'd want to rewrite your DBMS in the first place.
Why do people do it? Because just as people try to optimize without knowing what they're optimizing or any proof that they need to, people also try to implement features without knowing what features they need or having any indication that the features are wanted.
EAV is the ultimate example of that: instead of nailing down the business logic, you just throw your hands in the air and say, "fuck it, let the users make it up as they go along."
Admin
You're on a technical site, using a hopelessly broken browser and bitching about how you can't see the site, in spite of the fact that there are free ones available that work.
PEBCAK.
Admin
But not from the guy who can't figure out how to post a comment correctly.
Admin
I use FF, Safari and IE interchangably... just whatever window happens to come up. I suppose that (in your ignorance) you were blissful enough to lay downa comment that had absolutely no substance whatsoever.
name 1 way that Internet Explorer is either not free or actually broken. Plenty (meaning 2 or 3) people commenting on it... but I PERSONALLY think that you simply dont like that fact that IE is owned by a multi-billion dollar company and is not open source. I have worked on websites (for a living) for 13 years. All I have seen is DIFFERENT behaviors. I haven't seen any proof that lead me to believe that any browser is better than another... in fact... I have always been able to replicate all functionalities in all browsers.
I suppose this goes to show... if anything works in one browser and not another (at least, recent browser, as all of the main ones are available for free) ... that is a WTF on the MORON who wrote it. you idiots that think one browser is in some way better than another are obviously too lazy or incompetant to learn how to do your jobs, and may as well shut the hell up... because there isn't a damned thing that can be done with one browser and I can't do with every browser used by at least 5% of the population
Admin
You have to buy Windows to get Internet Explorer. Therefore it is not free.
Any version of IE<9 is broken. And at least the version of IE you use seemed to have problems with the site.
Q.E.D.