Comment On A Spoonful of Sugar

John S. was doing some work on the search feature of a client's website when he noticed that he would receive a 500 Server Error if he tested against the API with an empty string. [expand full text]
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6Next »

Re: A Spoonful of Sugar

2011-03-16 11:28 • by iToad (unregistered)
341160 in reply to 341127
Mary:
You know, you can say it backwards, which is "docious-ali-expi-istic-fragil-cali-rupus"; but that's going a bit too far, don't you think?


You want to be very careful saying that out loud. Do not call up that which you cannot put back down.

Re: A Spoonful of Sugar

2011-03-16 11:28 • by trtrwtf (unregistered)
341161 in reply to 341158
Pyroka:
Unless you're searching for hotels in Wales


The very definition of the phrase "trwtf"

Re: A Spoonful of Sugar

2011-03-16 11:30 • by anonymous internet wanker (unregistered)
341162 in reply to 341100
come on, don't you love doing some on the search function? I do. It's my favorite thing, I do it all the time! :)

(well, my favorite thing besides the obvious)

Re: A Spoonful of Sugar

2011-03-16 11:39 • by fwfw (unregistered)
341163 in reply to 341134
java.lang.Chris;:
The only justifiable reason for the previous developer doing this is that he/she wasn't allowed to change the underlying data access code. I once worked at a place where I was regularly coming across broken code in the lower levels of the ball 'o mud code base. I'd submit fixes, along with a unit test (a novelty at that particular firm - no one else had even heard of unit testing) only for a more "senior" developer to veto the changes every time.


The fact that they use CF tells me that they regularly change production data by using the Edit Rows function in SSMS.

Re: A Spoonful of Sugar

2011-03-16 11:42 • by steenbergh
341164 in reply to 341145
Power Troll:

ITS A SMALL WORLD, AFTER ALL!
ITS A SMALL WORLD, AFTER ALL!
ITS A SMALL WORLD, AFTER ALL!
ITS A SMALL, SMALL WORLD!

ITS A SMALL WORLD, AFTER ALL!
ITS A SMALL WORLD, AFTER ALL!
ITS A SMALL WORLD, AFTER ALL!
ITS A SMALL, SMALL WORLD!

ITS A SMALL WORLD, AFTER ALL!
ITS A SMALL WORLD, AFTER ALL!
ITS A SMALL WORLD, AFTER ALL!
ITS A SMALL, SMALL WORLD!

ITS A SMALL WORLD, AFTER ALL!
ITS A SMALL WORLD, AFTER ALL!
ITS A SMALL WORLD, AFTER ALL!
ITS A SMALL, SMALL WORLD!


GOD DAMMIT!

Re: A Spoonful of Sugar

2011-03-16 11:48 • by Squidfood (unregistered)
341166 in reply to 341096
Someone:
Personally, I cannot think of a better string.


But is it one of your favorite strings?

Re: A Spoonful of Sugar

2011-03-16 11:53 • by trtrwtf (unregistered)
341168 in reply to 341166
Squidfood:
Someone:
Personally, I cannot think of a better string.


But is it one of your favorite strings?



No, that would be "Brown paper packages tied up with %s"

Re: A Spoonful of Sugar

2011-03-16 11:56 • by Wonk (unregistered)
if comment EQ ""
cfset comment = "Chargoggagoggmanchauggagoggchaubunagungamaugg"

Re: A Spoonful of Sugar

2011-03-16 11:57 • by Anonymous (unregistered)
341170 in reply to 341166
Squidfood:
Someone:
Personally, I cannot think of a better string.


But is it one of your favorite strings?

private string _fav1 = "raindrops on roses";
private string _fav2 = "whiskers on kittens";
private string _fav3 = "bright copper kettles";
private string _fav4 = "warm woolen mittens";
private string _fav5 = "brown paper packages tied up with string";

These are a few of my favorite strings.

Re: A Spoonful of Sugar

2011-03-16 11:57 • by Vacaloca (unregistered)
341171 in reply to 341137
lyates:
How do I get that song to stop playing in my head?


song.Dispose();

Re: A Spoonful of Sugar

2011-03-16 12:09 • by MrBester
341172 in reply to 341158
Pyroka:
F:
Llanfairpwllgwyngyllgogerychwyrndrobwllllantisiliogogogoch. There's no chance whatsoever of that accidentally producing a successful search.

Unless you're searching for hotels in Wales

