Comment On 1's and 0's

Consider "0010000000100000". It's a string filled with nothing but "1" and "0" characters. Now, unless such a string is part of some classroom assignment where the goal is to programmatically convert Based 2 to Base 10 — or, perhaps, existing in some highly-limited and/or perverted language like MUMPS — there is never a good reason for it to exist in a program. [expand full text]
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5Next »

Re: 1's and 0's

2010-06-14 09:02 • by Dilbert (unregistered)
MUMPS, now called Cache is NOT a limited and perverted language

Re: 1's and 0's

2010-06-14 09:03 • by Anonymous (unregistered)
0110011001101001011100100111001101110100

Re: 1's and 0's

2010-06-14 09:03 • by Joel (unregistered)
0001101100101001010100st

Re: 1's and 0's

2010-06-14 09:05 • by Knux2 (unregistered)
Oh, ouch. Ouch ouch ouch.

Re: 1's and 0's

2010-06-14 09:05 • by PB (unregistered)
Now that's Proper coding. Not too many worries about their code being reverse engineering, I imagine.

Re: 1's and 0's

2010-06-14 09:06 • by Mike (unregistered)
I stopped reading halfway down. If I had a job that involved this code, my next words would be "I quit".

Re: 1's and 0's

2010-06-14 09:07 • by Alargule (unregistered)
WTF does it do???

(apart from being featured in TDWTF)

Re: 1's and 0's

