• (cs) in reply to Patrik

    Anonymous:
    Grah. Meant to quote that post. Now this is the "Design" editor, and I see [ quote ] marks. BBcode embedded in HTML? STFU (captcha).

    "stuh-foo" ??? Gotta be an acronym. but don't see it. Anyone?

  • (cs) in reply to smbell

    smbell:
    makomk:
    Anonymous:
    Proper way to code this sort of thing:

    while [[ 1 ]]; do echo "./upload-site" >> script; ./script; done Like, duh.
    Better:

    while [[ 1 ]]; do echo "./upload-site" >> script; done; ./script


    Did I miss something, or will both of these simply fill the file 'script' with lines (untill the disk runs out of space and it crashes) while never actually getting to the part where it executes the script?

    Now that is replacing a WTF with a real WTF.

    The first one will actually execute the script each time after a line has been added. So first it will execute

    <FONT face="Courier New" size=2>./upload-site</FONT>

    Then

    <FONT face="Courier New" size=2>./upload-site
    ./upload-site</FONT>

    And so on...

    Still moronic though.

  • (cs) in reply to de-troll-boss-de-troll
    de-troll-boss-de-troll:

    Anonymous:
    Grah. Meant to quote that post. Now this is the "Design" editor, and I see [ quote ] marks. BBcode embedded in HTML? STFU (captcha).

    "stuh-foo" ??? Gotta be an acronym. but don't see it. Anyone?

    "Shut The Fuck Up"

  • (cs) in reply to Ford351-4V
    Ford351-4V:
    Reminds me of the old days when people said "Please" to their computers.

    You might be interested in programming in Intercal.

  • (cs) in reply to Less
    Anonymous:
    Possibly, but the "--Ripley" firmly distinguishes it as an Aliens quote.


    I took my wife to see "Aliens" on our first date.

    It's still one of my favorite movies.

    Yes, we are still married.

    :P

  • (cs) in reply to Richard Nixon
    Richard Nixon:
    richleick:


    And for you Java purists out there, i'm sorry, but the { SHOULD be on a seperate line!


    No, it should not.

    sincerely,
    Richard Nixon


    K&R were wrong. ;-)


    The only time I ever see people putting {'s on a line by themselves aside from opening a function, class, or namespace where it will be all the way at the beginning of the line, is when people are trying to increase their LOC.


    I do it because it's possible to see at a glance if all braces are closed.

  • Brad (unregistered)

    Whoever wrote that script was just pissed off, copied and pasted the line a random huge amount and thought to him or herself, "take that you son of a bitch!"  TAKE IT!!

    A sadistic bastard to be sure.

  • (cs) in reply to Raider

    I would love to see the revision history of that script (assuming it's source-controlled in the first place, which, given its WTF-ness, is probably an unreasonably large ass-umption). 
       
    1.1    Upload script
    1.2    Connection terminated, try a second upload
    1.3    Larger document, add another try
    1.4    Upload timed out again
    1.5    This should do it for now
    ...
    1.36    Hit me baby one more time
    ...
    1.58   This is getting ridiculous
    ...
    1.97    Please God let this be enough
    ...
    1.121   Somebody shoot me


     

  • (cs) in reply to EvanED
    EvanED:
    Richard Nixon:
    richleick:


    And for you Java purists out there, i'm sorry, but the { SHOULD be on a seperate line!


    No, it should not.

    sincerely,
    Richard Nixon


    K&R were wrong. ;-)


    The only time I ever see people putting {'s on a line by themselves aside from opening a function, class, or namespace where it will be all the way at the beginning of the line, is when people are trying to increase their LOC.


    I do it because it's possible to see at a glance if all braces are closed.



    K&R's biggest benefit was to reduce the amount of lines a program took up on the screen in the days where you could only see 20-someodd lines at a time.  When that isn't an issue, I rather go with the format that makes it much easier for me to quickly scan through my code.  Putting the braces on its own line and at the same indentation level as its controlling statement really does help in making sure that the code is organized correctly.

    Quite personally, I don't care which style a programmer uses, so long as it is the same throughout the code.

  • (cs) in reply to cconroy

    cconroy:
    I would love to see the revision history of that script (assuming it's source-controlled in the first place, which, given its WTF-ness, is probably an unreasonably large ass-umption). 
       
    1.1    Upload script
    1.2    Connection terminated, try a second upload
    1.3    Larger document, add another try
    1.4    Upload timed out again
    1.5    This should do it for now
    ...
    1.36    Hit me baby one more time
    ...
    1.58   This is getting ridiculous
    ...
    1.97    Please God let this be enough
    ...
    1.121   Somebody shoot me

    hahahahahhaah

  • (cs) in reply to EvanED
    EvanED:
    Richard Nixon:
    richleick:


    And for you Java purists out there, i'm sorry, but the { SHOULD be on a seperate line!


    No, it should not.

    sincerely,
    Richard Nixon


    K&R were wrong. ;-)


    The only time I ever see people putting {'s on a line by themselves aside from opening a function, class, or namespace where it will be all the way at the beginning of the line, is when people are trying to increase their LOC.


    I do it because it's possible to see at a glance if all braces are closed.



    You're developing in something that doesn't do that for you? And, if yes, why?

    sincerely,
    Richard Nixon

  • Jason (unregistered)

    Obviously, the original author was certifiable.  Wasn't it Emerson who said something to the effect of:

    "A foolish consistency is the hobgoblin of little minds?"

    And what about Einstein:

    "Insantiy: doing the same thing over and over again and expecting different results."

    ---Jason

     

  • (cs) in reply to Adam WG
    Anonymous:
    Proper way to code this sort of thing:

    while [[ 1 ]]; do echo "./upload-site" >> script; ./script; done

    Like, duh.



    Nonono, that will only run ./upload-site  inf*(inf-1)/2 times which isn't nearly enough. Perhaps



    echo "./upload-site" > script; while [[ 1 ]]; do cat script script >> script2; mv script2 script; ./script; done

  • Kiss me, I'm Polish (unregistered) in reply to Todd
    Anonymous:

    No, although the quote is originally from Aliens - the Clerks reference is actually doubly-brillant.  In "Clerks - The Animated Series", they actually use this quote from Aliens in a witty reference (when Leonardo Leonardo's base launches into orbit).

     

    So actually, whoever posted "I love the Clerks reference" actually one-upped all you geeks out there with a double reference.


    I love the Martha Stewart reference.
  • Anon Coward (unregistered) in reply to richleick
    richleick:
    RayS:
    Anonymous:

    RayS:
    So what's the WTF? That he didn't try to upload_site more times that that?


    To be REALLY SAFE, you need to reimplement it something like this.


    WHILE (0=1)
        ./upload_site
    LOOP

    That way, you don't even have to manually run the upload code, since it's running forever as a kind of whacked out service!

    I assume you meant 0 <1 ? Or perhaps 0 != 1 ?


    That'll be it! Never start writing a WHILE but add the condition for a DO UNTIL.
    Still, what's a WTF submission without at least one WTF reply?

    You're making it too hard.  You just need
    while (true)
    {
       ./upload_site
    }

    Or you could do this
    while (true)
    {
       if (0==1)
       {
          break;
       }
       ./upload_site
    }

    And for you Java purists out there, i'm sorry, but the { SHOULD be on a seperate line!

     

    Can somebody tell me why you need to if(0==1){ break;} part?  I'm trying to implement this in a mission critical system here so I don't want crappy code.  Thanks.

  • stubborn buffer (unregistered)

    Clearly this is an implementation of the "Stubborn Buffer" pattern, e.g.:

    <FONT face="Courier New" color=#008000>//partially effective
    <FONT color=#000000>toilet.flush();</FONT>
    //some progress
    <FONT color=#000000>toilet.flush();
    toilet.flush();</FONT>
    //this one finally gets the job done
    <FONT color=#000000>toilet.flush();</FONT></FONT>

  • (cs) in reply to EvanED
    EvanED:
    I do it because it's possible to see at a glance if all braces are closed.

    You are using an editor which does that for you anyway aren't you?

  • Felipe (unregistered) in reply to stubborn buffer
    Alex:
    Below are the unedited, full contents of "retry_upload_site"


    The Real WTF is that the code is not commented !
  • (cs) in reply to Anon Coward
    Anonymous:

    Can somebody tell me why you need to if(0==1){ break;} part?  I'm trying to implement this in a mission critical system here so I don't want crappy code.  Thanks.

    It's because of quantum physics. There's a minute chance that your system will "hop" to another dimension where 0 and 1 are the same value. You don't want your code to execute in a dimension where you can't rely on 0 and 1 being different values.

    So it's for inter-dimensional portability.

    However, this example only takes into account a logic reversal dimension. The example should really be (for 8-bit systems ONLY.)

    for( i = 1; i < 0xFF; i++ )
    {
       if( 0 == i )
       {
            return( isTrue( FALSE ) );
        }  
    }

  • touring (unregistered) in reply to Anon Coward

    because without the possibility to break; it would be an infinite loop?

    ps.
    {
    {
    {

    eat that!

  • risk (unregistered) in reply to Looce
    Anonymous:
    richleick:


    -- snip -- ~Looce


    And for you Java purists out there, i'm sorry, but the { SHOULD be on a seperate line!


    The language does not dictate where its syntactic elements should be placed, unless said placement is part of the syntax (as in mIRC scripting).
    That would be a coding convention.


    Ah yes, like a java code convention perhaps?

  • (cs) in reply to Raider
    Raider:

    richleick:

    And for you Java purists out there, i'm sorry, but the { SHOULD be on a seperate line!

    The only time I ever see people putting {'s on a line by themselves aside from opening a function, class, or namespace where it will be all the way at the beginning of the line, is when people are trying to increase their LOC.



    Visual Studio 2002+ C# uses the BSD/Allman style by default. I used to be K&R until I started doing massive amounts C#. Actually, I still am pretty much K&R, just VS decides to seperate it out for me lol. Frankly, as long as you use a standard, it shouldn't matter. Also, if someone is counting lines of code, and isn't using a line-counter that takes things such as lines with just a brace into account, then they deserved to be fooled. To benchmark myself I use line counters, even though where I work, LOC isn't taken into account at all. The better line counters don't count comments, braces, defines, function declarations, class declarations, struct declaration, variable declarations (at least most... there are exceptions to that one)... and maybe a couple other things...
  • Jon (unregistered) in reply to Ford351-4V
    Ford351-4V:
    Reminds me of the old days when people said "Please" to their computers.
    struct please_t { } please, thankyou;

    puts("Hello world!"), please; please, puts("Hello world!"), thankyou;

  • Anonymous (unregistered) in reply to makomk

    When will the last command (./script) be executed? ...Never

  • lurker (unregistered) in reply to Raider
    Raider:

    cconroy:
    I would love to see the revision history of that script (assuming it's source-controlled in the first place, which, given its WTF-ness, is probably an unreasonably large ass-umption). 
       
    1.1    Upload script
    1.2    Connection terminated, try a second upload
    1.3    Larger document, add another try
    1.4    Upload timed out again
    1.5    This should do it for now
    ...
    1.36    Hit me baby one more time
    ...
    1.58   This is getting ridiculous
    ...
    1.97    Please God let this be enough
    ...
    1.121   Somebody shoot me

    hahahahahhaah



    Yeah, I almost snarfed my tea on that one. 

    This code reminds me of the old saying:
    "Fool me once, shame on you,  fool me twice, shame on... er ... can't get fooled again."

    Only in this case you have to add a "Fooled me 128 times, WTF?!" 


  • Lordy (unregistered) in reply to Patrik

    In most bourne shell alikes ...

    while ! ./upload-site ; do sleep 1 ; done


  • (cs) in reply to mare

    Anonymous:
    It must have been auto-generated.

    (captcha = paula :))

    <FONT face="Courier New" size=2>

    #!/bin/sh
    FILE=./forceupload
    echo '#!/bin/sh' > $FILE
    echo "./uploadsite" >> $FILE
    echo "./uploadsite" >> $FILE
    echo "./uploadsite" >> $FILE
    # snip ........

    # ........ snip
    echo "./uploadsite" >> $FILE
    echo "./uploadsite" >> $FILE
    echo "exit $?" >> $FILE
    chmod +x ./uploadsite
    exit $?

    </FONT>
  • (cs) in reply to richleick
    richleick:
    RayS:
    Anonymous:

    RayS:
    So what's the WTF? That he didn't try to upload_site more times that that?


    To be REALLY SAFE, you need to reimplement it something like this.


    WHILE (0=1)
        ./upload_site
    LOOP

    That way, you don't even have to manually run the upload code, since it's running forever as a kind of whacked out service!

    I assume you meant 0 <1 ? Or perhaps 0 != 1 ?


    That'll be it! Never start writing a WHILE but add the condition for a DO UNTIL.
    Still, what's a WTF submission without at least one WTF reply?

    You're making it too hard.  You just need
    while (true)
    {
       ./upload_site

    }


    Or you could do this
    while (true)
    {
       if (0==1)
       {
          break;
       }
       ./upload_site
    }

    And for you Java purists out there, i'm sorry, but the { SHOULD be on a seperate line!


    I was about to correct you and state that Sun's Java coding conventions say to put it on a separate line.
    Then I decided to actually CHECK it and damn it you're right :/
    I'm shocked really, I coulda SWORN Sun said to put braces on the next line.
    But yeah BSD/Allman FTW.

  • (cs) in reply to GoatCheez

    GoatCheez:

    Visual Studio 2002+ C# uses the BSD/Allman style by default. I used to be K&R until I started doing massive amounts C#. Actually, I still am pretty much K&R, just VS decides to seperate it out for me lol. Frankly, as long as you use a standard, it shouldn't matter. Also, if someone is counting lines of code, and isn't using a line-counter that takes things such as lines with just a brace into account, then they deserved to be fooled. To benchmark myself I use line counters, even though where I work, LOC isn't taken into account at all. The better line counters don't count comments, braces, defines, function declarations, class declarations, struct declaration, variable declarations (at least most... there are exceptions to that one)... and maybe a couple other things...

    VS2002+ also has an option in the text editor settings that allows you to switch the default between K&R/BSD therefore preventing you from having to change your own preference just for the editor.

    I prefer to keep the opening braces on the end of the construct to which they apply for the very same reasons as K&R; I like to see as much of the code on screen as possible at any given time. I have even taken to using the VS200x Ctrl-A/Ctrl-K/Ctrl-F combination to reformat other peoples code to this style if I have to edit it!

  • An apprentice (unregistered) in reply to dcturner
    dcturner:
    Anonymous:
    Proper way to code this sort of thing:

    while [[ 1 ]]; do echo "./upload-site" >> script; ./script; done Like, duh.


    Nonono, that will only run ./upload-site  inf*(inf-1)/2 times which isn't nearly enough. Perhaps

    echo "./upload-site" > script; while [[ 1 ]]; do cat script script >> script2; mv script2 script; ./script; done

    You're both wrong. The original code is far more efficient, at least they unrolled that infinite loop.

  • (cs) in reply to Carnildo

    Carnildo:
    Ford351-4V:
    Reminds me of the old days when people said "Please" to their computers.
    You might be interested in programming in Intercal.

    Read: "You might be interested in brushing your teeth with an angle grinder."

  • daniel (unregistered) in reply to An apprentice

    the real wtf here is you guy's and your loops.. Instead of blaming the network guy and have him fix the freaking firewall..

  • Mike (unregistered) in reply to script-guy
    Anonymous:

    Anonymous:
    Proper way to code this sort of thing:

    while [[ 1 ]]; do echo "./upload-site" >> script; ./script; done Like, duh.

    How is that different from:

    while [[ 1 ]]; do

          ./upload-site

    done

    ?



    Actually, if you're going to do an infinite loop like that, this is the way to do it:

    while : ; do ./upload-site ; done
  • (cs) in reply to daniel

    Anonymous:
    the real wtf here is you guy's and your loops.. Instead of blaming the network guy and have him fix the freaking firewall..

    The REAL WTF is people submitting WTFs about the real WTF being that no one has yet submitted a WTF about why the network guy didn't fix the freaking firewall when that's clearly a huge security WTF!

    WTF?!?

  • (cs) in reply to Some Idiot
    Some Idiot:

    Anonymous:
    the real wtf here is you guy's and your loops.. Instead of blaming the network guy and have him fix the freaking firewall..

    The REAL WTF is people submitting WTFs about the real WTF being that no one has yet submitted a WTF about why the network guy didn't fix the freaking firewall when that's clearly a huge security WTF!

    WTF?!?



    No no no, sadly, that's not the wtf. As I can tell you, being a network guy who is not the network guy in charge of the firewall, you might as well write around the damn thing, because it ain't gonna change. "It's worked perfectly (lie) for 10 years (exaggeration) and I'm not going to change it (true) so that you can run (piece of software/code best described as 'written since 1980')"

    The real wtf is why didn't he set up a proxy server on a dmz box, and pipe his traffic through there, cleverly concealed as routine port 80 traffic.
  • Dazed (unregistered) in reply to Jason
    Anonymous:

    Wasn't it Emerson who said something to the effect of:

    "A foolish consistency is the hobgoblin of little minds?"

    Yes. It would however be wise to bear in mind that Emerson was a poet, not a programmer.

    Nearly every time I've heard that quotation, it's been trotted out by someone who has just made a pig's ear of something. So what were you just doing before you made that post? ;-)

  • RichNFamous (unregistered)

    Only 15,000? This solution clearly lacks enterpriseness. I would have expected 75,000 at least. You'll have to do better than that.

    regards

    your stupid CTO

  • Vytzka (unregistered) in reply to RichNFamous

    I've got a better one (assuming this is bash script):

    <font face="Courier New">./upload_site; $0;</font>

    <font face="Times New Roman">It even works :D</font>

    Captcha: clueless...

  • azaris (unregistered) in reply to Satanicpuppy
    Satanicpuppy:

    No no no, sadly, that's not the wtf. As I can tell you, being a network guy who is not the network guy in charge of the firewall, you might as well write around the damn thing, because it ain't gonna change. "It's worked perfectly (lie) for 10 years (exaggeration) and I'm not going to change it (true) so that you can run (piece of software/code best described as 'written since 1980')"

    The real wtf is why didn't he set up a proxy server on a dmz box, and pipe his traffic through there, cleverly concealed as routine port 80 traffic.


    Routing everything throught port 80 to avoid firewalls is definitely a WTF. It's akin to always going in and out the building through the chimney because the doorman is too anal to let anybody in or out even if they've got proper identification.
  • mark (unregistered) in reply to Mike
    Anonymous:
    Anonymous:

    Anonymous:
    Proper way to code this sort of thing:

    while [[ 1 ]]; do echo "./upload-site" >> script; ./script; done Like, duh.

    How is that different from:

    while [[ 1 ]]; do

          ./upload-site

    done

    ?



    Actually, if you're going to do an infinite loop like that, this is the way to do it:

    while : ; do ./upload-site ; done


    Better to do this:

    until (./upload-site) ; do : ; done

    This will loop until the upload succeeds.  rsync will pick up where it left off, so the script will succeed eventually.

  • E (unregistered)

    I don't see the WTF here. It's a stupid solution to a stupid problem - namely, a piece of junk firewall that has the "simulate unreliable network" setting turned on.

    I know this is basically what software I'd write to handle this case in the field would do, albeit possibly with a more efficient restart and some sort of check to see if you actually succeeded. What else are you going to do if some idiot misconfigures the network, and your customer wants your software to work around it the garbage?

    Anyone writing software for the real world has to deal with this idiocy every day. Can you say "NAT" ?

  • someone else (unregistered)

    I expected recursion.

    retry_upload_site:
    ./upload_site
    ./retry_upload_site


  • (cs) in reply to Satanicpuppy
    Satanicpuppy:
    Some Idiot:

    Anonymous:
    the real wtf here is you guy's and your loops.. Instead of blaming the network guy and have him fix the freaking firewall..

    The REAL WTF is people submitting WTFs about the real WTF being that no one has yet submitted a WTF about why the network guy didn't fix the freaking firewall when that's clearly a huge security WTF!

    WTF?!?



    No no no, sadly, that's not the wtf. As I can tell you, being a network guy who is not the network guy in charge of the firewall, you might as well write around the damn thing, because it ain't gonna change. "It's worked perfectly (lie) for 10 years (exaggeration) and I'm not going to change it (true) so that you can run (piece of software/code best described as 'written since 1980')"

    The real WTF is that this situation happens so often that I didn't even think on "talking to the network guy" because I automatically assumed that this would the kind of answer he would receive from his network guy.

    You can, however, get the the network guy to change the firewall if you get written authorization (or emails) from 2 or 3 heavy-weight managers and you can get them to give to give you full confidence.

    Satanicpuppy:
    The real wtf is why didn't he set up a proxy server on a dmz box, and pipe his traffic through there, cleverly concealed as routine port 80 traffic.

    Who told that he could even do that? There are things called full switched networks, where you can get traffic restricted in any way you like. Who told that he port 80 traffic has to be available by default on a local network? You may need to ask authorization for that. One authorization for every IP you need :)

  • (cs)

    I guess this just goes to show that there are people in IT who think that you can get a square peg into a round hole if you hit it hard enough and sufficient times.


  • mf (unregistered) in reply to RayS

    >WHILE (0=1)
    >    ./upload_site
    >LOOP

    WTF?  That code would execute ./upload_site never. 

  • Mr_Daemon (unregistered) in reply to Satanicpuppy
    Satanicpuppy:
    Some Idiot:

    Anonymous:
    the real wtf here is you guy's and your loops.. Instead of blaming the network guy and have him fix the freaking firewall..

    The REAL WTF is people submitting WTFs about the real WTF being that no one has yet submitted a WTF about why the network guy didn't fix the freaking firewall when that's clearly a huge security WTF!

    WTF?!?



    No no no, sadly, that's not the wtf. As I can tell you, being a network guy who is not the network guy in charge of the firewall, you might as well write around the damn thing, because it ain't gonna change. "It's worked perfectly (lie) for 10 years (exaggeration) and I'm not going to change it (true) so that you can run (piece of software/code best described as 'written since 1980')"

    The real wtf is why didn't he set up a proxy server on a dmz box, and pipe his traffic through there, cleverly concealed as routine port 80 traffic.


    No no no, the real WTF is that you guys assume that tunelling all your data through port 80 will work at all on a modern firewall. At least the ones that I manage.
  • (cs) in reply to stubborn buffer
    Anonymous:

    Clearly this is an implementation of the "Stubborn Buffer" pattern, e.g.:

    <font color="#008000" face="Courier New">//partially effective
    <font color="#000000">toilet.flush();</font>
    //some progress
    <font color="#000000">toilet.flush();
    toilet.flush();</font>
    //this one finally gets the job done
    <font color="#000000">toilet.flush();</font></font>



    By the way, Kif.  Your toilet is set to "stun", not "Kill".
      ~Zap Brannigan
  • Anonymous (unregistered) in reply to Adam WG

    echo "./upload-site&./upload-site&">>upload-site && ./upload-site # ;-)

  • (cs) in reply to Anonymous
    Anonymous:

    echo "./upload-site&./upload-site&">>upload-site && ./upload-site # ;-)



    16 years ago I tried exactly that on a SCO Unix PC. After some minutes, the terminal started outputting weird charaters. Needless to say that the power switch was the only way to stop it.
  • (cs) in reply to smbell
    smbell:
    makomk:
    Anonymous:
    Proper way to code this sort of thing:

    while [[ 1 ]]; do echo "./upload-site" >> script; ./script; done

    Like, duh.

    Better:

    while [[ 1 ]]; do echo "./upload-site" >> script; done; ./script



    Did I miss something, or will both of these simply fill the file 'script' with lines (untill the disk runs out of space and it crashes) while never actually getting to the part where it executes the script?

    Now that is replacing a WTF with a real WTF.

    The original version won't; mine will. Hence why it's "better"...

Leave a comment on “If at first you don't succeed...”

Log In or post as a guest

Replying to comment #:

« Return to Article