Nope, not even then. Perhaps if you were searching for "places that sell novelty railway platform tickets in Wales" you might get lucky, but mostly you'd get back Llanfair, Anglesey (as distinct from all the other Llanfairs around Wales). Llanfair P.G. is also acceptable but nobody calls it Llanfairpwllgwll...gogogoch any more.

If you want me, I'll be with the sheep.

Re: A Spoonful of Sugar

2011-03-16 12:14 • by BentFranklin (unregistered)
My favorite brain melting song goes like this:

Meow meow meow meow meow meow meow meow
meow meow meow meow meow meow meow meow
meow meow meow meow meow meow meow meow
meow meow meow meow meow meow meow meow!

(http://www.youtube.com/watch?v=5JuVHCJVYf4 if you don't remember or happily were never subjected to said torture.)

Re: A Spoonful of Sugar

2011-03-16 12:22 • by trtrwtf (unregistered)
341175 in reply to 341172
MrBester:
If you want me, I'll be with the sheep.


I'll bet you will. Hey, McLeod! Get off of my ewe!

Re: A Spoonful of Sugar

2011-03-16 12:23 • by The Bytemaster
Once again we get a code sample where a programmer fixes a problem by using a "magic string".

Re: A Spoonful of Sugar

2011-03-16 12:26 • by Herby (unregistered)
341177 in reply to 341150
RichP:
D'oh, an error, a pes-ky error
Ray, a bright idea'd fix
Me, the coder to save the day,
Far, a non-pool memory access
So, I think I'll throw an error
La, the yellow one next to Po
Tea, a choice n'stead of coffee,
which brings us back to D'oh!


The hills are alive with the sound of music.....


Sorry, wrong Julie Andrews movie. Never [Emily Litella] mind.

Re: A Spoonful of Sugar

2011-03-16 12:35 • by OldPeter (unregistered)
You want long words? Forget English and choose German:

Oberdonaudampfschifffahrtsgesellschaftskapitäswitwenrentenantragsformulartitelzeilenendbuchstabengrößenangabe.

(Upper danube steam ship company captain's widow rent applicance form title line end letter size value)

Re: A Spoonful of Sugar

2011-03-16 12:38 • by PedanticCurmudgeon
341180 in reply to 341157
neminem:
Also, if they really had to submit a search string, rather than random long words, fun as they are to name, couldn't they just have mashed the keyboard a bit, and gone with something like "CJFNNCNNOLIIEHREHCDMUCDGERWP"? Pretty sure *that* won't ever get any results anywhere.

It does now. Nice work.

Re: A Spoonful of Sugar

2011-03-16 12:44 • by Fred (unregistered)
The obvious approach to this problem is to create a thingy that responds to a search for "supercalifragilisticexpialidocious" and make sure it thoroughly insults the reader in the most vile terms possible. (Like maybe calling them a VB programmer...)

Then just sit back and wait for the complaints to pile up, forcing management to authorize fixing the actual bug instead of papering over it.

If they merely change the magic word, rinse and repeat...

Re: A Spoonful of Sugar

2011-03-16 12:48 • by RobFreundlich
341184 in reply to 341157
neminem:
Also, if they really had to submit a search string, rather than random long words, fun as they are to name, couldn't they just have mashed the keyboard a bit, and gone with something like "CJFNNCNNOLIIEHREHCDMUCDGERWP"? Pretty sure *that* won't ever get any results anywhere.


Whenever I need a magic string that should never appear in real-world data, I use something like this:

"~~~!!!~~!~! THIS STRING SHOULD NEVER APPEAR IN REAL-WORLD DATA AND IS USED TO MEAN insert meaning here . IF IT DOES APPEAR IN REAL-WORLD DATA, THIS APPLICATION WILL PROBABLY BREAK OR BEHAVE IN AN UNPREDICTABLE WAY ~~~~!!!!~~~~"

It has the benefit of being self-documenting, and if it ever does show up in real-world data, someone is clearly messing with the application's head.

Re: A Spoonful of Sugar

2011-03-16 12:57 • by ThingGuy McGuyThing
I'll probably take some flak, but I can see valid reasons for doing this rather than any of the other suggestions (bypassing search, returning the user to the search page, etc).

1) Time constraints: If the dev had another 50 critical bugs to fix that day, there's no reason he should spend any more time on this bug. An if statement and a comment suffice.

2) Global search: He can't return the user to the original page. If this search appears at the top of every page, then he'd have to go through the pain of ensuring that every form in the application was correctly populated on a bad search.

