• codeacrobat (unregistered) in reply to TheSpiesMustFlow
    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 (unregistered)

    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 (unregistered) in reply to ac
    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 (unregistered) in reply to Jane
    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 (unregistered)
    function DeUnicode($_input){ //added to strip out italics tag from name $_input = str_replace('', '', $_input); $_input = str_replace('', '', $_input); return $_input; }

    The comment is wrong. It's stripping out the bold tag.

  • (cs) in reply to Ouch!
    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! (unregistered) in reply to millimeep
    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 (unregistered)

    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 (unregistered)

    One of the best Code WTFs compilations in a long time! Reminds of the original posts back in the day.

  • Mister Zimbu (unregistered)

    You're misreading the function declaration there.

    It's clearly "De un- code:"

  • Mark G (unregistered)

    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 (unregistered)

    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 (unregistered) in reply to Mark G
    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 (unregistered) in reply to TheJasper
    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 and . It is unfortunate tags like or 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 (unregistered) in reply to Sandeek Uhnt
    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 (unregistered)

    There is no such thing as an italics tag. There is an 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.

  • (cs) in reply to Leo
    Leo:
    #define ONE 1 #define TWO 2

    I prefer

    #define THE_LONELIEST_NUMBER 1 #define THE_LONELIEST_NUMBER_SINCE_THE_NUMBER_ONE 2

  • (cs) in reply to AndyC
    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!

  • (cs) in reply to frits
    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. ;)

  • (cs) in reply to Adrian
    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?
  • (cs) in reply to TheJasper
    TheJasper:
    RE the italics that become bold I would say that using italic tags is the real wtf. It is unfortunate tags like or 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 … !).
  • (cs) in reply to Molière
    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 btd!" 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.

  • (cs) in reply to Cad Delworth
    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 (unregistered) in reply to Sandeek Uhnt
    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 (unregistered) in reply to HUH
    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?

  • (cs) in reply to nobody
    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 (unregistered) in reply to Bosshog

    I look forward to seeing 'optimusPrime.transform(...)'

  • (cs) in reply to Lorne Kates
    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 :(

  • (cs) in reply to HUH
    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.

  • (cs)
    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 (unregistered) in reply to Centricity
    Centricity:
    I have a sudden desire to redefine and 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 (unregistered)

    Crap, I think this is mine: Transformer optimusPrime = new Transformer();

  • (cs) in reply to TheSpiesMustFlow
    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 (unregistered) in reply to nobody
    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 (unregistered) in reply to Maurits
    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 (unregistered) in reply to 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. 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 (unregistered) in reply to Bonghit
    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 (unregistered) in reply to safarmer
    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 (unregistered) in reply to Helix

    It's quadruple meta.

    And don't call me Strangly.

  • Elvis (unregistered) in reply to Adrian
    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 ?????

  • (cs) in reply to Steve the Cynic
    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 (unregistered) in reply to AndersI
    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 (unregistered) in reply to monkeypants
    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?

  • (cs) in reply to Elvis
    Elvis:
    public constant Newton = 9.81 ?????
    public constant Newton = Fig; // no bananas today!
  • informatimago (unregistered) in reply to AndersI

    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 (unregistered)

    optimusPrime.transform(); optimusPrime.rollOut();

  • (cs)

    Huh, it even does deployment too!

    optimusPrime.rollOut()
  • Micro-architect (unregistered) in reply to Crash Magnet
    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 (unregistered) in reply to nobody
    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 (unregistered)

    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
    

Leave a comment on “In A Rush, Properly Handled, and More”

Log In or post as a guest

Replying to comment #:

« Return to Article