Important-Function(), IsNumber(), and More()

« Return to Article
  • Broken Universe 2011-04-04 09:08
    From today on, 4 will not be <= 4. Thank you for your assistance in facilitating this change.


    Captcha: iusto - iusto know that 4 <= 4.
  • RuBen 2011-04-04 09:11
    A picture says more then a thousand French words... or in this case, one: Merde!
  • Todd Lewis 2011-04-04 09:23
    Did I just go blind, or did the flesh evaporate from the text leaving only the bones behind? TRWTF is the new font.
  • ParkinT 2011-04-04 09:25
    The "John Connor" snippet PROVES that far into the future, Ruby on Rails will be a dominant language/framework.

    There is no COBOL in the future!
  • Frenchie 2011-04-04 09:27
    Alex Papadimoulis:
    I never bothered to look it up, since it was pretty obvious it was some explicitive

    Methinks Paul spent too much time with foreign coders, his language skills are all mixed up...

    BTW, did someone ever wonder why that library is called libcaca? Scatological humour at its finest :-)
  • Quicksilver 2011-04-04 09:29
    Ah the empty string is a number ...
    I knew that!
  • Caffeine 2011-04-04 09:31
    Article:
    Paul shared this creative snippet of VB.NET.

    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;
    }



    Well... I can't argue with that. That is extremely creative VB.NET. So creative you would almost think it was a different language!
  • Mike D. 2011-04-04 09:33
    It used to be enough just to destroy John Connor. Now we have to take his stories away, too.
  • frits 2011-04-04 09:34
    Caffeine:
    Article:
    Paul shared this creative snippet of VB.NET.

    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;
    }



    Well... I can't argue with that. That is extremely creative VB.NET. So creative you would almost think it was a different language!


    Bool-Merde.NET?
  • HellKarnassus 2011-04-04 09:40
    I'm saving the steaming pile ascii art for the Communicator
  • Anonymous 2011-04-04 09:41
    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).
  • Nagesh 2011-04-04 09:44
    The purpose of this function is true WTF. I have figured it all out.
  • hoodaticus 2011-04-04 09:45
    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?
  • Anonymous Coward 2011-04-04 09:53
    Dividing by `$null...

    is my personal favourite.
  • akatherder 2011-04-04 09:53
    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).


    oh non mon ami! I took Spanish. Of course, the Spanish equivalent is mierda, so I assumed it was the same.
  • bsaksida 2011-04-04 09:54
    Clearly he wanted to create skynet and terminator and hid it inside of a program. Waiting to be awaken someday
  • bsaksida 2011-04-04 09:54
    I can not see the link to youtube site. Unavaible in my country due to publisher limit
  • Serial Public Interface 2011-04-04 09:55
    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.

  • C-Octothorpe 2011-04-04 10:14
    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!
  • boog 2011-04-04 10:18
    So "merde!" means campfire? I don't get it.
  • Anonymous 2011-04-04 10:19
    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?
  • boog 2011-04-04 10:25
    Nagesh:
    The purpose of this function is true WTF. I have figured it all out.

    Which function?
  • Girltron 2011-04-04 10:28
    Ladytron++;

    Never thought I'd see a reference to that in code. Plus 10 internets to the first person who finds Goldfrapp in code.
  • hoodaticus 2011-04-04 10:29
    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?
    I would never use it anyway, but the code sample made me wonder.
  • BlueKnot 2011-04-04 10:30
    frits:
    Caffeine:
    Article:
    Paul shared this creative snippet of VB.NET.

    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;
    }



    Well... I can't argue with that. That is extremely creative VB.NET. So creative you would almost think it was a different language!


    Bool-Merde.NET?
    Whatever language it is, IsNumber("") returns true and IsNumber("1.5") does not... so I'll vote for Bool-Merde.NET on this ome.
  • C-Octothorpe 2011-04-04 10:30
    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?


    Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

    IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.
  • Vilx- 2011-04-04 10:33
    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?
  • hoodaticus 2011-04-04 10:44
    C-Octothorpe:
    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?


    Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

    IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.
    Thank God for dynamics.
  • Ken 2011-04-04 10:47
    Debug.Assert(value <= Int32.MaxValue);


    This protects you when "The INT is TOO DAMN HIGH!"
  • Anonymous 2011-04-04 10:52
    C-Octothorpe:
    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?


    Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

    IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

    Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!
  • frits 2011-04-04 10:58
    Anonymous:
    C-Octothorpe:
    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?


    Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

    IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

    Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!


    Bah! True Scots- uh... coders like to know the real function signature they are calling. Anyway, what's so hard about using a few dozen Missing.Value parameters? I mean you only have to write a method once, right?
  • hoodaticus 2011-04-04 11:01
    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.
  • Coyne 2011-04-04 11:02
    My favorite is "destroyEverythingYouTouch". That pattern will be very useful in the future. I plan to create all of these:


    void PersistObject(obj) { destroy obj; }

    void PreventFailure() { int x = 1/0; }

    int increment(int &x) { return x--; }

    double discountSale(double amt) { amt * 2.72; }

  • hoodaticus 2011-04-04 11:02
    Anonymous:
    C-Octothorpe:
    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?


    Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

    IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

    Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!
    Ahh, no more ... Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing);
  • C-Octothorpe 2011-04-04 11:04
    Anonymous:
    C-Octothorpe:
    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?


    Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

    IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

    Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!


    I've got mixed feelings about optional/default parameters. I guess I'm a purist (or a change resistant donkey, either-or), but I much prefer method overloading. To me, it just looks cleaner and it's more explicit.

    But I think I'm arguing against myself because really and truly, it was brought in for interop, not for us lazy devs who don't want to write 5 overloads...
  • Anonymous 2011-04-04 11:05
    frits:
    Anonymous:
    C-Octothorpe:
    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?


    Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

    IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

    Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!


    Bah! True Scots- uh... coders like to know the real function signature they are calling. Anyway, what's so hard about using a few dozen Missing.Value parameters? I mean you only have to write a method once, right?

    Actually, I hate VB.NET so much that I would still use C# for interop - and just bite the bullet and supply those dozens of Type.Missing params. It may suck but it's still a lot better than using VB.NET!
  • hoodaticus 2011-04-04 11:06
    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.
  • C-Octothorpe 2011-04-04 11:06
    hoodaticus:
    Anonymous:
    C-Octothorpe:
    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?


    Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

    IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

    Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!
    Ahh, no more ... Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing);


    It's kind of beautiful, don't you think? It's kind of like a huge array of wind-mills...
  • C-Octothorpe 2011-04-04 11:08
    Anonymous:
    frits:
    Anonymous:
    C-Octothorpe:
    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?


    Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

    IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

    Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!


    Bah! True Scots- uh... coders like to know the real function signature they are calling. Anyway, what's so hard about using a few dozen Missing.Value parameters? I mean you only have to write a method once, right?

    Actually, I hate VB.NET so much that I would still use C# for interop - and just bite the bullet and supply those dozens of Type.Missing params. It may suck but it's still a lot better than using VB.NET!


    Wow, now there's a guy who REALLY hates VB.NET. Hats off to you sir for successfully cutting off your nose to spite your face... :)
  • Anonymous 2011-04-04 11:09
    C-Octothorpe:
    Anonymous:
    C-Octothorpe:
    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?


    Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

    IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

    Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!


    I've got mixed feelings about optional/default parameters. I guess I'm a purist (or a change resistant donkey, either-or), but I much prefer method overloading. To me, it just looks cleaner and it's more explicit.

    But I think I'm arguing against myself because really and truly, it was brought in for interop, not for us lazy devs who don't want to write 5 overloads...

    I completely agree, I will still be writing overloaded methods in favour of methods accepting optional parameters, but it's going to be a god-send for interop.
  • Anonymous 2011-04-04 11:10
    C-Octothorpe:
    Anonymous:
    frits:
    Anonymous:
    C-Octothorpe:
    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?


    Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

    IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

    Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!


    Bah! True Scots- uh... coders like to know the real function signature they are calling. Anyway, what's so hard about using a few dozen Missing.Value parameters? I mean you only have to write a method once, right?

    Actually, I hate VB.NET so much that I would still use C# for interop - and just bite the bullet and supply those dozens of Type.Missing params. It may suck but it's still a lot better than using VB.NET!


    Wow, now there's a guy who REALLY hates VB.NET. Hats off to you sir for successfully cutting off your nose to spite your face... :)

    It takes a lot of effort to hate VB.NET this much!!
  • Steve The Cynic 2011-04-04 11:12
    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...
  • Meep 2011-04-04 11:13
    Ken:
    Debug.Assert(value <= Int32.MaxValue);


    This protects you when "The INT is TOO DAMN HIGH!"


    Funny.
  • hoodaticus 2011-04-04 11:23
    C-Octothorpe:
    I've got mixed feelings about optional/default parameters. I guess I'm a purist (or a change resistant donkey, either-or), but I much prefer method overloading. To me, it just looks cleaner and it's more explicit.

    But I think I'm arguing against myself because really and truly, it was brought in for interop, not for us lazy devs who don't want to write 5 overloads...
    I LOVE optional parameters in C#. Just use them for things that are truly optional but that do not alter the behavior of the method. For instance, if you have a SaveAs method that needs different parameters depending on the serialization format, then you do an overload (you hear that, MS Office team?!). If you have an AddPhoneNumber method, however, it could probably use an optional (nullable?) parameter for extension instead of forcing it to be specified.
  • justsomedude 2011-04-04 11:26
    Article:
    Paul shared this creative snippet of VB.NET.

    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;
    }




    IsNumber("2.0")

    ...
  • frits 2011-04-04 11:28
    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.
  • Coyne 2011-04-04 11:31
    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.
  • dkf 2011-04-04 11:35
    I would have commented earlier but I was [rolls D20 while disregarding part of the range] thinking about Jessica in Berlin... Yes, that's what I was doing.
  • trtrwtf 2011-04-04 11:50
    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.
  • Krenn 2011-04-04 11:53
    No "reticulating splines"? For shame...
  • boog 2011-04-04 11:53
    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.

    string excrement(string x) { return x = "Merde!"; }
  • Mike 2011-04-04 11:55
    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.

    :)
  • Ryan Herbert 2011-04-04 12:01
    The biggest WTF is that Skynet became self-aware at 2:14AM, not 2:13AM.
  • Gibbon1 2011-04-04 12:10
    Anonymous Coward:
    Dividing by `$null...

    is my personal favourite.


    13 {Write-Host $logTime "Playing rock-scissors-file_mot_found..."}

    Is my favorite.
  • Kalle 2011-04-04 12:12
    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.

    :)


    and Haskell.

    :)
  • boog's sock puppet 2011-04-04 12:12
    boog:
    So "merde!" means campfire? I don't get it.

    Your an idiot.
  • justsomedude 2011-04-04 12:19
    boog's sock puppet:
    boog:
    So "merde!" means campfire? I don't get it.

    Your an idiot.


    *You're

  • Brent 2011-04-04 12:32
    TRWTF is that the person who wrote "Important-Function()" probably thinks that fitting a square in a circle is what is meant by "squaring the circle".
  • Mason Wheeler 2011-04-04 12:34
    C-Octothorpe:
    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.


    I, on the other hand, hate it when crap like case sensitivity leaks into languages and screws it up for the rest of us who are trying to accomplish something productive.
  • C-Octothorpe 2011-04-04 12:49
    Mason Wheeler:
    C-Octothorpe:
    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.


    I, on the other hand, hate it when crap like case sensitivity leaks into languages and screws it up for the rest of us who are trying to accomplish something productive.


    So you think that a language which forces you to be specific about which member, field, etc. you're talking about is a screw up, or are you just trolling?

    The logical conclusion to that argument is to ask why should you spell the function name in use as it is defined? Because what, the compiler/interpreter should just KNOW what you're talking about?

    void DoStuff() { // does stuff... }

    d0Stuuff("some string");

    Who wouldn't want to work in a language like that?
  • boog 2011-04-04 12:49
    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.
  • eternicode 2011-04-04 13:15
    justsomedude:
    Article:
    Paul shared this creative snippet of VB.NET.

    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;
    }




    IsNumber("2.0")

    ...


    Obviously floats and doubles don't count as numbers.
  • hoodaticus 2011-04-04 13:26
    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----;
  • hoodaticus 2011-04-04 13:30
    C-Octothorpe:
    Mason Wheeler:
    C-Octothorpe:
    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.


    I, on the other hand, hate it when crap like case sensitivity leaks into languages and screws it up for the rest of us who are trying to accomplish something productive.


    So you think that a language which forces you to be specific about which member, field, etc. you're talking about is a screw up, or are you just trolling?

    The logical conclusion to that argument is to ask why should you spell the function name in use as it is defined? Because what, the compiler/interpreter should just KNOW what you're talking about?

    void DoStuff() { // does stuff... }

    d0Stuuff("some string");

    Who wouldn't want to work in a language like that?
    The benefits of case sensitivity aren't apparent until you start using it.

    Addendum (2011-04-04 13:39):
    C-Octothorpe:
    Mason Wheeler:
    C-Octothorpe:
    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.


    I, on the other hand, hate it when crap like case sensitivity leaks into languages and screws it up for the rest of us who are trying to accomplish something productive.


    So you think that a language which forces you to be specific about which member, field, etc. you're talking about is a screw up, or are you just trolling?

    The logical conclusion to that argument is to ask why should you spell the function name in use as it is defined? Because what, the compiler/interpreter should just KNOW what you're talking about?

    void DoStuff() { // does stuff... }

    d0Stuuff("some string");

    Who wouldn't want to work in a language like that?
    The benefits of case sensitivity aren't apparent until you start using it.

    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.
  • Coyne 2011-04-04 13:33
    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).
  • hoodaticus 2011-04-04 13:42
    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.
  • boog 2011-04-04 13:45
    Mason Wheeler:
    C-Octothorpe:
    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.


    I, on the other hand, hate it when crap like case sensitivity leaks into languages and screws it up for the rest of us who are trying to accomplish something productive.

    Exactly what is this productive something that "the rest of you" are trying to accomplish that is precluded by the inability to use lower- and upper-case letters interchangeably?
  • Svick 2011-04-04 13:53
    I like the fact that Important-Function() writes #5 ("Surfing porn sites on the internet...") 99.9% of the time.
  • C-Octothorpe 2011-04-04 13:56
    hoodaticus:

    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.


    Without case sensitivity, this wouldn't be. The compiler wouldn't let you do that...

    The example you give is a perfectly cromulent C# example and would compile and run happily. For a junior dev looking at it, it may be a little confusing but at least it's concise. For me, code littered with "m_"s is about as readable as a page WRITTEN COMPLETELY IN BLOCK LETTERS. Case sensitivity is your friend: "item" to me is much more meaningful and clear than m_item, IMO.
  • caecus 2011-04-04 13:56
    Both case sensitivity and case insensitivity can be abused, but who would rather use a library that treats differently cased identifiers differently, as in "Add() does X but add() does Y" (and I've seen such an abomination in production code *shudder*).

    Yes, there are conventions for how case is used in case-sensitive languages, but personally, I'd rather live with the situation where another dev screwing up case doesn't matter. Used well, either is perfectly fine. Used poorly, case-sensitivity can be a true wtf.
  • BBCode OKAy 2011-04-04 14:00
    boog:
    Mason Wheeler:
    C-Octothorpe:
    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.


    I, on the other hand, hate it when crap like case sensitivity leaks into languages and screws it up for the rest of us who are trying to accomplish something productive.

    Exactly what is this productive something that "the rest of you" are trying to accomplish that is precluded by the inability to use lower- and upper-case letters interchangeably?

    HEs oBviOUsly TROlling. no ONE iS IDIotiC eNOUgh toTHINKThings liKE caSe and w h ite sPA ce IS not IMPortAnt.
  • C-Octothorpe 2011-04-04 14:04
    BBCode OKAy:
    boog:
    Mason Wheeler:
    C-Octothorpe:
    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.


    I, on the other hand, hate it when crap like case sensitivity leaks into languages and screws it up for the rest of us who are trying to accomplish something productive.

    Exactly what is this productive something that "the rest of you" are trying to accomplish that is precluded by the inability to use lower- and upper-case letters interchangeably?

    HEs oBviOUsly TROlling. no ONE iS IDIotiC eNOUgh toTHINKThings liKE caSe and w h ite sPA ce IS not IMPortAnt.


    I wish I could agree with you: Case sensitive hater.
  • boog 2011-04-04 14:13
    BBCode OKAy:
    boog:
    Mason Wheeler:
    I, on the other hand, hate it when crap like case sensitivity leaks into languages and screws it up for the rest of us who are trying to accomplish something productive.

    Exactly what is this productive something that "the rest of you" are trying to accomplish that is precluded by the inability to use lower- and upper-case letters interchangeably?

    HEs oBviOUsly TROlling. no ONE iS IDIotiC eNOUgh toTHINKThings liKE caSe and w h ite sPA ce IS not IMPortAnt.

    Really? Damn. And here I was sincerely hoping for some genuine answers.
  • anonymous 2011-04-04 14:16
    But what if inbool is EOF?
  • Power Troll 2011-04-04 14:24
    Is PowerShell .NET compatible?
  • boog's sock puppet 2011-04-04 14:24
    boog:
    BBCode OKAy:
    boog:
    Mason Wheeler:
    I, on the other hand, hate it when crap like case sensitivity leaks into languages and screws it up for the rest of us who are trying to accomplish something productive.

    Exactly what is this productive something that "the rest of you" are trying to accomplish that is precluded by the inability to use lower- and upper-case letters interchangeably?

    HEs oBviOUsly TROlling. no ONE iS IDIotiC eNOUgh toTHINKThings liKE caSe and w h ite sPA ce IS not IMPortAnt.

    Really? Damn. And here I was sincerely hoping for some genuine answers.

    Then your an idiot.
  • C-Octothorpe 2011-04-04 14:28
    boog's sock puppet:
    boog:
    BBCode OKAy:
    boog:
    Mason Wheeler:
    I, on the other hand, hate it when crap like case sensitivity leaks into languages and screws it up for the rest of us who are trying to accomplish something productive.

    Exactly what is this productive something that "the rest of you" are trying to accomplish that is precluded by the inability to use lower- and upper-case letters interchangeably?

    HEs oBviOUsly TROlling. no ONE iS IDIotiC eNOUgh toTHINKThings liKE caSe and w h ite sPA ce IS not IMPortAnt.

    Really? Damn. And here I was sincerely hoping for some genuine answers.

    Then your an idiot.


    Since when did this site degrade into The Daily Retarded Trolling Attempt?
  • JJ 2011-04-04 14:37
    Unce.

    Tice.

    Fee tines a mady.


    (And pet peeve: giggling is "hee hee," not "he he.")
  • C-Octothorpe's sock puppet 2011-04-04 14:39
    C-Octothorpe:
    boog's sock puppet:
    boog:
    BBCode OKAy:
    boog:
    Mason Wheeler:
    I, on the other hand, hate it when crap like case sensitivity leaks into languages and screws it up for the rest of us who are trying to accomplish something productive.

    Exactly what is this productive something that "the rest of you" are trying to accomplish that is precluded by the inability to use lower- and upper-case letters interchangeably?

    HEs oBviOUsly TROlling. no ONE iS IDIotiC eNOUgh toTHINKThings liKE caSe and w h ite sPA ce IS not IMPortAnt.

    Really? Damn. And here I was sincerely hoping for some genuine answers.

    Then your an idiot.


    Since when did this site degrade into The Daily Retarded Trolling Attempt?

    About 2004, I think.
  • Ouch! 2011-04-04 14:49
    Kalle:
    Mike:
    Anonymous:
    What kind of merde language doesn't have line terminators?

    Python.
    :)

    and Haskell.
    :)

    Haskell has line terminators (well, not exactly, but ';' isn't a line terminator but a statement [expression?] terminator in C - and probably C# - too, so what).
    Sometimes they are even used.
  • Todd Lewis 2011-04-04 14:53
    Todd Lewis:
    Did I just go blind, or did the flesh evaporate from the text leaving only the bones behind? TRWTF is the new font.


    Seriously guys, did nobody else notice a change in the site's font? It's so thin I can hardly make out the letters. Other web sites look as good/bad as they did last week, i.e. no changes. But the Daily WTF is a real What The Font today. What's up?
  • владимир 2011-04-04 14:59
    Don't get on that guy's case. He was just protecting against FILE_NOT_FOUND.
  • Lou Thomas 2011-04-04 14:59
    Todd Lewis:
    Todd Lewis:
    Did I just go blind, or did the flesh evaporate from the text leaving only the bones behind? TRWTF is the new font.


    Seriously guys, did nobody else notice a change in the site's font? It's so thin I can hardly make out the letters. Other web sites look as good/bad as they did last week, i.e. no changes. But the Daily WTF is a real What The Font today. What's up?

    This is the funniest joke I've seen in the comments in a long time. Normally we only read stories about idiot users who can't figure out basic things with their web browsers.
  • C-Octothorpe 2011-04-04 15:00
    Todd Lewis:
    Todd Lewis:
    Did I just go blind, or did the flesh evaporate from the text leaving only the bones behind? TRWTF is the new font.


    Seriously guys, did nobody else notice a change in the site's font? It's so thin I can hardly make out the letters. Other web sites look as good/bad as they did last week, i.e. no changes. But the Daily WTF is a real What The Font today. What's up?


    It's the gub'ment messing with your lookin' box...

    In other words, no, I haven't noticed anything.
  • hoodaticus 2011-04-04 15:13
    C-Octothorpe:
    Since when did this site degrade into The Daily Retarded Trolling Attempt?
    Since I registered.
  • boog 2011-04-04 15:18
    C-Octothorpe:
    boog's sock puppet:
    boog:
    BBCode OKAy:
    boog:
    Mason Wheeler:
    I, on the other hand, hate it when crap like case sensitivity leaks into languages and screws it up for the rest of us who are trying to accomplish something productive.

    Exactly what is this productive something that "the rest of you" are trying to accomplish that is precluded by the inability to use lower- and upper-case letters interchangeably?

    HEs oBviOUsly TROlling. no ONE iS IDIotiC eNOUgh toTHINKThings liKE caSe and w h ite sPA ce IS not IMPortAnt.

    Really? Damn. And here I was sincerely hoping for some genuine answers.

    Then your an idiot.


    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.
  • C-Octothorpe 2011-04-04 15:19
    hoodaticus:
    C-Octothorpe:
    Since when did this site degrade into The Daily Retarded Trolling Attempt?
    Since I registered.


    Nice!
  • boog 2011-04-04 15:25
    fake boog's sock puppet:
    boog:
    Really? Damn. And here I was sincerely hoping for some genuine answers.

    Then your an idiot.
    BWAAAK!!
    My, what an interesting parrot. Would you like a cracker?
  • boog 2011-04-04 15:38
    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.
  • boog 2011-04-04 15:39
    Todd Lewis:
    Seriously guys, did nobody else notice a change in the site's font?
    Yes.
  • hoodaticus 2011-04-04 15:46
    boog:
    Todd Lewis:
    Seriously guys, did nobody else notice a change in the site's font?
    Yes.
    Nice.
  • влÐÂà 2011-04-04 15:56
    hoodaticus:
    boog:
    Todd Lewis:
    Seriously guys, did nobody else notice a change in the site's font?
    Yes.
    Nice.

    Nice!
  • boog 2011-04-04 16:00
    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.
  • boog 2011-04-04 16:07
    caecus:
    Both case sensitivity and case insensitivity can be abused, but who would rather use a library that treats differently cased identifiers differently, as in "Add() does X but add() does Y" (and I've seen such an abomination in production code *shudder*).
    Having two functions with similar names perform different tasks is just bad design. Period. Are you suggesting that case sensitivity allows this mistake and case insensitivity does not?

    If idiot-developer can't create function "add()" because "Add()" is already used, what will stop him from creating function "add2()" instead?
  • boog 2011-04-04 16:20
    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.
  • m 2011-04-04 16:25
    Anonymous:

    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?


    If <i>I</i> don’t terminate a line, I usually stay on the line I’m already on.
  • Todd Lewis 2011-04-04 16:35
    Lou Thomas:
    Todd Lewis:
    Todd Lewis:
    Did I just go blind, or did the flesh evaporate from the text leaving only the bones behind? TRWTF is the new font.


    Seriously guys, did nobody else notice a change in the site's font? It's so thin I can hardly make out the letters. Other web sites look as good/bad as they did last week, i.e. no changes. But the Daily WTF is a real What The Font today. What's up?

    This is the funniest joke I've seen in the comments in a long time. Normally we only read stories about idiot users who can't figure out basic things with their web browsers.

    Oh I figured out what's up with the browser. Tahoma sucks. I meant what's up with the editors. I've only got so many pairs of glasses to try. Maybe when your eyes get to be as good as mine aren't (I used to read source code in 8pt; now that looks like blank paper) you'll appreciate how lousy thin fonts look. It's easy enough to work around, but having to is a WTF. Now get off my lawn.
  • Jimminfy 2011-04-04 18:08
    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?
  • LoveKnuckle 2011-04-04 18:14
    caecus:
    Both case sensitivity and case insensitivity can be abused, but who would rather use a library that treats differently cased identifiers differently, as in "Add() does X but add() does Y" (and I've seen such an abomination in production code *shudder*).

    Yes, there are conventions for how case is used in case-sensitive languages, but personally, I'd rather live with the situation where another dev screwing up case doesn't matter. Used well, either is perfectly fine. Used poorly, case-sensitivity can be a true wtf.


    This is obviously a troll. A non-troll couldn't be this insensitive.
  • Malibu 2011-04-04 18:16
    Mason Wheeler:
    C-Octothorpe:
    And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.


    I, on the other hand, hate it when crap like case sensitivity leaks into languages and screws it up for the rest of us who are trying to accomplish something productive.


    cOUldN't AgREe mOre, WHO, nEEDS, case-SenSitIvities anyWAYs, it ServeS aS liTTLe puRPose In ProgRAMming As iN wrITTeN lAngUAgE. MaKiNG BOokS CasE SEnSItIVe stIFLeS tHE AuthOR's cREAtiVity, aND REDUcES hIS ProDUCTiVity.
  • Jenema 2011-04-04 18:17
    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 2011-04-04 18:26
    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 2011-04-04 20:34
    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.
  • chrismcb 2011-04-04 21:26
    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?
  • chrismcb 2011-04-04 21:27
    eternicode:


    Obviously floats and doubles don't count as numbers.


    Obviously negative numbers don't count either.
  • TK 2011-04-04 21:50
    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 2011-04-04 23:00
    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 2011-04-04 23:20
    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 2011-04-04 23:26
    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 2011-04-05 00:06
    I have to agree. The worse VB.NET code gets, the more it looks like C#
  • itsmo 2011-04-05 05:44
    justsomedude:
    boog's sock puppet:
    boog:
    So "merde!" means campfire? I don't get it.

    Your an idiot.


    *You're



    Yor
  • Level 2 2011-04-05 06:16
    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 2011-04-05 06:25
    Who is this Jessica in Berlin?
  • Anonymouse 2011-04-05 08:14
    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 2011-04-05 08:57
    TRWTF is the tortuous way the random numbers are used?
  • hoodaticus 2011-04-05 11:11
    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.
  • hoodaticus 2011-04-05 11:11
    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.
  • hoodaticus 2011-04-05 11:37
    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! 2011-04-05 13:30
    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."
  • Zoc 2011-04-06 00:55
    bsaksida:
    I can not see the link to youtube site. Unavaible in my country due to publisher limit
    It's a Ladytron song, with the lyrics: Destroy everything you touch / Today / Destroy me / This way

    Maybe this one will work for you: http://www.metacafe.com/watch/304991
  • Azarien 2011-04-06 06:17
    I wonder if John Connor has been destoried properly.
  • Design Pattern 2011-04-06 09:54
    chrismcb:
    eternicode:


    Obviously floats and doubles don't count as numbers.


    Obviously negative numbers don't count either.

    +1
  • EvanED 2011-04-06 11:38
    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.
  • DaveK 2011-04-06 16:49
    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 2011-04-07 05:42
    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 2011-04-07 09:47
    Isn't it vital to know which way to destroy things?

    private function "destroyEverythingYouTouch" {

    today();

    destroyMe();

    thisWay();
    }

  • Nutster 2011-04-10 09:30
    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 2011-04-28 12:15
    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. 2011-05-30 16:07
    The sad thing about the PrBoolFlag function is, it doesn't handle FileNotFound.