3) One-off effects: If the search operation has one-off effects, then it's far easier to pass it a bad string than try to reproduce those effects outside of the search operation.


Bear in mind that if the above apply, it indicates a WTF somewhere further down the line. But we knew that when we found out the search API didn't allow empty strings.

Really, the best suggestion I've seen was by RobFreundlich - the actual string should be self-documenting.

Re: A Spoonful of Sugar

2011-03-16 13:00 • by Vic (unregistered)
It would be a real WTF if the client was Disney and people were trying to find the correct spelling.

Re: A Spoonful of Sugar

2011-03-16 13:06 • by boog
341188 in reply to 341186
ThingGuy McGuyThing:
I'll probably take some flak, but I can see valid reasons for doing this rather than any of the other suggestions (bypassing search, returning the user to the search page, etc).

1) Time constraints: If the dev had another 50 critical bugs to fix that day, there's no reason he should spend any more time on this bug. An if statement and a comment suffice.
Wouldn't an if-statement suffice for bypassing the search?

Re: A Spoonful of Sugar

2011-03-16 13:10 • by chron3
341189 in reply to 341186
ThingGuy McGuyThing:
- the actual string should be self-documenting.


<cfif Trim(url.searchText) EQ "">
<!--- empty string will cause an error --->
<cfset searchString="If you are reading this, you are likely a fellow coder, or a general web geek. We have to pollute our code with this crap because the stupid fecks on the [insert team name] team at [insert company name] cant write an API worth a damn. No search string generates a 500 error from that pile of stinking mess they delivered, so instead, you get to read this.">
</cfif>

Re: A Spoonful of Sugar

2011-03-16 13:10 • by somedude
341190 in reply to 341148
Mahatma Gandhi, as you know, walked barefoot most of the time, which produced an impressive set of calluses on his feet. He also ate very little, which made him rather frail and, with his odd diet, he suffered from bad breath. This made him a...

super calloused fragile mystic hexed by halitosis.

Re: A Spoonful of Sugar

2011-03-16 13:11 • by boog
341191 in reply to 341134
java.lang.Chris;:
The only justifiable reason for the previous developer doing this is that he/she wasn't allowed to change the underlying data access code.
Why would the previous developer have needed to change the underlying data access code? Was it broken?

Re: A Spoonful of Sugar

2011-03-16 13:11 • by BF (unregistered)
341192 in reply to 341105
Michael:
Anonymous Coward:
TRWTF is ColdFusion.


Understatement of the year.

CAPTCHA: mara ... jade?


I think we can all agree that the real WTF is the brain dead .NET webservice API that they were using to do the searching.

Re: A Spoonful of Sugar

2011-03-16 13:26 • by steenbergh
341194 in reply to 341192
BF:
Michael:
Anonymous Coward:
TRWTF is ColdFusion.


Understatement of the year.

CAPTCHA: mara ... jade?


I think we can all agree that the real WTF is the brain dead .NET webservice API that they were using to do the searching.

Does ColdFusion pay you to say that, or didn't any of the .Net shops want you after reading your resume?

Re: A Spoonful of Sugar

2011-03-16 13:30 • by foo (unregistered)
341195 in reply to 341157
neminem:

Also, if they really had to submit a search string, rather than random long words, fun as they are to name, couldn't they just have mashed the keyboard a bit, and gone with something like "CJFNNCNNOLIIEHREHCDMUCDGERWP"? Pretty sure *that* won't ever get any results anywhere.


CJFNNCNNOLIIEHREHCDMUCDGERWP is probably a Welsh word.

Re: A Spoonful of Sugar

2011-03-16 13:31 • by hoodaticus
John S. was doing some on the search feature of a client's website...
I tried that once, but it didn't work out as well as using a mirror.

Re: A Spoonful of Sugar

2011-03-16 13:33 • by AnthonyC (unregistered)
Although you can type it backwards, which is dociousaliexpiisticfragilcalirupus, but that's going a bit too far, don't you think?

Re: A Spoonful of Sugar

2011-03-16 13:36 • by hoodaticus
So TRWTF is that the DAL code was off limits, and he should have used wrapper pattern? Which, in a sense, he did?

So TRWTF is that there is no RWTF?

