• Jenema (unregistered) in reply to boog
    boog:
    fake boog's sock puppet:
    boog:
    So "merde!" means campfire? I don't get it.
    Your an idiot.
    And you need a new act, my transparent troll.

    Don't woory booger, I thought you was funny (for once)

  • Banna (unregistered) in reply to hoodaticus
    hoodaticus:
    <snip loads of stuff> Here's an example:
    class blah 
    {
      Item _item;
      blah(Item item) { _item = item; /* what would this do without case sensitivity?*/ }
      Item Item { get { return _item; } set { _item = value; } }
    }

    Without case sensitivity, you need to be an expert in the compiler to predict what it will do.

    Although I agree that Case-Sensitivity is a wonderful way of ensuring you know what you are doing, I'm not sure whether calling an Item item would be allowed in a case insensitive language.

    If nothing else, I think Case-Sensitivity aids readability, not just because there is a consistency with each instance, but because it allows using standards to distinguish between Constants, variables, methods etc. Although this is still possible in case-insensitive languages, insisting on case ensures that this standard (if used) is used for each occurrence aiding readability and therefore maintainability.

    (I'm not a big fan of instance variables mimicking Object names in different case - although I suppose as a parameter to a method it might make sense (eq myObject.equals(Object object); )).

  • Mike (unregistered)

    I'll fix that boolean code!

    if( ( ( value == true ) == true ) || ( ( value == false ) == true ) ) {
       ...
    }
    

    Just remember one thing: You can't write too much code that compares booleans against true and false.

  • (cs) in reply to Serial Public Interface
    Serial Public Interface:
    The important function, could lay dormant in an application for years before someone thought to look at the logs, then realise like all logs, they are useless when the debug code and the release code do not use the same stack traces.

    You put stack traces in your logs?

  • (cs) in reply to eternicode
    eternicode:

    Obviously floats and doubles don't count as numbers.

    Obviously negative numbers don't count either.

  • TK (unregistered) in reply to Mike
    Mike:
    Anonymous:
    C-Octothorpe:
    hoodaticus:
    That last sample is some really good VB.NET alright.

    Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?

    boog will strangle the penguin no matter what. I think we all know that by now...

    And no, you can't do _ for line continuation because dusting off my flamewar hat C# is a REAL language which doesn't require hand-holding like this.

    zis comment is merde!

    Almost, but not quite - you don't need _ in C# because C# is a REAL language that has line terminators. Hence if you don't terminate the line, you can flow onto the next without requring an explicit continuation symbol. What kind of merde language doesn't have line terminators?
    Python.

    :)

    Indeed. I used to prefer ; as a command terminator until I learned Python. The kicker for me was that I noticed the Perl version of my Python scripts (with roughly the same number of lines) contained far more ;'s in Perl then 's in Python.

    Python's reliance on line continuation is much aided by the fact that unbalanced (), [], or {} imply line continuation. So, in practice, my multi-line Python code rarely requires a line continuation character.

  • the beholder (unregistered) in reply to Banna
    Banna:
    hoodaticus:
    <snip loads of stuff> Here's an example:
    class blah 
    {
      Item _item;
      blah(Item item) { _item = item; /* what would this do without case sensitivity?*/ }
      Item Item { get { return _item; } set { _item = value; } }
    }

    Without case sensitivity, you need to be an expert in the compiler to predict what it will do.

    Although I agree that Case-Sensitivity is a wonderful way of ensuring you know what you are doing, I'm not sure whether calling an Item item would be allowed in a case insensitive language.

    If nothing else, I think Case-Sensitivity aids readability, not just because there is a consistency with each instance, but because it allows using standards to distinguish between Constants, variables, methods etc. Although this is still possible in case-insensitive languages, insisting on case ensures that this standard (if used) is used for each occurrence aiding readability and therefore maintainability.

    (I'm not a big fan of instance variables mimicking Object names in different case - although I suppose as a parameter to a method it might make sense (eq myObject.equals(Object object); )).

    While VB has plenty WTFs to go about, this was the one thing Microsoft did well: It is case-insensitive, but once you define an identifier one way e.g. SimpleSocketCollectionFactory from then on you can type it as SiMpLeSoCkEtCoLlEcTiOnFaCtOrY or any other case, and the IDE will autocorrect the identifier. Reserved words autocorrect too.

    The good thing about it is that you'll never have a moron write hoodaticus's code snippet, because Item would be either the class, the instance, or the method, but not all of them. (OTOH, other WTFs are still available to the moron)

    There's a way around if you are evil enough, but I can't remember what it is anymore.

  • Sudo (unregistered) in reply to frits
    frits:
    Steve The Cynic:
    Anonymous:
    Didn't you do French in highschool? I knew "merde" and I also know "foutre le camp", but these are literally the only French words I remember (clearly it was a very useful class).
    I live in northern France, and a more common "bad word" around here is "putain". The literal sense is "whore", but it gets used for just about anything, including as a general assertion of frustration.

    For emphasis, "putain de merde" works as well...

    Shitwhore would make a great band name.

    Turns out there's a band on MySpace called "Shitwhores". They suck worse than Akismet.
  • Sudo (unregistered) in reply to Mike
    Mike:
    I'll fix that boolean code!
    if( ( ( ( value == true ) == true ) || ( ( value == false ) == true ) ) != false ) {
       ...
    }
    
    Just remember one thing: You can't write too much code that compares booleans against true and false.
    That's better... you almost missed one!
  • S (unregistered)

    I have to agree. The worse VB.NET code gets, the more it looks like C#

  • itsmo (unregistered) in reply to justsomedude
    justsomedude:
    boog's sock puppet:
    boog:
    So "merde!" means campfire? I don't get it.
    Your an idiot.

    *You're

    Yor

  • Level 2 (unregistered) in reply to Anonymous
    Anonymous:
    C-Octothorpe:
    hoodaticus:
    That last sample is some really good VB.NET alright.

    Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?

    boog will strangle the penguin no matter what. I think we all know that by now...

    And no, you can't do _ for line continuation because dusting off my flamewar hat C# is a REAL language which doesn't require hand-holding like this.

    zis comment is merde!

    Almost, but not quite - you don't need _ in C# because C# is a REAL language that has line terminators. Hence if you don't terminate the line, you can flow onto the next without requring an explicit continuation symbol. What kind of merde language doesn't have line terminators?
    All languages have line terminators. All languages have statement terminators. In some languages they are the same character.

  • methinks (unregistered)

    Who is this Jessica in Berlin?

  • Anonymouse (unregistered) in reply to Serial Public Interface
    Serial Public Interface:
    The important function, could lay dormant in an application for years before someone thought to look at the logs, then realise like all logs, they are useless when the debug code and the release code do not use the same stack traces.

    It looks as if he's simulating a log entry in the terminal window. This code does not log at all. Probably the real actions are logged like "Log-Function $logTime "Applying action X" instead of using Write-Host.

    Captcha: aliquam - A question asked Ali

  • QJ (unregistered)

    TRWTF is the tortuous way the random numbers are used?

  • (cs) in reply to Jimminfy
    Jimminfy:
    hoodaticus:
    Vilx-:
    I wonder - I'm not a C++ expert, but the PrBoolFlag function - if the inbool was obtained via some memory-magic manipulations (like casting an int* to a bool*); and they used some weird compiler for an embedded software (which might be since it seems to have something to with printers); could it not be that it was possible for the value to actually be something that the compiler doesn't recognize as either true or false?
    That is compiler dependent.
    Is that not his point?
    Assertions do not usually end in question marks. Shall I elaborate? Some compiler versions implement bool C-style, so for those compilers, you only have two possible states of a boolean. For the rest, it might be possible.
  • (cs) in reply to Jimminfy
    Jimminfy:
    hoodaticus:
    Vilx-:
    I wonder - I'm not a C++ expert, but the PrBoolFlag function - if the inbool was obtained via some memory-magic manipulations (like casting an int* to a bool*); and they used some weird compiler for an embedded software (which might be since it seems to have something to with printers); could it not be that it was possible for the value to actually be something that the compiler doesn't recognize as either true or false?
    That is compiler dependent.
    Is that not his point?
    Assertions do not usually end in question marks. Shall I elaborate? Some compiler versions implement bool C-style, so for those compilers, you only have two possible states of a boolean. For the rest, it might be possible.
  • (cs) in reply to boog
    boog:
    boog (cheap imitation):
    boog:
    boog (cheap imitation):
    C-Octothorpe:
    Since when did this site degrade into The Daily Retarded Trolling Attempt?
    I know I started when I saw one of boog's idiotic comments featured.
    In other words, somebody submitted some code he wrote to this site, and I posted a mean comment about it.
    This and this. I'll let the internet jury decide whose guilty of the bigger idiocy: boog or Remy.
    How stalkeresque. You certainly like to keep track of my posting habits.

    Kind of disturbing really, but a little flattering.

    It gets more disturbing the more you think about it.

  • It's a-me, Mario! (unregistered) in reply to QJ
    QJ:
    TRWTF is the tortuous way the random numbers are used?

    It's been build so there's a random (1% per run) chance to call a random (out of 15) phrase.

    Captcha: paratus - the missing part when it is shortened to "ap."

  • Azarien (unregistered)

    I wonder if John Connor has been destoried properly.

  • Design Pattern (unregistered) in reply to chrismcb
    chrismcb:
    eternicode:

    Obviously floats and doubles don't count as numbers.

    Obviously negative numbers don't count either.

    +1

  • (cs) in reply to TK
    TK:
    Indeed. I used to prefer ; as a command terminator until I learned Python. The kicker for me was that I noticed the Perl version of my Python scripts (with roughly the same number of lines) contained far more ;'s in Perl then \'s in Python.

    Python's reliance on line continuation is much aided by the fact that unbalanced (), [], or {} imply line continuation. So, in practice, my multi-line Python code rarely requires a line continuation character.

    I write a bit of Python, and I haven't had an explicit \ in my code for ages. There have been a few times where I've inserted extra () to avoid them (I prefer that solution), but even that's rare.

    I feel like I went into Python with an open mind about the line endings and indentation-sensitivity. I wound up liking not needing semicolons and rather disliking the indentation thing. (IMO it makes editing harder, and I've definitely seen websites complete destroy the meaning of Python code by not preserving the indentation.) I do sometimes wonder if the time I spent with Basic back in the day contributed to my like of the line-ending thing.

  • (cs) in reply to hoodaticus
    hoodaticus:
    Coyne:
    hoodaticus:
    Coyne:
    hoodaticus:
    Coyne:
    My favorite is "destroyEverythingYouTouch". That pattern will be very useful in the future. I plan to create all of these:
    /*snip*/ int increment(int &x) { return x--; }
    I like this one, especially since it returns x, which allows you to read x's value, and then, after you read its returned value, it decrements it.

    Exactly: Neither the return nor the change to x counts as an increment. The name is a doubled lie.

    How about: return ++x----;

    That's not right. The routine's name is "increment". Following the pattern we must therefore do anything but increment (and preferably exactly the opposite of that).

    I was merely attempting to make it appear as if it incremented, but then decrement it back after the return.
    I agree, if it returns the wrong result, people would notice something was up with it straight away, it would be far more evil to return the correct result so that they won't notice x has changed until the /next/ time they try to use it which could be much much later. By which time your function will have made its escape and be miles from the scene of the crime.

    Your syntax is way off though. You can't combine the inc/dec operators like that because they need an lvalue to work on, and after the first one has been applied you don't have an lvalue any more, just the result of that first operation, which is a plain old integer rvalue. So you can't write "x++++" for the same reason that you can't write (e.g. if x == 3 to start with) "4++".

    What you were looking for is "return 1 + x--;".

  • Dave (unregistered)

    The inBool one accidentally had a comment line removed:

    if ( (inbool == true) || (inbool == false) ) {
        value = inbool;
        retval = 0;
      } else {
            // inbool == FILE_NOT_FOUND
      	printf("\n???SW.ERROR:Printer/PrIntDpi: illegal 0 \n");
        retval = CPERR_BoolArgBad;
      }
    

    FTFY.

  • hm (unregistered)

    Isn't it vital to know which way to destroy things?

    private function "destroyEverythingYouTouch" {

    today();
    
    destroyMe();
    
    thisWay();
    

    }

  • (cs)
    Bool IsNumber (string str) 
    { 
      return str _
        .Replace ("0", "") _
        .Replace ("1", "") _
        .Replace ("2", "") _
        .Replace ("3", "") _
        .Replace ("4", "") _
        .Replace ("5", "") _
        .Replace ("6", "") _
        .Replace ("7", "") _
        .Replace ("8", "") _
        .Replace ("9", "") _
        .Length == 0;
    }
    

    There are two things that jump out at me here.

    1. IsNumeric was left out of VB.Net 1.x! What were they thinking? Were they thinking? Probably, not; it is Microsoft after all. They finally put it back in version 2.

    2. This thing has a false positive with a null string ("") and false negatives with -5, 3.4, 2e5, 3e+4, etc. Adapting this general design to allow these, however, would allow invalid strings like "3..4", "-e5", "3+4", etc.

    You actually have to break the string into fields (leading, integer, decimal point, fraction, E, exponent) to parse this properly without a built-in function.

  • zenstain (unregistered) in reply to trtrwtf
    trtrwtf:
    Coyne:
    hoodaticus:
    Coyne:
    My favorite is "destroyEverythingYouTouch". That pattern will be very useful in the future. I plan to create all of these:
    /*snip*/ int increment(int &x) { return x--; }
    I like this one, especially since it returns x, which allows you to read x's value, and then, after you read its returned value, it decrements it.

    Exactly: Neither the return nor the change to x counts as an increment. The name is a doubled lie.

    It's the opposite of an increment. It's an excrement.

    I am stealing this. Thank you.

  • Max E. (unregistered)

    The sad thing about the PrBoolFlag function is, it doesn't handle FileNotFound.

Leave a comment on “Important-Function(), IsNumber(), and More()”

Log In or post as a guest

Replying to comment #:

« Return to Article