• snoofle (unregistered)

    Comment c = ""; c = c + "What "; c = c + "The "; c = c + "Fuck?";

  • vertagano (cs) in reply to snoofle
    snoofle:
    Comment c = ""; c = c + "What "; c = c + "The "; c = c + "Fuck?";

    Syntax error.

  • matthewr81 (cs)

    Wow.. that has to be one of the best WTFs in a long time... wow.

  • Mike (unregistered) in reply to snoofle

    Even better, holding the string in Session() while trying to concat the whole monstrosity together.

    Ouch.

  • MAV (unregistered)

    Oof. Thats quite the... code.

  • A Fan (unregistered) in reply to MAV

    Holy Cow! (RIP:)

  • Anonymous (unregistered)

    My eyes!!! The goggles, they do NOTHING!!!

  • rob (unregistered)

    That needs to be up for an award.

  • TwelveBaud (unregistered)

    Apparently someone

    a) doesn't have write access to the style database, or doesn't know he has write access to the style database,

    b) was working on a system which Many Moons Ago had plans for users to set their own styles, but those plans have been scrapped,

    c) cannot create actual CSS files,

    d) doesn't believe in Join() or local variables.

    ... WTF?

    Captcha: doom (what I want to play with this person, my infammo chaingun against his 1-shot-per-clip pistol)

  • Say What? (unregistered) in reply to TwelveBaud

    Let's see, that's:

    approx 100 string concatenations outside the main loop approx 10 string concatenations inside the main loop * numRows approx 8 string concatenations inside the inner loop * numFields in what should be a join

    for a grand total of waaay-too-many!

    barfs

  • Kemp (unregistered) in reply to vertagano
    vertagano:
    snoofle:
    Comment c = ""; c = c + "What "; c = c + "The "; c = c + "Fuck?";

    Syntax error.

    No syntax error if we assume C++ and

    class Comment : public std::string {};

  • Aaron (cs)

    Jesus. The code makes no sense, and even the CSS makes no sense - "tdWhiteBdr" and "tdBlackBdr" is exactly how style sheets are NOT intended to be used.

    This is a true scrap-and-rewrite case, not even worth trying to salvage.

  • Bill Szczytko (unregistered)

    There are so many things wrong here I don't know where to begin. Session variable to join the whole style together? UGH. What a disaster.

  • Anonymous (unregistered)

    I've seen this before too, unfortunately. In this other case it was actually HTML, and they had the guts to not only put it into a database, but to concatenate it with ASP variables and document.write() calls before using Response.write to send the whole thing to the client.

    Imagine, for a moment, if you will, trying to read HTML that is escaped for inclusion in Response.write AND document.write() all at the same time. :shudder:

  • Eli (unregistered)

    The thing is... I could see myself at one time thinking, "hey, wouldn't it be great if we could abstract away some of the CSS code. Maybe put the class names in a table."

    I'm pretty sure I'd have stopped long before it got this bad, though.

  • RafBar (unregistered)
    Comment held for moderation.
  • Jan (unregistered)

    Where the hell are my googles? Aaaah, no, this is not possible, I hope the man who wrote this is long dead.

  • Jan (unregistered)

    Oh my! I hope the man who wrote this is long dead. Otherwise I would have him explained: What the f*ck?!

    Captcha: waffles, yeas I could eat some!

  • TheD (cs)

    There is nothing good or redeemable in that code. Could you imagine coding out 10k worth of CSS using that mess? I would certainly want to be paid by the hour, and spend about 30 minutes drinking hard liqour in a decontamination tank trying to forget about the horrible abortion of code I'd just foisted on the world.

    I think one of the more horribler things about the code is that it looks like they perhaps learned a little bit about CSS, but not enough to get away from a table-based layout (on non-tabular data). They also didn't take the time to learn any CSS shorthand.

  • Chad Emm (unregistered)

    Nice, reminds me of the eComm/CRM app I was responsible for maintaining when I started my career as a web dev. We had a Styles table that had a field for every single CSS property, so every style created by a user was stored as a row with individual values set in each field.

    Of course, this was the same app that would paste an entire form page's content in a <input type="hidden"> so you can store what the user had typed on the previous form page(s).

  • Mike Rod (unregistered)

    It's possible that the development team got a new server and they were stress-testing it.

  • MrTufty (cs)

    I really would rather die than work with CSS code that bad.

  • Jim Flood (unregistered)

    Whoever wrote this code is a <strong_language>Fucking</strong_language> Moron

  • Adam (unregistered) in reply to Kemp

    Maybe he overloaded the '+' operator in the Comment class

    Captcha: ninjas - sweet

  • seejay (cs)

    All I said when I read that was "What the flippity??"

    That's not just a monstrosity... it's a total aberration to the human brain because no one in their right mind would think that even remotely logical!

    -- Seejay

  • zack (unregistered)

    FAIL

  • batasrki (cs)

    Holy shit! I can emphatize with the OP, I'm dealing with a similar situation. Only in my case, someone decided it was a good idea to write out the head and body tags and the go through the entire Control collection (ASP.NET) and add each Control manually. Ugh

  • g0zer (unregistered)

    Cry. Delete. Rewrite.

  • KattMan (cs)

    I bet this code got past the reviewers because he "cool-cammed" it.

    Hey why are you saving it in a server variable? Look at his nice font! Ohh. Ahh.

  • Chris M (unregistered)

    I use the s = s + "..." ... some times in shell scripts when you need to build a path or whatever and when you might expect to need to change the order. And just for readibility, too.

    That way, even in vi or notepad it's a simple edit to reorder:

    set CLASSPATH = %CLASSPATH%;c:\apps\xerces\bin... set CLASSPATH = %CLASSPATH%;c:\apps\xalan... etc.

    But clearly this dude was deranged.

  • izb (unregistered)

    I read this site all the time but never comment.

    That's the first post that's moved me to comment.

    Simply... wow. That just messes with your head far too much.

  • Atrophy (cs) in reply to Anonymous
    Anonymous:
    My eyes!!! The goggles, they do NOTHING!!!
    +1
  • OneMHz (cs)
    session("gsStyleSheet") = session("gsStyleSheet") & " " & trim(rsCSSDetail("PropertyName") & " ") & " " & trim(rsCSSDetail("PropertyValue") & " " )
    Shouldn't there be a colon between the name and value?

    So, aside from this being horrible (aka fantastic WTF!), it doesn't even produce a working style sheet! WOO!

  • Ian (unregistered)

    My god this is bad.

    This is a good example of why separating code and content is a good idea. It's amazing that some people still haven't learnt about templating languages...

  • nbast (unregistered)

    haha, I did something similar a long, long time ago.

    We had an admin section where admin users could change colors online. I stored the colors in a table on the SQL server and wrote out a big <style> block at the top of each page. Though the query to build the code was just a simple loop, and all the static CSS was in a separate file.

  • tezoatlipoca (cs)

    Ugh. I agree with all of the afore mentioned reasons why this is just... ugh (bad use of css, misuse of session etc.)

    Although I do admit to having produced something as mangled(but not as ... bad..) after I had to write perl-cgi output to generate an email newsletter. Not so hard eh? 2 hrs later it was done and had a nice css stylesheet to look purty. Then it was discovered that Lotus Notes (uh. internal newsletter and guess what our email system is?) likes ignoring most aspects of stylesheets. Back to inlines with all sorts of sticky conditionals (if value > 5 make table cell blue etc.)

    So perhaps this wasn't the intended design (if you can call it that) but rather what it ended up as after some "just get it working" hacking.

    Of course we all go back and fix it later right? :/

  • awt (unregistered)

    set rsCSS = db1.execute("select * from tblCSSClasses") ... if rsCSS("IsClass") then

    So tblCSSClasses contains CssClasses.. and other things!

  • Diego (unregistered) in reply to Kemp
    Kemp:
    vertagano:
    snoofle:
    Comment c = ""; c = c + "What "; c = c + "The "; c = c + "Fuck?";

    Syntax error.

    No syntax error if we assume C++ and

    class Comment : public std::string {};

    C++ does not inherit constructors. Comment's constructor does not take parameters. Comment c = ""; will not compile

    read Stroustroup book before trying to be funny with C++

    muhahaha :)

  • Someone You Know (cs) in reply to zack
    zack:
    FAIL
    Even worse!
  • Aaron (cs) in reply to KattMan
    KattMan:
    I bet this code got past the reviewers because he "cool-cammed" it.
    Too soon. You should have waited for a more appropriate submission, but because you got impatient, the joke's not funny anymore.
  • skington (cs) in reply to awt
    awt:
    > set rsCSS = db1.execute("select * from tblCSSClasses") ... > if rsCSS("IsClass") then

    So tblCSSClasses contains CssClasses.. and other things!

    It'll contain styles assigned either to classes or Id's, at a guess.

  • Random832 (cs) in reply to Kemp
    Kemp:
    vertagano:
    snoofle:
    Comment c = ""; c = c + "What "; c = c + "The "; c = c + "Fuck?";

    Syntax error.

    No syntax error if we assume C++ and

    class Comment : public std::string {};

    Or Comment::Comment(char *), Comment::operator+(char *)

  • Cyrus (cs) in reply to Diego
    Diego:
    Kemp:

    No syntax error if we assume C++ and

    class Comment : public std::string {};

    C++ does not inherit constructors. Comment's constructor does not take parameters. Comment c = ""; will not compile

    read Stroustroup book before trying to be funny with C++

    muhahaha :)

    Yes, but if we assume a custom class that does not inherit from string then a constructor:

    Comment(const char *String)

    will compile this code just fine.

  • MaGnA (cs)

    Absolutely the best WTF we've seen lately...

  • MaGnA (cs)

    Just saw this:

    trim(rsCSSDetail("PropertyName") & " ")

    WTF!?!?! Append a space and then trim it?

  • iToad (unregistered)

    This is yet another reason why I occasionally fall on my knees and thank God that I do not develop Web applications.

  • Porpus (unregistered) in reply to TheD
    TheD:
    I think one of the more horribler things about the code is that it looks like they perhaps learned a little bit about CSS, but not enough to get away from a table-based layout (on non-tabular data). They also didn't take the time to learn any CSS shorthand.

    This may be ignorance, but I have never understood how CSS and "table-based layout" are alternatives to each other. Even when using "table-based layout," I am likely still using CSS for something.

    To me, CSS seems to have one huge flaw. I do not understand why the styles are applied hierarchically. If I apply a green, 1px solid border to something, very rarely do I want that setting to "cascade" to that control's child controls.

    I like the ASP.NET 2.0 "themes" system, which allows one to apply named styles to server-side controls without causing any "cascading." I wish client-side styles were more like that.

    captcha: dubya (wtf?)

  • otto (unregistered) in reply to Aaron

    regarding the tdWhiteBdr and tdBlackBdr classes...

    aside from the fact that they could have just done the four border styles in one line why exactly is css "not intented to be used" this way? is it just that they don't lock it into the "td" element?

  • Zylon (cs) in reply to Porpus
    Porpus:
    To me, CSS seems to have one huge flaw. I do not understand why the styles are applied hierarchically. If I apply a green, 1px solid border to something, very rarely do I want that setting to "cascade" to that control's child controls.
    And that's why people competent in CSS use the "class" attribute.
  • Diego (unregistered) in reply to Cyrus
    Cyrus:
    Diego:
    Kemp:

    No syntax error if we assume C++ and

    class Comment : public std::string {};

    C++ does not inherit constructors. Comment's constructor does not take parameters. Comment c = ""; will not compile

    read Stroustroup book before trying to be funny with C++

    muhahaha :)

    Yes, but if we assume a custom class that does not inherit from string then a constructor:

    Comment(const char *String)

    will compile this code just fine.

    too late! he made an empty class. we can see it clearly!

Leave a comment on “Overflowing Style Sheets”

Log In or post as a guest

Replying to comment #:

« Return to Article