Click here to Skip to main content

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrasing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
GeneralRe: Try/catch block...memberPIEBALDconsult20 Nov '12 - 13:30 
It lacks a while.
GeneralRe: Try/catch block...memberjasperp20 Nov '12 - 20:56 
I like it. Another opportunity to bill the client.
GeneralRe: Try/catch block...memberspencepk21 Nov '12 - 4:03 
Huh... why bother?
GeneralRe: Try/catch block...memberProgramFOX21 Nov '12 - 4:10 
When I was programming that, I thought: "It's in a catch block, then it can't throw an error!" Dead | X|
ProgramFOX

GeneralRe: Try/catch block...memberRafagaX21 Nov '12 - 4:28 
Mmmm... you seem determined to read that file, is it important?
CEO at:
- Rafaga Systems
- Para Facturas
- Modern Components
for the moment...

GeneralRe: Try/catch block...memberProgramFOX21 Nov '12 - 4:32 
No. The reading of the file isn't important.
That's a code from 2 years ago.
Now, I know how I can read files!
ProgramFOX

GeneralRe: Try/catch block...memberjnlt21 Nov '12 - 5:33 
Timed out first time, then worked the second time?
GeneralWhy would you do this to a stored procedure? It never did anything to you.memberthrakazog15 Nov '12 - 11:58 
ALTER PROCEDURE [dbo].[arUpdate]
   @intForecastID int,
   @strForecastName varchar(18),
   @strBillTo varchar(12),
   @strPOCName varchar(50),
   @strPOCEmail varchar(100),
   @strModifiedBy varchar(20),
   @strComment varchar(3000),
   @strDelMaterials varchar(8000),
   @strData1 varchar(8000),
   @strData2 varchar(8000),
   @strData3 varchar(8000),
   @strData4 varchar(8000),
   @strData5 varchar(8000),
   @strData6 varchar(8000),
   @strData7 varchar(8000),
   @strData8 varchar(8000),
   @strData9 varchar(8000),
   @strData10 varchar(8000),
   @strData11 varchar(8000),
   @strData12 varchar(8000),
   @strData13 varchar(8000),
   @strData14 varchar(8000),
   @strData15 varchar(8000),
   @strData16 varchar(8000),
   @strData17 varchar(8000),
   @strData18 varchar(8000),
   @strData19 varchar(8000),
   @strData20 varchar(8000)
 
WTF | :WTF: None of the code in this procedure or from the calling methods looked any better. The data going into the varchar(8000) fields was delimited with a grab bag combination of special characters. Which was then pealed apart using cursors. WTF | :WTF:
Play my game Gravity: IOS[^], Android[^], Windows Phone 7[^]

GeneralRe: Why would you do this to a stored procedure? It never did anything to you.memberZac Greve15 Nov '12 - 12:48 
WTF | :WTF: Dead | X|
I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image.
Stephen Hawking

GeneralRe: Why would you do this to a stored procedure? It never did anything to you.memberjim lahey20 Nov '12 - 3:41 
What if I want @strData21 varchar(8000)?
 
If you don't think this is a serious question then you should have a chat with a lass in our office. According to her a DB server handling a load of 1 select query a second is being DDOS'd and the answer to this non-problem is to select all from every single table in the database on application startup and perform all paging and sorting in memory..
JokeRe: Why would you do this to a stored procedure? It never did anything to you.memberLewis198620 Nov '12 - 20:50 
Hey it sounds like she's onto something, let's pin all of our mission critical data to the table and give it a wild night it won't forget!
 
Or you could go to mongoDB. MongoDB is web-scale mongo db can pipe all your data to /dev/null to ensure lightning fast performance.
 
Just a question for said girl, if I try to read too many files from a slow, mechanical hard-drive and I cause thrashing, am I DDOS'ing my HD   Poke tongue | ;-P
 
I want to put the fun back into fundamentalism!
GeneralRe: Why would you do this to a stored procedure? It never did anything to you.protectorPete O'Hanlon20 Nov '12 - 12:09 
Back slowly away. This was obviously the work of a Sociopath.

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos

CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