Re: A Spoonful of Sugar

2011-03-16 13:38 • by hoodaticus
341200 in reply to 341198
AnthonyC:
Although you can type it backwards, which is dociousaliexpiisticfragilcalirupus, but that's going a bit too far, don't you think?
That isn't backwards, dude. Neither character-wise nor syllable-wise nor phonetically.

Re: A Spoonful of Sugar

2011-03-16 13:38 • by Bob (unregistered)
Luckily, Bobx can automatically catch this exception and produce a meaningful error message in less than 20 lines of code.

Re: A Spoonful of Sugar

2011-03-16 13:39 • by hoodaticus (unregistered)
341202 in reply to 341200
hoodaticus:
AnthonyC:
Although you can type it backwards, which is dociousaliexpiisticfragilcalirupus, but that's going a bit too far, don't you think?
That isn't backwards, dude. Neither character-wise nor syllable-wise.

Never mind. I'm a moron. I didn't realize you we're quoting the movie.

Re: A Spoonful of Sugar

2011-03-16 13:39 • by The Great Lobachevsky (unregistered)
341203 in reply to 341157
neminem - I'm glad I'm not the only one here that appreciates Tom Lehrer.

I randomly walk around singing "per clementina si!" when the mood strikes me :)

captcha: nimis

Re: A Spoonful of Sugar

2011-03-16 13:40 • by Helps the Medicine Go Down (unregistered)
Why exactly was Brian testing with an empty string, anyway? I hate it when devs do crap like that.

Re: A Spoonful of Sugar

2011-03-16 13:42 • by kastein (unregistered)
341205 in reply to 341194
steenbergh:
BF:
Michael:
Anonymous Coward:
TRWTF is ColdFusion.


Understatement of the year.

CAPTCHA: mara ... jade?


I think we can all agree that the real WTF is the brain dead .NET webservice API that they were using to do the searching.

Does ColdFusion pay you to say that, or didn't any of the .Net shops want you after reading your resume?


Didn't you know? Microsoft is replacing Visual FoxPro with Visual ColdFusion++ .NET Live Edition

if this sentence didn't give you chills, you are probably not human.

Re: A Spoonful of Sugar

2011-03-16 13:43 • by hoodaticus
341206 in reply to 341202
hoodaticus unregistered:
hoodaticus:
AnthonyC:
Although you can type it backwards, which is dociousaliexpiisticfragilcalirupus, but that's going a bit too far, don't you think?
That isn't backwards, dude. Neither character-wise nor syllable-wise.

Never mind. I'm a moron. I didn't realize you we're quoting the movie.
I'm just not homosexual enough to have memorized the lyrics to every musical. Tho thorry, my apologieth.

Re: A Spoonful of Sugar

2011-03-16 13:43 • by frits
341207 in reply to 341191
boog:
java.lang.Chris;:
The only justifiable reason for the previous developer doing this is that he/she wasn't allowed to change the underlying data access code.
Why would the previous developer have needed to change the underlying data access code? Was it broken?


Oh I'm sure it worked as well as any super sophisticated SQL LIKE query would...

Re: A Spoonful of Sugar

2011-03-16 13:45 • by jumentum (unregistered)
341208 in reply to 341206
hoodaticus:
hoodaticus unregistered:
hoodaticus:
AnthonyC:
Although you can type it backwards, which is dociousaliexpiisticfragilcalirupus, but that's going a bit too far, don't you think?
That isn't backwards, dude. Neither character-wise nor syllable-wise.

Never mind. I'm a moron. I didn't realize you we're quoting the movie.
I'm just not homosexual enough...

Hardly could tell, from the name and the self-talk.

Re: A Spoonful of Sugar

2011-03-16 13:50 • by Pr0gramm3r
The correct solution to this problem would have been,


<cfif Trim(url.searchText) EQ "">
<!--- empty string will cause an error --->
<cfset searchString="null">
</cfif>

Re: A Spoonful of Sugar

2011-03-16 13:54 • by JJ (unregistered)
I'll be in my bunk...doing some.

Re: A Spoonful of Sugar

2011-03-16 14:05 • by hoodaticus
341212 in reply to 341208
jumentum:
hoodaticus:
hoodaticus unregistered:
hoodaticus:
AnthonyC:
Although you can type it backwards, which is dociousaliexpiisticfragilcalirupus, but that's going a bit too far, don't you think?
That isn't backwards, dude. Neither character-wise nor syllable-wise.

