• Hit (unregistered)

    Ahh..another classic case of a developer designing a Database with only his application in mind and having no regards to whether you can query it or not. Even asking simple questions about what "flags" are set with SQL would not be readable unless you heavily comment it.

    As a developer that also designs databases myself, I have no problem with people who have that dual role, but it essential that they learn first what good database design is before they are allowed to create any sort of schema.

    Otherwise, you end up with garbage like this.

  • Ged (unregistered)

    To quote Homer Simpson, "oh ooo spaghetio!"

    I mean holy crud, that code is just awful and unholy in so many ways...

  • (cs)

    I've joked about using the ASCII characters that come after '9' as hex digits before.

    I guess the moral of the story is, any hilariously implausible scenario you can imagine, has probably happened somewhere already.

  • seconddevil (unregistered)

    I had a similar thing.... it converted ints (casted from strings) into binary, with the gotcha that every pair of binary was swapped for reasons that are beyon the scope of this post... so, say

    input-> "XYZ" (imaginary values 'x', 'y' & 'z', btw) to bin -> 01010101 01010101 00101011 (also imaginary, these don't correspond to anything (i think)) to code -> 10101010 10101010 00010111

    magic

  • (cs)

    What in the world is the point of something like that? Wouldn't you have to custom-handle any operation with that value, i.e. math, etc?

  • seconddevil (unregistered) in reply to sir_flexalot
    sir_flexalot:
    What in the world is the point of something like that? Wouldn't you have to custom-handle any operation with that value, i.e. math, etc?
    I am painfully aware of that
  • (cs)

    Wow. The whole ASCII values for hex thing is laughable, but certainly workable. Switching the endianness is just frustrating. But the code! That takes it to another level.

  • Ron (unregistered) in reply to seconddevil
    seconddevil:
    to bin -> 01010101 01010101 00101011 (also imaginary, these don't correspond to anything (i think))

    01010101 = 0x55 = U 01010101 = 0x55 = U 00101011 = 0x2b = +

    "UU+" .... must be some kind of secret code....

    Captcha: gotcha -- it's making fun of me for forgetting my password and the domain changing!

  • (cs)

    Ze goggles, zey do nothing.

  • (cs) in reply to Ron

    Hmmm, I usually go straight for the article - I rarely look at the masthead. I didn't even notice the name change until I saw the previous article with 6 pages of posts.

    New name is lame, if PC, but then again, the name only caught my attention the first day; I come for the content!

  • Luke Dawson (unregistered)

    Do these "boolians" bare any resemblance to booleans by any chance, or is he reinventing those too?

  • [twisti] (unregistered)

    This reminds me of another hex related WTF I've seen a friend do:

    He's a horrible programmer that only knows PHP and SQL, and he was asking me for advise on how to store his ~10000 flags for his customers without wasting so much space. Obviously, I told him that storing them by using single bits was a good way - one byte could hold 8 of his flags, instead of wasting 8 bytes on it (he used some integer type to store 1's and -1's). Then I told him that because I know little about PHP and SQL, he should probably read up about bitflags and bitmasks.

    I learned never to give out advise like that again when I saw him store a 10,000 character string (2-byte unicode, even): "0010101100101010010....". Testing for a flag would be done by something along the lines of byte.fromBinary(flagString.middle(400,408)); flagBoolean = byte && bitmask;

    It still gives me nightmares.

  • [twisti] (unregistered) in reply to [twisti]

    Now that I look at it again, I have no idea why it came to my mind as 'hex related'.

  • anonymous (unregistered) in reply to Hit

    This is not a Worse Than Failure, this is another way to do ascii2binary. Here you have a binary you can read. Is binary because is the exact value (with a offset), and is text because you can open it with a text editor and change it. Is better to use 0..9-A..F, but that option can be nice to write simple code. Of course, if your code is complex, you better do the normal thing.

  • nobody (unregistered)

    This code is hexed.

  • Dave (unregistered)

    Most depressive.

    captcha: pointer... but in MACHINEHEX!!!1! OMG!

  • ewan (unregistered) in reply to anonymous
    anonymous:
    This is not a _Worse Than Failure_, this is another way to do ascii2binary.

    I tend to agree, while it IS a WTF in that you look at it and go... WTF?! there is usualy some valid reason way back in time which has nescitated the method.

    Often the danger of refactoring such code is that you won't notice the reason untill after you have made the change and things stop working!!

  • EmmanuelD (unregistered) in reply to anonymous
    anonymous:
    This is not a _Worse Than Failure_, this is another way to do ascii2binary. Here you have a binary you can read. Is binary because is the exact value (with a offset), and is text because you can open it with a text editor and change it. Is better to use 0..9-A..F, but that option can be nice to write simple code. Of course, if your code is complex, you better do the normal thing.
    Right, I prefer to write "4<1>": instead of this nasty 4a1b (or maybe something else). First, it's easier to understand, as the semantics are quite clear. Second, it doesn't mix numbers with letters - something that I haven't understood yet.

    Frankly, all those damn conventions about hexadecimal or 'boolians' are just plain dangerous. Our job is kind of artistic, and that conventionalism is just another way to give up our freedom. I mean, what about the 1st amendment?

    Free yourself! Reinvent!

    For instance, my 'boolian' has two values, '+' and '-'. Makes it easier to read. bool(boolian('-')) has some chance to be false, and bool(bollian('+')) may be true in some cases.

    (Captcha: riaa. Did I do something wrong?)

  • (cs)

    I don't see where the "evil bit" as per RFC 3514 will be stored in that table...

  • seconddevil (unregistered)

    it would be better to keep both, then change the title & image depending on what URL the luser types in. After a few months drop the one with the least usage....

    gota love democracy

  • Reed H (unregistered)

    BTW if people are upset about the name of the site, go post comments in that other article... some of us are trying to read and enjoy the actual content... thanks..

  • anonymous (unregistered) in reply to EmmanuelD
    EmmanuelD:
    anonymous:
    This is not a _Worse Than Failure_, this is another way to do ascii2binary. Here you have a binary you can read. Is binary because is the exact value (with a offset), and is text because you can open it with a text editor and change it. Is better to use 0..9-A..F, but that option can be nice to write simple code. Of course, if your code is complex, you better do the normal thing.
    Right, I prefer to write "4<1>": instead of this nasty 4a1b (or maybe something else).

    WRONG!.. re-read please. I say, easy to READ by code.

  • AndrewB (unregistered) in reply to Reed H
    Reed H:
    BTW if people are upset about the name of the site, go post comments in that other article... some of us are trying to read and enjoy the actual content... thanks..
    I'm sorry. I should have thought about that before posting. It was slightly boneheaded of me to talk about how the new site name is lame in a thread like this when another much more appropriate thread is near. I promise to never fill these forums with such blatantly misplaced opinions on how the new site name is lame.

    Starting NOW.

  • greywar (unregistered)

    The flipped binary is something I have seen before while doing embedded systems. I just can't recall why now. I hate monday mornings.

  • (cs)

    Oh I've been working on files which encodes date and time, and have specifications like that (after a bit of reverse engineering):

    p45w_63A4gS0000.dat
    |\/| ||||||`--'
    | || |||||| part number of the file
    | || ||||||
    | || |||||Second \  Encoded from 0 on as
    | || ||||Minute   |    0123456789
    | || |||Hour      |    ABCDEFGHIJ
    | || ||Day        |    KLMNOPQRST
    | || |Month       |    UVWXYZabcd
    | || Year-2000   /     efghijklmn
    | ||                   opqrstuvwx
    | ||
    | |Which part of data, "e" or "w"
    | |
    | Which part of data, as numbers
    Always "p"
    
  • part-time language lawyer (unregistered) in reply to Luke Dawson

    Naked (bare) booleans? Sounds like some geek's wet dream...

  • T.D. (unregistered) in reply to beta
    beta:
    Oh I've been working on files which encodes date and time, and have specifications like that (after a bit of reverse engineering):
    p45w_63A4gS0000.dat
    |\/| ||||||`--'
    | || |||||| part number of the file
    | || ||||||
    | || |||||Second \  Encoded from 0 on as
    | || ||||Minute   |    0123456789
    | || |||Hour      |    ABCDEFGHIJ
    | || ||Day        |    KLMNOPQRST
    | || |Month       |    UVWXYZabcd
    | || Year-2000   /     efghijklmn
    | ||                   opqrstuvwx
    | ||
    | |Which part of data, "e" or "w"
    | |
    | Which part of data, as numbers
    Always "p"
    

    Er, you're generating a lot of these, right?

    All the files from the same day have the same first 8 characters... that's gotta be hell to access and store. Do you stick them all into a single directory and just hope it works out, or what? I guess it's clever in that you can write out cute name searches based on whether you want the e[ast?] or w[est?] data.

    My company does something similar but cleverly uses folder names for dates and then time chunks per day, so you can see at a glance what's going on from the shell, without even opening another interface. Hmm, 20060117 is missing, guess the MYSTERY DATA SOURCE was down that day...

    Final thought: if the first character's always "p"-ing, do you really need it out there in the wind, so to speak?


    capt = muhahaha... That's not funny.

  • Joseph Newton (unregistered) in reply to greywar
    greywar:
    The flipped binary is something I have seen before while doing embedded systems. I just can't recall why now. I hate monday mornings.

    Big-endian/little-endian perhaps?

    Whatever the reason on the machine level, such details should be taken care of at the lowest level possible, long before they arise to the level of source code.

  • iMalc (unregistered)

    OMG, I have actually worked on a project in its maintenance phase, where the 6 characters after '9' were used instead of 'A'-'F' in its "HEX" output. It was written in ASM though.

    We were going to fix it, but people who had already integrated with our system would suddenly have to change things too, so we just fixed the bugs and left well enough alone. The product is dead anyway now.

  • (cs)

    If you want comment on the new website name, that's fine, but please do so in an appropriate forum ... Thanks!

  • Antony Curtis (unregistered) in reply to Licky Lindsay
    Licky Lindsay:
    I've *joked* about using the ASCII characters that come after '9' as hex digits before.

    I guess the moral of the story is, any hilariously implausible scenario you can imagine, has probably happened somewhere already.

    Perhaps someone should tell the guy that he is not programming on a Sinclair ZX-81... Those little machines did not use ASCII.... CHR(ORD('9')+1) = 'A'

    Fun!

  • Antony Curtis (unregistered) in reply to Antony Curtis
    Antony Curtis:
    Licky Lindsay:
    I've *joked* about using the ASCII characters that come after '9' as hex digits before.

    I guess the moral of the story is, any hilariously implausible scenario you can imagine, has probably happened somewhere already.

    Perhaps someone should tell the guy that he is not programming on a Sinclair ZX-81... Those little machines did not use ASCII.... CHR(ORD('9')+1) = 'A'

    Fun!

    Oops, I probably should use the correct ZX81 syntax.... so it would be CHR$(CODE('9') + 1) = 'A'

  • Expat (unregistered)

    OMFG, That hex coding is painful to look at! Maybe is because the boolians are used by booligans for configuation. What if I take the array of bits and give a power of 2 value to each position on the array? I'm so clever! Maybe I should call them bite or bait, not decide yet...

  • Expat (unregistered)

    OMFG, That hex coding is painful to look at! Maybe is because the boolians are used by booligans for configuation. What if I take the array of bits and give a power of 2 value to each position on the array? I'm so clever! Maybe I should call them bite or bait, not decided yet...

  • James (unregistered)

    I actually used a "hex" like this for a personal program I wrote myself. It was actually used to write some simple "code" (pretty close to assembly in its simplicity of design, and a whole lot less readable) for a Scott Adams adventure-style game on a TI-99/4A written in TI Basic. (It worked, but not until I got it onto a different machine. The code was fine, but the slow machine, as well as the three layers of interpretation, made reading the <100 line file from disk take five minutes.)

    For comparison, I came up with the scheme at the age of 14, and by the time I was 18, I had realized just how badly designed it was. And my implementation wasn't nearly as badly engineered as this monstrosity.

  • Rich (unregistered) in reply to Antony Curtis

    CHR$ (CODE "9" +1)

    I think you'll find.

  • totolamoto (unregistered) in reply to greywar

    Flipped binaries are often necessary when working with bitmaps or else you end with strange pictures.

  • (cs) in reply to Reed H
    Reed H:
    BTW if people are upset about the name of the site, go post comments in that other article... some of us are trying to read and enjoy the actual content... thanks..
    The site had a name change? Huh, must've missed it. On topic, though, people can't seem to see the bigger picture. Look at the pathetic way two booleans are stored as an int. That's way bigger Worse Than Failure material.
  • Johnny (unregistered)

    I think nobody got it... These are esoteric data types, they are not booleans but boolians. Geezzz you guys should get the WTF award

  • Excession (unregistered) in reply to Luke Dawson
    Luke Dawson:
    Do these "boolians" bare any resemblance to booleans by any chance, or is he reinventing those too?

    Bare? You mean, of course, bear.

    "Baring gifts" has all sorts of connotations :)

    capcha: alarm

    wtf: I have a username/account :)

  • Skipper (unregistered)

    That was worse than pepper spray.

  • Joseph Newton (unregistered) in reply to Antony Curtis
    Antony Curtis:
    Antony Curtis:
    Licky Lindsay:
    I've *joked* about using the ASCII characters that come after '9' as hex digits before.

    I guess the moral of the story is, any hilariously implausible scenario you can imagine, has probably happened somewhere already.

    Perhaps someone should tell the guy that he is not programming on a Sinclair ZX-81... Those little machines did not use ASCII.... CHR(ORD('9')+1) = 'A'

    Fun!

    Oops, I probably should use the correct ZX81 syntax.... so it would be CHR$(CODE('9') + 1) = 'A'

    Thanks, Anthony,

    Boy, that does take me back, and I remember the thrill: "Fially, I have a machine I can actually write my programs on. Mine was a Timex, though, Timex 1000, to be precise. With the special supplementary RAM pack, I could boost it to a whopping 16K.

    That was actually enough to implement a paystub generator that handled weekly, monthly, bi-weekly, semi-monthly pay periods, calculated OT on a 40hrs/week basis, and correctly handled federal, Oregon State, and Social Security deduction, taking earned income credit into account also. It worked quite well up until Sen. Bob "Long-Tongue" Packwood introduced his "Tax Simplification" in 1986. Somehow the dumbed-down tables were just not worth updating the program for.

  • Scottford (unregistered)

    Best WTF in months, I says. Totally hideous.

  • (cs) in reply to bstorer
    bstorer:
    Wow. The whole ASCII values for hex thing is laughable, but certainly workable. Switching the endianness is just frustrating. But the code! That takes it to another level.

    What about the concept of storing a non-atomic value in a single field in the first place?

    I can just hear the designer: "But 25 columns is just too BIG! How can we use such a WIDE table?"

  • whicker (unregistered) in reply to Joseph Newton
    Joseph Newton:
    greywar:
    The flipped binary is something I have seen before while doing embedded systems. I just can't recall why now. I hate monday mornings.

    Big-endian/little-endian perhaps?

    Whatever the reason on the machine level, such details should be taken care of at the lowest level possible, long before they arise to the level of source code.

    Wrong.

    In the embedded world, you do not muck with the endianess. You let the program deal with it. It's easy enough to write a simple function to reverse the endian in a consistent fashion, rather than have hardware with just plain incorrect behavior if an un-alligned read or write is performed.

    Stuff like, oh crap, what memory area was this read from? Oh no, that place... what were the first two LSB's of the address where this int32 was read?

  • Prosthetic Lips (unregistered) in reply to T.D.
    T.D.:
    beta:
    Oh I've been working on files which encodes date and time, and have specifications like that (after a bit of reverse engineering):
    p45w_63A4gS0000.dat
    |\/| ||||||`--'
    | || |||||| part number of the file
    | || ||||||
    | || |||||Second \  Encoded from 0 on as
    | || ||||Minute   |    0123456789
    | || |||Hour      |    ABCDEFGHIJ
    | || ||Day        |    KLMNOPQRST
    | || |Month       |    UVWXYZabcd
    | || Year-2000   /     efghijklmn
    | ||                   opqrstuvwx
    | ||
    | |Which part of data, "e" or "w"
    | |
    | Which part of data, as numbers
    Always "p"
    

    Er, you're generating a lot of these, right?

    All the files from the same day have the same first 8 characters... that's gotta be hell to access and store. Do you stick them all into a single directory and just hope it works out, or what? I guess it's clever in that you can write out cute name searches based on whether you want the e[ast?] or w[est?] data.

    My company does something similar but cleverly uses folder names for dates and then time chunks per day, so you can see at a glance what's going on from the shell, without even opening another interface. Hmm, 20060117 is missing, guess the MYSTERY DATA SOURCE was down that day...

    Final thought: if the first character's always "p"-ing, do you really need it out there in the wind, so to speak?


    capt = muhahaha... That's not funny.

    Ooh, can we make the above a WTF? What happens when you get to year 2060? Sounds like a Y2K (which happens in another 17 years, according to us programmers) all over again.

    Sweet!


    capt = digdug (fun game)

  • (cs) in reply to Licky Lindsay
    Licky Lindsay:
    I've *joked* about using the ASCII characters that come after '9' as hex digits before.

    I guess the moral of the story is, any hilariously implausible scenario you can imagine, has probably happened somewhere already.

    I had an IBM JX PC (1980 vintage) with a game called Tapper. After you finished four levels, level five was the same as level 1, and so on. Obviously the designers never anticipated anybody would bother to go past level 99, because the level indicator then went on to say ":0", ":1", etc. It went through ';', '<', '=', '>', '?' before I got bored of it.

  • (cs) in reply to T.D.
    T.D.:
    beta:
    Oh I've been working on files which encodes date and time, and have specifications like that (after a bit of reverse engineering):
    p45w_63A4gS0000.dat
    |\/| ||||||`--'
    | || |||||| part number of the file
    | || ||||||
    | || |||||Second \  Encoded from 0 on as
    | || ||||Minute   |    0123456789
    | || |||Hour      |    ABCDEFGHIJ
    | || ||Day        |    KLMNOPQRST
    | || |Month       |    UVWXYZabcd
    | || Year-2000   /     efghijklmn
    | ||                   opqrstuvwx
    | ||
    | |Which part of data, "e" or "w"
    | |
    | Which part of data, as numbers
    Always "p"
    

    Er, you're generating a lot of these, right?

    All the files from the same day have the same first 8 characters... that's gotta be hell to access and store. Do you stick them all into a single directory and just hope it works out, or what? I guess it's clever in that you can write out cute name searches based on whether you want the e[ast?] or w[est?] data.

    My company does something similar but cleverly uses folder names for dates and then time chunks per day, so you can see at a glance what's going on from the shell, without even opening another interface. Hmm, 20060117 is missing, guess the MYSTERY DATA SOURCE was down that day...

    Final thought: if the first character's always "p"-ing, do you really need it out there in the wind, so to speak?

    The WTF is that the file naming scheme is not created by me, but the previous programmer; thousands of files have been created already, and I can't ask for a more sensible file naming or directory structuring scheme. I'm just the one to use the files --- and you're right, all the files are placed in the same folder (don't ask how long it would take just to do an ls). What I need to do is to combine the "e" and "w" files with the same second and third character that are nearest in time, parse them, and do further processing.

    In my student days, I once wrote a program that generated tens of thousands files in the same directory. It was a practical lesson to time how long the ls command can take. Maybe the programmer who designed such a scheme was just repeating my fault, but in a production environment.

  • AdT (unregistered)

    F:<ABG> A>Q... ;KBEE:GM, CNLM ;KBEE:GM!

  • Anonymous (unregistered)

    A WTF that wasn't noted here: He used Hungarian notation for bBit0 and bBit1. As if variables named Bit0 and Bit1 could be anything but Bools.

    On second thought, that was actually well thought out. Sometimes, bits cannot be accurately represented by Booleans, such as when...I got nothing.

Leave a comment on “The End of Hex as We Know It”

Log In or post as a guest

Replying to comment #123322:

« Return to Article