Click here to Skip to main content

Articles by OriginalGriff (Articles: 2, Tip/Tricks: 35)

Articles: 2, Tip/Tricks: 35

RSS Feed

Average article rating: 4.94

DLLs & Assemblies

Timestamping assemblies with Build date and time.
Posted: 27 Apr 2012   Updated: 27 Apr 2012   Views: 2,955   Rating: 4.93/5    Votes: 4   Popularity: 2.95
Licence: The Code Project Open License (CPOL)      Bookmarked: 16   Downloaded: 91
It surprised me to find that there is no simple way to find out when a .NET assembly was built. You can work it out from the revision number (provided you only use the "standard" numbering scheme) but it's not obvious. This provides a simple way to timestamp individual assemblies at build time.

Interviews

A Coder Interview With Paul Griffin
Posted: 21 Sep 2011   Updated: 21 Sep 2011   Views: 9,257   Rating: 4.95/5    Votes: 34   Popularity: 7.57
Licence: The Code Project Open License (CPOL)      Bookmarked: 6   Downloaded: 0
Welcome to our continuing series of Code Project interviews in which we talk to developers about their backgrounds, projects, interests and pet peeves. In this installment we track down Code Project member Paul Griffin.
No blogs have been submitted.
No video articles have been posted.

Average tips rating: 4.78

Files and Folders

Where should I store my data? [Tip/Trick]
Posted: 20 Apr 2012   Updated: 20 Apr 2012   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: The Code Project Open License (CPOL)      Bookmarked: 12   Downloaded: 0
There is a common theme in development: storing data files in the application folder. This is bad, and wrong, and should be stamped on!

Miscellaneous

On-demand loading of images from a database [Tip/Trick]
Posted: 16 May 2012   Updated: 16 May 2012   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 0
Loading an image from a database isn't difficult, but it can waste time. If you are loading a large list of Images (or even thumbnails) from a DB but not using them immediately, then it can take some considerable time. Why not load them on demand instead?

ASP.NET

Supporting Development and Release web.config in ASP.NET [Tip/Trick]
Posted: 5 Jan 2011   Updated: 7 Jan 2011   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 6   Downloaded: 0
Supporting Development and Release web.config in ASP.NET
Showing a page of information at a time in a GridView [Tip/Trick]
Posted: 7 Feb 2011   Updated: 8 Feb 2011   Rating: 4.83/5    Votes: 8   Popularity: 4.36
Licence: The Code Project Open License (CPOL)      Bookmarked: 5   Downloaded: 0
When I add a log reader, the size of the log can be huge, and get very slow to view. This makes the GridView do all the work of paging the data for you.
A generic Image-From-DB class for ASP.NET [Tip/Trick]
Posted: 14 Aug 2011   Updated: 14 Aug 2011   Rating: 4.75/5    Votes: 4   Popularity: 2.81
Licence: The Code Project Open License (CPOL)      Bookmarked: 6   Downloaded: 0
Getting an image from a database and displaying it in an ASP.NET page is something we have to do quite often. Here is a generic class which does the job for you.

C#

Hiding inherited properties [Tip/Trick]
Posted: 1 Feb 2010   Updated: 2 Oct 2011   Rating: 4.62/5    Votes: 19   Popularity: 5.88
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 0
When you create a custom control (or any class), you inherit a lot of properties from the base class, most of which are fine. However, particularly in the case of a control derived from UserControl this brings a lot of properties which may not be relevant to the new control.
A C# implementation of AI MEMO 239, Item 169- Count the one bits in a number [Tip/Trick]
Posted: 12 Apr 2012   Updated: 12 Apr 2012   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
If you haven't heard of AI Memo 239, then you need to have a look at it. It is an MIT memo from 1972 containing "clever code" and such like. Some of it is absolutely beautiful!

.NET Framework

A safe way to get the user to check if the .NET framework is installed [Tip/Trick]
Posted: 28 Apr 2011   Updated: 29 Apr 2011   Rating: 4.50/5    Votes: 6   Popularity: 3.50
Licence: The Code Project Open License (CPOL)      Bookmarked: 9   Downloaded: 0
Sometimes, it is helpful to find out if the .NET framework is installed on a machine, or get a user to check over the phone. But, some people should not be allowed near Regedit or the windows folder, so here is a safe way to get them to check.
DateTime extension method to give Week number [Tip/Trick]
Posted: 14 Jul 2011   Updated: 14 Jul 2011   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 0
Strangely, the .NET DateTime does not provide a Week Number. This extension rectifies this.
Converting a List to a DataTable [Tip/Trick]
Posted: 15 Jul 2011   Updated: 18 Jul 2011   Rating: 4.97/5    Votes: 17   Popularity: 6.11
Licence: The Code Project Open License (CPOL)      Bookmarked: 15   Downloaded: 0
I wrote this because I was interested in a Q&A question which asked for exactly that. Since I quite often use DataTables to transfer data, and to display it for debugging I knocked up an extension method to do it.
Counting lines in a string [Tip/Trick]
Posted: 9 Jan 2012   Updated: 17 Jan 2012   Rating: 4.84/5    Votes: 21   Popularity: 6.40
Licence: The Code Project Open License (CPOL)      Bookmarked: 21   Downloaded: 0
It seems an obvious requirement, but the .NET framework will not count occurrences of a character in a string. It's easy to do, but which way is the quickest?

