Click here to Skip to main content
15,887,244 members

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, embarrassing 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.

 
GeneralRe: Case closed: NULLs are somehow valid in strings now? Pin
AspDotNetDev25-Aug-10 10:35
protectorAspDotNetDev25-Aug-10 10:35 
GeneralRe: Case closed: NULLs are somehow valid in strings now? Pin
PIEBALDconsult25-Aug-10 15:10
mvePIEBALDconsult25-Aug-10 15:10 
GeneralRe: Case closed: NULLs are somehow valid in strings now? Pin
Luc Pattyn25-Aug-10 16:59
sitebuilderLuc Pattyn25-Aug-10 16:59 
GeneralRe: Case closed: NULLs are somehow valid in strings now? Pin
PIEBALDconsult25-Aug-10 17:44
mvePIEBALDconsult25-Aug-10 17:44 
GeneralRe: Case closed: NULLs are somehow valid in strings now? Pin
CDP180226-Aug-10 1:02
CDP180226-Aug-10 1:02 
GeneralRe: Case closed: NULLs are somehow valid in strings now? Pin
Dave Calkins26-Aug-10 11:15
Dave Calkins26-Aug-10 11:15 
GeneralRe: Case closed: NULLs are somehow valid in strings now? Pin
Stephen Hewitt27-Aug-10 20:30
Stephen Hewitt27-Aug-10 20:30 
GeneralBeginner's Shame: Manually Draw Characters Pin
AspDotNetDev25-Aug-10 8:26
protectorAspDotNetDev25-Aug-10 8:26 
Back in my first year of programming, I was in a Visual Basic class, but I didn't like Visual Basic so I spent a good amount of my time coding in QuickBasic 4.5. In my infinite wisdom, I decided that it would be easier to use draw commands to show text on the screen rather than loading a font from the file system. So I created a function that took the top left coordinate of where to draw the string and it would draw the string... with Quick Basic draw commands. As I recall, there was a for loop to split the strings into individual characters. Then, there was a giant switch command on those characters (or was it a chained if statement... hmmm) to decide which draw commands to use. I then fine-tuned each letter so that large groups of pixels would be drawn as rectangles and individual pixels would be drawn with the command to set a single pixel. I was very impressed with my code, which I'm pretty sure was over 400 lines long! You can see it in action in my Tetris game at the link below, which also used only procedurally drawn textures (i.e., no image files were loaded):

Tetris (scroll to bottom of page)

I will see if I can find this chunk of code, so that you can be mesmerized by this astounding masterpiece. Blush | :O

GeneralRe: Beginner's Shame: Manually Draw Characters Pin
josda100025-Aug-10 9:34
josda100025-Aug-10 9:34 
GeneralRe: Beginner's Shame: Manually Draw Characters Pin
AspDotNetDev25-Aug-10 10:30
protectorAspDotNetDev25-Aug-10 10:30 
GeneralRe: Beginner's Shame: Manually Draw Characters Pin
Dave Calkins26-Aug-10 11:18
Dave Calkins26-Aug-10 11:18 
GeneralRe: Beginner's Shame: Manually Draw Characters Pin
Luc Pattyn25-Aug-10 11:34
sitebuilderLuc Pattyn25-Aug-10 11:34 
GeneralRe: Beginner's Shame: Manually Draw Characters Pin
AspDotNetDev25-Aug-10 12:52
protectorAspDotNetDev25-Aug-10 12:52 
GeneralRe: Beginner's Shame: Manually Draw Characters Pin
Luc Pattyn25-Aug-10 13:23
sitebuilderLuc Pattyn25-Aug-10 13:23 
GeneralRe: Beginner's Shame: Manually Draw Characters Pin
Baconbutty26-Aug-10 3:17
Baconbutty26-Aug-10 3:17 
GeneralRe: Beginner's Shame: Manually Draw Characters Pin
BillW3326-Aug-10 5:42
professionalBillW3326-Aug-10 5:42 
GeneralRe: Beginner's Shame: Manually Draw Characters Pin
Stefan_Lang31-Aug-10 6:42
Stefan_Lang31-Aug-10 6:42 
GeneralRe: Beginner's Shame: Manually Draw Characters Pin
AspDotNetDev31-Aug-10 8:19
protectorAspDotNetDev31-Aug-10 8:19 
GeneralThat may have been a mistake... PinPopular
OriginalGriff20-Aug-10 23:16
mveOriginalGriff20-Aug-10 23:16 
GeneralRe: That may have been a mistake... Pin
PIEBALDconsult21-Aug-10 4:22
mvePIEBALDconsult21-Aug-10 4:22 
GeneralRe: That may have been a mistake... Pin
OriginalGriff21-Aug-10 4:30
mveOriginalGriff21-Aug-10 4:30 
GeneralRe: That may have been a mistake... Pin
PIEBALDconsult21-Aug-10 4:39
mvePIEBALDconsult21-Aug-10 4:39 
GeneralRe: That may have been a mistake... Pin
OriginalGriff21-Aug-10 4:41
mveOriginalGriff21-Aug-10 4:41 
GeneralRe: That may have been a mistake... Pin
Jeroen De Dauw21-Aug-10 4:35
Jeroen De Dauw21-Aug-10 4:35 
GeneralRe: That may have been a mistake... Pin
OriginalGriff21-Aug-10 4:39
mveOriginalGriff21-Aug-10 4:39 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.