Click here to Skip to main content
15,913,944 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.

 
JokeRe: Does this count? Pin
Luc Pattyn5-Apr-08 5:03
sitebuilderLuc Pattyn5-Apr-08 5:03 
GeneralRe: Does this count? Pin
jamie5505-Apr-08 5:10
jamie5505-Apr-08 5:10 
GeneralRe: Does this count? Pin
Luc Pattyn5-Apr-08 5:28
sitebuilderLuc Pattyn5-Apr-08 5:28 
GeneralRe: Does this count? Pin
jamie5505-Apr-08 5:34
jamie5505-Apr-08 5:34 
GeneralRe: Does this count? Pin
Luc Pattyn5-Apr-08 6:08
sitebuilderLuc Pattyn5-Apr-08 6:08 
GeneralRe: Does this count? Pin
MarkB7777-Apr-08 21:18
MarkB7777-Apr-08 21:18 
GeneralRe: Does this count? Pin
zildjohn0110-Apr-08 17:04
zildjohn0110-Apr-08 17:04 
QuestionRe: Does this count? Pin
AJGermano2-Jun-08 9:57
AJGermano2-Jun-08 9:57 
This is a function of mine, could I get a critique on this? The reason for it being there is because exceptions coming out of the lower level library were not very descriptive or helpful to the guy trying to understand where the config was screwed so this layer was added to get some extra info into the exceptions that were coming up if files were missing and so on.

Public Shared Function GetInt(ByVal iniFile As String, ByVal sectionName As String, ByVal keyName As String) As Integer
Dim i As Integer
Dim ConfigFile As IniConfigSource
Dim ConfigSection As IConfig
Try
'check file exists
If (Not System.IO.File.Exists(iniFile)) Then
Throw New Exception("Config file does not exist: " & iniFile)
End If
'Access the file
ConfigFile = New IniConfigSource(iniFile)
'Get section
ConfigSection = ConfigFile.Configs(sectionName)
'check section exists
If (IsNothing(ConfigSection)) Then
Throw New Exception("Config section does not exist: " & iniFile & vbTab & sectionName)
End If
'get key and check it is a valid value
Try
i = ConfigSection.GetInt(keyName)
Catch ex As Exception
Throw New Exception("Exception attempting to access integer key: " & iniFile & vbTab & sectionName & vbTab & keyName)
End Try

Return i
Catch ex As Exception
'Exceptions come in here
Throw ex
End Try
End Function
GeneralRe: Does this count? Pin
PIEBALDconsult5-Apr-08 16:41
mvePIEBALDconsult5-Apr-08 16:41 
GeneralRe: Does this count? Pin
leppie5-Apr-08 20:46
leppie5-Apr-08 20:46 
GeneralRe: Does this count? Pin
Dan Neely7-Apr-08 2:30
Dan Neely7-Apr-08 2:30 
GeneralRe: Does this count? Pin
Stephen Hewitt7-Apr-08 15:35
Stephen Hewitt7-Apr-08 15:35 
GeneralRe: Does this count? Pin
PIEBALDconsult8-Apr-08 11:41
mvePIEBALDconsult8-Apr-08 11:41 
GeneralRe: Does this count? Pin
leppie9-Apr-08 0:24
leppie9-Apr-08 0:24 
GeneralRe: Does this count? Pin
PIEBALDconsult9-Apr-08 13:07
mvePIEBALDconsult9-Apr-08 13:07 
Jokeself-obfuscating Pin
Mr.PoorEnglish23-Apr-08 14:28
Mr.PoorEnglish23-Apr-08 14:28 
RantRecruiting Horror PinPopular
Philip Laureano4-Apr-08 5:38
Philip Laureano4-Apr-08 5:38 
GeneralRe: Recruiting Horror Pin
Pete O'Hanlon4-Apr-08 6:29
mvePete O'Hanlon4-Apr-08 6:29 
GeneralRe: Recruiting Horror [modified] Pin
Jason Lepack (LeppyR64)4-Apr-08 8:14
Jason Lepack (LeppyR64)4-Apr-08 8:14 
GeneralRe: Recruiting Horror [ATTENTION CP Admin: Please move this thread to the Lounge. Thanks!] Pin
Philip Laureano4-Apr-08 12:14
Philip Laureano4-Apr-08 12:14 
GeneralRe: Recruiting Horror Pin
darkelv4-Apr-08 13:52
darkelv4-Apr-08 13:52 
GeneralRe: Recruiting Horror Pin
Philip Laureano4-Apr-08 14:19
Philip Laureano4-Apr-08 14:19 
GeneralRe: Recruiting Horror Pin
darkelv4-Apr-08 16:55
darkelv4-Apr-08 16:55 
GeneralRe: Recruiting Horror Pin
Frank Kerrigan15-Apr-08 22:52
Frank Kerrigan15-Apr-08 22:52 
GeneralRe: Recruiting Horror Pin
Colin Angus Mackay5-Apr-08 5:43
Colin Angus Mackay5-Apr-08 5:43 

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.