Date and Time

DateTime extensions for to make some simple tasks a little more readable [Tip/Trick]
Posted: 9 Mar 2012   Updated: 9 Mar 2012   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
Sometimes, you want to insert a date into a database as the start of the day, or you need to work out when the last Tuesday of the month is. These aren't difficult tasks, but the code can be difficult to follow. These extensions provide an easy-to-read way to do it.

Internet / Network

Retrieving IP and MAC addresses for a LAN [Tip/Trick]
Posted: 2 Apr 2012   Updated: 2 Apr 2012   Rating: 4.00/5    Votes: 4   Popularity: 2.26
Licence: The Code Project Open License (CPOL)      Bookmarked: 6   Downloaded: 0
Getting the IP and MAC for your PC is pretty simple, but what if you need those on your local network? It's not as simple as it sounds...

Macros and Add-ins

Making F1 do something useful in Visual Studio [Tip/Trick]
Posted: 10 Feb 2011   Updated: 12 Feb 2011   Rating: 5.00/5    Votes: 45   Popularity: 8.27
Licence: The Code Project Open License (CPOL)      Bookmarked: 28   Downloaded: 0
F1 in Visual Studio takes forever, and rarely comes up with anything useful. Replace it with a Google MSDN search!

Programming Tips

Visual Studio Tasks List [Tip/Trick]
Posted: 5 Jul 2010   Updated: 5 Jul 2010   Rating: 5.00/5    Votes: 13   Popularity: 5.57
Licence: The Code Project Open License (CPOL)      Bookmarked: 6   Downloaded: 0
Marking code you need to return to later
Following object inheritance [Tip/Trick]
Posted: 20 Jul 2010   Updated: 23 Jul 2010   Rating: 4.29/5    Votes: 7   Popularity: 3.62
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
Sometimes, it helps to know the complete inheritance of an object or type in order to understand what can be done with it. This Tip presents a simple C# class to access the information
Human readable strings for enum elements [Tip/Trick]
Posted: 12 Aug 2010   Updated: 12 Aug 2010   Rating: 4.78/5    Votes: 8   Popularity: 4.26
Licence: The Code Project Open License (CPOL)      Bookmarked: 8   Downloaded: 0
Using enum really helps readability, but the values within the enum must understandably conform to the rules for variables names. This is fine until you need to display enum values to the user. This tip shows you how to associate and access a human readable string with each enum element.
Converting numbers to the word equivalent. [Tip/Trick]
Posted: 19 Aug 2010   Updated: 22 Aug 2010   Rating: 4.99/5    Votes: 50   Popularity: 8.47
Licence: The Code Project Open License (CPOL)      Bookmarked: 7   Downloaded: 0
If your tutor asks you to convert numbers to words (i.e. 565 to a string "Five hundred and sixty-five") then you are not alone! Here is the simplest, most foolproof way to do it.
Converting dates to the Roman equivalent [Tip/Trick]
Posted: 26 Aug 2010   Updated: 26 Aug 2010   Rating: 4.67/5    Votes: 3   Popularity: 2.23
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
If your tutor asks you to convert years to the Roman equivalent, (e.g. 2010 to MMX) then you are not alone! Here is the simplest, most foolproof way to do it!
Getting the last error in a custom error page [Tip/Trick]
Posted: 3 Jan 2011   Updated: 5 Jan 2011   Rating: 4.33/5    Votes: 3   Popularity: 2.07
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
When you provide a custom error handler page, it is useful to be able to log what caused the problem, so that you can fix it. Server.GetLastError() will not return anything in the page, though...
Sending an Email in C# with or without attachments: generic routine. [Tip/Trick]
Posted: 2 Mar 2011   Updated: 3 Mar 2011   Rating: 4.90/5    Votes: 33   Popularity: 7.41
Licence: The Code Project Open License (CPOL)      Bookmarked: 30   Downloaded: 0
Sending an email is not a real problem, but I am fed up with answering the question "How do I do it?" in Q&A . So, here is the generic routine I use to send an email, with or without attachments, so I can just point people at it!
Password Storage: How to do it. [Tip/Trick]
Posted: 25 Apr 2011   Updated: 29 Apr 2011   Rating: 4.87/5    Votes: 61   Popularity: 8.74
Licence: The Code Project Open License (CPOL)      Bookmarked: 69   Downloaded: 0
A lot of people are asking how to encrypt passwords, and I have answered "Don't do it" too many times. This Tip describes how to store a password in your database, and why.
Adding a File Open dialog to a PropertyGrid control [Tip/Trick]
Posted: 8 May 2011   Updated: 8 May 2011   Rating: 3.88/5    Votes: 7   Popularity: 3.27
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
The Visual Studio Property pane is a control, which can be used in WinForms like any other, and it provides a simple, easy to use property editor for your classes. However, it is not obvious how to get it to open a browse dialog for a file path property.
A simple way to ensure only one instance is running. [Tip/Trick]
Posted: 31 Jul 2011   Updated: 31 Jul 2011   Rating: 4.38/5    Votes: 6   Popularity: 3.45
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 0
Sometimes, you want to only run a single instance of an application - this makes it very simple to do. An Extension method that checks, switches and kills as necessary.
A FileDialog.Filter generator for all supported images [Tip/Trick]
Posted: 16 Sep 2011   Updated: 18 Sep 2011   Rating: 5.00/5    Votes: 6   Popularity: 3.89
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
Recently, I had to write a quick app to load images into a database, and wanted to restrict the file type to just images. You can do this with the OpenFileDialog.Filter property, but it is a pain working out what file extensions to permit.
Adding your items to Visual Studio default files [Tip/Trick]
Posted: 17 Jul 2010   Updated: 9 Oct 2011   Rating: 4.95/5    Votes: 16   Popularity: 5.96
Licence: The Code Project Open License (CPOL)      Bookmarked: 11   Downloaded: 0
Adding your items to Visual Studio default files
How to get a basic WCF service working on a web hosting service [Tip/Trick]
Posted: 10 Oct 2011   Updated: 10 Oct 2011   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
Originally, I was going to create a simple Web Service using an ASMX file, but that appears to have been removed from Visual Studio 2010 - or at least I couldn't find it easily. So, WCF it is! I love the way technology lasts, don't you? Right, so I know nothing about WCF, tutorials here I come...
Setting a default value for C# Auto-implemented properties [Tip/Trick]
Posted: 4 Jan 2012   Updated: 7 Jan 2012   Rating: 4.80/5    Votes: 10   Popularity: 5.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 9   Downloaded: 0
One of the things missing from C# is the ability to set a default value of auto-implemented properties. You can set a default for variable backed properties, and you can set them for the designer. This does it for you.
XmlSerializer doesn't work with Dictionaries. Oh, and it has problems with KeyValuePairs too. [Tip/Trick]
Posted: 12 Jan 2012   Updated: 13 Jan 2012   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
XmlSerializer complains if you try to serialize anything which implements IDictionary. This provides a way of serialising them which (if not capable of restoring the exact dictionary content) restores the actual field contents in a new dictionary.
Using Visual Studio to find a database connection string [Tip/Trick]
Posted: 14 Jan 2012   Updated: 14 Jan 2012   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
Visual Studio has a Server Explorer built in to handle database access - it can lalso generate database connection strings ready for saving in application config files.
Using human readable enum values in a ComboBox [Tip/Trick]
Posted: 24 Jan 2012   Updated: 31 Jan 2012   Rating: 4.88/5    Votes: 12   Popularity: 4.92
Licence: The Code Project Open License (CPOL)      Bookmarked: 11   Downloaded: 0
Sometimes, all I want is a control which allows the user to select one of several options, and tell me which one - ideally as a handy enum value. This shows a simple method which allows this.

