In A Rush, Properly Handled, and More

« Return to Article
  • Bosshog 2010-03-10 09:06
    Transformer optimusPrime = new Transformer()

    WIN!
  • WhiskeyJack 2010-03-10 09:07
    Whoever wrote that article seems to be the one that's "in a rush", judging by all the copy/paste errors.

    --
    Note from Alex: Whoa. I swear, at like 3AM last nite it looked perfect! (Fixed)
  • @Deprecated 2010-03-10 09:09
    WhiskeyJack:
    Whoever wrote that article seems to be the one that's "in a rush", judging by all the copy/paste errors.


    Hey give Alex a break, he's all wiped after having to implement some impossible features that were sold to a customer.

    As for the:
    public long getLength() {
    return 1000000; // no clue
    }

    I am afraid I have done something similar from time to time, when I am going through some inherited code where the original dev is long gone, and putting in something like
    // OMGWTF I can't believe this #$$@#

    Why do I put that in there? Venting or something, I guess...
  • SR 2010-03-10 09:14
    The comments for validation one is something I'd do while still learning to program effectively. Of course I'd go back and replace them with code before putting it into production.

    As for optimusPrime = new Transformer() - that is teh awesome! :oD
  • Richard T. Roll 2010-03-10 09:16
    All of this is fine on embedded platforms which might not have a file system.
  • AndyC 2010-03-10 09:17
    It's a bit unfair to just clip bits of code out of context. If you'd left in the public class PieceOfString bit the getLength method makes perfect sense!
  • Another PHP Guy 2010-03-10 09:17
    function DeUnicode($_input){
    
    //added to strip out italics tag <i> from name
    $_input = str_replace('<i>', '', $_input);
    $_input = str_replace('</i>', '', $_input);
    return $_input;
    }


    Sure the PHP guy wasn't in a rush. He had simply could use strip_tags instead of his own function.

    facilisi -- facilis is latin for easy to do
  • me_again 2010-03-10 09:19
    Transformer optimusPrime = new Transformer();

    is this a wtf because it's cool?

    captcha: vulputate - A vulture that likes tater tots.
  • TheSpiesMustFlow 2010-03-10 09:28
    me_again:
    Transformer optimusPrime = new Transformer();

    is this a wtf because it's cool?


    Half because it's cool, half because jokes shouldn't go in production systems I guess.
  • RayMarron 2010-03-10 09:29
    I find all this anti-Italic sentiment disturbing.
  • True that 2010-03-10 09:32
    Transformer optimusPrime = new Transformer();
    is only cool if you're working in a graphical environment and instantiating models for rendering where you can pass the constructor arguments, like 'TRUCK', or 'ROBOT', or 'GORILLA' (for the optimusPrimal version).
  • Erasmus Darwin 2010-03-10 09:32
    SR:
    The comments for validation one is something I'd do while still learning to program effectively. Of course I'd go back and replace them with code before putting it into production.


    In that case, it helps to have something greppable (such as FIXME) in the placeholder comments to make sure it doesn't get forgotten before deploying the code.
  • Lorne Kates 2010-03-10 09:36
    class Transformer

    class Transformers : Transformer, Collection

    Transformer optimusPrime = new Transformer();

    Transformers autobots = new Transformers();

    optimusPrime->Address(autobots);

    optimusPrime->IssueCommand("Transform!!!!");

    AwesomeSoundEffectsFactory::GetSoundEffect("ch ch ch CH!")->Play();
  • Anonymous 2010-03-10 09:39
    I'm pretty sure that the first function posted (the more I read into it) is a waste of space.
  • jrk 2010-03-10 09:42
    I tried to put some italic tags around a bit of text today, but somehow, it doubled my text

    I tried to put some italic tags around a bit of text today, but somehow, it doubled my text
  • frits 2010-03-10 09:48
    //Fixed for naming and precision
    
    Public Function kgf()
    kgf = 9.80665
    End Function
  • java.lang.Chris; 2010-03-10 09:52

    public interface Transformer { ... }

    public interface Car extends Transformer { ... }

    List<Transformer> transformers = new ArrayList<Transformer>();
    transformers.add(new Transformer());

    List<Car> robotsInDisguise = (List<Car>) transformers;
  • Anon 2010-03-10 09:55
    AndyC:
    It's a bit unfair to just clip bits of code out of context. If you'd left in the public class PieceOfString bit the getLength method makes perfect sense!


    Indeed, and the Optimus Prime bit might have been from code for a Transformers game, in which case it's perfectly cromulent.
  • SR 2010-03-10 09:56
    Erasmus Darwin:
    In that case, it helps to have something greppable (such as FIXME) in the placeholder comments to make sure it doesn't get forgotten before deploying the code.


    That's exactly what I did. "FIXME" and "TODO write this code" are good, though I've still a soft spot for "banana"
  • highphilosopher 2010-03-10 09:59
    Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.

    --
    Note from Alex: there were several comments pointing out typos/mistakes, but since the errors were fixed, the comments were no longer relavent; I did keep one, which was at the top and was a good balance of poking fun at me and explaining the original problem. On the same note, comments that respond to this will probably be deleted, too, since it's double-meta (I think?) discussion.
  • Dave 2010-03-10 10:02
    Bosshog:
    Transformer optimusPrime = new Transformer()
    WIN!


    Too right. I have been guilty of similar naming conventions, like having a boolean flag to indicate if the current user is local or remote (in circumstances where "local" security has been requested to be lower for convenience on the assumption that other protections will mitigate the extra risk) called b_from_round_these_parts. Then you can check
    if not b_from_round_these_parts
    (needs to be read in either a west country accent or with a hick slur)
  • AndersI 2010-03-10 10:03
    "A nice example of ahead planning," Robert writes, "just in case the Earth's mass dramatically changes overnight, we are prepared for a fast, system-wide adjustment."

    Public Function Newton()
    Newton = 9.81
    End Function


    Actually, this should be a function of latitude - see http://en.wikipedia.org/wiki/Gravitational_acceleration.

    For us here in Sweden, 9.82 is the best approximation.
  • MP 2010-03-10 10:03
    Anon:
    AndyC:
    It's a bit unfair to just clip bits of code out of context. If you'd left in the public class PieceOfString bit the getLength method makes perfect sense!


    Indeed, and the Optimus Prime bit might have been from code for a Transformers game, in which case it's perfectly cromulent.


    That would make it even more of a WTF since the article states:

    "I was going through some obscure code from the developers before me, and something caught my eye," Philippe wrote. "It was a class whose task was to transform data, and this is how it was instantiated."
  • frits 2010-03-10 10:04
    'Fixed for naming and precision
    
    Public Function kgf()
    kgf = 9.80665
    End Function



    'Added to fix the code the jerkoff Senior
    'Software Consultant broke.

    Public Function Newton()
    Newton= kgf
    End Function

  • toshir0 2010-03-10 10:07
    Richard T. Roll:
    All of this is fine on embedded platforms which might not have a file system.

    'it's not good
  • toshir0 2010-03-10 10:08
    toshir0:
    Richard T. Roll:
    All of this is fine on embedded platforms which might not have a file system.

    'it's not good

    'it's good
  • Matt Westwood 2010-03-10 10:10
    frits:
    'Fixed for naming and precision
    
    Public Function kgf()
    kgf = 9.80665
    End Function



    'Added to fix the code the jerkoff Senior
    'Software Consultant broke.

    Public Function Newton()
    Newton= kgf
    End Function



    Amateur.

    Public Function Newton()
    Newton= kgf()
    End Function
  • Adrian 2010-03-10 10:12
    Public Function Newton()
    
    Newton = 9.81
    End Function


    As a mech engineer, I would say it is not too bad, it makes sure you always use the same value and a known accuracy for g trougout the program.

    Some people use 9,81, others just 9,8 and some others round it to 10, and the actual value depends on a lot of things ( where you are on the globe, position of the moon....)

    This allows get some accuracy of the result and eventualy improve it.
  • TheJasper 2010-03-10 10:13
    RE the italics that become bold I would say that using italic tags is the real wtf. Though it feels strange to redefine this in css, html wasn't meant for defining presentation. That's why you have <Strong> and <Em>. It is unfortunate tags like <i> or <b> exist at all.

    Since you can redefine everything in css it is a mistake to think those tags will do what you think.
  • TheJasper 2010-03-10 10:13
    RE the italics that become bold I would say that using italic tags is the real wtf. Though it feels strange to redefine this in css, html wasn't meant for defining presentation. That's why you have <Strong> and <Em>. It is unfortunate tags like <i> or <b> exist at all.

    Since you can redefine everything in css it is a mistake to think those tags will do what you think.
  • Anonymous 2010-03-10 10:15
    frits:
    'Fixed for naming and precision
    
    Public Function kgf()
    kgf = 9.80665
    End Function

    'Added to fix the code the jerkoff Senior
    'Software Consultant broke.

    Public Function Newton()
    Newton= kgf
    End Function


    ROFL, senior software consultant! We've been reading your crappy angst-ridden comments long enough to know you're still in high-school, frits! Now get the hell back to class!
  • grizz 2010-03-10 10:17
    The Newton function probably is to avoid having a magic number in a calculation. Seems to me that's generally considered A Good Thing, not a WTF.
  • frits 2010-03-10 10:21
    Matt Westwood:
    frits:
    'Fixed for naming and precision
    
    Public Function kgf()
    kgf = 9.80665
    End Function



    'Added to fix the code the jerkoff Senior
    'Software Consultant broke.

    Public Function Newton()
    Newton= kgf
    End Function



    Amateur.

    Public Function Newton()
    Newton= kgf()
    End Function


    Hey man, this is VB. Parentheses optional.
  • DaveK 2010-03-10 10:22
    Another PHP Guy:
    function DeUnicode($_input){
    
    //added to strip out italics tag <i> from name
    $_input = str_replace('<i>', '', $_input);
    $_input = str_replace('</i>', '', $_input);
    return $_input;
    }


    Sure the PHP guy wasn't in a rush. He had simply could use strip_tags instead of his own function.
    I don't know about you, but <i<i>>I</</i>i> for one can see another problem with it.
  • Leo 2010-03-10 10:23
    grizz:
    The Newton function probably is to avoid having a magic number in a calculation. Seems to me that's generally considered A Good Thing, not a WTF.


    You're the one that does

    #define ONE 1
    #define TWO 2

    aren't you?

    Sometimes you really don't need it.
  • Matt Westwood 2010-03-10 10:23
    grizz:
    The Newton function probably is to avoid having a magic number in a calculation. Seems to me that's generally considered A Good Thing, not a WTF.


    Agreed - the only problem I might possibly have with it is its name - NewtonsPerKg would be better - but as a concept it's fine. No WTF.
  • Zachary 2010-03-10 10:25
    "I tried to put some italic tags around a bit of text today," writes Derek, "but somehow, it emboldened my text. I did some digging, and I found that our front-end developer has this in our CSS stylesheet."

    i { color: #000; font-weight: bold; font-style: normal; }


    The real WTF here is that he is using the i tag to begin with. Any real web developer/designer uses pure CSS.
  • DaveK 2010-03-10 10:25
    highphilosopher:
    Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.

    --
    Note from Alex: there were several comments pointing out typos/mistakes, but since the errors were fixed, the comments were no longer relavent; I did keep one, which was at the top and was a good balance of poking fun at me and explaining the original problem

    *relevant*
  • Nitpickers R. Lame 2010-03-10 10:25
    Anonymous:

    I must admit I tend to agree; delete trolls and totally off-topic posts but don't delete relevant stuff. And if the original article is that messed up then it is perfectly relevant to point it out. Most people were being light-hearted about it, why purge perfectly innocent comments? Can the WTF community not enjoy a meta-WTF once in a while?

    highphilosopher:
    Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.

    md5sum:
    It's not the first time I've seen Alex nix a comment that didn't agree with him (including one or two of mine). Lame, but hey, he's the "god" of the wtf, right? Like "WTF did you delete my perfectly valid comment for?". Although, deleting peoples' comments is gonna bite him. Nobody comes here to read the articles, the articles mostly make no sense as a WTF, often containing valid code that the submitter and the writer are unable to comprehend. The COMMENTS though are almost ALWAYS an entertaining read.


    In this case none of yours are. Get over yourselves.

    Now as to whether this comment about useless comments being useless is useful... Well that's a different question entirely....
  • DaveK 2010-03-10 10:28
    Leo:
    grizz:
    The Newton function probably is to avoid having a magic number in a calculation. Seems to me that's generally considered A Good Thing, not a WTF.


    You're the one that does

    #define ONE 1
    #define TWO 2

    aren't you?

    Sometimes you really don't need it.
    And sometimes you do, because some scientific software has to give actually *correct* results, at any latitude, and even up a mountain, down a mineshaft, or in an orbiting spacecraft. It depends how much precision is required, which is something none of us can infer from a contextless snippet, but if it's even doing physics-based calculations at all, it's certainly possible they might want two or three significant digits of precision, which is the level at which it becomes worth considering variations in g.
  • frits 2010-03-10 10:29
    Anonymous:

    ROFL, senior software consultant! We've been reading your crappy angst-ridden comments long enough to know you're still in high-school, frits! Now get the hell back to class!


    We? Is there a frog in your pocket? For the dense, "senior software consultant" is a callback to the article.
  • SR 2010-03-10 10:33
    TheJasper:
    RE the italics that become bold I would say that using italic tags is the real wtf. Though it feels strange to redefine this in css, html wasn't meant for defining presentation. That's why you have <Strong> and <Em>. It is unfortunate tags like <i> or <b> exist at all.

    Since you can redefine everything in css it is a mistake to think those tags will do what you think.


    I agree that it's preferable to use EM and STRONG in place of I and B but redefining expected behaviour is definitely a WTF in my book.
  • Simon 2010-03-10 10:35
    I tried to put some italic tags around a bit of text today," writes Derek, "but somehow, it emboldened my text."


    This was a deliberate feature to tell you to stop using <i> to italicise text. The correct XHTML-compliant tag is <em>.
  • DaveK 2010-03-10 10:35
    jrk:
    I tried to put some italic tags around a bit of text today, but somehow, it doubled my text

    I tried to put some italic tags around a bit of text today, but somehow, it doubled my text

    Perhaps you could explain how that works?

  • DaveK 2010-03-10 10:39
    Simon:
    I tried to put some italic tags around a bit of text today," writes Derek, "but somehow, it emboldened my text."


    This was a deliberate feature to tell you to stop using <i> to italicise text.
    Don't you mean "... tell you to stop using unicode to italicise text ..."?
  • SR 2010-03-10 10:40
    DaveK:
    jrk:
    I tried to put some italic tags around a bit of text today, but somehow, it doubled my text

    I tried to put some italic tags around a bit of text today, but somehow, it doubled my text

    Perhaps you could explain how that works?


    That was referring to a copy and paste error that Alex has now fixed. Kudos on O'Rly, thuogh. It's ages since I've seen one.
  • Helix 2010-03-10 10:43
    DaveK:
    highphilosopher:
    Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.

    --
    Note from Alex: there were several comments pointing out typos/mistakes, but since the errors were fixed, the comments were no longer relavent; I did keep one, which was at the top and was a good balance of poking fun at me and explaining the original problem

    *relevant*


    Strangly by discussing about the spelling of relevant you have created a triple-meta comment.
  • ath 2010-03-10 10:45
    grizz:
    The Newton function probably is to avoid having a magic number in a calculation. Seems to me that's generally considered A Good Thing, not a WTF.


    Agree. If you hardcode the values you may screw up badly.
    For example, Alice calculates the force as F = 9.81 * m. Later Bob wants to do the inverse so he calculates m = F / 9.8128. Then the swedish guy comes along and calculates F again as F = 9.82 * m. You'd better wish they're programming a game and not the guidance system for an Ariane V rocket.

    Sure, I'd prefer a constant to a function but it's still better than hardcoded values...
  • Quirkafleeg 2010-03-10 10:47
    Zachary:
    Any real web developer/designer uses pure CSS.
    That's pointless. You need something else to which to apply the CSS.
  • Quirkafleeg 2010-03-10 10:57
    Helix:
    Strangly by discussing about the spelling of relevant you have created a triple-meta comment.
    ‘Strangely’. But then you knew that…
  • Seminymous Coward 2010-03-10 10:57
    Leo:
    grizz:
    The Newton function probably is to avoid having a magic number in a calculation. Seems to me that's generally considered A Good Thing, not a WTF.


    You're the one that does

    #define ONE 1
    #define TWO 2

    aren't you?

    Sometimes you really don't need it.


    Are you trolling or incapable of understanding why wanting all uses to match, to be easy to change uniformly, to contribute to readable code, and to perhaps eventually depend on localization or configuration is wise? Are you claiming a named constant is an automatic WTF?

    P.S. Wikipedia alone gives 9.80665, 9.797645, and 9.812865328 as reasonable choices if you don't want to account for latitude.
  • DaveK 2010-03-10 11:12
    Helix:
    DaveK:
    highphilosopher:
    Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.

    --
    Note from Alex: there were several comments pointing out typos/mistakes, but since the errors were fixed, the comments were no longer relavent; I did keep one, which was at the top and was a good balance of poking fun at me and explaining the original problem

    *relevant*


    Strangly by discussing about the spelling of relevant you have created a triple-meta comment.
    Equally strangely, by discussing about the discussing about the spelling of relevant, you have created a quadruple-meta comment, and this is presumably a quintuple-meta comment.

    I propose that we accept existence of the remaining meta levels up to and including the countable alephs by induction, rather than attempting to prove it exhaustively in this thread.
  • DaveK 2010-03-10 11:15
    SR:
    DaveK:
    jrk:
    I tried to put some italic tags around a bit of text today, but somehow, it doubled my text

    I tried to put some italic tags around a bit of text today, but somehow, it doubled my text

    Perhaps you could explain how that works?


    That was referring to a copy and paste error that Alex has now fixed.
    No fair! Guess IHBT :)
    SR:
    Kudos on O'Rly, thuogh. It's ages since I've seen one.
    I was gonna write it out in letters, but then I thought, it's only 3kB more for a thumbnail, so why not?
  • Rob 2010-03-10 11:16
    Transformer optimusPrime = new Transformer();

    I think there is more to that line then meets the eye.
  • frits 2010-03-10 11:17
    DaveK:
    Helix:
    DaveK:
    highphilosopher:
    Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.

    --
    Note from Alex: there were several comments pointing out typos/mistakes, but since the errors were fixed, the comments were no longer relavent; I did keep one, which was at the top and was a good balance of poking fun at me and explaining the original problem

    *relevant*


    Strangly by discussing about the spelling of relevant you have created a triple-meta comment.
    Equally strangely, by discussing about the discussing about the spelling of relevant, you have created a quadruple-meta comment, and this is presumably a quintuple-meta comment.

    I propose that we accept existence of the remaining meta levels up to and including the countable alephs by induction, rather than attempting to prove it exhaustively in this thread.


    I believe you are being a meta-nazi (Godwin's law invoked).
  • John 2010-03-10 11:21
    aparantly, speling is purty hard.
  • Jane 2010-03-10 11:23
    The "exit for" is executing in the branch delay slot, obviously!

    (For those not in the know, in certain assembly languages, the line after any branch command gets executed. Some assemblers rearrange the code before compiling, or insert a NOOP after all branches)
  • DaveK 2010-03-10 11:29
    Jane:
    (For those not in the know, in certain assembly languages, the line after any branch command gets executed. Some assemblers rearrange the code before compiling, or insert a NOOP after all branches)
    Yeah, they're really the ultimate expression of hardware's "fuck-you-you-can-fix-it-in-the-software" attitude made silicon! :-P

  • Someone too lazy to login and at work 2010-03-10 11:29
    I don't think that using a constant for something that actually is a constant is really a WTF. Even if you're never likely to alter the value of the constant, you do at least get to use a symbolic name instead of a value.

    I don't know if the way it's being done is a WTF though - I'm assuming that's how VB does returns?
  • Joe Bob Briggs 2010-03-10 11:29
    Transformer michaelBay = new Transformer();
  • millimeep 2010-03-10 11:31
    I'll see your Optimus Prime and raise you a Gregor Samsa
  • avflinsch 2010-03-10 11:35

    // trying to be thorough, what if return doesn't?
    // catch all possible errors

    public bool Receive( string FilePath )
    {
    try
    {
    return true;
    }
    catch( Exception e )
    {
    try
    {
    ExceptionManager.Publish( e, Priorities.High );
    return false;
    }
    catch ( Exception e )
    {
    return wtf; // just in case return does not work
    }
    }
    }




  • Ouch! 2010-03-10 11:44
    millimeep:
    I'll see your Optimus Prime and raise you a Gregor Samsa

    Thank you. At last a reference I get without googling. Heck, my kids are too old to understand Optimus Prime without googling. Now I feel old - no thanks for that.
  • ctw 2010-03-10 11:44
    I wrote and am using a library called "Transformer". How did I resist that joke?

    Perhaps more accurately, how did I get beaten to it?
  • SR 2010-03-10 11:46
    Ouch!:
    Thank you. At last a reference I get without googling. Heck, my kids are too old to understand Optimus Prime without googling. Now I feel old - no thanks for that.


    There are Facebook nostalgia groups for old mobile phones. Now _that_ makes me feel old!

    (And don't even get me started on retro 90s clubs!)
  • John Preston 2010-03-10 11:53
    I'd put money that the BS function variable syntax of this:

    Public Function Newton()
    Newton = 9.81
    End Function


    Is why this had to be there:
    Public Shared Function GetItemFromValue(ByVal ddlControl As DropDownList) As Integer
    Dim i As Integer
    If ddlControl.Items.Count > 0 Then
    For i = 0 To ddlControl.Items.Count - 1
    If ddlControl.Items(i).Selected() Then
    Return i
    Exit For 'leaving this here cause we're in a rush
    End If
    Next
    End If
    End Function


    Return i
    probably used to be
    GetItemFromValue = i
    and since using the function as a variable wouldn't "return" and exit, they needed an exit to prevent later iterations of the loop. Then someone with a brain came along later and changed it to return, but forgot to take out the comment.
  • SkittlesAreYum 2010-03-10 11:54
    grizz:
    The Newton function probably is to avoid having a magic number in a calculation. Seems to me that's generally considered A Good Thing, not a WTF.


    This.

    It's generally good practice (not that I always follow it) of putting all numbers that signify something as constants, even if they can never change. It makes it most code much easier to read, instead of "9.81? Where did that come from again? Let me read the comments..."
  • shash 2010-03-10 11:55
    Bosshog:
    Transformer optimusPrime = new Transformer()

    WIN!


    Probably more to it than meets the eye...
  • onitake 2010-03-10 12:01
    John Preston:

    Return i
    probably used to be
    GetItemFromValue = i
    and since using the function as a variable wouldn't "return" and exit, they needed an exit to prevent later iterations of the loop. Then someone with a brain came along later and changed it to return, but forgot to take out the comment.

    wait a minute.
    vb allows
    Return <Value>
    instead of
    <Function Returning A Value's Name> = <Value>
    now?
    doesn't that make vb even more obsolete as it already is?
  • Bim Job 2010-03-10 12:05
    Well, the real WTF with the Newton procedure is that it should be a property, not a procedure.

    It's worthless otherwise, isn't it? Getting Newton's gravitational constant is all very well. But why should we need recompilation to set it?

    I'm also deeply depressed about the concept of a VB.Net "Consultant." But that's another story.
  • java.lang.Chris; 2010-03-10 12:08
    Joe Bob Briggs:
    Transformer michaelBay = new Transformer();


    michaelBay.direct(); // throws BadImplementationException
  • Centricity 2010-03-10 12:21
    I have a sudden desire to redefine <i> and<b> to hot-pink Comic Sans, just to get people to stop using them.
  • HUH 2010-03-10 12:24
    function POBox(eobj, eid)
    {
    return (true);
    }

    Holy crap! It's the dreaded parentheses around the return value. NOT CLEAN! NOT CLEAN!

    CAPTCHA: persto - African American magic words.. PERSTO CHANGO!.. you know... like how they say aks instead of ask and always use the personal form of the verb instead of its correct form?
  • SR 2010-03-10 12:25
    Centricity:
    I have a sudden desire to redefine <i> and<b> to hot-pink Comic Sans, just to get people to stop using them.


    That's evil! I like you.
  • Matt Westwood 2010-03-10 12:26
    frits:
    Matt Westwood:
    frits:
    'Fixed for naming and precision
    
    Public Function kgf()
    kgf = 9.80665
    End Function



    'Added to fix the code the jerkoff Senior
    'Software Consultant broke.

    Public Function Newton()
    Newton= kgf
    End Function



    Amateur.

    Public Function Newton()
    Newton= kgf()
    End Function


    Hey man, this is VB. Parentheses optional.


    soz
  • Kauna 2010-03-10 12:27
    optimusPrime = new Transformer()

    I guess there is more in this code than meets the eye. I guess it is a robot in disguise. Which I am not of course, but the site wants me to confirm I am not a robot.
  • David 2010-03-10 12:31
    Robert obviously doesn't get the concept of precision ... I had the pleasure of following a developer who hard coded the conversion rate for metric Tonne to US ton. The customer had requested greater precision so I had to search thousands of lines of code for the number 2.2 and determine on a case by case basis if it was a met tonne conversion ... I replaced them with constant from a shared library. I guess Robert would have simply done a find and replace 2.2 with 2.2046.

    Captcha: Dolor ... we would have saved a lot by defining met tonne conversion rate in one place to first time around.
  • erat 2010-03-10 12:38
    Kauna:
    optimusPrime = new Transformer()

    I guess there is more in this code than meets the eye. I guess it is a robot in disguise. Which I am not of course, but the site wants me to confirm I am not a robot.


    It is only a robot in disguise if:

    public class Transformer : Robot
    {
    ...
    }
  • See Sharper 2010-03-10 12:38
    Matt Westwood:
    frits:
    'Fixed for naming and precision
    
    Public Function kgf()
    kgf = 9.80665
    End Function



    'Added to fix the code the jerkoff Senior
    'Software Consultant broke.

    Public Function Newton()
    Newton= kgf
    End Function



    Amateur.

    Public Function Newton()
    Newton= kgf()
    End Function

    Child.

    Public Function Newton()
    GoTo kgf

    Saves the memory consumed by the End Function.
  • Outtascope 2010-03-10 12:41
    frits:
    DaveK:
    Helix:
    DaveK:
    highphilosopher:
    Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.

    --
    Note from Alex: there were several comments pointing out typos/mistakes, but since the errors were fixed, the comments were no longer relavent; I did keep one, which was at the top and was a good balance of poking fun at me and explaining the original problem

    *relevant*


    Strangly by discussing about the spelling of relevant you have created a triple-meta comment.
    Equally strangely, by discussing about the discussing about the spelling of relevant, you have created a quadruple-meta comment, and this is presumably a quintuple-meta comment.

    I propose that we accept existence of the remaining meta levels up to and including the countable alephs by induction, rather than attempting to prove it exhaustively in this thread.


    I believe you are being a meta-nazi (Godwin's law invoked).


    Given that the above thread attempts to address the issue of perceived censorship and the inhibition of commentary that strays from the desired thread of the governing power, that this could easily be considered germane to the concept of propaganda, and given that propaganda had a central role inside the Nazi regime, the invocation of Godwin's law is wholly inappropriate as the comparison is not one that is inherently hyperbolic in nature.

    Be that as it may, the invocation further fails on its face purely and simply because of the commonly accepted tradition that the issuer of the Nazi/Hitler reference is prohibited from simultaneously being the invoker of Godwin's Law (perhaps because allowing Hitler to somehow become the posthumous arbiter of peace could be considered a tad distasteful).
  • frits 2010-03-10 12:46
    Outtascope:
    frits:
    DaveK:
    Helix:
    DaveK:
    highphilosopher:
    Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.

    --
    Note from Alex: there were several comments pointing out typos/mistakes, but since the errors were fixed, the comments were no longer relavent; I did keep one, which was at the top and was a good balance of poking fun at me and explaining the original problem

    *relevant*


    Strangly by discussing about the spelling of relevant you have created a triple-meta comment.
    Equally strangely, by discussing about the discussing about the spelling of relevant, you have created a quadruple-meta comment, and this is presumably a quintuple-meta comment.

    I propose that we accept existence of the remaining meta levels up to and including the countable alephs by induction, rather than attempting to prove it exhaustively in this thread.


    I believe you are being a meta-nazi (Godwin's law invoked).


    Given that the above thread attempts to address the issue of perceived censorship and the inhibition of commentary that strays from the desired thread of the governing power, that this could easily be considered germane to the concept of propaganda, and given that propaganda had a central role inside the Nazi regime, the invocation of Godwin's law is wholly inappropriate as the comparison is not one that is inherently hyperbolic in nature.

    Be that as it may, the invocation further fails on its face purely and simply because of the commonly accepted tradition that the issuer of the Nazi/Hitler reference is prohibited from simultaneously being the invoker of Godwin's Law (perhaps because allowing Hitler to somehow become the posthumous arbiter of peace could be considered a tad distasteful).


    GodwinsLaw<GodwinsLaw>




    Who made you the Godwins Law police?
    BTW- Your first point is wrong, and your second point is a big "who care's".
  • Rick 2010-03-10 12:51
    DaveK:
    Jane:
    (For those not in the know, in certain assembly languages, the line after any branch command gets executed. Some assemblers rearrange the code before compiling, or insert a NOOP after all branches)
    Yeah, they're really the ultimate expression of hardware's "fuck-you-you-can-fix-it-in-the-software" attitude made silicon! :-P


    In simple terms, a branch can execute code that is not already on the fast internal cpu cache. During the time that memory is loaded, there is essentially time to execute another instruction without ANY cost in time. I would very much like to see your hardware solution for optimum execution speed that addresses this issue.

  • anon 2010-03-10 13:08
    Are you quite finished?
  • sirlewk 2010-03-10 13:10
    TheSpiesMustFlow:
    jokes shouldn't go in production systems


    WTF?
  • Molière 2010-03-10 13:13
    sirlewk:
    TheSpiesMustFlow:
    jokes shouldn't go in production systems


    WTF?
    That's right. Unless, of course, the application is supposed to be funny. Otherwise, cut it out.
  • sirlewk 2010-03-10 13:13
    He's not the Godwin's Law police, he's the Godwin Nazi. How this wasn't blatantly obvious to you is beyond me...
  • frits 2010-03-10 13:16
    lol. Once again proving the comments > the article.
  • ac 2010-03-10 13:16
    Rick:

    During the time that memory is loaded, there is essentially time to execute another instruction without ANY cost in time.

    Except that the branch delay often ends up being filled with a NOP, so there is a cost. In particular, once you have branch prediction that works (a "hardware solution for optimum execution speed "), like any modern CPU, the delay slot wastes a cycle you could usefully have spent executing real code.
  • pbean 2010-03-10 13:24
    im in ur stylesheetz, changin ur tagz
  • bob171123 2010-03-10 13:34
    Seminymous Coward:
    Leo:
    grizz:
    The Newton function probably is to avoid having a magic number in a calculation. Seems to me that's generally considered A Good Thing, not a WTF.


    You're the one that does

    #define ONE 1
    #define TWO 2

    aren't you?

    Sometimes you really don't need it.


    Are you trolling or incapable of understanding why wanting all uses to match, to be easy to change uniformly, to contribute to readable code, and to perhaps eventually depend on localization or configuration is wise? Are you claiming a named constant is an automatic WTF?

    P.S. Wikipedia alone gives 9.80665, 9.797645, and 9.812865328 as reasonable choices if you don't want to account for latitude.


    I used to blindly believe everything Wikipedia said, until I found out they don't have an entry for Office Robbery Statistics. If Wikipedia won't dedicate an entry to that, it's useless.
  • Dan 2010-03-10 14:06
    me_again:
    Transformer optimusPrime = new Transformer();

    is this a wtf because it's cool?


    No, because Optimus Prime is not new. He was introduced in the very first episode of the original cartoon.
  • quisling 2010-03-10 14:08
    frits:
    'Fixed for naming and precision
    
    Public Function kgf()
    kgf = 9.80665
    End Function



    'Added to fix the code the jerkoff Senior
    'Software Consultant broke.

    Public Function Newton()
    Newton= kgf
    End Function

    +1
  • Henning Makholm 2010-03-10 14:10
    http://en.wikipedia.org/wiki/Office#Office_robbery_statistics

    Unfortunately the only statistics that section presents is about theft from offices, rather than robbery.
  • Bit Bull (Player Hater) 2010-03-10 14:16
    See Sharper:
    Matt Westwood:
    frits:
    'Fixed for naming and precision
    
    Public Function kgf()
    kgf = 9.80665
    End Function



    'Added to fix the code the jerkoff Senior
    'Software Consultant broke.

    Public Function Newton()
    Newton= kgf
    End Function



    Amateur.

    Public Function Newton()
    Newton= kgf()
    End Function

    Child.

    Public Function Newton()
    GoTo kgf

    Saves the memory consumed by the End Function.


    Man you corny!
  • ThomasP 2010-03-10 14:17
    java.lang.Chris;:

    public interface Transformer { ... }

    public interface Car extends Transformer { ... }

    List<Transformer> transformers = new ArrayList<Transformer>();
    transformers.add(new Transformer());

    List<Car> robotsInDisguise = (List<Car>) transformers;


    Shouldn't Transformer implement Car instead of Car extend Transformer?
  • sy 2010-03-10 14:19
    the vb return method wasn't available until vb.net

    so more likely it was partially updated

    http://www.a1vbcode.com/vbtip-156.asp
  • Sandeek Uhnt 2010-03-10 14:19
    Henning Makholm:
    http://en.wikipedia.org/wiki/Office#Office_robbery_statistics

    Unfortunately the only statistics that section presents is about theft from offices, rather than robbery.

    Darn, well did you also know that Wikipedia doesn't have an article for "gullable"?
  • quisling 2010-03-10 14:23
    Helix:
    DaveK:
    highphilosopher:
    Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.

    --
    Note from Alex: there were several comments pointing out typos/mistakes, but since the errors were fixed, the comments were no longer relavent; I did keep one, which was at the top and was a good balance of poking fun at me and explaining the original problem

    *relevant*


    Strangly by discussing about the spelling of relevant you have created a triple-meta comment.
    Quick! Strangly it before it can reproduce!

    AAAAUUUGGGH!!! TOO LATE!!!

    2nd attempt: lmao, Alex, Akismet thinks a link to a comment on YOUR site, in THIS thread is spam. wt-meta-meta-wtf-f?
  • quisling 2010-03-10 14:26
    Sandeek Uhnt:
    Henning Makholm:
    http://en.wikipedia.org/wiki/Office#Office_robbery_statistics

    Unfortunately the only statistics that section presents is about theft from offices, rather than robbery.

    Darn, well did you also know that Wikipedia doesn't have an article for "gullable"?
    What, as in "able to be transformed into a gull, sea- or otherwise?"

    I did not know that. Or, uh, care.

    In other news, did you know that they legitimately do not have an article for "gullible"?

  • frits 2010-03-10 14:28
    This is not spam. No one is advertising anything except their boredom. Nice integration of strangly BTW.
  • codeacrobat 2010-03-10 14:38
    TheSpiesMustFlow:
    me_again:
    Transformer optimusPrime = new Transformer();

    is this a wtf because it's cool?


    Half because it's cool, half because jokes shouldn't go in production systems I guess.


    Jokes should go to production systems,
    all our systems have
    asr-manpages.
  • Keith Brawner 2010-03-10 14:47
    A Linux Users group used to maintain a gravity forecast website, which is now sadly maintained by archive.org:

    http://web.archive.org/web/20030802144823/http://www.ae.msstate.edu/gforecast/

    How will I know what tomorrow's gravity will be now?

    (I always thought that it was funny how they specified, 9.81 m/s/s DOWN)
  • Crash Magnet 2010-03-10 14:51
    ac:
    Rick:

    During the time that memory is loaded, there is essentially time to execute another instruction without ANY cost in time.

    Except that the branch delay often ends up being filled with a NOP, so there is a cost. In particular, once you have branch prediction that works (a "hardware solution for optimum execution speed "), like any modern CPU, the delay slot wastes a cycle you could usefully have spent executing real code.


    One of the cost for a pipeline CPU is that instructions that follow a break in the instruction stream are partially execute. This means that the CPU has to use some time and effort to undo the effects of instructions which followed a call or branch.

    But since this cost is usually less than the gain added by using a pipeline archecture, its usually a win. This is true even without the branch prediction or other software or hardware fancy footwork. Of course, this equation goes horrobly wrong as the nubmer of calls or branches increase.

  • Anachronda 2010-03-10 15:01
    Jane:
    The "exit for" is executing in the branch delay slot, obviously!


    Reminds me of an old joke from Usenet:

    HALT
    NOP ; skid pad for pipelined processor
    NOP
    NOP
    NOP
  • forgottenlord 2010-03-10 15:02
    function DeUnicode($_input){
    //added to strip out italics tag <i> from name
    $_input = str_replace('<i>', '', $_input);
    $_input = str_replace('</i>', '', $_input);
    return $_input;
    }


    The comment is wrong. It's stripping out the bold tag.
  • millimeep 2010-03-10 15:04
    Ouch!:
    millimeep:
    I'll see your Optimus Prime and raise you a Gregor Samsa

    Thank you. At last a reference I get without googling. Heck, my kids are too old to understand Optimus Prime without googling. Now I feel old - no thanks for that.


    bonus points for anyone who knows which piece of open source code he's referenced in!
  • Ouch! 2010-03-10 15:30
    millimeep:
    Ouch!:
    millimeep:
    I'll see your Optimus Prime and raise you a Gregor Samsa

    Thank you. At last a reference I get without googling. Heck, my kids are too old to understand Optimus Prime without googling. Now I feel old - no thanks for that.


    bonus points for anyone who knows which piece of open source code he's referenced in!

    Apache, wasn't it?
  • chew chew chew 2010-03-10 15:38
    If anyone doesn't understand why you'd want to use a constant (probably better than a function) for Newton instead of magic numbers everywhere, I'd like to have a look at their code. I'll bet there's a lot of fodder in there for this site.
  • Alex B 2010-03-10 15:54
    One of the best Code WTFs compilations in a long time! Reminds of the original posts back in the day.
  • Mister Zimbu 2010-03-10 16:11
    You're misreading the function declaration there.

    It's clearly "De un-<i> code:"
  • Mark G 2010-03-10 16:18
    It seems to me that the newton function could have been added with a simple return value more as a stub for testing, at which point you could return to it later and add the code for elevation, lunar cycle, etc as you saw fit.
  • Bitbeard 2010-03-10 16:34
    The Exit For is actually 100% correct and Best Practice. Otherwise, the loop has to iterate through the rest of the collection even though it already has the value it wants. It will make the code "rush" if that's what you want to call it.

    Then again, it's VB, so the Exit For probably uses as many cycles as the iteration does.
  • Sandeek Uhnt 2010-03-10 16:43
    Mark G:
    It seems to me that the newton function could have been added with a simple return value more as a stub for testing, at which point you could return to it later and add the code for elevation, lunar cycle, etc as you saw fit.

    Testing?

    Your ideas intrigue me. I would like to subscribe to your newsletter.
  • suscipit 2010-03-10 17:04
    TheJasper:
    RE the italics that become bold I would say that using italic tags is the real wtf. Though it feels strange to redefine this in css, html wasn't meant for defining presentation. That's why you have <Strong> and <Em>. It is unfortunate tags like <i> or <b> exist at all.

    Since you can redefine everything in css it is a mistake to think those tags will do what you think.

    strong { color: GrayText; font-size: xx-small; font-weight:lighter }

    There, I fixed strong for you.
  • sino 2010-03-10 17:34
    Sandeek Uhnt:
    Mark G:
    It seems to me that the newton function could have been added with a simple return value more as a stub for testing, at which point you could return to it later and add the code for elevation, lunar cycle, etc as you saw fit.

    Testing?

    Your ideas intrigue me. I would like to subscribe to your newsletter.
    *groan*

    You sure about that?

    XD
  • Josh 2010-03-10 17:35
    There is no such thing as an italics tag. There is an <i> tag, which defines: "a span of text in an alternate voice or mood, or otherwise offset from the normal prose, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, a thought, a ship name, or some other prose whose typical typographic presentation is italicized."

    Perhaps the subtmitter should learn the difference between content and styling before mocking the front end developer.
  • Maurits 2010-03-10 18:01
    Leo:

    #define ONE 1
    #define TWO 2


    I prefer

    #define THE_LONELIEST_NUMBER 1
    #define THE_LONELIEST_NUMBER_SINCE_THE_NUMBER_ONE 2
  • Cad Delworth 2010-03-10 18:02
    AndyC:
    It's a bit unfair to just clip bits of code out of context. If you'd left in the public class PieceOfString bit the getLength method makes perfect sense!

    Don't think so, Andy. If that were the case, the function would be:

    public long getLength() {
      Random r = new Random(long PieceOfString);
      return r.NextLong;
    }

    … wouldn't it?

    I particularly love the fact that this function has no parameters. Proper WTFery!
  • Cad Delworth 2010-03-10 18:06
    frits:
    //Fixed for naming and precision
    
    Public Function kgf()
    kgf = 9.80665
    End Function


    If (as I suspect) the original was VB/VBA/VBS, that should actually read:

    ' Fixed for naming and precision and efficiency
    Public Global Const kgf = 9.80665

    // is not a comment indicator in VB and its spawn. ;)
  • Cad Delworth 2010-03-10 18:09
    Adrian:
    As a mech engineer, I would say it is not too bad, it makes sure you always use the same value and a known accuracy for g trougout the program.

    You mean, like a manifest constant does?
  • Cad Delworth 2010-03-10 18:11
    TheJasper:
    RE the italics that become bold I would say that using italic tags is the real wtf.
    It is unfortunate tags like <i> or <b> exist at all.
    Since you can redefine everything in css it is a mistake to think those tags will do what you think.

    Especially when these comments require you to use BBCode and not HTML tags (HTML tags for the Forums, BBCode tags for the Comments: good consistency there … !).
  • Cad Delworth 2010-03-10 18:31
    Molière:
    sirlewk:
    TheSpiesMustFlow:
    jokes shouldn't go in production systems


    WTF?
    That's right. Unless, of course, the application is supposed to be funny. Otherwise, cut it out.

    I once worked on a system for IBM POS devices which used some C software called Leisure Industry Programming System (this was written by a third-party, not IBM, hence the mildly jokey name). The devices themselves were known as PC/Ts (PC Tills, geddit?).

    Yours truly wrote a simplistic interface to vacuum data from these devices and likewise send data to them using an serial port (stop giggling: this was MANY years ago). I named the software PUSS (PCT Upload/download Software System).

    A few days later, a normally sedate colleague approached my cubicle in a furious temper. "You b**t**d!" he said—which was truly shocking language for this guy. "Uh … what's the problem?" I stammered. "I've just had to do a presentation to senior management about the PUSS-LIPS interface!!!" he roared.

    My protestations that I genuinely hadn't foreseen nor intended that did little to placate him.

    The annoying thing was that I genuinely hadn't foreseen nor intended that! To be fair, I had already been "asked" to change the name of little bit of software: it was originally called Cash Register Async Program, which "management" objected to; but they were okay with PUSS.
  • DaveK 2010-03-10 19:14
    Cad Delworth:

    The annoying thing was that I genuinely hadn't foreseen nor intended that! To be fair, I had already been "asked" to change the name of little bit of software: it was originally called Cash Register Async Program, which "management" objected to; but they were okay with PUSS.
    Heh. With the collusion of my project manager at the time, we very nearly managed to sneak my first game out the door under the title "Four Unreleased Computer Knockouts" (it was a compilation). We were hoping they wouldn't notice until we'd got the cassette inserts printed up with the words placed vertically one above the other and all the initial capitals aligned, but someone spotted what we were up to and we had to change the name.
  • nobody 2010-03-10 19:33
    Sandeek Uhnt:
    Henning Makholm:
    http://en.wikipedia.org/wiki/Office#Office_robbery_statistics

    Unfortunately the only statistics that section presents is about theft from offices, rather than robbery.

    Darn, well did you also know that Wikipedia doesn't have an article for "gullable"?


    Indeed, it does not. Imagine that.

    http://en.wikipedia.org/wiki/Special:Search?search=gullable&go=Go
  • nobody 2010-03-10 19:43
    HUH:
    function POBox(eobj, eid)
    {
    return (true);
    }

    Holy crap! It's the dreaded parentheses around the return value. NOT CLEAN! NOT CLEAN!

    CAPTCHA: persto - African American magic words.. PERSTO CHANGO!.. you know... like how they say aks instead of ask and always use the personal form of the verb instead of its correct form?


    Why are there so many asshats on this forum?
  • frits 2010-03-10 20:19
    nobody:
    HUH:
    function POBox(eobj, eid)
    {
    return (true);
    }

    Holy crap! It's the dreaded parentheses around the return value. NOT CLEAN! NOT CLEAN!

    CAPTCHA: persto - African American magic words.. PERSTO CHANGO!.. you know... like how they say aks instead of ask and always use the personal form of the verb instead of its correct form?


    Why are there so many asshats on this forum?


    This is not a forum. This is a comments section, which is a notorious asshat magnet (...one of us...).
  • David 2010-03-10 20:52
    I look forward to seeing 'optimusPrime.transform(...)'
  • safarmer 2010-03-10 21:16
    Lorne Kates:
    class Transformer

    class Transformers : Transformer, Collection

    Transformer optimusPrime = new Transformer();

    Transformers autobots = new Transformers();

    optimusPrime->Address(autobots);

    optimusPrime->IssueCommand("Transform!!!!");

    AwesomeSoundEffectsFactory::GetSoundEffect("ch ch ch CH!")->Play();


    Damn you! I compiled and ran your code and my PC transformed and tried to kill me :(
  • monkeypants 2010-03-10 21:59
    HUH:
    CAPTCHA: persto - African American magic words.. PERSTO CHANGO!.. you know... like how they say aks instead of ask and always use the personal form of the verb instead of its correct form?


    If you look into it a little, you'll learn that black American dialect grew from the nonstandard English dialects spoken by the people who settled the southern states. Your "correct" form is just the standard dialect, i.e. the dialect that happens to be spoken by the people who happened to become the most influential.

    The dialect used depends on context. So if a black man was drafting legislation or lecturing at Harvard, he'd correctly use "ask". If he instead said to you,"I aksed you already, get me some fries with that", he'd also be correct.
  • lolwtf 2010-03-10 22:02
    If fromDate < toDate Then
    'it's good. todo: handle this
    Else
    'it's not good. todo: handle this
    End If

    Make more sense now?
  • oheso 2010-03-10 23:42
    Centricity:
    I have a sudden desire to redefine <i> and<b> to hot-pink Comic Sans, just to get people to stop using them.


    Be glad you don't work around here. You would only be promoting their use.
  • Dave 2010-03-11 03:19
    Crap, I think this is mine:
    `Transformer optimusPrime = new Transformer();`
  • forbjok 2010-03-11 03:45
    jokes shouldn't go in production systems

    Says who? :p

    Besides, it's not like the users are ever going to see the source code anyway.
  • Simon 2010-03-11 04:42
    nobody:
    Sandeek Uhnt:

    Darn, well did you also know that Wikipedia doesn't have an article for "gullable"?


    Indeed, it does not. Imagine that.

    http://en.wikipedia.org/wiki/Special:Search?search=gullable&go=Go


    That's because it's in teh wiktionary... fools
  • Steve the Cynic 2010-03-11 04:58
    Maurits:
    Leo:

    #define ONE 1
    #define TWO 2


    I prefer

    #define THE_LONELIEST_NUMBER 1
    #define THE_LONELIEST_NUMBER_SINCE_THE_NUMBER_ONE 2

    #define ALL_ALONE_AND_EVERMORE_SHALL_BE_SO 1
    #define THE_LILYWHITE_BOYS 2
    #define THE_RIVALS 3
    etc.

    (Look it up, I'm too lazy to explain it for you.)

    Not valetudo again...
  • Bonghit 2010-03-11 05:38
    Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.

    --

    Note from Alex: there were several comments pointing out typos/mistakes, but since the errors were fixed, the comments were no longer relavent; I did keep one, which was at the top and was a good balance of poking fun at me and explaining the original problem. On the same note, comments that respond to this will probably be deleted, too, since it's double-meta (I think?) discussion.


    --

    Another note from Alex: I am totally gay, i seriously love the cock.


    Note from Bonghit: Threatening anyone that disagrees with you, with comment deletion, is prick behaviour. Deleting non spam comments is prick behaviour. No one likes a prick.

    incassum - incase you are unsure, just say "ummmmm".

  • illtiz 2010-03-11 06:04
    Bonghit:
    Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.

    --

    Note from Alex: there were several comments pointing out typos/mistakes, but since the errors were fixed, the comments were no longer relavent; I did keep one, which was at the top and was a good balance of poking fun at me and explaining the original problem. On the same note, comments that respond to this will probably be deleted, too, since it's double-meta (I think?) discussion.


    --

    Another note from Alex: I am totally gay, i seriously love the cock.


    Note from Bonghit: Threatening anyone that disagrees with you, with comment deletion, is prick behaviour. Deleting non spam comments is prick behaviour. No one likes a prick.

    incassum - incase you are unsure, just say "ummmmm".



    Um - according to that utterly authentic looking note, Alex does.
    Also, it's merely your obvious homophobia that's making an issue of it at all :-)

    While I do see your point though, I'd like to state in Alex's defence that personally I prefer not having to skip through 25 nitpicks lamenting obvious errors in the article submission, especially when I can no longer see what those errors were.
  • shk 2010-03-11 07:29
    safarmer:
    Lorne Kates:
    class Transformer

    class Transformers : Transformer, Collection

    Transformer optimusPrime = new Transformer();

    Transformers autobots = new Transformers();

    optimusPrime->Address(autobots);

    optimusPrime->IssueCommand("Transform!!!!");

    AwesomeSoundEffectsFactory::GetSoundEffect("ch ch ch CH!")->Play();


    Damn you! I compiled and ran your code and my PC transformed and tried to kill me :(


    You're a decepticon?
  • Pedants R Us 2010-03-11 07:47
    It's quadruple meta.

    And don't call me Strangly.
  • Elvis 2010-03-11 08:13
    Adrian:
    Public Function Newton()
    
    Newton = 9.81
    End Function


    As a mech engineer, I would say it is not too bad, it makes sure you always use the same value and a known accuracy for g trougout the program.

    Some people use 9,81, others just 9,8 and some others round it to 10, and the actual value depends on a lot of things ( where you are on the globe, position of the moon....)

    This allows get some accuracy of the result and eventualy improve it.


    public constant Newton = 9.81
    ?????
  • SenTree 2010-03-11 08:15
    Steve the Cynic:
    #define ALL_ALONE_AND_EVERMORE_SHALL_BE_SO 1
    #define THE_LILYWHITE_BOYS 2
    #define THE_RIVALS 3
    etc.

    (Look it up, I'm too lazy to explain it for you.)

    DAMN YOU ! Now I've got an earworm - yes I did recognise the song. I'll sing YOU bloody one-oh.
  • TheCPUWizard 2010-03-11 08:31
    AndersI:
    "A nice example of ahead planning," Robert writes, "just in case the Earth's mass dramatically changes overnight, we are prepared for a fast, system-wide adjustment."

    Public Function Newton()
    Newton = 9.81
    End Function


    Actually, this should be a function of latitude - see http://en.wikipedia.org/wiki/Gravitational_acceleration.

    For us here in Sweden, 9.82 is the best approximation.


    NOT just Latitude, there are also many areas where there are "anomolies". A few (26) years ago I developed a submarine system that calculated depth. It needed to be EXTREMELY accurate (especially at shallow depths becuase of the periscope). Water Pressure was the primary input, but an accelerometer was also a big part of the equation. This had to be "nulled out" as the submarine traveled.

  • HUH 2010-03-11 09:35
    monkeypants:
    HUH:
    CAPTCHA: persto - African American magic words.. PERSTO CHANGO!.. you know... like how they say aks instead of ask and always use the personal form of the verb instead of its correct form?


    If you look into it a little, you'll learn that black American dialect grew from the nonstandard English dialects spoken by the people who settled the southern states. Your "correct" form is just the standard dialect, i.e. the dialect that happens to be spoken by the people who happened to become the most influential.

    The dialect used depends on context. So if a black man was drafting legislation or lecturing at Harvard, he'd correctly use "ask". If he instead said to you,"I aksed you already, get me some fries with that", he'd also be correct.


    So what if he needed an amberlampse?
  • too_many_usernames 2010-03-11 09:45
    Elvis:

    public constant Newton = 9.81
    ?????

    public constant Newton = Fig; // no bananas today!
  • informatimago 2010-03-11 11:10
    Actually, it's a function of the distance between the centers of mass. Up in a plane, up a mountain, or just a modern building, (or down a mine) have a non negligible effect.

    (defun g (r) (/ (* G earth-mass) r r))
    G --> 6.672e-11
    earth-mass --> 5.9736e+24
    (g earth-radius-mean) --> 9.819219440743515
    (g earth-radius-polar) --> 9.863137339893514
    (g earth-radius-equatorial) --> 9.797370409088225


    ;; Eiffel Tower;
    (- (g (+ earth-radius-mean 324))
    (g earth-radius-mean)) --> -0.0009986452443744298

    ;; Freedom Tower:
    (- (g (+ earth-radius-mean (* 1776 (* 0.0254 12))))
    (g earth-radius-mean)) --> -0.0016684067266901081


    ;; A320-200 from Valencia to Paris
    (- (g (+ earth-radius-mean (* 32000 (* 0.0254 12))))
    (g earth-radius-mean)) --> -0.029996312593159047
  • Defininendum 2010-03-11 11:24
    optimusPrime.transform();
    optimusPrime.rollOut();
  • TwelveBaud 2010-03-11 12:44
    Huh, it even does deployment too!
    optimusPrime.rollOut()
  • Micro-architect 2010-03-11 15:27
    Crash Magnet:
    ac:
    Rick:

    During the time that memory is loaded, there is essentially time to execute another instruction without ANY cost in time.

    Except that the branch delay often ends up being filled with a NOP, so there is a cost. In particular, once you have branch prediction that works (a "hardware solution for optimum execution speed "), like any modern CPU, the delay slot wastes a cycle you could usefully have spent executing real code.


    One of the cost for a pipeline CPU is that instructions that follow a break in the instruction stream are partially execute. This means that the CPU has to use some time and effort to undo the effects of instructions which followed a call or branch.

    But since this cost is usually less than the gain added by using a pipeline architecture, its usually a win. This is true even without the branch prediction or other software or hardware fancy footwork. Of course, this equation goes horribly wrong as the number of calls or branches increase.


    That's not a very good overview of how a modern processor works...

    The partial work is easy to throw away, just zero all the pipeline registers (and flash copy the rename table). What's a lot harder is to emulate a one (or two!) cycle branch delay slot, when the real delay is something different.

    Also, unconditional branches (including call and return) can often be predicted at 100% (returns will require a return address stack predictor). They cause a break in the current cycle's instruction decoding, but instruction decode is usually well ahead of execute anyway...

    TL;DR - write your code however you want. The CPU will make it fast.
  • tation 2010-03-12 17:07
    nobody:
    HUH:
    function POBox(eobj, eid)
    {
    return (true);
    }

    Holy crap! It's the dreaded parentheses around the return value. NOT CLEAN! NOT CLEAN!

    CAPTCHA: persto - African American magic words.. PERSTO CHANGO!.. you know... like how they say aks instead of ask and always use the personal form of the verb instead of its correct form?


    Why are there so many asshats on this forum?


    Because you people multiply like rabbits.
  • specialK 2010-03-12 17:15
    Either the provided sample code is wrong, or that whole function is equivalent to
    Return ddlControl.SelectedIndex

    If the function is called "GetItemFromValue", shouldn't it return the item?


    Public Shared Function GetItemFromValue(ByVal ddlControl As DropDownList) As Integer
    Dim i As Integer
    If ddlControl.Items.Count > 0 Then
    For i = 0 To ddlControl.Items.Count - 1
    If ddlControl.Items(i).Selected() Then
    Return ddlControlItems(i)
    End If
    Next
    End If
    End Function
  • specialK 2010-03-12 17:21
    ^^ ok that function should return a type of ListItem, not integer... :P
  • Zeo woods 2010-03-14 10:46
    Wow, that actually makes pretty good sense when you think about it dude.

    Jess
    www.big-brother-watching.net.tc
  • susan2012 2010-03-14 21:50
    you want to meet the s i n gl es, sex y beauties. ...It takes only a few minutes to submit a profile which, however, will bring you more fun!!!!! Believe me!!!!!!!
    ...____ S e e k I n t e r r a c i a l [DOT] c o m ___= free to join C'MON NOW!!!
    ____ S e e k I n t e r r a c i a l [DOT] c o m __

    ____ S e e k I n t e r r a c i a l [DOT] c o m ___= free to join C'MON NOW!!!
    :) :) :) :) :) :) :) :) :) :) :) :) :)
    :) :) :) :) :) :) :) :) :) :) :) :) :) :)
    :) :) :) :) :) :) :) :) :) :) :) :) :) :)
    :) :) :) :) :) :) :) :) :) :) :) :) :) :)
    :) :) :) :) :) :) :) :) :) :) :) :) :) :)
    :) ____ S e e k I n t e r r a c i a l [DOT] c o m ___= free to join C'MON NOW!!!
  • vt_mruhlin 2010-03-15 02:04

    "I was going through some obscure code from the developers before me, and something caught my eye," Philippe wrote. "It was a class whose task was to transform data, and this is how it was instantiated."

    Transformer optimusPrime = new Transformer();


    OMG, I might very well be Philippe's predecessor. I know somebody inherited that same WTF from me, but I'm sure I'm not the only clever person to come up with that one.
  • Vino 2010-03-15 02:55
    Actually F gets significantly smaller as the rocket gets higher... it would be better to have a function to calculate it, which then calculates F depending on the rocket's position relative to Earth and other bodies.

    Captcha: esse - a brand of Korean cigarettes, an hispanic gangster, or a village in Finland.
  • Steve H 2010-03-15 07:50
    Simon:
    I tried to put some italic tags around a bit of text today," writes Derek, "but somehow, it emboldened my text."


    This was a deliberate feature to tell you to stop using <i> to italicise text. The correct XHTML-compliant tag is <em>.


    But that's irrelevant anyway, since <i> is back in HTML5, with new semantics. But you'd know that already, since you're clearly an expert.

    See here: http://html5doctor.com/i-b-em-strong-element/
  • pflock 2010-03-15 10:55
    Leo:
    grizz:
    The Newton function probably is to avoid having a magic number in a calculation. Seems to me that's generally considered A Good Thing, not a WTF.


    You're the one that does

    #define ONE 1
    #define TWO 2

    aren't you?

    Sometimes you really don't need it.


    That's true. I recently got rid of that pi-crap in all my code, improving

    const float sigma = foo() / pi;

    to

    const float sigma = foo () / 3.1;

    and thus getting rid of a freaking header, yay.
  • cod3_complete 2010-03-15 11:52
    This is great stuff. We should have more of these "coded smorgasbords". LOL.
  • Héctor 2010-03-16 09:52
    Public Void FuckUrAss()
    {
    Public List<Transformers> Autobots= new List<Transformers>();
    string type="Autobots"
    Autobots=
    try
    {
    appmain.BSLTransformerService.GetAllTransformers(type);
    foreach(Transformers in Autobots)
    {
    messagebox.Show("Fuck ur Self");
    }
    }
    catch
    {
    messagebox.Show("An error was found, fuck too");
    return;
    }
    }



  • AN Other 2010-03-18 20:27
    lolwtf:
    If fromDate < toDate Then
    'it's good. todo: handle this
    Else
    'it's not good. todo: handle this
    End If

    Make more sense now?


    Also certain languages don't handle empty if statements well, could just be a hangover or habit to put a place holder.
  • Timothy (TRiG) 2010-03-19 14:21
    I don't understand all this hatred for the italics tag. It's a useful and valid grammatical entity.

    * The <i>Marie Celeste</i> was found drifting abandoned.
    * Socrates was a Greek philosopher.
    * <i>Socrates</i> has eight letters.
    * "The words were not <i>The doom of Minas Tirith</i>," said Aragorn.

    In none of the above cases should the italics tags be replaced with emphasis tags. For ship names, for discussion of words as words, and (in some instances) for quotations, italics are necessary.

    TRiG.
  • The senior software consultant 2010-03-19 16:20
    Hey, I made the daily WTF!

    But seriously, give me a break. I was on a tight deadline, and missed a comment that had been part of a seperate little code snippet, which was what was being left in. That got removed, the comment stayed :-)