• (cs)

    I recall, working in Delphi many years ago, dealing with BigEndian issues.

    I assumed they were issues from a small country called Endia.

  • (cs)

    True confession: I recently wrote some code using the observer pattern. The variable I use to hold the observer object?

    brainGuy

    No, I don't believe any of my co-workers get the joke.

  • Leo (unregistered)

    One little, two little, three little Indians...

  • Warren (unregistered)

    The code Vladimir found goes some way to solving the usual cause of problems we see: companies and projects with too many chiefs and not enough little indians.

  • Black Bart (unregistered)

    The Indian code maintains the batting averages for the Atlanta Braves...

  • Sarcastic kebab reaper (unregistered)

    I stopped using funny variable names when I had to start maintain my own apps. Should have founded a company instead.

  • bd (unregistered)

    Nagesh little indian. Many hamburgers later, big indian.

  • Cidolfas (unregistered)

    The first one does not appear to be a WTF - in fact, the developer is covering all his/her bases by not only testing for null and undefined, but a real string whose contents are "null" or "undefined" - i.e. a victim of a bad concatenation. Might be an indication of WTFs elsewhere (or just oversights) but is not a WTF in itself.

  • Kryptus (unregistered)

    It is better to work with one Big Indian rather than three Little Indians anyway...

  • MrBester (unregistered) in reply to Remy Porter

    And nor do most outside US as MST3K isn't exported (I had to look it up too; I thought you were going with a Fringe reference).

  • Abico (unregistered)

    I'm missing the WTF in the first one.

    Also, my comments frequently look like Dan's submission. Very stream-of-consciousness. It's kind of like rubber ducking when there's no one to be your duck.

  • (cs)

    Big Indians in Java (the island) and little Indians in Delphi (the city) does remind me a bit of ten foot pygmies in a Montezuma hall...

  • (cs) in reply to Remy Porter
    Remy Porter:
    True confession: I recently wrote some code using the observer pattern. The variable I use to hold the observer object?
    brainGuy

    No, I don't believe any of my co-workers get the joke.

    I don't. Care to explain?

  • (cs)

    On wacked-out variable names:

    An embedded system I inherited in the early 90s had its own multithreading preemptive scheduler. The central control variable of this scheduler celebrated a recent purchase made by the previous developer: golf_gti.

    In the same system, sloppily built in C, a set of complicated calculations (pressure- and temperature-influenced compressibility of gases) was based on some old BASIC code. The underlying equations had parts involving the Greek letters pi and tau, the latter of which had locally acquired a mispronunciation as if spelled "tor". Of course, the BASIC interpreter was unable to cope with this abuse of the reserved word "or" (some BASIC systems cope, some do not), so the developers changed it, and misspelled "pi" as well: double apple, pie;

    I wasn't particularly amused, but these names became part of the local jargon.

  • Middle Endian (unregistered)

    Dephi code or Delhi code?

  • (cs)

    A long time ago, when I was implementing a tree-based construct in C++, I had to delete a tree node and wrote a comment about killing all the children before turning the gun on ourselves.

    No Indians or squirrels were harmed in the writing of this WTF.

  • (cs) in reply to Medinoc

    As MrBester pointed out, it's a "Mystery Science Theater 3000" reference.

  • vbl (unregistered)

    Maybe... the Little BigIndians were those who fought the Battle of Little Bighorn...

  • ¯\(°_o)/¯ I DUNNO LOL (unregistered) in reply to Leo
    Leo:
    One little, two little, three little Indians...
    Four big, five big, six big Indians...
  • Abico (unregistered) in reply to ¯\(°_o)/¯ I DUNNO LOL
    Leo:
    One little, two little, three little Indians...
    16777216 big, 33554432 big, 50331648 big endians....
  • Abico (unregistered) in reply to Abico
    Abico:
    Leo:
    One little, two little, three little Indians...
    16777216 big, 33554432 big, 50331648 big endians....
    (32-bit ints, BTW).
  • (cs)

    I assume that

    c_SecretSquirrelCommand.ExecuteSecretHandshake(syn_nuts)

    occurs elsewhere in the code.

  • (cs)
    /// >summary<
    /// Returns True if the input string is 
    /// null, empty, "undefined", or "null".
    /// >/summary<
    /// String to check /// Boolean public static bool IsEmpty(string s) {
    	return string.IsNullOrEmpty(s) || s == "undefined" || s == "null"; }
    Sadly, I've seen things like this necessary in the short term due to past bad programming. Million-row relational tables where someone has stored 'null' in some column instead of NULL and you have to fix a different bug immediately, but can't get approval to do a proper fix with database update.

    In other words, because Enterprisey.

  • Fiddy-P (unregistered) in reply to Thuktun
    Thuktun:
    /// >summary<
    /// Returns True if the input string is 
    /// null, empty, "undefined", or "null".
    /// >/summary<
    /// String to check /// Boolean public static bool IsEmpty(string s) {
    	return string.IsNullOrEmpty(s) || s == "undefined" || s == "null"; }
    Sadly, I've seen things like this necessary in the short term due to past bad programming. Million-row relational tables where someone has stored 'null' in some column instead of NULL and you have to fix a different bug immediately, but can't get approval to do a proper fix with database update.

    In other words, because Enterprisey.

    I've had to do this interpreting Spring Web REST parameters. If you pass in an empty parameter, the string representation you get of it is "null".

  • Steven (unregistered)

    as a CS major at georgia tech, I had a required intro to computer engineering class that was mostly about the basics of circuits...logic gates and whatnot. one day the professor got to endian-ness and proceeded to write "Big Indian" and "Little Indian" on the board in giant letters. I was young and stupid and argued with her for what felt like years, but was probably 30 seconds (I'd expected SOMEBODY else in the room to pipe up and agree!). She just stared at me with a dumb look on her face until I finally realized a) everybody else in the class was dumb and b) you're not supposed to correct the professor.

  • Matt (unregistered)

    Oh, c'mon. Now you're just Boytzing up the articles so we'll have something to gripe about. Well we're not going to bite. So there.

  • Jack (unregistered)
    to make the URL unique, so that the browser always gets it and doesn't use a cached version
    In other words, we're deliberately breaking a browser feature, but not using the language elements intended for cache control.
  • Jack (unregistered)
    toString(16).substring(1)
    When computers finally get intelligent, there is going to be all sorts of code that starts throwing errors like "Why the fuck are you making me do it that way?" followed shortly by a moron eradication campaign.

    Imagine: reducing the human burden on the environment and raising the average intelligence of developers in one move! I can't say it's the worst idea I've heard...

  • (cs) in reply to Cidolfas
    Cidolfas:
    The first one does not appear to be a WTF - in fact, the developer *is* covering all his/her bases by not only testing for null and undefined, but a real string whose contents are "null" or "undefined" - i.e. a victim of a bad concatenation. Might be an indication of WTFs elsewhere (or just oversights) but is not a WTF in itself.

    You beat me to it. This is dealing with someone else's WTF, it's not a WTF itself.

  • (cs)

    I don't get this Indian joke at all.

  • Null (unregistered)

    So what happens when a field value is 'Null'? Huh? No so smart after all, maybe?

    To say nothing of internationalization...

  • jmm (unregistered) in reply to Thuktun

    " Million-row relational tables where someone has stored 'null' in some column instead of NULL and you have to fix a different bug immediately, but can't get approval to do a proper fix with database update. "

    --and then, just when you think you've got it fixed, you find out you deleted the last name for the lady named "Linda Null" in the data...

    (btdt)

  • Moose (unregistered)

    The first rule of The Secret Squirrel Club is that you don't talk about The Secret Squirrel Club.

  • (cs) in reply to Black Bart
    Black Bart:
    The Indian code maintains the batting averages for the Atlanta Braves...

    Not Cleveland?

  • Rodnas (unregistered)

    Is the Wile E. Coyote among the programmers trying to fool the Roadrunner-like hackers? It will never succeed. There are many animated cartoons to prove this theory.

  • (cs) in reply to jmm
    jmm:
    --and then, just when you think you've got it fixed, you find out you deleted the last name for the lady named "Linda Null" in the data...

    (btdt)

    The auntie of little Bobby Tables.

  • (cs) in reply to Jack
    Jack:
    to make the URL unique, so that the browser always gets it and doesn't use a cached version
    In other words, we're deliberately breaking a browser feature, but not using the language elements intended for cache control.

    So he's programming for humans, not computers. Which is what you're supposed to do.

    I find that languages that make a hack workaround like this so much easier than the "proper" way to do it are fundamentally flawed.

  • (cs)
    Return IsEmpty('Nothing') 'suck it, C# developers
    

    hehe

  • Ol' Bob (unregistered) in reply to Black Bart
    Black Bart:
    The Indian code maintains the batting averages for the Atlanta Braves...

    Hey! How about the Cleveland Indians?!? (Oh, sorry - I forgot - the Cleveland Indians have no batting averages. <sob!>)

    CAPTCHA: usitas - ladies-of-the-evening in Spanish-speaking locales.

  • (cs)

    The real WTF of the squirrel one is that the property is public.

    Note a very secret club if you make the property public is it. It should be private and available only to elite friends.

  • Dan (unregistered) in reply to Cidolfas

    Javascript wins again

  • Ol' Bob (unregistered) in reply to Thuktun
    Thuktun:
    /// >summary<
    /// Returns True if the input string is 
    /// null, empty, "undefined", or "null".
    /// >/summary<
    /// String to check /// Boolean public static bool IsEmpty(string s) {
    	return string.IsNullOrEmpty(s) || s == "undefined" || s == "null"; }
    Sadly, I've seen things like this necessary in the short term due to past bad programming. Million-row relational tables where someone has stored 'null' in some column instead of NULL and you have to fix a different bug immediately, but can't get approval to do a proper fix with database update.

    In other words, because Enterprisey.

    Think of it this way - without Enterprisey thinking, millions upon millions of software developers would be out of work, starving, begging on cold street-corners, instead of sitting in once-comfortable chairs in cubicles throughout the land, waiting for approval to proceed with the obvious thing after it's been considered, debated, gone over, lost, found, folded, spindled, filed away, stamped for cancellation, returned to sender, and finally, eventually, MAYBE approved by management, thirteen levels deep - but BY NO MEANS any earlier than 4:59 PM on the Friday of a holiday weekend.

    Share and enjoy.

  • iToad (unregistered)

    Back in the olden days, we transferred files containing binary single-precision floating point values between old-school 68030-based Macs, 80X86-based PCs and various VAXes. Every one of them used a different byte order, and the VAX also didn't use the standard IEEE-754 floating-point format. As an extra challenge, all of the conversion code was written in Pascal.

  • (cs) in reply to iToad
    iToad:
    Back in the olden days, we transferred files containing binary single-precision floating point values between old-school 68030-based Macs, 80X86-based PCs and various VAXes. Every one of them used a different byte order, and the VAX also didn't use the standard IEEE-754 floating-point format. As an extra challenge, all of the conversion code was written in Pascal.
    And we liked it damnit!
  • Soaring Eagle (unregistered)

    How many different byte orders are there? Middle-Indian?

  • (cs) in reply to Soaring Eagle
    Soaring Eagle:
    How many different byte orders are there? Middle-Indian?
    Think of a byte order as a string. You can only read it in 2 directions. Forwards and backwards.

    Or a better analogy is comparing little endian and big endian to written languages.

    Left to right vs right to left. 10110001 in 1 is the same as 10001101 in the other.

    Edit: I also wanted to attach a clip from "the honking" in futurama from the bloody binary numbers in the mirror scene, but I couldn't find one. You will just have to look it up on your own.

  • ping floyd (unregistered) in reply to iToad
    iToad:
    Back in the olden days, we transferred files containing binary single-precision floating point values between old-school 68030-based Macs, 80X86-based PCs and various VAXes. Every one of them used a different byte order, and the VAX also didn't use the standard IEEE-754 floating-point format. As an extra challenge, all of the conversion code was written in Pascal.

    And we liked it! Also, aren't little indians usually in a cupboard?

  • (cs) in reply to PiisAWheeL
    PiisAWheeL:
    Soaring Eagle:
    How many different byte orders are there? Middle-Indian?
    Think of a byte order as a string. You can only read it in 2 directions. Forwards and backwards.

    Or a better analogy is comparing little endian and big endian to written languages.

    Left to right vs right to left. 10110001 in 1 is the same as 10001101 in the other.

    Sort of. Endianness can operate at the bit level, but more typically, it affects the bytes of multi-byte words (and by "words" I mean words of bytes, not strings. Strings often are unaffected by endianness).

    In little endian, the 32-bit hex representation of 650,000(base 10) is: 10 EB 09 00 and in big endian: 00 09 EB 10

    Note that the bits within each byte remain in the same order. The leftmost bit is the lowest address. In big endian, the most significant (biggest) byte comes first by address; in little endian, the least significant (littlest) byte come first by address.

    Addendum (2012-10-11 14:04): ETA: To further complicate things, larger blocks may be transposed. My example assumes 8-bit blocks, but it could be 16-bit blocks, for example. Then, the little endian would be: EB 10 09 00

    Addendum (2012-10-11 14:07): Oops. Make that EB 10 00 09. SOrry for confusing anyone further, but I can't edit anymore at this point.

  • jay (unregistered) in reply to Null
    Null:
    So what happens when a field value is 'Null'? Huh? No so smart after all, maybe?

    To say nothing of internationalization...

    Yes, this is why setting a field to the string "null" or other such magic values is a really really bad idea. But if someone else has done it, it is not always practical to fix it, so you just have to grit your teeth and code for it.

    I used to work on a system where the original authors had done exactly that: they would put various magic values like "null" and "na" into fields to indicate unknown or not yet read. I used to fantasize about ways to torture them to death.

  • jay (unregistered)

    In fairness, the "BigIndian" programmer (not Nagesh, I mean the programmer who used that name in his code) may have known the correct name and just been joking. I haven't done any research on this, but I strongly suspect that whoever invented the terms BigEndian and LittleEndian was thinking of the song "Ten Little Indians" and making a joke.

Leave a comment on “The Secret Squirrel Club, a Gun, and More”

Log In or post as a guest

Replying to comment #392232:

« Return to Article