Never mind. I'm a moron. I didn't realize you we're quoting the movie.
I'm just not homosexual enough...

Hardly could tell, from the name and the self-talk.
Wit Lesson #1 - before turning a phrase, it helps to understand the phrase you are turning.

Re: A Spoonful of Sugar

2011-03-16 14:07 • by boog
341213 in reply to 341207
frits:
boog:
java.lang.Chris;:
The only justifiable reason for the previous developer doing this is that he/she wasn't allowed to change the underlying data access code.
Why would the previous developer have needed to change the underlying data access code? Was it broken?


Oh I'm sure it worked as well as any super sophisticated SQL LIKE query would...

Maybe it does. And maybe the search operation starts out with
if (parameter is invalid)

throw a 500 error

or something to that effect. Is it unlikely that the API developers decided "empty string" was an invalid input that they didn't want to handle?

Re: A Spoonful of Sugar

2011-03-16 14:08 • by Peter (unregistered)
341214 in reply to 341212
hoodaticus:
jumentum:
hoodaticus:
hoodaticus unregistered:
hoodaticus:
AnthonyC:
Although you can type it backwards, which is dociousaliexpiisticfragilcalirupus, but that's going a bit too far, don't you think?
That isn't backwards, dude. Neither character-wise nor syllable-wise.

Never mind. I'm a moron. I didn't realize you we're quoting the movie.
I'm just not homosexual enough...

Hardly could tell, from the name and the self-talk.
Wit Lesson #1 - before turning a phrase, it helps to understand the phrase you are turning.

How do you "turn" a phrase?

Re: A Spoonful of Sugar

2011-03-16 14:10 • by Sudo
341215 in reply to 341114
Roy:
Not so much a WTF as a "GoreBlimey"
That should be "cor blimey", but it's easy to see how you came to make that mistake - Dick Van Dyke does the worst cockney impression known to man... it lies somewhere between Pakistani and South African.

Re: A Spoonful of Sugar

2011-03-16 14:10 • by notromda
341216 in reply to 341143
Bert:
lyates:
How do I get that song to stop playing in my head?

Simple; replace it with this one:

Chim chimin-ee, chim chimin-ee, chim chim cher-ee,
A sweep is as lucky, as lucky can be;
Chim chimin-ee, chim chimin-ee, chim chim cher-oo,
Good luck will rub off when I shakes 'ands with you!


Go fly a kite.

Re: A Spoonful of Sugar

2011-03-16 14:12 • by Sudo
341217 in reply to 341209
Pr0gramm3r:
The correct solution to this problem would have been,


<cfif Trim(url.searchText) EQ "">
<!--- empty string will cause an error --->
<cfset searchString="FILE_NOT_FOUND">
</cfif>
FTFY

Re: A Spoonful of Sugar

2011-03-16 14:18 • by Gunslinger (unregistered)
341218 in reply to 341205
kastein:
steenbergh:
BF:
Michael:
Anonymous Coward:
TRWTF is ColdFusion.


Understatement of the year.

CAPTCHA: mara ... jade?


I think we can all agree that the real WTF is the brain dead .NET webservice API that they were using to do the searching.

Does ColdFusion pay you to say that, or didn't any of the .Net shops want you after reading your resume?


Didn't you know? Microsoft is replacing Visual FoxPro with Visual ColdFusion++ .NET Live Edition

if this sentence didn't give you chills, you are probably not human.


If you were someone who used visual FoxPro, then you weren't human already.

CAPTCHA: nobis - Only a nobis uses FoxPro.

Re: A Spoonful of Sugar

2011-03-16 14:23 • by Lois Griffin (unregistered)
341219 in reply to 341214
Peter:
hoodaticus:
jumentum:
hoodaticus:
hoodaticus unregistered:
hoodaticus:
AnthonyC:
Although you can type it backwards, which is dociousaliexpiisticfragilcalirupus, but that's going a bit too far, don't you think?
That isn't backwards, dude. Neither character-wise nor syllable-wise.

Never mind. I'm a moron. I didn't realize you we're quoting the movie.
I'm just not homosexual enough...

Hardly could tell, from the name and the self-talk.
Wit Lesson #1 - before turning a phrase, it helps to understand the phrase you are turning.

How do you "turn" a phrase?
God, you're dumb! Thank God for that ass!
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6Next »

Add Comment