2010-06-14 09:09 • by Eric (unregistered)
This code is dubbed Job Security. It has the look of needing to be modified often(from the comments, I didn't actually try and understand it).

Re: 1's and 0's

2010-06-14 09:10 • by MrPotes (unregistered)
Blimey, that's crazy - I mean, who'd go to the trouble of putting "[1]{1}" in a regex, instead of just "1"?!

Re: 1's and 0's

2010-06-14 09:10 • by ceiswyn (unregistered)
311510 in reply to 311501
Dilbert:
MUMPS, now called Cache is NOT a limited and perverted language


It is, however, named after a disease. Gotta wonder about that, really.

Re: 1's and 0's

2010-06-14 09:11 • by anonymous hater (unregistered)
10% of the way through reading this code I realized I was polluting my brain w/junk. So in order to protect my logic circuits I punch myself in the head.

Once I awoke I realized I should warn others.

DO NOT READ THIS CODE IT WILL CAUSE A SEGMENTATION_FAULT in YOUR BRAIN.

CAPTCHA: eros - errors indeed

Re: 1's and 0's

2010-06-14 09:13 • by @Deprecated
Thank goodness that management never changes requirements, 'cuz otherwise that piece of (ummm...) code would cause some major headaches to modify.

So! Any guesses as to what this is (errr ahhh...) 'designed' to accomplish?

- DON'T LOOK AT THE CODE, MARION!
- It's beeeyooootiful!
* cue swirling gasses and spirits that make your skull melt

Re: 1's and 0's

2010-06-14 09:14 • by OzPeter
The sample strings are 82 bits long. I did a cursory search on google and I can't see any popular DB (MSSQL, MySQL or Orace) that supports 96 bit integers. So storing the result in a varchar column isn't totally in the realms of stupidity. The alternatives would have been to split the value up into multiple columns, which then creates the issue of trying to ensure that the columns are assembled in the correct order when you are doing a query.

Of course I bet that there may have been another way to encode the information so you didn't have to jump through all of these hoops.

Re: 1's and 0's

2010-06-14 09:14 • by Macke (unregistered)
Aaahhhhhhhahaahhhhhrrrgghhh!!!

Re: 1's and 0's

2010-06-14 09:17 • by mike5 (unregistered)
My God, it's full of 0's and 1's!

Re: 1's and 0's

2010-06-14 09:17 • by Anon (unregistered)
I think some day I heard that TRWTF was PHP...

Re: 1's and 0's

2010-06-14 09:18 • by Leo (unregistered)
311517 in reply to 311514
Macke:
Aaahhhhhhhahaahhhhhrrrgghhh!!!


My thoughts exactly.

Re: 1's and 0's

2010-06-14 09:19 • by bl@h (unregistered)
$smarty->ass

captcha: iusto --> No I didn't

Re: 1's and 0's

2010-06-14 09:19 • by frits
I had the pleasure of inheriting some C# code that expanded hex characters into binary strings using the infamous loop over a switch anti-pattern. The method would expect an 64 bit ascii hex string (8 characters) and the code would create an intermediate string of 64 ones and zeros. Then certain status bits were parsed from the result using string manipulation methods.

I replaced about 150 lines of nonesense with something like:


UInt64 result = Convert.ToUInt64(myString, 16);




BTW- There's at least one language (ATLAS) that supports binary strings natively. But it's so old and obscure it barely warrants mentioning.

Re: 1's and 0's

2010-06-14 09:24 • by highphilosopher (unregistered)
311520 in reply to 311516
Anon:
I think some day I heard that TRWTF was PHP...


You can write some pretty elegant code in PHP. The real problem is that it has such a low learning curve that almost any idiot with a keyboard can write code in PHP.

Captcha: iusto -- Kinda like gusto, but more selfish.

Re: 1's and 0's

2010-06-14 09:27 • by Justin (unregistered)
311521 in reply to 311520
highphilosopher:
Anon:
I think some day I heard that TRWTF was PHP...


You can write some pretty elegant code in PHP. The real problem is that it has such a low learning curve that almost any idiot with a keyboard can write code in PHP.

Captcha: iusto -- Kinda like gusto, but more selfish.


Like VBA!

Ninja Vanish!

Re: 1's and 0's

2010-06-14 09:28 • by Justin (unregistered)
an Epic WTF.



CAPTCHA: augue....yeah its british for argue.

Re: 1's and 0's

2010-06-14 09:30 • by Keith Twombley (unregistered)
My favorite part is the very end. They're using Smarty! So great. All that idiotic crap, and then at the end they still had the presence of mind to use a templating engine.

Re: 1's and 0's

2010-06-14 09:31 • by justsomedude (unregistered)
perchance? perchance? dear god why....

I never made it to the punchline, once the code started I made it all of 3 seconds before giving up.

Re: 1's and 0's

2010-06-14 09:32 • by AnOldRelic (unregistered)
TRWTF is.... TRWTF is... aww, to heck with it. Today's WTF is TRWTF.

Re: 1's and 0's

2010-06-14 09:33 • by djh (unregistered)
I'm not even going to attempt to waste valuable brain cycles on trying to interpret what the hell that code does.

Maybe the developer was told to obfuscate his code, but he didn't get the memo.

Re: 1's and 0's

2010-06-14 09:34 • by Neville Flynn (unregistered)
It's Great Codethulhu!

Re: 1's and 0's

2010-06-14 09:37 • by David Hamilton (unregistered)
A great example of the old maxim:

Just because you can do it that way doesn't mean that you should.

Re: 1's and 0's

2010-06-14 09:38 • by Dank (unregistered)
Holy F*&%, that's some convoluted code!. I wonder what kind of data those binary strings are storing? If it's actually another data type, it might be possible to write a function that parses it and converts it into something sane, then worry about interpreting it.

Re: 1's and 0's

2010-06-14 09:39 • by student (unregistered)
The only thing I could think of while reading this was that I had already solved this problem. Store the damn value as an integer and just do a quick conversion. (I use it to determine admin privileges).

Re: 1's and 0's

2010-06-14 09:41 • by wtf (unregistered)
MY god... it's full of dumb!

Re: 1's and 0's

2010-06-14 09:42 • by TV's frank (unregistered)
It's the first time code makes me cry.

Re: 1's and 0's

2010-06-14 09:42 • by Aaron
311534 in reply to 311513
OzPeter:
The sample strings are 82 bits long. I did a cursory search on google and I can't see any popular DB (MSSQL, MySQL or Orace) that supports 96 bit integers. So storing the result in a varchar column isn't totally in the realms of stupidity. The alternatives would have been to split the value up into multiple columns, which then creates the issue of trying to ensure that the columns are assembled in the correct order when you are doing a query.

Of course I bet that there may have been another way to encode the information so you didn't have to jump through all of these hoops.

May have been? How about a fixed-point decimal column? Or even two integer columns (one 64-bit and one 32-bit)?

Also, there's no such product as "MSSQL". Or "Orace" for that matter.

Re: 1's and 0's

2010-06-14 09:44 • by CodeNinja (unregistered)
ARRGHH!

The goggles, they do nothing!

Re: 1's and 0's

2010-06-14 09:45 • by Someone who can't be bothered to login from work (unregistered)
311536 in reply to 311513
OzPeter:
The sample strings are 82 bits long. I did a cursory search on google and I can't see any popular DB (MSSQL, MySQL or Orace) that supports 96 bit integers. So storing the result in a varchar column isn't totally in the realms of stupidity. The alternatives would have been to split the value up into multiple columns, which then creates the issue of trying to ensure that the columns are assembled in the correct order when you are doing a query.

Of course I bet that there may have been another way to encode the information so you didn't have to jump through all of these hoops.


As it happens, 82-bits is also the size of the floating point registers in the IA-64 architecture.

Re: 1's and 0's

2010-06-14 09:47 • by Raedwald
Awesome. Like some of the classic TDWTFs of yore.

Re: 1's and 0's

2010-06-14 09:48 • by Severity One
311538 in reply to 311509
MrPotes:
Blimey, that's crazy - I mean, who'd go to the trouble of putting "[1]{1}" in a regex, instead of just "1"?!
Consistency.

Re: 1's and 0's

2010-06-14 09:49 • by Matt S (unregistered)
311539 in reply to 311533
I came to say the same thing. It started off bad, then got worse, then worse, than tear-worthy.

Re: 1's and 0's

2010-06-14 09:53 • by jjs (unregistered)
Can't wait for the narrated version!

Re: 1's and 0's

2010-06-14 09:54 • by KittyKat (unregistered)
It was horrible ones and zeros everywhere and I think I saw a two

Re: 1's and 0's

2010-06-14 09:54 • by anonymous coward (unregistered)
I would laugh... if it wasn't so much like the code I have to maintain (and yes, I clean it up where I can)

When I leave this job I have so many WTFs to show you.

Re: 1's and 0's

2010-06-14 09:55 • by Adriano
This was an interesting interpretation of 'snippet' I had not previously encountered.

Re: 1's and 0's

2010-06-14 09:56 • by bp (unregistered)
I feel so bad for the Hear-A-Blog guy who will have to read that code.

Re: 1's and 0's

2010-06-14 09:56 • by Zylon
<comment redcated>

Re: 1's and 0's

2010-06-14 09:58 • by jjs (unregistered)
311546 in reply to 311545
Zylon:
<comment redcated>

<reply redacted>

Re: 1's and 0's

2010-06-14 09:59 • by Tom Woolf (unregistered)
There once was an outside consulting firm that would modify my company's code for clients. They were known to add hundreds (if not thousands) of lines of useless code with the intent of obscuring the real code in the useless spaghetti code.

Compared to whomever wrote the code featured in today's TDWTF, those consultants were rookies. Today's code hides its purpose and process brilliantly. As another poster stated - this is job security...

Or, as Scott Adams put it:
http://dilbert.com/dyn/str_strip/000000000/00000000/0000000/000000/20000/3000/700/23765/23765.strip.gif

Re: 1's and 0's

2010-06-14 10:01 • by avflinsch
311548 in reply to 311501
Dilbert:
MUMPS, now called Cache is NOT a limited and perverted language


Correct, it is a limitlessly perverted language.

Addendum (2010-06-14 11:14):
Or a lanuage with unlimited perversions.

Re: 1's and 0's

2010-06-14 10:01 • by FragFrog (unregistered)
311549 in reply to 311513
OzPeter:
The sample strings are 82 bits long. I did a cursory search on google and I can't see any popular DB (MSSQL, MySQL or Orace) that supports 96 bit integers.

I know for a fact MySQL supports binary data columns and it would greatly surprise me if all other database environments did not have similar data types. One would normally use them for storying binary data (like images if you are an idiot) but they would do well enough for bitmasks. Provided you need more than 31 masks of course, which in and of itself is already quite a WTF.

Re: 1's and 0's

2010-06-14 10:05 • by Little Bobby Tables
I'm pretty sure this is the Necronomicon code. Don't read it out loud!!

There are 10 types of people in this world..

Re: 1's and 0's

2010-06-14 10:05 • by TK (unregistered)
311551 in reply to 311534
Aaron:
Also, there's no such product as "MSSQL".
Right. Just like there's no such product as a "Ford Mustang."
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5Next »

Add Comment