- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
"stuh-foo" ??? Gotta be an acronym. but don't see it. Anyone?
Admin
The first one will actually execute the script each time after a line has been added. So first it will execute
Then
And so on...
Still moronic though.
Admin
"Shut The Fuck Up"
Admin
You might be interested in programming in Intercal.
Admin
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
Admin
K&R were wrong. ;-)
I do it because it's possible to see at a glance if all braces are closed.
Admin
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.
Admin
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
Admin
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.
Admin
hahahahahhaah
Admin
You're developing in something that doesn't do that for you? And, if yes, why?
sincerely,
Richard Nixon
Admin
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
Admin
Nonono, that will only run
./upload-site
inf*(inf-1)/2 times which isn't nearly enough. Perhapsecho "./upload-site" > script; while [[ 1 ]]; do cat script script >> script2; mv script2 script; ./script; done
Admin
I love the Martha Stewart reference.
Admin
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.
Admin
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>
Admin
You are using an editor which does that for you anyway aren't you?
Admin
The Real WTF is that the code is not commented !
Admin
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 ) );
}
}
Admin
because without the possibility to break; it would be an infinite loop?
ps.
{
{
{
eat that!
Admin
Ah yes, like a java code convention perhaps?
Admin
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...
Admin
puts("Hello world!"), please; please, puts("Hello world!"), thankyou;
Admin
When will the last command (./script) be executed? ...Never
Admin
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?!"
Admin
In most bourne shell alikes ...
while ! ./upload-site ; do sleep 1 ; done
Admin
#!/bin/sh
FILE=./forceupload
echo '#!/bin/sh' > $FILE
echo "./uploadsite" >> $FILE
echo "./uploadsite" >> $FILE
echo "./uploadsite" >> $FILE
# snip ........
# ........ snip
</FONT>echo "./uploadsite" >> $FILE
echo "./uploadsite" >> $FILE
echo "exit $?" >> $FILE
chmod +x ./uploadsite
exit $?
Admin
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.
Admin
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!
Admin
You're both wrong. The original code is far more efficient, at least they unrolled that infinite loop.
Admin
Read: "You might be interested in brushing your teeth with an angle grinder."
Admin
the real wtf here is you guy's and your loops.. Instead of blaming the network guy and have him fix the freaking firewall..
Admin
Actually, if you're going to do an infinite loop like that, this is the way to do it:
while : ; do ./upload-site ; done
Admin
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?!?
Admin
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.
Admin
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? ;-)
Admin
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
Admin
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...
Admin
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.
Admin
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.
Admin
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" ?
Admin
I expected recursion.
./upload_site./retry_upload_site
Admin
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.
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 :)
Admin
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.
Admin
>WHILE (0=1)
> ./upload_site
>LOOP
WTF? That code would execute ./upload_site never.
Admin
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.
Admin
By the way, Kif. Your toilet is set to "stun", not "Kill".
~Zap Brannigan
Admin
echo "./upload-site&./upload-site&">>upload-site && ./upload-site # ;-)
Admin
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.
Admin
The original version won't; mine will. Hence why it's "better"...