• cthulhu (unregistered)

    TRWTF is they use SQL. A file based caching solution can be more efficient.

  • Stephen (unregistered)

    While this is terrible code.. you should just fix it. Monkey see monkey do (both good and bad).

  • Metalman (unregistered)

    Regarding:

    "More JavaScript. Is it a string or an integer?"
    
        if (obj.value>="9000" && obj.value<=9999)
    

    I recognize this. It is one of the favorite datatype of contractors called the Stringtinger!

  • TekniCal (unregistered) in reply to m0ffx
    m0ffx:
    I can't remember the name of the Law that says anyone criticising language will themselves make a linguistic error.

    Muphrie's Law?

  • WouldLikeToKnowSQL (unregistered)
    Comment held for moderation.
  • bobby (unregistered) in reply to Bob

    +1 This is the reason why I wake up every morning and go doing this job

  • hambai (unregistered)

    Ahh, that reminds me of my favorite PHP function :)))) I've spent hours laughin at this beauty :)

    function checkVal($param) {
      if ($param = 0) {
        return false;
      } else {
        return true;
      }
    }
    
  • Really Think That's Crazy (unregistered) in reply to TopCod3r

    Really? I'd be finding another job if I was told that, since it would seem PROGRAMMERS were incapable of reading CODE if that were the mandate!

  • GG (unregistered)
    Comment held for moderation.
  • GG (unregistered)
    Comment held for moderation.
  • GG (unregistered)
    Comment held for moderation.
  • David (unregistered)

    Wow. could at least use String.Empty

  • nike dunk (unregistered)
    Comment held for moderation.
  • Oh dear, oh dear. (unregistered) in reply to OhDear

    None of that code makes any sense.

    What you describe didn't work because VB6 doesn't have an += operator. Fancy that.

  • D (unregistered)

    As someone who never did any VB, the real WTF for me is that = means both equals and assignment. So I just had to test if this code was valid vb.net:

    Dim var1, var2, var3 var1 = "test" var2 = "test" var3 = var1 = var2 Response.Write var3

    returns true

    It actually works! How incredibly stupid is that!

  • Anone (unregistered) in reply to D

    Not at all?

  • David (unregistered)

    I have a comment about this kind of code in VB

       If SomeVariable = True Then
          DoSomething()
       Else
          SomethingElse()
       Endif
    

    I ran into a case where True was not True. We had a class which was serialized from a file that had been written by another program. One was VB6 and the other was .NET (I don't remember which was which). The program that wrote the file had written 1 for true and 0 for false. The other program read the 1 into the variable using some Marshal functions (the file was a flat-binary file).

    This resulted in SomeVariable -- which was boolean -- holding the value of 1. If you moused-over it in the debugger, the debugger would tell you the value was True. But if you stepped through the code it would call SomethingElse. This took a while to figure out because the debugger was telling me one thing and doing another.

    The real problem (well, limited to the scope of fixing this bit of code and not the code that read it in the first place), was that CInt(True) = -1. So, even though SomeVariable claims to be True, it's really 1 which is NOT the same as True.

    But if it had been

       If SomeVariable Then
    

    it worked fine.

  • wholesale jordan shoes (unregistered)
    Comment held for moderation.
  • huojia (unregistered)
    Comment held for moderation.

Leave a comment on “A Touch of Genius”

Log In or post as a guest

Replying to comment #:

« Return to Article