Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice
Just found this.. not really a horror per say, but WTF:

php:
<?
<style>
<?if(!$_GET['article']){?>

*{
    
}
<?}?>
</style>
?>

Adbot
ADBOT LOVES YOU

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Munkeymon posted:

That was amateur horror. It takes professionals to create Live Horrors


I want to see the thought process on the variable name....

"I'll call it 's'! No, wait, that could be confusing. 'ss'! Oh man, that's like all nazi and poo poo. 'sss' it is!"

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

MasterSlowPoke posted:

maybe he doesn't know that == tests for equality?

Yeah, but != tests for !equality. So..... !?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice
I got asked to help out on a project while the guy doing the dev work was on vacation. This is what I found. Formatting and variable names preserved as found, a couple function names and a domain changed to protect the innocent. (this is javascript)

code:
    var i;
///
// 60 lines of code later
////

    for(i=0;thelist[i];i++) {	  
 p = p + '<li class=' + ((i % 2) == 0?'listOdd':'listOdd') + ' id="'+thelist[i].MemberID+'" >';
    if ( thelist[i].State == 3 || thelist[i].State == 4 ) 
      p = p + '<div class="memberNumber" id="memberNumber">&nbsp;'+(i+1)+'&nbsp;&nbsp;</div>';
    else
      p = p + (i+1);
          if ( thelist[i].UserID != userId || originator == true) {
      	p += '<img class=removeMember name="removeMember" onclick="postMessageExecRemoveMember(\''
   +((originator==true && thelist[i].MemberID == 0)?thelist[i].UserID:thelist[i].MemberID)+
            '\');return false;" title="Remove user" src="img/phoneRemoveButton.gif">';

    }

    var cname = '';
    
    if ( thelist[i].UserID.indexOf('@somedomain.com') != -1 ) {
      l2 = 'VI #' + String(displayID);
    } else
      l2 = mainPageController.contactsToolPanel.getContactLabelByNumber(mainPageController.contactsToolPanel.removeStuff(thelist[i].UserID), true);
        if ( l2 && l2 != '' ) 
          p = p + l2;
    else if ( thelist[i].DisplayName && thelist[i].DisplayName != '' )
      p = p + thelist[i].DisplayName;
        else if ( thelist[i].UserID ) {
          p = p + thelist[i].UserID;
        }
           }
I just stared at it for a while, then took the rest of the day off.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Broken Knees Club posted:

I just really like the one liner version. It's [0] is true, but also equals false?? :v:

It's "I don't understand javascript 101" [0] creates an array with one value, so by itself, it evaluates to TRUE, since it exists. When you do a compare, [0].valueOf() is done, and since it's a single element array, it returns that element: 0.

\/ it has it's :downs: moments for sure.

Lumpy fucked around with this message at 19:34 on Aug 15, 2010

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

CHRISTS FOR SALE posted:

code:
.nav_list_link:hover, .nav_list_link:hover {
Why would it ever make sense to do this ever?!?

:suicide:

I'm not sure hitting paste twice is really a coding horror, especially since it doesn't affect functionality or introduce any display bugs.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Bozart posted:

HTML position information only.

Anyway I realized I was wandering off topic - the horror is that some people who can't program (at all!) think that programming works like it does in the movies, and therefore it is easy. And it is catching.

An old boss of mine had this sign hanging on his wall: "Anything I don't understand must be easy."

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Surface posted:

Ohhh, so it's your code that causes other developers to cry when it comes time for maintenance.

Huh?

Having a duplicated selector in a CSS rule isn't something one should aspire to, and if I saw one, I'd remove it. But since it cannot cause any unwanted behavior, isn't propagated anywhere else, can't break any other CSS files or rules, and I can't fathom it's existence causing anyone to cry at any point, I didn't think it was a HORROR. A minor annoyance that should be cleaned up, sure, but not a horror. How you infer that my code causes people to cry because of that....

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Jabor posted:

Because the kind of person who double-pastes and doesn't notice or correct it is also the kind of person who is sloppy in other areas of their code.

So they should post a picture of the person in the thread instead!

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice
Here's some type-related fun I came across in some vendor code today:

code:
SetLineVol(String(Number(nLineNo)), String(Number(nVolume)));

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

ToxicFrog posted:

So wait, is it calling Number() on something that's already numeric? Or are they not only using systems hungarian, but lying about the type?

The inputs to this method come from SELECT elements, so technically that is a String always. There's a lot of weird stuff like this, which I gather comes form said vendor being a .NET developer who had to do a little bit of javascript.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Ryouga Inverse posted:

This is the funniest coding horror I've seen in a while, and this post just makes it even better. :lol:

I immediately thought of this: http://video.adultswim.com/tim-and-eric-awesome-show-great-job/erics-banking-problems.html

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Munkeymon posted:

I still think the string manipulation function I found at work is worse than Duff's, which is at least somewhat understandable.

edit: took me a while to find it

:bang:

Don't worry - it's still in use :)

