|
Lexical Unit posted:Roman numeral horror I am going to have nightmares about seeing this somewhere in 5 years from someone who believes in proactive job security. edit: no good reason for me to have quoted all that Wuhao fucked around with this message at 05:47 on Aug 12, 2009 |
# ? Aug 12, 2009 05:29 |
|
|
# ? May 15, 2024 02:06 |
|
Wuhao posted:I am going to have nightmares about seeing this somewhere in 5 years from someone who believes in proactive job security. And just think, you can actually do practical stuff that looks more-or-less like that.
|
# ? Aug 12, 2009 05:31 |
|
Avenging Dentist posted:And just think, you can actually do practical stuff that looks more-or-less like that. Please don't tell me that at this point in time
|
# ? Aug 12, 2009 05:33 |
|
tripwire posted:Please don't tell me that at this point in time Here's some code I wrote for a memoizer for C++0x: code:
|
# ? Aug 12, 2009 05:36 |
|
Avenging Dentist posted:And just think, you can actually do practical stuff that looks more-or-less like that. Yeah, you know, do we call people with ungodly C++ boost skill "gurus," or "sith lords?"
|
# ? Aug 12, 2009 05:38 |
|
By the time i was called in the program would sometimes not crash while trying to create an inventarisation snapshot to use on some hand scanners, so it wasnt really dead yet. A wonder that it ever worked though:code:
|
# ? Aug 12, 2009 12:42 |
|
4VAlien posted:
Here's the real horror.
|
# ? Aug 12, 2009 14:33 |
|
I had assumed that was in another language (Dutch) http://www.allwords.com/word-decimal.html But yeah: code:
|
# ? Aug 12, 2009 15:28 |
|
Scaevolus posted:Here's the real horror. Maybe the first programmer working on this was Dutch? E: f;b
|
# ? Aug 12, 2009 15:30 |
|
Mill Town posted:Maybe the first programmer working on this was Dutch? That still doesn't forgive this... code:
|
# ? Aug 12, 2009 18:49 |
|
code:
|
# ? Aug 12, 2009 18:50 |
|
HatfulOfHollow posted:That still doesn't forgive this... Nor the fact that he named it RoundOff because Round is already taken by a standard VB function.
|
# ? Aug 12, 2009 21:29 |
|
Avenging Dentist posted:Here's some code I wrote for a memoizer for C++0x: What the christ is that doing?
|
# ? Aug 16, 2009 05:42 |
|
Tinyn posted:What the christ is that doing? It forwards a call from operator() to call, converting from the types passed in to the original type specified in the memoizer class template where necessary. It's there to eliminate unnecessary copying by supporting C++0x move semantics whenever possible. I have a comment explaining more-or-less that in the code itself, but where's the fun in that? Avenging Dentist fucked around with this message at 06:05 on Aug 16, 2009 |
# ? Aug 16, 2009 06:03 |
|
Incoherence posted:Another way to make people crazy: if you ever have an opportunity to write a 4-level nested loop, use the variables i, ii, iii, and iiii. what about i, ii, iii, and iv?
|
# ? Aug 16, 2009 09:19 |
|
Intel Penguin posted:what about i, ii, iii, and iv? A well-written program would use both IIII and IV.
|
# ? Aug 16, 2009 14:57 |
|
What's from, QCS?
|
# ? Aug 16, 2009 15:04 |
|
Otto Skorzeny posted:What's from, QCS? E/N.
|
# ? Aug 16, 2009 15:25 |
|
Mill Town posted:A well-written program would use both IIII and IV.
|
# ? Aug 16, 2009 16:09 |
|
Wow, cleaning up our old team's code was horrific. First of all, one of our biggest, most complex products has a pretty large user database. We store TONS of information on users, that's sort of the point of the software (not going to say what it does, though, it's not important). Eventually our WHOLE development team was fired and a new team (us) brought in. The guys that were working on this did get a chance to talk to the old team on the way out. I guess what happened is this: All the user info was stored in one table. In fact, everything was stored in one table, the whole database (several gigs at this point, it's even larger now) was on goddamn table. At one point, they actually managed to max out the number of columns a table can have in SQL Server 2000. Then they were required to add two more columns. So, instead of normalizing ANYTHING, they go ahead and just... delete what they considered the two least used columns to make room for the new ones. This was back before any sort of backup policy was in place, meaning that data was gone FOREVER. They also didn't tell anyone that they did it, so they had to discover this a year or so later. Same guys also had a few favorite VB tricks, including using one variable for pretty much everything (I guess they were rationing variables back in the day or something) and determining what to do using if statements to figure out the type. Yeah, I can see an application or two of that maybe, but using ONE VARIABLE ON AN ENTIRE SITE is just insanity. Also I had to edit a function they wrote, in classic ASP. It was one function to generate the code necessary to populate a java-applet-based graph. Not very tough at all, just feed an applet some numbers. It took them 3000+ lines of code spread amongst 3 or 4 include files. They also had not heard of a thing called concatenation, so every single minor variation of things like the select statements (which of course were all inline) had its own if statement and was written out in full. Also no input validation, so yes people could SQL inject like crazy. And yes, people DID SQL inject us. Imagine our surprise one day when one of our legacy product's production environment was suddenly missing our "users" table. Myrddin Emrys fucked around with this message at 04:14 on Aug 17, 2009 |
# ? Aug 17, 2009 04:12 |
|
I look at the source code for our site for five minutes and I find this:code:
code:
|
# ? Aug 17, 2009 15:33 |
|
The only one I see that's worth crying about is the willy-nilly truncation of the XML. I'd say that's a great way to magically create malformed XML. Maybe the fact that he's storing XML in a text field of some sort instead of an XML field, but I guess this is the "coding horrors" thread, not the "critique my dba by looking at 10 lines of application code" thread.
|
# ? Aug 17, 2009 16:36 |
|
I like that the helper function they wrote to handle the null string case requires about twice as much typing as the expression itself.code:
code:
|
# ? Aug 17, 2009 16:52 |
|
Jethro posted:The only one I see that's worth crying about is the willy-nilly truncation of the XML. I'd say that's a great way to magically create malformed XML. Maybe the fact that he's storing XML in a text field of some sort instead of an XML field, but I guess this is the "coding horrors" thread, not the "critique my dba by looking at 10 lines of application code" thread. You score 1 point. The other flaws are in the 2 functions posted. There are several flaws.
|
# ? Aug 17, 2009 17:04 |
|
Jethro posted:not the "critique my dba by looking at 10 lines of application code" thread. that was written by the lead architect*. many of his contributions have been posted before: code:
edited to add: I don't work there
|
# ? Aug 17, 2009 17:17 |
|
Zombywuf posted:You score 1 point. The other flaws are in the 2 functions posted. There are several flaws. The maxLength < 0 check is stupid, just throw an argument exception. Or at least check for <= 0. Calling SubString even if no truncation is needed.
|
# ? Aug 17, 2009 17:28 |
|
Zombywuf posted:You score 1 point. The other flaws are in the 2 functions posted. There are several flaws. He's setting the value of maxLength to the text length. We he then returns the substring, he will return the string the same as it went into the function.
|
# ? Aug 17, 2009 17:38 |
|
dwazegek posted:The maxLength < 0 check is stupid, just throw an argument exception. Or at least check for <= 0. Ding ding 2 points. The last one I'd count is somewhat stylistic. But if you're masking null pointer errors in your data layer, urdoinitrong.
|
# ? Aug 17, 2009 17:45 |
|
HFX posted:He's setting the value of maxLength to the text length. We he then returns the substring, he will return the string the same as it went into the function. That's only if maxLength exceeds text length, though. If maxLength is between 0 and text.Length it stays the same.
|
# ? Aug 17, 2009 17:57 |
|
Myrddin Emrys posted:That's only if maxLength exceeds text length, though. If maxLength is between 0 and text.Length it stays the same. Right which is completely retarded. Sadly this code reminds me of a lot of the code I see around my work. I'm going to have to post some when I find some.
|
# ? Aug 17, 2009 18:33 |
|
HFX posted:Right which is completely retarded. Sadly this code reminds me of a lot of the code I see around my work. I'm going to have to post some when I find some. Sure it's not ideal. I just meant he wouldn't necessarily be returning the same string, which is what you originally said.
|
# ? Aug 17, 2009 18:54 |
|
We have a code test that we make candidates take before we consider giving them an interview. We ask them to build a little song database, give it at least three specific views of the data, and to switch between views using a modern JS library. Nobody, not one person, has ever passed the test. Not even me. This gem came in today, in part of the submitter's home-grown application code, including a class that wraps PHP's mysql_* functions: php:<? class songs_global { // ... public function fixString($Instring=NULL){ //Use this on any text you pass into the database. //Queries will fail if any variable contains a single quote. //First replaces addslashes /' with just a single quote, //then replaces single quotes with two single quotes. //ie bee/'s knees or bee's knees becomes bee''s knees, //then uses the first quote to escape the second //so INSERT 'bee''s knees' is interpreted as //INSERT 'bee's knees' if($Instring == NULL){ return NULL; } $OutString = str_replace("'", "''", str_replace("\'", "'", $Instring)); return $OutString; }?> The entire "global" class is a horrible, horrible thing that makes me want to shoot him. Thankfully I don't have a gun, I'll just get to ask him what the gently caress he's thinking if the boss decides he's worth interviewing. McGlockenshire fucked around with this message at 23:50 on Aug 18, 2009 |
# ? Aug 18, 2009 23:41 |
|
Why would it make a backslashy mess? Unless it replaces the second instance with the first, as opposed to the first instance with the second
|
# ? Aug 19, 2009 00:08 |
|
On his own demo for his own code, submitting: "Testy'test"test" transforms into \"Testy\'test\"test\" I have no idea what's even going on. I think he might have magic_quotes_gpc enabled. (Non-PHP people: magic_quotes_gpc is a misfeature that automatically tries to escape quotes in all input.)
|
# ? Aug 19, 2009 00:48 |
|
Am I just a bad programmer or is something like this bad:code:
|
# ? Aug 19, 2009 05:18 |
|
McGlockenshire posted:... I like how it lets "don\\'t escape my injection" through
|
# ? Aug 19, 2009 05:27 |
|
ryanmfw posted:Am I just a bad programmer or is something like this bad: output(i) returns a reference to the i'th element of an internal array I'd guess. If so I'd personally overload[] and use output[i] = device_read(i) myself; It's a stylistic choice.
|
# ? Aug 19, 2009 18:47 |
|
code:
|
# ? Aug 19, 2009 20:55 |
|
Please you've got to stop. Between that and the find you wrote up on my whiteboard earlier today, I am going to lose all hope.
|
# ? Aug 19, 2009 21:16 |
|
|
# ? May 15, 2024 02:06 |
|
Oh the things I could draw if posts were whiteboards...
|
# ? Aug 19, 2009 22:36 |