Comment On Coded Smorgasbord: The Pilot Episode

It's time for a new series: The Coded Smorgasbord. Inspired by the Pop-up Potpourri, the examples presented here aren't necessarily "bad" code nor do they imply the miserable failure that we're all used to reading here. Like previous "bunch o' code" articles, the examples are more-or-less fun snippets of code like ones that we've all written at one time or another. Enjoy! [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: Coded Smorgasbord: The Pilot Episode

2006-10-02 04:43 • by sk
most clueless way of counting the spaces ....


<?php

$howMushSpacesIsOutThere = 0;
$countSpacesInThisWord = " ";

while ( ($countSpacesInThisWord{$howMuchSpacesIsOutThere} != '' ? ++$howMuchSpacesIsOutThere : 0)) ;

print $howMuchSpacesIsOutThere . "\n";


?>

speaking of devil captcha: clueless, really!

Re: Coded Smorgasbord: The Pilot Episode

2006-10-02 05:10 • by HardCoder
93980 in reply to 93827
Jojosh_the_Pi:
Alex Papadimoulis:
int doctrackId = Convert.ToInt32("0");  //wtf!!



Maybe the programmer was concerned the int would be initialized with 64 bits, so he used this to try to specify a 32 bit integer, thus conserving memory.

wtf!!

CAPTCHA Test

 

Re: Coded Smorgasbord: The Pilot Episode

2006-10-02 05:12 • by piersy
93981 in reply to 93787
I suppose it's just possible that there was som logic embedded in a trigger or something, which would be something of a wtf in itself if this was the way they went about applying said logic.

Re: Coded Smorgasbord: The Pilot Episode

2006-10-02 05:26 • by egilhh
93982 in reply to 93898
Anonymous:

JustThat:
Of course, trying to create meaningful server names can also lead to these types of problems. I remember a Microsoft Exchange server that was being built for a mailbox restoration while I was at ISS...ah, yes. It was called ISSEXREST

Or, how about the Microsoft Exchange Team Blog...

http://msexchangeteam.com/

(m-sex-change-team-dot-com)

 

You just can't beat 

http://www.expertsexchange.net

 

~egilhh

Re: Coded Smorgasbord: The Pilot Episode

2006-10-02 06:12 • by hpeg
93986 in reply to 93800

Guess it's better than a method called "howToTellYourProgrammersAreLackingSleepAndHighOnCaffeine" or placeholder constants like:

public static final String GLOBAL = "Girls #18 Fujiyoushi Dead 41 to go";
 

Re: Coded Smorgasbord: The Pilot Episode

2006-10-02 07:06 • by ChrisH

MakeCum is very funny.  I can't help thinking though maybe it's accidental.  It is possible.

 
I previous incarnations I have actually issued the command line:

> ROLLBACK DICK

 
For the life of me I can't remember what the acronym stood for but to get the inclusion of the "K" was a certain fix created out of the necessity to correctly complete the phrase above.
 

Re: Coded Smorgasbord: The Pilot Episode

2006-10-02 07:28 • by nbit

What does captcha mean? Is it more brilliant than a paula bean?

can someone give me a link to the wtf article about captcha?

 

Re: Coded Smorgasbord: The Pilot Episode

2006-10-02 08:13 • by csrster
93993 in reply to 93855
Anonymous:

I'm getting too old. The only one that made me LOL was the try/catch with the same exact code.  That's awesome.  I wish I had 14-yr-old humor again.

 

CAPTCHA: awesomeness

 

 

Agreed, but what a shame they forgot the "finally" clause with the same code. 

Re: Coded Smorgasbord: The Pilot Episode

2006-10-02 08:32 • by The Big D
93995 in reply to 93993
Anonymous:
Anonymous:

I'm getting too old. The only one that made me LOL was the try/catch with the same exact code.  That's awesome.  I wish I had 14-yr-old humor again.

 

CAPTCHA: awesomeness

 

 

Agreed, but what a shame they forgot the "finally" clause with the same code. 

 

Maybe the original unobfuscated code was C++?

Re: Coded Smorgasbord: The Pilot Episode

2006-10-02 09:42 • by David Zimmerman
93999 in reply to 93788
BradC:
Alex Papadimoulis:

I'm sure a lot of you would have mocked Josh's collegue for having a constant named COMMA. Ha! Who's laughing now?

#define COMMA "|"

Beautiful in its simple WTF'ery.

Probably this should be something like

#define DELIMITER "|"

Besides, COMMA is much esier to spell then DELIIMTRER 

Re: Coded Smorgasbord: The Pilot Episode

2006-10-02 14:37 • by Kevin S.
>> Price = 0e-5; /* J.Palmer 1999-11-15 - I hope it's not a bug */

 

Reminds me of a system I once worked on, where one of the comments that had survived months of source-code check-ins was something like:

 / * This doesn't work - need to fix on Monday */

Re: Coded Smorgasbord: The Pilot Episode