Wow, that's impressive. Here's some zingers from an app I just got told I have to "fix":

code:
try {
  !!appState.length && (currentState = appState[0]) != null;
} catch(e) {}
and then later...

code:
switch(currentState) {
 
  case "mpTabSelect":
    showTabs();
    if (currentState == "mpTabSelect") {
      // much code
    }
   break;

  // and it goes on like that... and on... and on...
}

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Incoherence posted:

This is more a coder horror than a coding horror, but we had something fun happen in one of my freshman CS classes. We had take-home exams, because doing a CS exam in a lecture hall on paper is really dumb and just means the graders have to figure out exactly how many syntax errors we let you make before we decide you actually don't know how to program (I ended up TAing the same class afterward).

After the second exam, the professor mentioned in class that someone had posted the exam on Rent-A-Coder, and that someone had told him about it. I can sort of see this: someone really desperate to get a good grade, and doesn't expect the professor to be watching those sites for the exam to show up.

The professor dithers on the final for awhile after this, but finally decides to make it a take-home exam as well. One day, I check the course webpage and there's a news update: the same username has posted the final on the same site. The next day, another update: some other user has accepted the job. The afternoon the exam was due, though, the other user withdrew, saying it was "unethical". I sort of wonder how much of a hand the professors had in this.

If the professor was smart / evil, he would have accepted the job himself, taken some of the kids cash, then flunked the kid for plagiarizing the profs work. :devil:

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

pokeyman posted:

What an obnoxious way to write.

That's how screenplay software is written.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

revmoo posted:



