4 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for Momerath

Quite commonly I see people using one of the Parse routines then catching the exception thrown if the parse fails. This is, in general, a bad practice as throwing an exception is slower than using the corresponding TryParse method. This short snippet shows the routines that I used to measure …

Member Avatar for Mickey_1
0
556
Member Avatar for pritaeas

The following code snippet shows how you can parse a DSN (Data Source Name). Why is it useful? You can now pass a single DSN parameter to your database wrapper class' constructor (instead of five separate parameters), and tear it apart into the components you need. The password and port …

1
1K
Member Avatar for chriswelborn

I just wanted to show the basic usage of docopt, a module that makes parsing command-line arguments so much easier. I'm not affiliated with the creators of docopt, but I'm certainly thankful for their work and happy to post this little snippet. I will point you to [docopt.org](http://docopt.org) for more …

1
3K
Member Avatar for G_Waddell

Hi All, In my opinion, this is the best way to read in text from a csv file. Take for example if you are importing addresses: "1 Main Street","SmallTown","SmallCounty" The above is fine and easy to parse in BUT what if an address like this was entered: "App 1A, Tall …

Member Avatar for Nutster
1
5K

The End.