• (cs)

    My jaw just dropped.  This is beyond WTF.

  • (cs) in reply to Brian

    i have a headache, anyone have any aspirin left? this is too much. I would walk away from the monitor, clear out my desk, rip up the maintenance contract, and never ever look back.

  • (cs)

    Dare I ask what was assigned to rs3?

  • (cs)

    This, is beyound every WTFness we've seen so far, I'm sure.

    Anyone brave enough to defend this?

  • (cs) in reply to Razzie

    Before I can defend it I need to discern what the hell it's attempting to do....

    Perhaps it's a new form of code encryption algorithm.  If true, it's VERY effective!

  • (cs)

    I've just been basking in the WTFness of this code for the last 15 minutes and it's better than any drug you could take.

    'Whoa' - Neo.

  • (cs)

    That's a great idea. Now you can easily update the client side code without having to touch the server side code.

  • (cs) in reply to jesper

    i just threw up a little in my mouth.

    okay.  the defense.

    you are scared that your web server can be compromised, and since it's ASP, your business logic would be all plain text.  So...you store it in the db....

    no, i can't do this.

  • (cs)

    <font style="BACKGROUND-COLOR: #efefef">I bet the author was pretty damn proud of himself when he finished.</font>

  • (cs)

    Ha!  There's two open <script> tags and no closing ones.  What a WTF!  Of course the rest of the code makes perfect sense.

  • (cs)

    now THIS is a classic WTF.  When you literally say aloud "What the F*CK" then you know it's a good one.

  • (cs)

    It amazes me how people can find new ways of abusing the resources they have available to them.

  • (cs) in reply to gmiller
    gmiller:
    Ha!  There's two open <script> tags and no closing ones.  What a WTF!  Of course the rest of the code makes perfect sense.
    Well, that assumes that the ebcode doesn't contain the closing script tag...
  • (cs) in reply to Phil Scott

    I think the WTF must be that the table name was prefixed with 'tbl'. Only RUBBISH people do that.

  • (cs) in reply to jesper
    jesper:
    That's a great idea. Now you can easily update the client side code without having to touch the server side code.


    Dear lord I hope you're kidding.

    Of course, it's not like Javascript offers any kind of functionality to loop through the elements on the form. Nah, you're better off auto-generating a function that could potentially be 150 lines long. At the very least this could have been concatenated to a couple of Response.Write's, there's no need to have a separate line for .Write'ing a single space.
  • (cs)

    <font style="BACKGROUND-COLOR: #efefef">sql4 = <font color="#cc0000">"SELECT tblCode.* FROM tblCode;"</font>

    I'm not sure how sql server / access deals with this, but in oracle, the order rows are returned is not guaranteed to be the order they were put in unless you have an order by clause in the select statement. If this holds in sqlserver/access, then the javascript code could look very interesting if the server decides to return the rows in a different order...</font>

  • (cs)

    At least it's not oCode, or oCodeTable. I knew someone once who was so militant about using o- that he created wrapper classes for every class he used, with o- method names. Not someone I worked with, thank God.

    I wonder whether the field names have any meaning at all. They're intriguing in their stylish newfangled BASICA naming conventions.

  • (cs) in reply to foxyshadis

    It's really a cool way of doing code control.

  • (cs) in reply to Brian

    I don't think this is a WTF. [:|]


    ...


    ...


    ...

    Ok, I'm not that stupid, let me explain... I think it's pretty obvious he did that to obfuscate the source and not just obfuscate but to make everybody poor soul maintaining his code miserable. I think he utterly succeed wit that. [:O]
    Not doing this on purpose requires an amount of stupidity that wouldn't allow him to write that code. With such stupidity he couldn't understand the concept of a loop to iterate a recordset.. With such stupidity he couldn't understand the abstraction of server side code writing client side javascript.
    Don't be fooled, the author did this abomination on purpose.
    I know that it's not the policy of the daily WTF to publish the name of the snippets authors, I think this time you have to publish his name, A death squad needs to be dispatched. This man must be taken down!

  • (cs) in reply to Guayo

    I think you give this way too much credit.  I seriously doubt the author of this code knows what the word obfuscate means.

  • (cs)

    Is it possible this person ran afoul of the issue that you can't put a <script> or a </script> tag in the middle of ASP script (is that what this is?) and came up with this as the world's dumbest workaround? Rather than doing '<scri' + 'pt>' or whatever?

  • (cs)

    Yup, the person responsable was probably really proud at the end.
    Ineptitude : http://www.despair.com/demotivators/in24x30prin.html 

    http://www.despair.com/demotivators/incompetence.html (for almost any WTF)


    First you learn the difference between Abstraction and Obfuscation, when you know the difference, you start to learn that all Abstractions are a kind of Obfuscation ( this is a corollary to the Law of Leaky Abstractions)

  • (cs) in reply to dwntrdr
    ...<font style="background-color: rgb(239, 239, 239);">in oracle, the order rows are returned is not guaranteed to be the order they were put in unless you have an order by clause in the select statement. If this holds in sqlserver/access, then the javascript code could look very interesting if the server decides to return the rows in a different order...</font>
    <font style="background-color: rgb(239, 239, 239);">
    Perhaps he has a clustered index on the table. That would provide another location where something could break due to a seemingly unrelated change.
    </font>
  • (cs)

    Brilliant! Code re-use best practices! The fella deserves promotion to Architect!

  • (cs)

    Seems like the programmer read "How to write unmaintainable code"[1] and used a lot of the good techniques learned from that book.

    Or... maybe all the -code items in the db comes from some standard?

    [1] http://mindprod.com/unmain.html

  • (cs) in reply to andyandy

    "<font size="2">Or... maybe all the -code items in the db comes from some standard?"

    holy cow! I didn't look a lot at the "what does the tblCode look like" picture before writing that [:S]</font>

  • (cs)

    This must be the biggest WTF ever seen in the history of coding. I think the use of lethal force should be allowed - and even encouraged - in situations like this!

  • (cs) in reply to andyandy
    andyandy:
    You've found me a new bible. I'm getting to work on it right now [6]
  • (cs)

    I can't stop crying...

  • (cs)

    I just asked myself: how the guy entered this kind of data into tblCode?

    Maybe the biggest WTF is about to come...

  • (cs) in reply to gmr

    gmr:
    I think you give this way too much credit...


    You may be right. It's just that this snippet is so unbeliable stupid.
    Like those 2 for loops iterate over rs3 recordset without using any data from it. For each record in rs3 a piece of javascript is wrote. The javascipt seems to be something like
    if (element[id].checked == true)
    {
     //do something using the same id
    }
    Or something like that, where the id is just the value of snum (a simple sequence from 1 to the number of records rs3 has). I mean how such stupidity can allow someone to write any code?
    That's why to me it seems more reasonably to believe that this was done on purpose.

  • (unregistered)

    Do you know what's also a WTF?

    That the url <font color="#0000ff">http://thedailywtf.com/rss.aspx</font> in this post actually links to http://www.bloglines.com/rss.aspx. If that isn't what the fuck, then I don't know either.

  • (unregistered)

    Actually, this reminds me of a game programming technique from way back. Since game programmers wanted to be able to change the artwork used in their games, but also needed the fastest possible speed on really slow processors, they would often write "sprite compilers". A sprite compiler would take an image and translate it into the assembly instructions needed to draw the image to screen. For example, rather than having one function that's a general "drawSprite" function or something like that, each sprite is compiled into assembly instructions that amount to "put redvalue; put greenvalue; put bluevalue;....etc." rather than "load the pixel from the source bitmap; write the pixel to the destination bitmap; increment the counter; repeat;"

    The result is code that can only draw the specific image it was compiled from, but that can draw it really really fast. It certainly looks like the intent of this code was something similar. (Not that that would make it OK!)

Leave a comment on “tblCode”

Log In or post as a guest

Replying to comment #:

« Return to Article