(I don't release a site to a client until it validates XHTML 1.0 Strict)

Why are you still using that DOCTYPE? :v:

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

revmoo posted:

What in the world is wrong with that doctype?

It's depreciated, and if you want to actually use any feature of HTML5, your stuff won't validate any more? What features of XHTML Strict do you actually need?

Lumpy fucked around with this message at 18:44 on Mar 31, 2011

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

revmoo posted:

Deprecated in favor of HTML5? I'm not switching to HTML5 until IE catches up.

"catches up" with what? IE6 renders pages perfectly fine using the HTML5 doctype. I suspect you are a little unsure on what a Doctype is and does. <!DOCTYPE html> puts IE6 into standards mode exactly like XHTML 1.0 strict.

A note on IE6 and HTML5: http://ejohn.org/blog/html5-doctype/
EDIT: and another: http://diveintohtml5.org/semantics.html

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Zombywuf posted:


EDIT: Also just wanting to reiterate the question, when did XHTML get deprecated?

"Depreciated" was a poor choice of wording on my part. I meant "unless you have an actual valid reason to use XHTML Strict, you should use HTML5, since the XHTML spec is no longer being worked on, and while it works fine now, maybe IE10 or FF 5 (or IE15 or FF12, or whatever) won't support it, whereas even if you don't use any HTML5 tags or features, your regular old web pages will render just fine even in the no-longer supported IE6 if you use the HTML5 doctype, so there is no *default* reason to use XHTML Strict instead of HTML5." Again, you may have a valid reason to do so, and then by all mean, go nuts.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

rjmccall posted:

While depreciate and deprecate have some overlap in ordinary English, only deprecate is accepted technical jargon.

My spelling is the real horror.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Orzo posted:

what are the comments like, is anyone a member?

I am, and let's just say it's mainly a place for designers.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Ugg boots posted:

No, this is fine, and I do it when it is like this:

code:
// Commented out for the demo until we can figure out the performance problems --Ugg 6/8/2011
// DoTheThing();
But seeing 100 lines of code wrapped with #if 0 that was written 5+ years ago and is still in the code makes me furious. If it's like "hey we might need this later" then it should be deleted, but if it's only genuinely temporarily commented out pending further changes/investigation, then that's fine.

At the job I just quit, I left blocks like this in commits:
code:
/* This is code marketing asked for last week, but today they decided they 
* didn't want it, but I know the focus group tomorrow :suicide: will whine
* and they'll beg me to put it back in and I will tell then it will take two days
* and I will use that time to look for a new job

/// code 

*/

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

NotShadowStar posted:

No loving way. Pics or it didn't happen.

At my last job, we had one SVN repo for every single project in the history of company; all 200+ of them. You'd do an initial commit on a new project, and it would be #96345. The next day, you'd commit your first change, and it would be #100032. A year ago, a bunch of the devs were pushing for moving to Mercurial or git, but it got vetoed because, I poo poo you not, the Director of Development was upset that "we can't have every project in the same repo, so no way."

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Scaramouche posted:

It's to the point now where I don't even know what CSS is >for< anymore, since it's been manhandled into so many roles, and seems worst-suited to what it was originally intended for (a nice portable way of presenting formatting). It seems like to do anything worthwhile with it you have to have JQeury, JSON, less.js, etc. etc. unless all you're doing is changing link behaviour and image alignments. I think making it a 'proper' language is almost moving in the wrong direction because it just becomes a less ugly JS with relatively sane markup and totally insane everything else.

99.5% of hacks and so on aren't needed if people simply 1) used a real reset.css and 2) used minimal, valid, sematic markup.

Sadly, 94.6% of people calling themselves Web Designers (or web developers, or whatever the hell they call themselves these days) do not do either of those things.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

JediGandalf posted:

So in this very thread I posted some rather horrific Javascript for a mortgage calculator we use and then attempted to "clean" it up with some jQuery. Well here is my solution:
code:
<input type="radio" id="rdoPercentage" checked name="downType" value="pct" />% of sale price 
<input type="radio" id="rdoFixedAmount" name="downType" value="fixed" />fixed amount 

$('#btnCalculate').click(function () { 
if (validForm) { 
var downType=$('#rdoPercentage').val() == "pct" ? "pct": "fixed"; 
 
var mortgage = MortgageCalculator.Calculate( 
$('#txtSalePrice').val(), 
$('#txtDownPayment').val(), 
$('#txtLoanTerm').val(), 
$('#txtInterestRate').val(), 
downType 
);
I'll you all laugh at this at my expense.


I'm sure you mean the incorrect getting of the radio group value, but not caching your jQuery selectors is the worse part.

\/\/ correct.

Lumpy fucked around with this message at 01:16 on Sep 3, 2011

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

BonzoESC posted:

Oh duh; this is why I prefer to use the DOM:

code:
> f = document.forms['track']
// => <form name="track" id="track" action="/live/form.rvt">…</form>
> f['ident']
// => <input name="ident" id="ident" type="text" value="DAL64" title="e.g. N123AB">
> f['ident'].value
// => "DAL64"

Except your way doesn't work either. You are just getting the value of a single radio input by ID just like the other example:

http://jsfiddle.net/WxThT/

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

lord funk posted:

My own idiocy that cost me 10 minutes of confusion:

code:
    for (int i=0; i<[array0 count]; i++) {
        [array0 removeObjectAtIndex:i];

        //other crap
    }
:derp: How come it's not removing all the objects?

is it because you forgot to do this?

[array0 removeAllObjects]

I'd do that and then wonder why my loop only ran once.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Presto posted:

I know Adobe Flexbuilder bitches if you do 'for (int i; ...' more than once. I think it's just a warning though.

Because actionscrpt is function scoped, not block scoped, so you are duplicating the creation of i.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Clavius posted:

Yeah don't do this. It's much better to just let IE have the square corners and use border-radius.

Don't you know that if everything doesn't have drop shadows and rounded corners in all browsers, your site won't work at all / visitors will immediately leave / nobody will understand the 'vision' / be unable to read the content that's nowhere near the rounded corners / become outraged?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Suspicious Dish posted:

Move over AES and PGP, it's time for "The most secure data cryption program in the world": KRYPTOChef!

AES and PGP are public algorithms, which means that anybody can study them to learn how they work and decrypt any file. KRYPTOChef is different:


It even has proof of its security! Watch:


For those not versed in idiot, this says: "The permutation of files with 18,033 bytes is a number with over 43,424 places."

In a million years, whatever humans have evolved to will have this inscribed on their buildings / on their currency:

some sort of crazy posted:

Who it does not know can only say there. That does not know so exactly !

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Bohemian Cowabunga posted:

So can we bitch about lovely teachers here?..
I am currently studying to become a network engineer and have taken an introductory course in C# on the side. The entire course has pretty much turned into a self-study. We have had zero theory and not turned in a single assignment, but merely worked on whatever we wanted during the classes.

Now we have never actually seen any of this guys own code until now, when he gave us the code our oral exam is based upon.

http://pastebin.com/RYHrAfRb

This guy is being paid to teach programming.

He's obviously just showing you what *not* to do....

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice
So I had to poke around in a homegrown CMS system that a client's old web dev shop wrote ~6 years ago. It is full of horrors, but the README file takes the cake:

code:
THIS IS OUT OF DATE: UPDATE WITH INFO ABOUT HOW THIS WORKS!

This directory holds files that will eventually become actual documents on
a website: the editor scripts, etc.
:suicide:

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Biowarfare posted:

Can we post HTML?



:psyduck:

Well, the important thing to remember is that all those font loads don't slow down the page load. Oh, wai

:suicide:


I'm going to pretend that's a page designed simply to show off every google font in a list. Because my small designer brain can't handle any other possibility.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Wheany posted:

CSS code:
a
{
	color:#333333;
	background-color:#FFFFFF;
	font-weight: normal;
	border-left-style: solid;
	border-left-color: #0083bc;
	border-left-width: 10px;
	border-right-style: none;
	border-right-width: 0px;
	border-right-color: #FFFFFF;
	padding-left: 10px;
}

a:hover
{
	background-color:#4e4c4d;
	font-weight: bold;
	padding-left: 10px;
	color: #FFFFFF;
}
Ok, done.

They did just list every instance of their a tags using unnecessarily specific selectors, right?

You fool! Now the one DIV where they didn't want those colors is all wrong!! Put them back!

My guess is that whoever wrote than has no clue what a .class is.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Maluco Marinero posted:

I really don't get this. I mean firstly, what security consultant in this day and age will tell them anything other than 'change now god drat it', and secondly, is their architecture so screwed up that they can't migrate to hashed passwords? I mean, they HAVE the passwords, they wouldn't even need the user to enter their password to do the migration to hashes, and they still don't do anything about it.

A few jobs ago I discovered they were storing passwords as plain text. I immediately brought it up to my boss, who brought it up to his boss, etc. A couple days later I was told we were not to change anything because Marketing had vetoed it... because how would we email user's their passwords when they clicked "forgot password"?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

MrBadidea posted:

code:
enum Rank { 1, ... A };
This, right here, is the part I keep looking at and cringing about. Has this person legitimately never handled a deck of cards? :stare:

"Ace can be one *and* 11? What kind of God would allow that!"

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Volmarias posted:

employeeID and I dare anyone to tell me otherwise :colbert:

code:
el = getElementByID('ohNoes');
Why isn't my JavaScript working?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Dren posted:

People complain and make snide remarks because they tire of waiting for everyone engaged in the discussion to realize they've been fighting windmills and decide to self-impose a limit on their pedantry.


color

You're both wrong:

https://kuler.adobe.com/

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Jewel posted:

Ah but that comment is vague you have to specify which operator you're calling!

code:
x++; //invoke the postfix ++ operator on x

What if that operator is removed at some point from the language?

code:
x++; // the 'x' character, followed by two(2) instances of the '+' character with a ';' character at the end

Adbot
ADBOT LOVES YOU

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Strong Sauce posted:

They're required to put them in by law I believe. So not really their fault.

As someone who does a lot of work for the booze industry, yes. They have to be there because The Man says so.

The Man says so for those awful reasons pointed out earlier, but the companies themselves would love to get rid of those stupid things.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply