Click here to Skip to main content
15,883,278 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: Yes, I know it's 2016 Pin
aaryan4227-May-16 21:12
aaryan4227-May-16 21:12 
GeneralRe: Yes, I know it's 2016 Pin
PIEBALDconsult28-May-16 7:15
mvePIEBALDconsult28-May-16 7:15 
GeneralRe: Yes, I know it's 2016 Pin
Rob Grainger14-Jun-16 0:35
Rob Grainger14-Jun-16 0:35 
GeneralStopwatch To pause App ???? Pin
Kevin Marois13-May-16 7:51
professionalKevin Marois13-May-16 7:51 
JokeRe: Stopwatch To pause App ???? Pin
User 1106097913-May-16 8:28
User 1106097913-May-16 8:28 
GeneralRe: Stopwatch To pause App ???? Pin
Brisingr Aerowing13-May-16 14:49
professionalBrisingr Aerowing13-May-16 14:49 
GeneralRe: Stopwatch To pause App ???? Pin
PIEBALDconsult13-May-16 17:51
mvePIEBALDconsult13-May-16 17:51 
GeneralRe: Stopwatch To pause App ???? Pin
glen20518-May-16 6:15
glen20518-May-16 6:15 
I found almost this exact code in the splashscreen of an app I inherited responsibility for....

"The app takes too long to start" was the complaint from the customer. In fact the splashscreen sat there burning up CPU cycles as fast as possible performing "sw.Elapsed.TotalMilliseconds < 10000". Then once the 10 seconds had elapsed it closed the splashscreen and *then* started all the application init tasks (DB connection, load config etc...)

I replaced the stopwatch with:
- a background thread to perform the app init (which normally took about 7 seconds)
- a thead.sleep to "pad" the splashscreen's lifespan up to 10 seconds

Apparently a 10-second splashscreen was desired, but cramming the app init into that 10 seconds cured the customer's "slow app" nicely.
GeneralRe: Stopwatch To pause App ???? Pin
Peter_in_278018-May-16 12:35
professionalPeter_in_278018-May-16 12:35 
GeneralRe: Stopwatch To pause App ???? Pin
Nathan Minier19-May-16 1:21
professionalNathan Minier19-May-16 1:21 
GeneralAccess to SQL Pin
TenmanS1411-May-16 4:32
TenmanS1411-May-16 4:32 
GeneralRe: Access to SQL Pin
Tim Carmichael11-May-16 4:53
Tim Carmichael11-May-16 4:53 
GeneralRe: Access to SQL Pin
TenmanS1411-May-16 4:56
TenmanS1411-May-16 4:56 
GeneralRe: Access to SQL Pin
Tim Carmichael11-May-16 4:57
Tim Carmichael11-May-16 4:57 
GeneralRe: Access to SQL Pin
Eddy Vluggen11-May-16 7:07
professionalEddy Vluggen11-May-16 7:07 
GeneralRe: Access to SQL Pin
Robert g Blair11-May-16 14:49
Robert g Blair11-May-16 14:49 
GeneralRe: Access to SQL Pin
TenmanS1412-May-16 0:26
TenmanS1412-May-16 0:26 
GeneralRe: Access to SQL Pin
Chris Quinn12-May-16 0:37
Chris Quinn12-May-16 0:37 
GeneralRe: Access to SQL Pin
Robert g Blair12-May-16 11:49
Robert g Blair12-May-16 11:49 
GeneralRe: Access to SQL Pin
Bernhard Hiller11-May-16 20:42
Bernhard Hiller11-May-16 20:42 
GeneralRe: Access to SQL Pin
TenmanS1412-May-16 0:23
TenmanS1412-May-16 0:23 
GeneralRe: Access to SQL Pin
Robert g Blair12-May-16 12:03
Robert g Blair12-May-16 12:03 
GeneralRe: Access to SQL Pin
TenmanS1412-May-16 21:43
TenmanS1412-May-16 21:43 
GeneralRe: Access to SQL Pin
David A. Gray1-Jul-16 21:30
David A. Gray1-Jul-16 21:30 
RantHow difficult is it really? Pin
PIEBALDconsult10-May-16 14:22
mvePIEBALDconsult10-May-16 14:22 

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.