• (cs)

    The INDICATOR is part of Standard SQL and has been used for decades when SQL is embedded in a X3J language.  Doesn't anyone read the manuals any more?

  • Konrad (unregistered)
    This concept is revolutionary
    How has Unix & LInux surivived so long without a /dev/verynull
     
    I must submit a kernel patch ... today if possible.
     
    PS send your responces to /dev/verynull
  • Philippe (unregistered) in reply to AJ

    How about QuantumStateNullableValue, wich state is null or not null, but only when you read it.

  • Konrad (unregistered)
    This is revolutionary, how has Unix surived so long without a /dev/verynull
     
    Must write kernel patch ... today if possible
     
    PS send your responces to /dev/verynull
  • Miral (unregistered) in reply to TankerJoe

    This isn't even a WTF at all.  As other people have pointed out, it's just a confusion of terms -- the programmer obviously meant "IsZero" and "IsVeryZero".  Since "zero" translates as "null" in several languages, this is perfectly reasonable.

    There is no way that anybody would write that sort of code if they really meant to create nullable types (in the object/pointer/database sense).

  • (cs) in reply to Konrad
    Anonymous:
    This concept is revolutionary
    How has Unix & LInux surivived so long without a /dev/verynull
     
    I must submit a kernel patch ... today if possible.
     
    PS send your responces to /dev/verynull


    Cannot stat '/dev/verynull'.  Looks like I need to upgrade my kernel.

  • (cs) in reply to Konrad

    http://en.wikipedia.org/wiki/Null_%28computer%29

    Hmmm ...

    'So, for any A, the expressions "A = Null" and "A <> Null" are neither true nor false.'

  • fuzzy lollipop (unregistered) in reply to PrisonerOfPain

    the real WTF is that NULL means the ABSENCE of any value.

    0 is a value a value of ZERO, 0.00000000000001 is a value as well.

  • (cs) in reply to fuzzy lollipop

    They also forgot...

    isLudicrousNull()!!!

  • (cs) in reply to Samah

    If it is Pretty Null, can there be an UglyNull?

  • revmischa (unregistered)

    Here in the bay area we'd probably call that "hellaNull"

  • Rohan Shah (unregistered) in reply to revmischa

    This first of all struck me as a big WTF. But it is of course completely logical given the problems you get with floating-point arithmetic.

  • Todd (unregistered) in reply to Dave
    Anonymous:
    Followed, of course, by isExcruciatinglyNull, damnThatsTheNullestThingEVER, politicianIQNull, and finally isNullAndNotNull.

    Dave


    don't forget Ludicrous speed
  • (cs) in reply to mjonhanson

    mjonhanson:
    What, no "fist!", "First!" or "frist!" post?  I'm losing my faith in the trolls.  Or they're starting to get that the joke isn't funny anymore.

    Null is a value between 0.0001 and 0.0000000001, dumb@$$es!

     "?????? ???!"

  • Tilendor (unregistered) in reply to TomCo

        I would like to add something other than a snide remark to the discussion.  This WTFery is best consumed at a single glance.  Both the concept of IsVeryNull and IsVeryZero are non-sequiturs.  Null and Zero in general use are considered to be absolute values.  Its not like a temperature or a color which can vary, and make statements like Very Hot and Very Blue sensible.  To use a modifier on a single scalar value is what breaks with normal assumptions.  What would you think of a weatherman who stated that "Today, the low temperature will be very 20 degrees".

    Everyone has their own cutoff or threshold on what they consider a WTF.  I'd recommend just enjoying the first reaction you get on this one and then letting it go.

  • Someonae (unregistered) in reply to RiX0R
    RiX0R:

    So what's wrong with plain old 0?

     



    BAH.

    That's SO NOT Enterprisy ...

    (hey, that captcha made me think: I'm almost a machine (3 attempts before getting it right)! I wonder if I can pass the Turing test ... huuummm $$$)
  • COrthbandt (unregistered)
    It's kinda sad to see programmers bitch around 'bout a topic they
    clearly do not understand.
    To anyone who ever handled anything like physics or numerical math
    this is not a WTF at all. The names may be funny, but these are quite
    valid functions. You can't rely on something being 0.0 when dealing
    with floats or doubles.
    One possible improvement would be to make the actual epsilon depend
    on the values to be compared, but with only a single number to decide
    on this obviously would not work.
     
    So, how about digging up something like Numerical Recipes before posting
    embarrassing comments involving Paula or brilliant?
     
    And no, I haven't got anything to do with the source of this code.
  • (cs) in reply to marvin_rabbit
    marvin_rabbit:
    isSoNullThatWhenItSitsAroundTheNullItSitsAROUNDTheNull(double _valu


    Like "Weird Al"'s line in the lyrics for Fat: "When I sit around the house I really sit around the house". This line is in the background vocals, and I had a real rough time hearing them. Yeah, I'm a non-native speaker, so there.
  • The 2-Belo (unregistered) in reply to Fred the wondermonkey
    Anonymous:
    marvin_rabbit:
    > isNull(double _value)

    That was just the start. I'm sure the rest of the library was:

    isTruelyNull(double _value)
    isReallyQuiteSpectacularlyNull(double _value)
    isNullToEndAllNull(double _value)
    isMoreNullThanTheOtherNull(double _value)
    isSoNullThatWhenItSitsAroundTheNullItSitsAROUNDTheNull(double _valu

     

    You forgot

    <FONT face="Courier New">isWithANameLikeMangledBabyDucksYouKnowItsGotToBeExtremelyNull()</FONT>

     

    No one also seems to want to mention obvious Very Bad Puns, such as

    isSecondGunmanOnTheGrassyNull();

    --
    $0.02

  • bendel (unregistered) in reply to bah

    I fully agree.


  • bendel (unregistered) in reply to bah
    Anonymous:
    Like most WTFs here, the real WTF is the people replying. Null also means 'zero', which is obviously the intent of this code. As opposed to 'empty', which is the meaning we commonly consider 'null' to have. For the idiots who state that he should have just tested for zero, you can't do that safely with double values, as it is incredibly rare that you will find two variables out of two different mathematical operations to have the EXACT same value. So 'A - B' will almost always have a remainder. Note that if you had ASKED why you couldn't do this, you would not be an idiot; asking would be a sign of wisdom, accepting that there are things which you do not yet know, and implying your desire to learn. The WTF here is probably Mihhon, who incorrectly understood what the original author was doing. I would enjoy knowing if those method names are the original names; if so, so what? How many times have you, as a programmer, not been able to bother yourself to pause in a mad programming dash to think of the 'perfect name' for a method? IsNull? IsZero? IsTiny? IsReallyTiny? My own function for this, which I used to use all the time, is called 'isZero' and takes two arguments, the value and the limit in sig figs. Still, I wouldn't consider a fellow programmer an idiot based on something like this; if I has only two particular zero cut-offs, I'd use two different methods as well; it is easier to refactor, if needed. If this site took the view that 'bad code' should be made an example of, and CORRECTED, I would enjoy it. Instead the forums are full of idiots who think they impart wisdom with snappy comments such as 'HAHAH what an idiot! WTF++'. I daresay this could be an interesting site, and it is SOooo close. But it falls flat, simply because it focuses on being insulting, rather than insightful. Hopefully others agree and the site improves. Until then, cheers,


    Once again: I fully agree.
  • UTU (unregistered) in reply to squirrel
    squirrel:
    It's quite simple. All nulls are equal, but some values of null are more null than others.


    I believe I missed the joke here, but no NULL is equal to any other NULL, including itself.
  • (cs) in reply to UTU
    Anonymous:
    squirrel:
    It's quite simple. All nulls are equal, but some values of null are more null than others.

    I believe I missed the joke here, but no NULL is equal to any other NULL, including itself.


    Not correct. isNull(NULL,NULL) returns true.
    In fact, isVeryNull(NULL,NULL) returns true too.
    So not only NULL is equal to NULL but it is very equal ;)
  • Arevos (unregistered)

    Just a quick correction: C++ isn't a strongly typed language; it's weakly typed.

    Also, the correct method in Java to represent null values should be to use the class that corresponds to the primtive value (such as the Integer class). I'm not sure whether this is the most common method, but it should be.

  • (cs) in reply to trollable

    Yanks eh? They did it again.

  • (cs) in reply to Arevos

    OK, what's up with the gimps saying "OMG you've got it all wrong, they meant ZERO not NULL!!"? How does that make it any better? How is "zero and very zero" different to "null and very null"?

    When you are talking about absolute values (be it null, zero, seven, true, false, or FileNotFound), there is no "very". It either is, or it isn't.

    If it's zero.... it's zero! No margin for error there at all. Having "isCloseToZero" and "isVeryCloseToZero" would be the terms to use in that instance, but even that is horrible. We're talking about floating point maths here, with numbers up to hundreds of digits long, and in that context , 65 is "close to zero".

    "isSmallerThanAMillionth" and "isSmallerThanAHundredth" would be more accurate, and clearer - it at least means something. How can anyone reading "isZero" know that it also includes non-zero numbers, and the difference between that and "isVeryZero"? Code obfuscation at its best.

    Summary: Stop saying "it's ok, they meant zero" - meaning zero here would be just as big of a WTF as meaning null!

  • chris vanderheyden (unregistered) in reply to mrprogguy
    IQpierce:

    Actually, when I go to the Elegant Steak House (tm) (patent pending), I always make a point mention that I'd like the steak prepared "extra medium."



    Hmm .. i prefer the VERY elegant steakhouse ...
  • (cs) in reply to Arevos
    Anonymous:
    Just a quick correction: C++ isn't a strongly typed language; it's weakly typed. 

    Oh shit, thanks for the advice - that's where we've been going wrong. Dump C++ and rewrite our enterprise apps as strongly-typed .BAT files.

    Anonymous:
    Also, the correct method in Java to represent null values should be to use the class that corresponds to the primtive value (such as the Integer class). I'm not sure whether this is the most common method, but it should be.

    The master has spoken. He decree the One Way to all.

  • Anthony (unregistered)

    This is not howlingly bad code. The only real WTF is in the naming. These functions don't check database nulls, they check aproximately-equal-to-zero, and so should be named

    isNearlyZero and isVeryNearlyZero

    That and the magic numbers that should be constants.
    That and the idea that someone is actually representing DB nulls this way
    That and not using a library function to check float-equivance.

    It's not as bad as Delphi code that I saw a colleage working on yesterday - and I quote:

            if StrToFloat(trim(Format('%15.2f', [fooFactor]))) = 100.00 then

    That's right folks - he's printing it into a string with a two-decimal place rounding, then converting that back into a float, just in order to do what a the standard library can do:

            if Math.SameValue(fooFactor, 100, 0.01) then

    Gah.


  • I should probably go as anonymous for this one, in case. (unregistered) in reply to dasmb
    Anonymous:

    Interestingly enough, what's far worse than non-nullable integers in .NET is the fact that Date is also a value type.  No null dates, but every .NET date time picker handles nullable values and every customer wants them.  We wound up using midnight on January 1st, 1900 (the default from one or another of our legacy systems, probably Access), and it kind of came back to haunt us.  Bug reports with "Date Time Field XxX displays January 1st" were very, very common.

    I don't have a particular problem with non-nullable value types, but the DateTime thing did weird me out somewhat. We were using DateTime.MinValue as a "null" constant, which led to interesting problems interoperating with Java. In the end it was easiest to set up a constant GregorianCalendar value in a static initialiser block (nullDate.setTimeInMillis(-62135596800000L);, for those who are interested :)) as NULL_DATE in the Java system...
  • RichNFamous (unregistered) in reply to Dave
    Anonymous:
    Followed, of course, by isExcruciatinglyNull, damnThatsTheNullestThingEVER, politicianIQNull, and finally isNullAndNotNull.

    Dave


    And they would then be VeryWTF?
  • RichNFamous (unregistered) in reply to RangerRick
    RangerRick:
    an implementation that didn't leave it open for a denial-of-truth attack.




    Leave that to the politicians...
  • Toni (unregistered) in reply to RichNFamous

    I didn't read all of the posts, but what about "isAbsoluteNull()" ?

    Try to top ;)

    lg,
    Toni

  • (cs) in reply to Todd

    Anonymous:
    Anonymous:
    Followed, of course, by isExcruciatinglyNull, damnThatsTheNullestThingEVER, politicianIQNull, and finally isNullAndNotNull.

    Dave


    don't forget Ludicrous speed

    Forty-Two

  • Adam Hupp (unregistered)

    This is just bad naming, not truly WTF.  They clearly meant this to be a "close to zero" check, not something that was conceptually "null" in the usual sense.  Anything making use of floating point operations is peppered with tests like this.

    -Adam

  • (cs) in reply to squirrel

    squirrel:
    It's quite simple. All nulls are equal.

    Oops you're wrong. Null != Null

    [8o|]

     

  • SQL hippie (unregistered) in reply to jannes
    jannes:

    squirrel:
    It's quite simple. All nulls are equal.

    Oops you're wrong. Null != Null

    [8o|]


    According to SQL, he is, but according to about-any-programming-language...
  • anonymous ape (unregistered)

    Did you know that in S60, null is just a bit less than MuchLess?-)

    enum TThreadPriority
    {
    EPriorityNull=(-30),
    EPriorityMuchLess=(-20),
    EPriorityLess=(-10),
    EPriorityNormal=0,
    EPriorityMore=10,
    EPriorityMuchMore=20,
    EPriorityRealTime=30,
    EPriorityAbsoluteVeryLow=100,
    EPriorityAbsoluteLow=200,
    EPriorityAbsoluteBackground=300,
    EPriorityAbsoluteForeground=400,
    EPriorityAbsoluteHigh=500
    }

  • Mr Dooku (unregistered)

    HL7 defines 10 flavors of null, which is an incomplete list, IMHO, since they leave out isVeryNull and SortaNull:


    <font face="Arial" size="3">NullFlavor</font>
    Lvl Type, Domain name and/or Mnemonic code Concept ID Mnemonic Print Name Definition/Description
    1 S: NoInformation (NI) 10610 NI NoInformation No information whatsoever can be inferred from this exceptional value. This is the most general exceptional value. It is also the default exceptional value.
    2 <font color="white">  </font>L:  (ASKU) 10614 ASKU asked but unknown Information was sought but not found (e.g., patient was asked but didn't know)
    2 <font color="white">  </font>L:  (NA) 10611 NA not applicable No proper value is applicable in this context (e.g., last menstrual period for a male.)
    2 <font color="white">  </font>L:  (NASK) 10613 NASK not asked This information has not been sought (e.g., patient was not asked)
    2 <font color="white">  </font>L:  (NAV) 10615 NAV temporarily unavailable Information is not available at this time but it is expected that it will be available later.
    2 <font color="white">  </font>L:  (NINF) 10618 NINF negative infinity Negative infinity of numbers.
    2 <font color="white">  </font>L:  (NP) 10619 NP not present Value is not present in a message. This is only defined in messages, never in application data! All values not present in the message must be replaced by the applicable default, or no-information (NI) as the default of all defaults.
    2 <font color="white">  </font>L:  (OTH) 10616 OTH other The actual value is not an element in the value domain of a variable. (e.g., concept not provided by required code system.)
    2 <font color="white">  </font>L:  (PINF) 10617 PINF positive infinity Positive infinity of numbers.
    2 <font color="white">  </font>L:  (UNK) 10612 UNK unknown A proper value is applicable, but not known.


    Mr Dooku
  • Devildog (unregistered) in reply to RayS

    Expressing an innocent opinion, while unknowing, about a post is one thing. Preaching to others about their wrong ways, while not having any idea wtf you're talking about, is another.

    I don't know who would get the "daily moron" award for the most "promote-to-management" incompetent reply, you or the guys who mention "data base" or "nullable types" in their replies.

    For your information, one can say 65 equals 0, once my threshold is high enough. Think of it as 65 == 0 for high enough values of zero.

    I would love to see a real C++ high performance application writing wtf here, and witness the folks on the forum wondering about where are the nullable types or how many database hits it takes to run a 3d graphics engine...


    THEY MEANT CLOSE TO ZERO, OK?

    cheers,
    Devildog

  • Devildog (unregistered) in reply to Devildog

    RayS:

    Expressing an innocent opinion, while unknowing, about a post is one thing. Preaching to others about their wrong ways, while not having any idea wtf you're talking about, is another.

    I don't know who would get the "daily moron" award for the most "promote-to-management" incompetent reply, you or the guys who mention "data base" or "nullable types" in their replies.

    For your information, one can say 65 equals 0, once my threshold is high enough. Think of it as 65 == 0 for high enough values of zero.

    I would love to see a real C++ high performance application writing wtf here, and witness the folks on the forum wondering about where are the nullable types or how many database hits it takes to run a 3d graphics engine...


    THEY MEANT CLOSE TO ZERO, OK?

    cheers,
    Devildog

  • Grovesy (unregistered) in reply to jsmith

    This is very useful for cases like "How many servings of alcohol did the average party goer drink", where those who didn't go to the party have a NULL in the servings column.  Those who went to the party, but didn't drink have a 0.

    Surely those who didn't go to the party would not have a corresponding tuple in 'went to the party' relation. If they didn’t go the party, they didn’t go to the party, period. Null alcohol units would end up in the proposition<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

    The person named p, arrived at the party at time t and drank an unknown number of beers. <o:p></o:p>

    Your meaning is of Null beers drank is.<o:p></o:p>

    The person named p never went to the party because of some magic value in one of the attributes.  <o:p></o:p>

    Anyhow, the specific meaning of a SQL Null is a SQL DBMS is ‘unknown’. <o:p></o:p>

     

     

     

  • (cs) in reply to PrisonerOfPain
    PrisonerOfPain:
    C# does support null for value types. It's called nullable types and you define 'm like bool? name = null, or something.


    as mentioned above: wrapping the primitive type in a class,

    the Nullable types in .NET are a class, wrapped around a primitive, with a flag for Null, and some member functions for dealing with null and default values (eg .getValueOrDefault).


  • (cs) in reply to RiX0R
    RiX0R:

    So what's wrong with plain old 0?

     



    0 is a value, not the same as NULL

    NULL should mean "no one has touched this and we have no idea what the value should be"
  • (cs) in reply to WeatherGod


    WeatherGod:
    Doesn't schools teach the concept of NaN (Not A Number).  I mean, even C and C++ support these!

    This code is definitely not NaN-friendly.



    schools teach a lot of things that people don't pick up on. Grammar, math, etc...

    NaN !~ Null !~ 0

    NaN you'll see on variant types that can represent numbers OR other values. NaN may not be a number but CAN be a string, object, etc....which do have meaning.

    0 has meaning

    Null is the primordial void, no interpretable value except "I dunno" or possibly "not applicable" in the case of FKs.


    I cringe anytime someone doesn't see the difference between NULL and 0.

  • Grovesy (unregistered) in reply to unklegwar
    unklegwar:
    RiX0R:

    So what's wrong with plain old 0?

     



    0 is a value, not the same as NULL

    NULL should mean "no one has touched this and we have no idea what the value should be"

    Well, no.. As mentioned beforehand, in the context of SQL (assuming this is the context we are talking in), it means 'Unknown'. (It’s a rather poor way of dealing with unknown data,, but that's a whole WTF and digression we can do without). <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

    Someone could have touched it. 'We have no idea what the value should be' is correct; 'no one has touched this ' is however is not because  we may have thought we did know the value, but then found out that we didn't really know the value at all. <o:p></o:p>

     

  • jbange (unregistered) in reply to RiX0R
    RiX0R:

    So what's wrong with plain old 0?



    Depending on the particular application, you may need to differentiate between "having a value of zero" and "having no value set at all". Kinda like Schroedinger's Cat, where a NULL value means the cat is neither alive (1) nor dead (0). Say you have a remote weather monitor app and are filling an array with readings from a radio linked temperature probe that potentially outputs a value between 100 and -100. In the case where the radio link is broken you certainly don't want to use "0" to indicate that, as 0 is a valid temperature. Instead you'd use a NULL value, so that when you later pull data from the array you know the difference between "cold" and "broken".
  • (cs) in reply to unklegwar
    unklegwar:
    RiX0R:

    So what's wrong with plain old 0?

     



    0 is a value, not the same as NULL

    NULL should mean "no one has touched this and we have no idea what the value should be"


    This is the best post here, thats all it would have took.

    Presumably not a yank eh?
  • (cs) in reply to WeatherGod
    WeatherGod:
    Anonymous:
    This concept is revolutionary
    How has Unix & LInux surivived so long without a /dev/verynull
     
    I must submit a kernel patch ... today if possible.
     
    PS send your responces to /dev/verynull



    Cannot stat '/dev/verynull'.  Looks like I need to upgrade my kernel.

    That's because your kernel isn't Enterprisey (and assuming your kernel isn't Enterprisey, you aren't Enterprisey either... So you'll be anchored to your programmer work for your entire life, and you will never ever become a Software Designer).

    Cheers!
    Guido

     

  • (cs) in reply to Guido

    The whole "Null" or "VeryNull" reminds me of Microsoft's own MSI Install logs--there is an entry near the bottom of most of them that will alternately say

    Reboot=Supresss

    or

    Reboot=ReallySupress

    Not sure what the difference is...

    --Jim

Leave a comment on “It's Pretty Null”

Log In or post as a guest

Replying to comment #:

« Return to Article