|
b0lt posted:It is when there's no way to check reference equality. On a related note, I love this solution for the lack of reference equality in PHP4: quote:Well why not add a new operator ==== [e] This is even better: code:
Plorkyeran fucked around with this message at 23:28 on Jun 14, 2010 |
# ? Jun 14, 2010 23:26 |
|
|
# ? Apr 27, 2024 06:35 |
|
Plorkyeran posted:On a related note, I love this solution for the lack of reference equality in PHP4: Clearly the more you hit = the more you really mean it.
|
# ? Jun 15, 2010 17:15 |
|
Munkeymon posted:Clearly the more you hit = the more you really mean it. All that research into fuzzy logic and we could've just used PHP all along.
|
# ? Jun 15, 2010 17:37 |
|
No specific code, but the following idea: Taking unfiltered user input and using it as an xml tag. Strings starting with numbers? No problem! Spaces? Throw them right in! I assume it was to save the 'trouble' of writing <entity><name>hurfdurf</name></entity> or <entity name="hurfdurf"></entity>. Instead we get <hurfdurf></hurfdurf> and I seriously want to strangle someone.
|
# ? Jun 15, 2010 22:40 |
|
I'm going to just put out a minor coding "horror" I used to try to write in C when I was just starting out as a wee lad.code:
cliffy posted:Taking unfiltered user input and using it as an xml tag. Strings starting with numbers? No problem! Spaces? Throw them right in! Recently, I wound up having to submit escaped / wrapped XML to a web service call because the visual programming language I've been working on sucks at arbitrary length "arrays" (they don't exist - everything's a string!) and parameter argument names are static and would have to be written in the rough coding equivalent of: (int,string,string,string,string,string) foo(arrayElem0,arrayElem1,arrayElem2,arrayElem3,arrayElem4...) {//dostuff} So the web service provider gave us a new call that let me take the XML I'd have given to the other call and now it looks like... <wrappedrequestdata> <requestdata><blah attrib="fuckmejesus" /></requestdata></wrappedrequestdata> We managed to make XML-RPC even less readable through this process and take up quadruple the bandwidth (and about 25% more memory on both the client and server). Sadly, this isn't the worst case of inefficiency in our system. I've tried to write out an EBNF for the visual language and all but every time I've looked at it, it just made me sad that I've spent 4 years of my life working on trying to improve this poo poo. I've gotta get out of this poo poo or actually make it better, ugh. loving proprietary software with no user community because of paranoid customers that refuse to ever share code.
|
# ? Jun 18, 2010 20:53 |
|
necrobobsledder posted:I'm going to just put out a minor coding "horror" I used to try to write in C when I was just starting out as a wee lad. Python, gently caress yeah.
|
# ? Jun 18, 2010 20:57 |
|
necrobobsledder posted:I'm going to just put out a minor coding "horror" I used to try to write in C when I was just starting out as a wee lad.
|
# ? Jun 18, 2010 21:19 |
|
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:
|
# ? Jun 18, 2010 22:03 |
|
This may not qualify as a horror, but it always catches people when they first see it:code:
|
# ? Jun 18, 2010 22:21 |
|
Lumpy posted: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)
|
# ? Jun 18, 2010 23:31 |
|
jandrese posted:This may not qualify as a horror, but it always catches people when they first see it: If you aren't familiar with the struct hack, I'm not sure you deserve to be called a C programmer.
|
# ? Jun 18, 2010 23:40 |
|
Lumpy posted: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) That is better then 90% of the Javascript I have to fix on a daily basis for the project I am on now. I give you one of the less stroke inducing bits of code today since it is small and not very identifying. Well maybe not 90, it is getting better... slowly.. code:
HFX fucked around with this message at 00:20 on Jun 19, 2010 |
# ? Jun 19, 2010 00:16 |
|
jandrese posted:This may not qualify as a horror, but it always catches people when they first see it: Especially since a feature has been built into C99 for this very purpose.
|
# ? Jun 19, 2010 01:18 |
|
Janin posted:Programming is math, but that doesn't mean it uses the same weird notation as algebra. (a) is a fairly natural way to express binary relations between mathematical objects, (b) needn't be seen as having any greater connection to algebra (in either the layman's or the mathematician's use of the word) than it does to any other field in which set theory is used.
|
# ? Jun 19, 2010 01:52 |
|
shrughes posted:Especially since a feature has been built into C99 for this very purpose. Perhaps he means the zero size data array? It's a trick used in a lot of header structs where the data size is variable. The actual size of the data member is actually 0, but of course using it as an array allows you to access the data past the header.
|
# ? Jun 19, 2010 02:33 |
|
Zakalwe posted:Perhaps he means the zero size data array? It's a trick used in a lot of header structs where the data size is variable. The actual size of the data member is actually 0, but of course using it as an array allows you to access the data past the header.
|
# ? Jun 19, 2010 03:52 |
|
Because c99 implementation is complete and consistent between compiler vendors. Right? This is the coding horror.
|
# ? Jun 19, 2010 05:02 |
|
Zero length arrays are a GCC extension that predates the C99 array[] syntax. Regardless, even if you've never heard of the GCC extension, a proper C programmer should be aware of the struct hack and be able to infer the meaning of that code on seeing it.
|
# ? Jun 19, 2010 06:09 |
|
Found this beauty today, while looking through our setup-process.. There has got to be a faster way of populating that table.code:
Tikki fucked around with this message at 10:09 on Jun 21, 2010 |
# ? Jun 21, 2010 10:04 |
|
http://blog.devinterface.com/2010/06/design-patterns-in-ruby-abstract-factory/
|
# ? Jun 21, 2010 22:42 |
|
Tikki posted:Found this beauty today, while looking through our setup-process.. There has got to be a faster way of populating that table. How long does this take to run?
|
# ? Jun 22, 2010 02:05 |
|
manero posted:How long does this take to run? I don't really understand that moon-language, but it doesn't sound that expensive (obviously it's a coding horror nonetheless) because it's only going to do IssueNumberSequence.create! 200,000 times (and I doubt it's expensive) and 20,000,000,000 comparisons for the find_by_number to work, assuming it's O(n). 20 billion isn't very many times for a computer to do something.
|
# ? Jun 22, 2010 02:32 |
|
a) It's not doing 20 billion anythings (no idea where you got that). b) Hitting disk 200,000 times is quite a few, I hope you've got that wrapped in a transaction
|
# ? Jun 22, 2010 02:33 |
|
king_kilr posted:a) It's not doing 20 billion anythings (no idea where you got that). If IssueNumberSequence.find_by_number() is O(n) in the sequence length, then it takes approximately 20 billion comparisons to fill the sequence.
|
# ? Jun 22, 2010 02:39 |
|
Ugg boots posted:20 billion isn't very many times for a computer to do something. Coding horror found.
|
# ? Jun 22, 2010 03:35 |
|
Kilson posted:If IssueNumberSequence.find_by_number() is O(n) in the sequence length, then it takes approximately 20 billion comparisons to fill the sequence. Uhh, doubtful. It's far more likely to be O(lg n).
|
# ? Jun 22, 2010 03:43 |
|
king_kilr posted:Uhh, doubtful. It's far more likely to be O(lg n). Did you just say lg? They never said "lg" when I was in school. Kids these days! Edit: Er, I mean, this is the real coding horror. shrughes fucked around with this message at 06:21 on Jun 22, 2010 |
# ? Jun 22, 2010 05:24 |
|
Ugg boots posted:I don't really understand that moon-language, but it doesn't sound that expensive (obviously it's a coding horror nonetheless) because it's only going to do IssueNumberSequence.create! 200,000 times (and I doubt it's expensive) and 20,000,000,000 comparisons for the find_by_number to work, assuming it's O(n). 20 billion isn't very many times for a computer to do something. I was asking him literally, how much wall time it took him to run in practice, while it filled the database with stupidity.
|
# ? Jun 22, 2010 15:31 |
|
code:
The real question is why the hell are you populating 200000 blank entries.
|
# ? Jun 22, 2010 17:32 |
|
shrughes posted:Did you just say lg? They never said "lg" when I was in school. We always used lg(x) when it was base 2, log(x) for base 10, and obviously ln(x) for base e. Obviously it doesn't matter for asymptotic analysis like this, but yeah.
|
# ? Jun 22, 2010 19:13 |
|
The table only contains the numbers, it's (apparently) the fastest way of checking if an issue number is already taken. I usually go grab some tea while it crunches. I think it takes around 10 minutes on my late-2008 MacBook. I just realized, that the clever way to do it would to dump the table once it's done, then use that to populate it instead.
|
# ? Jun 22, 2010 19:34 |
|
Tikki posted:The table only contains the numbers, it's (apparently) the fastest way of checking if an issue number is already taken. Real horror has been uncovered. This is seriously hosed.
|
# ? Jun 22, 2010 19:52 |
|
Tikki posted:I usually go grab some tea while it crunches. I think it takes around 10 minutes on my late-2008 MacBook.
|
# ? Jun 23, 2010 02:15 |
|
NotShadowStar posted:Real horror has been uncovered. This is seriously hosed. That disturbs me, and I was just working with 15-20 year old MUMPS code on a near daily basis for a couple months.
|
# ? Jun 23, 2010 06:22 |
|
Tikki posted:The table only contains the numbers, it's (apparently) the fastest way of checking if an issue number is already taken.
|
# ? Jun 23, 2010 09:25 |
|
I think there might be some confusion, as to how the issue numbers are used. The table is only populated once (or every time we start from a clean database in development). No numbers are being deleted in production. We have a number of events, that people buy tickets to. If a ticket is canceled, there is a hole in the Issue number sequence for that event. This table is then (apparently) used to very quickly find the first hole in the sequence for the next ticket... At least that's how a coworker explained it to me. I haven't actually gone and looked at the code... I'm not sure if I dare.
|
# ? Jun 23, 2010 12:21 |
|
What happened when a junior developer forgot http://php.net/manual/en/function.strrev.php About 4 major horrors in 10 lines. At least it worked (on anything but words with "xxx" in them). code:
|
# ? Jun 23, 2010 15:37 |
|
code:
|
# ? Jun 23, 2010 16:56 |
|
Hammerite posted:
Again, coding horrors thread. Logic need not apply.
|
# ? Jun 23, 2010 17:03 |
|
|
# ? Apr 27, 2024 06:35 |
|
I propose a new phrase "ozark bugs", meaning a bunch of errors which combine to mostly work. Just spent four hours disentangling a mess of this; every time I fixed one error the system stopped working because another broken part of it had (by coincidence) worked only with the previous bug.
|
# ? Jun 23, 2010 21:10 |