Click here to Skip to main content
15,891,136 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: Try to find something dumber if you can... Pin
David Skelly5-Aug-09 6:14
David Skelly5-Aug-09 6:14 
JokeRe: Try to find something dumber if you can... Pin
Super Lloyd5-Aug-09 17:29
Super Lloyd5-Aug-09 17:29 
GeneralRe: Try to find something dumber if you can... Pin
Edbert P6-Aug-09 19:49
Edbert P6-Aug-09 19:49 
GeneralRe: Try to find something dumber if you can... Pin
Paw Jershauge6-Aug-09 20:57
Paw Jershauge6-Aug-09 20:57 
GeneralRe: Try to find something dumber if you can... Pin
supercat97-Aug-09 8:09
supercat97-Aug-09 8:09 
GeneralRe: Try to find something dumber if you can... Pin
Edbert P9-Aug-09 16:27
Edbert P9-Aug-09 16:27 
GeneralEnumerate Websites in Vista Pin
costas08114-Aug-09 4:14
costas08114-Aug-09 4:14 
GeneralNot a horror, but still ugly Pin
codemunkeh3-Aug-09 17:38
codemunkeh3-Aug-09 17:38 
Just wrote this 5 minutes ago...

Got a panel that displays a bunch of thumbnails of images. You can highlight these by mousing over them.

In the MouseMove event for the panel, I had this...

queueHighlight determinines which slide is currently highlighted.
queueOffset determines the start position of what is visible.
slideHovered is calculated from MouseEventArgs.X based on the thumbnail width.

if ((slideHovered + queueOffset) != queueHighlight)
{
	if (queueHighlight != (slideHovered + queueOffset))
	{
		queueHighlight = (ushort)(slideHovered + queueOffset);
		forceRender(HymnMgrTarget.QueueList); // Redraw the panel
	}
	else
	{
		queueHighlight = (ushort)(slideHovered + queueOffset);
	}
}


I added the outer block when I first wrote the method. When tweaking it just then, I managed to add the inner if block, and only when I ran it and noticed that nothing had changed, did I realise my error.

this.Edit(reason:="oops");


Ninja (the Nerd)

Confused? You will be...

GeneralRe: Not a horror, but still ugly Pin
dasli5-Aug-09 0:10
dasli5-Aug-09 0:10 
GeneralRe: Not a horror, but still ugly Pin
Michael Bookatz5-Aug-09 1:08
Michael Bookatz5-Aug-09 1:08 
GeneralRe: Not a horror, but still ugly Pin
Stryder_15-Aug-09 5:05
Stryder_15-Aug-09 5:05 
GeneralA Junior Developer Learns that Seniority Doesn't Mean Smarter Pin
Kevin McFarlane31-Jul-09 4:41
Kevin McFarlane31-Jul-09 4:41 
GeneralRe: A Junior Developer Learns that Seniority Doesn't Mean Smarter Pin
PIEBALDconsult31-Jul-09 5:04
mvePIEBALDconsult31-Jul-09 5:04 
GeneralRe: A Junior Developer Learns that Seniority Doesn't Mean Smarter Pin
Rick York3-Aug-09 10:11
mveRick York3-Aug-09 10:11 
GeneralRe: A Junior Developer Learns that Seniority Doesn't Mean Smarter Pin
Jeroen De Dauw31-Jul-09 13:42
Jeroen De Dauw31-Jul-09 13:42 
JokeRe: A Junior Developer Learns that Seniority Doesn't Mean Smarter Pin
Super Lloyd1-Aug-09 23:49
Super Lloyd1-Aug-09 23:49 
GeneralRe: A Junior Developer Learns that Seniority Doesn't Mean Smarter Pin
RugbyLeague3-Aug-09 0:21
RugbyLeague3-Aug-09 0:21 
GeneralRe: A Junior Developer Learns that Seniority Doesn't Mean Smarter Pin
Fatbuddha 13-Aug-09 1:15
Fatbuddha 13-Aug-09 1:15 
GeneralI don't want to know the code behind this... PinPopular
zlezj31-Jul-09 3:16
zlezj31-Jul-09 3:16 
GeneralFunny labels Pin
supercat931-Jul-09 7:23
supercat931-Jul-09 7:23 
GeneralRe: I don't want to know the code behind this... Pin
Fatbuddha 13-Aug-09 1:14
Fatbuddha 13-Aug-09 1:14 
GeneralRe: I don't want to know the code behind this... Pin
Jeremy Tierman13-Aug-09 3:41
Jeremy Tierman13-Aug-09 3:41 
GeneralOpenStreetMap SlippyMap - MediaWiki extension Pin
Jeroen De Dauw26-Jul-09 12:44
Jeroen De Dauw26-Jul-09 12:44 
GeneralRe: OpenStreetMap SlippyMap - MediaWiki extension Pin
Corinna John1-Aug-09 17:10
Corinna John1-Aug-09 17:10 
GeneralWhat happens when it fails... PinPopular
OriginalGriff23-Jul-09 5:00
mveOriginalGriff23-Jul-09 5:00 

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.