2006-10-02 15:02 • by John Hensley
Alex Papadimoulis:
// This instance of OPParcelObj is owned by an instance of 
// OPParcelArray that is associated with an instance of
// OPCustThread which owns an instance of the parcel
// processor which is the processor needed to process
// this parcel.

How many parcels could a processor process if a processor could process parcels?
 

Re: Coded Smorgasbord: The Pilot Episode

2006-10-02 15:44 • by IndyHarcourt
94068 in reply to 93867

Nah. It's easier this way:

string twentySpaces = "                         ";
int length = 0;
for (int i=0;i<twentySpaces.Length;i++)           
{
    length++;
}
Console.WriteLine("The length of twentySpaces is {0}.", length);

And yes, I do envision the Battlestar Glactictica making out. Is there something wrong with that?

Re: Coded Smorgasbord: The Pilot Episode

2006-10-02 17:43 • by Adam
94102 in reply to 93843
BradC:
Anonymous:

I always wanted to create a help desk system called "My Pants". 

Support: "Hmm, I've never heard of that. Let me search my pants and see what I can find."

Support:  "I'm sorry, My Pants is down, so I can't answer your question."

Support:  "I seem to recall seeing something about that in My Pants."

 The 14 year old humor possibilities are endless!

Lol, nice.

Support: "Please hold. Sysadmin Julia currently has My Pants down for servicing."

Support: "I'm sorry, My Pants is a little slow today..."

Support: "I'm sorry, I can't seem to find that in My Pants."

 

 

You are all missing the true humor of this one:

Support: "I'm sorry, I don't know if I can help you with this. I'll stick it in My Pants and Julia will handle it as soon as possible."

captcha: jiggles ... I think the captcha system is getting in on the grade school humor.
 

Re: Coded Smorgasbord: The Pilot Episode

2006-10-02 21:49 • by lomaxx
i liked this wtf... particularly because i know the guy who's company developed the jetstar website :)

Re: Coded Smorgasbord: The Pilot Episode

2006-10-03 01:22 • by Marc
94132 in reply to 93812

Alex Papadimoulis:

#define COMMA "|" 

Anonymous:

<snip/>

   [A few days later]

   Boss: Ok, here is a .csv file to try your module:

   File: data;moredata;another data; etc

   Programmer: .....

   [More days later]

   Boss: the client sent this file, almost like the ones we'll use in production

   Second File: data-moredata-another data- etc.

<snip/>

To illustrate; my bank offers a statement download facility; you can choose Money, Quicken, etc, or "csv"; and guess what the delimiter is?

Tab

Now I'll grant that many spreadshets copy/paste better with tab, but why call it csv?

Marc

Re: Coded Smorgasbord: The Pilot Episode

2006-10-03 08:37 • by Engelbret Gunderson

It must be important to do this 'checkpoint' thing no matter what at least once a day...

while ((i=WaitForSingleObject(m_hCheckpointEvent,1<<20))!=WAIT_FAILED) {
if (shutdownthread) break;
switch (i) {
case WAIT_TIMEOUT: // every 17:29 whether you like it or not
// break;
case WAIT_OBJECT_0:
pthis->PerformCheckpoint();
}
}
}

 

Re: Coded Smorgasbord: The Pilot Episode

2006-10-03 13:05 • by cindypsych
94170 in reply to 93853
No, it's data rhymes with pat-a or that-a.  I think it's a WASP thing.

Re: Coded Smorgasbord: The Pilot Episode

2006-10-03 13:08 • by cindypsych
94173 in reply to 94132
Because if it has a .csv extension Excel will open it without having to copy/paste or import.  Just double-click the file.  And it has to have tab delimiters because too much real data often contains real commas.

Re: Coded Smorgasbord: The Pilot Episode

2006-10-03 13:14 • by cindypsych
94176 in reply to 93982
Anonymous:
Anonymous:

JustThat:
Of course, trying to create meaningful server names can also lead to these types of problems. I remember a Microsoft Exchange server that was being built for a mailbox restoration while I was at ISS...ah, yes. It was called ISSEXREST

Or, how about the Microsoft Exchange Team Blog...

http://msexchangeteam.com/

(m-sex-change-team-dot-com)

 

You just can't beat 

http://www.expertsexchange.net

 

~egilhh

 

Aw, come on.  What about www.therapist.com

the-rapist-dot-com

therapist-dot-com

Re: Coded Smorgasbord: The Pilot Episode

2006-10-03 15:16 • by Anonymous

Luckily, I've never worked for "this" company, but one of our vendors does act like that.

 

We ran into a serious problem involving the two different programs we use (one for data capture, one for data analysis).  Turns out that program A wrote a bunch of data with "block sizes" too large for program B (I assume it's because they used a fixed-sized buffer instead of reading the block size and allocating memory dynamically, a wtf on it's own).