Tools and IDE

Adding a Snippet to Visual Studio [Tip/Trick]
Posted: 16 Nov 2011   Updated: 20 Nov 2011   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: The Code Project Open License (CPOL)      Bookmarked: 5   Downloaded: 0
It is really easy to do once you get the idea how, but the Microsoft documentation could be a lot clearer - so here is a simple sample with full instructions.

Uncategorised Quick Answers

Formatting a DateTime for display - format string description [Tip/Trick]
Posted: 26 Jan 2010   Updated: 26 Jan 2010   Rating: 4.89/5    Votes: 8   Popularity: 4.40
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 0
Normally I keep information like this in a text file, in a folder called "How To Do It", as it is handy to have around, and too much work to search for each time I need it, but too much detail for me to remember if I don't use it often. Formatting a DateTime for display:DateTime.ToString()...
Disable the Close box on a form [Tip/Trick]
Posted: 26 Jan 2010   Updated: 18 Feb 2012   Rating: 4.96/5    Votes: 19   Popularity: 6.34
Licence: The Code Project Open License (CPOL)      Bookmarked: 13   Downloaded: 0
Disable the Close box on a form

Code Generation

Create Visual Studio forms for items you frequently use [Tip/Trick]
Posted: 8 Jan 2012   Updated: 8 Jan 2012   Rating: 4.63/5    Votes: 8   Popularity: 4.39
Licence: The Code Project Open License (CPOL)      Bookmarked: 7   Downloaded: 0
Quite often, when I create a new form, the first thing I need to add is an OK and a Cancel button. Recently, I realized that I could create templates for these in Visual Studio and save some time.

OriginalGriff



United Kingdom United Kingdom

Member

Born at an early age, he grew older. At the same time, his hair grew longer, and was tied up behind his head.
Has problems spelling the word "the".
Invented the portable cat-flap.
Currently, has not died yet. Or has he?


Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 27 May 2012
Copyright © CodeProject, 1999-2012
All Rights Reserved. Terms of Use
Layout: fixed | fluid