Click here to Skip to main content
15,560,584 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: Why use the correct exception type? Pin
RickZeeland23-Mar-18 21:00
mveRickZeeland23-Mar-18 21:00 
GeneralRe: Why use the correct exception type? Pin
Jörgen Andersson24-Mar-18 23:11
professionalJörgen Andersson24-Mar-18 23:11 
GeneralRe: Why use the correct exception type? Pin
Chris Maunder25-Mar-18 1:06
cofounderChris Maunder25-Mar-18 1:06 
GeneralRe: Why use the correct exception type? Pin
Jörgen Andersson25-Mar-18 4:23
professionalJörgen Andersson25-Mar-18 4:23 
GeneralRe: Why use the correct exception type? Pin
Chris Maunder25-Mar-18 12:49
cofounderChris Maunder25-Mar-18 12:49 
GeneralRe: Why use the correct exception type? Pin
Jörgen Andersson25-Mar-18 12:54
professionalJörgen Andersson25-Mar-18 12:54 
GeneralRe: Why use the correct exception type? Pin
Chris Maunder25-Mar-18 13:07
cofounderChris Maunder25-Mar-18 13:07 
GeneralRe: Why use the correct exception type? Pin
Sentenryu29-Mar-18 2:17
Sentenryu29-Mar-18 2:17 
Extensions aren't trustworthy, nothing guarantees the file is in the format it says it's on. The developer himself might have changed the extension to better suit his application, as evidenced by the shitload of formats that are just XML files, compressed or not, with a different extension (like SVG).

As for the first few bytes, many formats have common prefixes (there's 2 or 3 exemples on the list you linked, but there's more), some of them don't even require the prefix to be present and others (like SVG) are encoded as text that can have yet another prefix (BOM).

It's sad, but we can't trust the format markers when dealing with multiple formats.

GeneralRe: Why use the correct exception type? Pin
Slacker00726-Mar-18 2:18
professionalSlacker00726-Mar-18 2:18 
GeneralRe: Why use the correct exception type? Pin
Bernhard Hiller26-Mar-18 3:04
Bernhard Hiller26-Mar-18 3:04 
GeneralRe: Why use the correct exception type? Pin
F-ES Sitecore26-Mar-18 4:22
professionalF-ES Sitecore26-Mar-18 4:22 
GeneralRe: Why use the correct exception type? Pin
Slacker00726-Mar-18 7:51
professionalSlacker00726-Mar-18 7:51 
GeneralRe: Why use the correct exception type? Pin
Tim Carmichael27-Mar-18 7:44
Tim Carmichael27-Mar-18 7:44 
GeneralRe: Why use the correct exception type? Pin
S Douglas28-Mar-18 10:10
professionalS Douglas28-Mar-18 10:10 
GeneralRe: Why use the correct exception type? Pin
Kirill Illenseer28-Mar-18 23:40
Kirill Illenseer28-Mar-18 23:40 
GeneralRe: Why use the correct exception type? Pin
Sentenryu29-Mar-18 2:28
Sentenryu29-Mar-18 2:28 
GeneralRe: Why use the correct exception type? Pin
Christiaan van Bergen3-Apr-18 14:28
professionalChristiaan van Bergen3-Apr-18 14:28 
GeneralInteresting / strange code picked up from pluralsight training (functional programming) Pin
raddevus18-Mar-18 14:19
mvaraddevus18-Mar-18 14:19 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Sander Rossel18-Mar-18 22:15
professionalSander Rossel18-Mar-18 22:15 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
raddevus19-Mar-18 3:27
mvaraddevus19-Mar-18 3:27 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Richard Deeming19-Mar-18 3:46
mveRichard Deeming19-Mar-18 3:46 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
raddevus19-Mar-18 4:00
mvaraddevus19-Mar-18 4:00 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
raddevus19-Mar-18 4:08
mvaraddevus19-Mar-18 4:08 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
Sander Rossel19-Mar-18 8:17
professionalSander Rossel19-Mar-18 8:17 
GeneralRe: Interesting / strange code picked up from pluralsight training (functional programming) Pin
BillWoodruff19-Mar-18 18:54
professionalBillWoodruff19-Mar-18 18:54 

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.