We emailed company B about the problem at 4pm on Monday, and by 10am on Tuesday we had a custom-compiled version of the application ready to roll that would accept the block-size we needed.  It was just the single .exe and not the entire installer.  My boss was thrilled that the company had reacted to our problem so quickly.  I just about shit a brick, since I knew that .exe couldn't have gone through any kind of QA or testing.  Also, the "About" box showed exactly the same version number as the version we had previously, so there was no way to identify which version was installed on a system without simply trying to open up one of the "huge block" files and seeing if it segfaulted or not.

 

Re: Coded Smorgasbord: The Pilot Episode

2006-10-03 15:16 • by Anonymous
94243 in reply to 94240
Anonymous:

Luckily, I've never worked for "this" company, but one of our vendors does act like that.

 

 

And somehow, I posted this in the wrong thread!

 WTF.

 

Re: Coded Smorgasbord: The Pilot Episode

2006-10-03 15:40 • by Savaticus
94254 in reply to 93818
pjsson:
Volmarias:
I particularly like how Sunday is Admin day. I suppose they decided that it would be more empowering than Casual Fridays.

I guess no regular users will use the application on Sundays, so it is safe to assume that anyone using the application on a Sunday is an admin. At least until some user figures out if he changes the date of the PC clock to Sunday then you will get full admin privileges
The only problem with this idea is that the code was inserting a url link, which implies that this is a web app and therefore a serverside program. WHich means the user machines time settings would have no effect on the execution of this code.

Re: Coded Smorgasbord: The Pilot Episode

2006-10-04 05:22 • by Hendrik
Alex Papadimoulis:

I'm sure a lot of you would have mocked Josh's collegue for having a constant named COMMA. Ha! Who's laughing now?

#define COMMA "|"

Well, at least this guy knows his history: http://en.wikipedia.org/wiki/Comma_%28punctuation%29, see under History.
 

Re: Coded Smorgasbord: The Pilot Episode

2006-10-09 16:04 • by goldenratio
95173 in reply to 94173
Because if it has a .csv extension Excel will open it without having to copy/paste or import. Just double-click the file. And it has to have tab delimiters because too much real data often contains real commas.

this is why you use qualifiers

ie

"some data here","an address, usa"

Re: Coded Smorgasbord: The Pilot Episode

2006-10-20 03:26 • by A P
97248 in reply to 93817
cconroy:
Alex Papadimoulis:

For those of you with a maturity level greater than "14 years old", this next snippet probably won't be for you. Thankfully, Brian Samson isn't one of those people ..

public class MakeCum {

public static void main(String[] args) {
...
CLArgParser clap = new CLArgParser(clargs);

boolean err = clap.doStdArgs(args);

if (err) {
System.out.println("Usage: MakeCum ");
System.out.println(clap.getStdArgsDescription());
return;
}
...}

Ah yes, that class has it all: MakeCum, STD Arguments, and even the Clap makes an appearance! And who would have thought a class that did nothing but "convert a set of binned counts to cumulative counts" could be so fun.

Can... hardly... keep... a... straight... face...  (All that's missing is a "catch (ValueTransitionException valTrEx) {}" block; then I would have lost it.)

I used to try to avoid the "cum" abbreviation whenever possible, but app I'm currently working on has "cumQty" variables all over the place, so I've gotten pretty desensitized to it.  Now I have much more stamina tolerance for its usage.

We had a new programmer for whom English was a second language. She defined three variables in her COBOL program for loops:

 

01 COUNTERS.
  05  COUNT PIC 99.
  05  CONT PIC 99.
  05  C...

 I'll let you figure out what the last one was - I enjoyed watching my manager try to explain to her what the problem was, especially because she couldn't understand what he was saying. Eventually she got it and both were red-faced for hours afterwards... we were red-faced too - with laughter.

 

captcha - shizzle

Re: Coded Smorgasbord: The Pilot Episode

2006-10-20 03:29 • by A P
97250 in reply to 94176
Anonymous:
Anonymous:
Anonymous:

JustThat:
Of course, trying to create meaningful server names can also lead to these types of problems. I remember a Microsoft Exchange server that was being built for a mailbox restoration while I was at ISS...ah, yes. It was called ISSEXREST

Or, how about the Microsoft Exchange Team Blog...

http://msexchangeteam.com/

(m-sex-change-team-dot-com)

 

You just can't beat 

http://www.expertsexchange.net

 

~egilhh

 

Aw, come on.  What about www.therapist.com

the-rapist-dot-com

therapist-dot-com

 

I have exactly this problem with the user name I use on a lot of sites: MrAndyPuppy (the name's a long story, used to be AndyPuppy, added the Mr when I got married, etc, etc). Some sites just convert it all to lowercase, so I'm constantly being badgered for being one m-randy-puppy.

Re: Coded Smorgasbord: The Pilot Episode

2006-10-25 14:10 • by sir_flexalot
97999 in reply to 93781
Or, its a getting-rich man's conditional breakpoint, if you get paid per line of code!

Re: Coded Smorgasbord: The Pilot Episode

2007-08-31 12:29 • by PDK (unregistered)
That last WTF was sad. Made me die a little inside.
« PrevPage 1 | Page 2 | Page 3Next »

Add Comment