Comment On Overflowing Style Sheets

When Lex submitted a large snippet of code from an older ASP/VBScript application that he had inherited, I was considering extracting the following single line and publishing it as a Representative Line... [expand full text]
« PrevPage 1 | Page 2Next »

Re: Overflowing Style Sheets

2007-08-15 09:42 • by snoofle (unregistered)
Comment c = "";
c = c + "What ";
c = c + "The ";
c = c + "Fuck?";

Re: Overflowing Style Sheets

2007-08-15 09:51 • by vertagano
149776 in reply to 149772
snoofle:
Comment c = "";
c = c + "What ";
c = c + "The ";
c = c + "Fuck?";


Syntax error.

Re: Overflowing Style Sheets

2007-08-15 09:51 • by matthewr81
Wow.. that has to be one of the best WTFs in a long time... wow.

Re: Overflowing Style Sheets

2007-08-15 09:54 • by Mike (unregistered)
149779 in reply to 149772
Even better, holding the string in Session() while trying to concat the whole monstrosity together.

Ouch.

Re: Overflowing Style Sheets

2007-08-15 09:56 • by MAV (unregistered)
Oof. Thats quite the... code.

Re: Overflowing Style Sheets

2007-08-15 10:00 • by A Fan (unregistered)
149782 in reply to 149780
Holy Cow! (RIP:)

Re: Overflowing Style Sheets

2007-08-15 10:00 • by Anonymous (unregistered)
My eyes!!! The goggles, they do NOTHING!!!

Re: Overflowing Style Sheets

2007-08-15 10:00 • by rob (unregistered)
That needs to be up for an award.

Re: Overflowing Style Sheets

2007-08-15 10:04 • by 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)

Re: Overflowing Style Sheets

2007-08-15 10:09 • by Say What? (unregistered)
149786 in reply to 149785
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*

Re: Overflowing Style Sheets

2007-08-15 10:09 • by Kemp (unregistered)
149788 in reply to 149776
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 {};

Re: Overflowing Style Sheets

2007-08-15 10:11 • by Aaron
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.

Re: Overflowing Style Sheets

2007-08-15 10:14 • by 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.

Re: Overflowing Style Sheets

2007-08-15 10:14 • by 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:

Re: Overflowing Style Sheets

2007-08-15 10:15 • by 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.

Re: Overflowing Style Sheets

2007-08-15 10:30 • by RafBar (unregistered)
Oh My God!

Re: Overflowing Style Sheets

2007-08-15 10:30 • by Jan (unregistered)
Where the hell are my googles? Aaaah, no, this is not possible, I hope the man who wrote this is long dead.

Re: Overflowing Style Sheets

2007-08-15 10:32 • by 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!

Re: Overflowing Style Sheets

2007-08-15 10:32 • by TheD
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.

Re: Overflowing Style Sheets

2007-08-15 10:43 • by 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).

Re: Overflowing Style Sheets

2007-08-15 10:47 • by Mike Rod (unregistered)
It's possible that the development team got a new server and they were stress-testing it.

Re: Overflowing Style Sheets

2007-08-15 10:52 • by MrTufty
I really would rather die than work with CSS code that bad.

Re: Overflowing Style Sheets

2007-08-15 11:00 • by Jim Flood (unregistered)
Whoever wrote this code is a <strong_language>Fucking</strong_language> Moron

Re: Overflowing Style Sheets

2007-08-15 11:07 • by Adam (unregistered)
149805 in reply to 149788
Maybe he overloaded the '+' operator in the Comment class

Captcha: ninjas - sweet

Re: Overflowing Style Sheets

2007-08-15 11:19 • by seejay
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

Re: Overflowing Style Sheets

2007-08-15 11:21 • by zack (unregistered)
FAIL

Re: Overflowing Style Sheets

2007-08-15 11:21 • by batasrki
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

Re: Overflowing Style Sheets

2007-08-15 11:23 • by g0zer (unregistered)
Cry. Delete. Rewrite.

Re: Overflowing Style Sheets

2007-08-15 11:28 • by KattMan
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.

Re: Overflowing Style Sheets

2007-08-15 11:30 • by 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.

Re: Overflowing Style Sheets

2007-08-15 11:33 • by 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.

Re: Overflowing Style Sheets

2007-08-15 11:36 • by Atrophy
149816 in reply to 149783
Anonymous:
My eyes!!! The goggles, they do NOTHING!!!

+1

Re: Overflowing Style Sheets

2007-08-15 11:37 • by OneMHz
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!

Re: Overflowing Style Sheets

2007-08-15 11:51 • by 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...

Re: Overflowing Style Sheets

2007-08-15 12:08 • by 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.

Re: Overflowing Style Sheets

2007-08-15 12:13 • by tezoatlipoca
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? :/

Re: Overflowing Style Sheets

2007-08-15 12:19 • by awt (unregistered)
> set rsCSS = db1.execute("select * from tblCSSClasses")
...
> if rsCSS("IsClass") then

So tblCSSClasses contains CssClasses.. and other things!

Re: Overflowing Style Sheets

2007-08-15 12:25 • by Diego (unregistered)
149830 in reply to 149788
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 :)

Re: Overflowing Style Sheets

2007-08-15 12:34 • by Someone You Know
149833 in reply to 149809
zack:
FAIL

Even worse!

Re: Overflowing Style Sheets

2007-08-15 12:35 • by Aaron
149834 in reply to 149812
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.

Re: Overflowing Style Sheets

2007-08-15 12:46 • by skington
149838 in reply to 149826
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.

Re: Overflowing Style Sheets

2007-08-15 12:46 • by Random832
149839 in reply to 149788
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 *)

Re: Overflowing Style Sheets

2007-08-15 12:57 • by Cyrus
149844 in reply to 149830
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.

Re: Overflowing Style Sheets

2007-08-15 13:27 • by MaGnA
Absolutely the best WTF we've seen lately...

Re: Overflowing Style Sheets

2007-08-15 13:31 • by MaGnA
Just saw this:

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

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

Re: Overflowing Style Sheets

2007-08-15 13:59 • by iToad (unregistered)
This is yet another reason why I occasionally fall on my knees and thank God that I do not develop Web applications.

Re: Overflowing Style Sheets

2007-08-15 14:00 • by Porpus (unregistered)
149864 in reply to 149796
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?)

Re: Overflowing Style Sheets

2007-08-15 14:11 • by otto (unregistered)
149867 in reply to 149789
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?



Re: Overflowing Style Sheets

2007-08-15 14:29 • by Zylon
149871 in reply to 149864
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.

Re: Overflowing Style Sheets

2007-08-15 14:51 • by Diego (unregistered)
149877 in reply to 149844
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!
« PrevPage 1 | Page 2Next »

Add Comment