GeneralRe: Why would you do this to a stored procedure? It never did anything to you.memberFlorin Jurcovici22 Nov '12 - 1:13 
Unfortunately, such people insist on calling them programmers. Gives our profession a bad name ...
GeneralRe: Why would you do this to a stored procedure? It never did anything to you.memberSomeGuyThatIsMe21 Nov '12 - 2:17 
I have that exact same pattern in my DB(not done by me), i wonder if they were both written by the same person. In my version though all those varchar(8000)s are ignored in the first SP and passed to a second which does even more string manipulation with cursors. wonder why they just didnt use one varchar(max) or a text field.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

GeneralRe: Why would you do this to a stored procedure? It never did anything to you.memberKP Lee22 Nov '12 - 18:23 
SomeGuyThatIsMe wrote:
wonder why they just didnt use one varchar(max) or a text field.

I'd guess this was written in SQL 2000. max didn't exist and it took too much thinking to do character manipulation on text fields. (For anyone who'd write this in the first place.)
 
I can't picture how to execute a cursor on a varchar field. (Extract a fraction of the data and then use a cursor to retrieve it from a table, sure, but ON the field?)
GeneralRe: Why would you do this to a stored procedure? It never did anything to you.memberSomeGuyThatIsMe26 Nov '12 - 2:34 
If i find the time today i'll post that piece of the sp.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

GeneralRe: Why would you do this to a stored procedure? It never did anything to you.memberAdriaan Davel21 Nov '12 - 20:36 
Because people are still looking for a silver-bullet, 1 thing that can do everything for you. Would hate to see the design & architecture of the rest of the 'solution'
____________________________________________________________
Be brave little warrior, be VERY brave

GeneralRe: Why would you do this to a stored procedure? It never did anything to you.memberthrakazog22 Nov '12 - 3:25 
Design? Architecture? Not on this project man! Poke tongue | ;-P
Play my game Gravity: IOS[^], Android[^], Windows Phone 7[^]

GeneralRe: Why would you do this to a stored procedure? It never did anything to you.memberdazfuller21 Nov '12 - 20:58 
Because the person who wrote it likes to curl up in a small ball with a nervous twitch in their eye whilst they inappropriately touch a small fury animal.
 
Honestly, you're better not asking, pretend you never saw it and maybe, just maybe, you'll make it through to tomorrow with a shred of sanity left in you.
Eagles may soar, but weasels don't get sucked into jet engines

GeneralRe: Why would you do this to a stored procedure? It never did anything to you.memberHarry Neethling21 Nov '12 - 23:23 
Gave me a good laugh right now Big Grin | :-D
GeneralRe: Why would you do this to a stored procedure? It never did anything to you.membermmelvis22 Nov '12 - 3:45 
You have an application that is 25 years old with no documentation for the tables, c-isam tables. You have to make this wonderful application talk to a modern day databases. You have been given a budget of $0 to get this task completed. You have just enough time to learn syntax to put something together that will hopefully work. That is how this happens.
GeneralRe: Why would you do this to a stored procedure? It never did anything to you.memberthrakazog22 Nov '12 - 18:04 
I could see it happening that way sometimes. But this code was from an ASP.net app. The comments put the creation date of this piece around 2005.
 
This may have come about through code rot. Maybe it worked great for something small and the scope and input string kept expanding. In any case... ick. And of course I don't have the time to fix it either. So I'll pass it on to somebody else also.
Play my game Gravity: IOS[^], Android[^], Windows Phone 7[^]

GeneralRe: Why would you do this to a stored procedure? It never did anything to you.memberexmsde22 Nov '12 - 11:13 
I see this and I think "Why did I enable it? Why did I agree to varchar(8000)? I could have stopped it. I could have kept Sybase's 255 character limit. I could have...."
 
Ah the law of unintended consequences.
GeneralRe: Why would you do this to a stored procedure? It never did anything to you.memberthomas.michaud26 Nov '12 - 4:08 
I've seen code like that were they were manipulating data -- usually because they couldn't (normally they just didn't want to) use better tools.
 
But I'm worried about this line -- Which was then pealed apart using cursors.
 
Cursors?
GeneralRe: Why would you do this to a stored procedure? It never did anything to you.memberNitin Sawant4 Dec '12 - 1:22 
Unsure | :~ Unsure | :~ Unsure | :~
============================================
The grass is always greener on the other side of the fence

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 25 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid