Click here to Skip to main content

Articles by John Simmons / outlaw programmer (Articles: 51, Tip/Tricks: 54)

Articles: 51, Tip/Tricks: 54

RSS Feed

Average article rating: 4.25

Clipboard

Copying a DIB to the Clipboard
Posted: 16 Oct 2001   Updated: 15 Apr 2008   Views: 128,465   Rating: 3.71/5    Votes: 46   Popularity: 6.17
Licence: The Code Project Open License (CPOL)      Bookmarked: 52   Downloaded: 956
Helps with copying a device independant bitmap to the clipboard.

Dialogs and Windows

Using CResizablePage In a CFormView
Posted: 26 Nov 2000   Updated: 16 Apr 2001   Views: 82,152   Rating: 2.98/5    Votes: 21   Popularity: 3.94
Licence: The Code Project Open License (CPOL)      Bookmarked: 26   Downloaded: 1,517
Technique for utilizing a CResizablePage in a CFormView-derived class
Wizard Form Implementation
Posted: 14 Dec 2008   Updated: 24 Jun 2010   Views: 56,016   Rating: 4.84/5    Votes: 49   Popularity: 8.19
Licence: The Code Project Open License (CPOL)      Bookmarked: 155   Downloaded: 569
Create a dynamically resizable wizard form
CResizableFormView
Posted: 28 Nov 2000   Updated: 6 Jun 2001   Views: 146,776   Rating: 3.36/5    Votes: 37   Popularity: 5.27
Licence: Not specified      Bookmarked: 42   Downloaded: 1,880
Extension of Paolo Messina's CResizableDialog concept
Enumerate Controls In a Dialog Box or FormView
Posted: 9 Aug 2005   Updated: 9 Aug 2005   Views: 42,844   Rating: 3.48/5    Votes: 24   Popularity: 4.80
Licence: Not specified      Bookmarked: 22   Downloaded: 475
Enumerate all controls in a dialog box or form view.

Document / View

Tracking The Mouse In A View
Posted: 21 Jan 2001   Updated: 7 May 2001   Views: 81,980   Rating: 2.98/5    Votes: 29   Popularity: 4.36
Licence: The Code Project Open License (CPOL)      Bookmarked: 35   Downloaded: 1,357
Track a mouse click, even in a scrolled view

Files and Folders

XML Application Profile Class
Posted: 27 Jan 2007   Updated: 27 Jan 2007   Views: 38,464   Rating: 4.56/5    Votes: 23   Popularity: 6.20
Licence: The Code Project Open License (CPOL)      Bookmarked: 40   Downloaded: 425
Implement XML application profiles that are similar (but not too similar) to using INI files
FileSystemWatcher - Pure Chaos (Part 1 of 2)
Posted: 14 Feb 2010   Updated: 17 Dec 2010   Views: 56,652   Rating: 4.91/5    Votes: 74   Popularity: 9.18
Licence: The Code Project Open License (CPOL)      Bookmarked: 214   Downloaded: 3,238
How to get all the events you want - whether you need them or not.
FileSystemWatcher - Pure Chaos (Part 2 of 2)
Posted: 14 Feb 2010   Updated: 17 Dec 2010   Views: 38,298   Rating: 4.90/5    Votes: 59   Popularity: 8.67
Licence: The Code Project Open License (CPOL)      Bookmarked: 121   Downloaded: 0
Use the demo application (from Part 1) to observe events posted when creating files in the watched folder
Synchronicity - A Folder Synchronizing Application
Posted: 5 Feb 2011   Updated: 7 Feb 2011   Views: 11,917   Rating: 4.82/5    Votes: 18   Popularity: 6.05
Licence: The Code Project Open License (CPOL)      Bookmarked: 75   Downloaded: 527
Windows service for synchronizing folders

List Controls

CListCtrl - one of the Blonde classes in MFC
Posted: 8 Dec 2002   Updated: 8 Dec 2002   Views: 164,481   Rating: 3.42/5    Votes: 44   Popularity: 5.62
Licence: Not specified      Bookmarked: 29   Downloaded: 0
Some dialogbox code to give the Blonde a clue

Menus

Modifying the System Menu
Posted: 26 Jan 2007   Updated: 26 Jan 2007   Views: 53,320   Rating: 3.14/5    Votes: 61   Popularity: 5.61
Licence: Not specified      Bookmarked: 35   Downloaded: 525
Add menu items to, and learn how to handle the system menu
Dynamically Build Your Menu and/or Toolbar
Posted: 12 May 2005   Updated: 12 May 2005   Views: 79,255   Rating: 3.03/5    Votes: 36   Popularity: 4.71
Licence: Not specified      Bookmarked: 33   Downloaded: 0
Build a menu and/or a toolbar dynamically without using resource files (well, almost).

Miscellaneous

CodeProject Article Scraping
Posted: 13 Oct 2008   Updated: 11 Dec 2010   Views: 45,384   Rating: 4.47/5    Votes: 46   Popularity: 7.43
Licence: The Code Project Open License (CPOL)      Bookmarked: 83   Downloaded: 199
Scrape the My Articles page here on CodeProject to keep an eye on your articles.
CodeProject Article Scraper, Revisited
Posted: 11 Dec 2010   Updated: 13 Nov 2011   Views: 27,680   Rating: 4.94/5    Votes: 45   Popularity: 8.17
Licence: The Code Project Open License (CPOL)      Bookmarked: 49   Downloaded: 700
New and improved! Keep an eye on your CodeProject articles and reputation without having to log onto CP.
Blinking Cells For Chris Maunder's Grid Control
Posted: 13 May 2005   Updated: 13 May 2005   Views: 41,516   Rating: 3.15/5    Votes: 25   Popularity: 4.41
Licence: The Code Project Open License (CPOL)      Bookmarked: 10   Downloaded: 529
Create blinking cells for Chris Maunder's grid control.
User Login For WinForm Applications
Posted: 2 Oct 2008   Updated: 2 Oct 2008   Views: 48,113   Rating: 4.43/5    Votes: 55   Popularity: 7.69
Licence: The Code Project Open License (CPOL)      Bookmarked: 113   Downloaded: 1,087
Discusses windows authentication and application-specific authentication for WinForm applications

Printing

Keep Your InkJet Print Head Clean
Posted: 4 Jan 2009   Updated: 4 Jan 2009   Views: 24,604   Rating: 4.87/5    Votes: 21   Popularity: 6.43
Licence: The Code Project Open License (CPOL)      Bookmarked: 43   Downloaded: 282
A utility that you can use to "exercise" your inkjet printer without wasting a lot of ink or paper

Web Services

How I Optimized my Silverlight Asynchronous Web Service Consumption
Posted: 26 May 2010   Updated: 27 May 2010   Views: 18,467   Rating: 4.95/5    Votes: 16   Popularity: 5.96
Licence: The Code Project Open License (CPOL)      Bookmarked: 18   Downloaded: 0
With some earlier design forethought, I was able to inject some significant code optimization into a current project.

Windows Mobile

Scrolling Property Page in PocketPC 2002
Posted: 22 Dec 2003   Updated: 22 Dec 2003   Views: 65,534   Rating: 3.51/5    Votes: 18   Popularity: 4.41
Licence: The Code Project Open License (CPOL)      Bookmarked: 23   Downloaded: 0
Add a scrollbar to a property page when the SIP is displayed.

GDI+

Determining Ideal Text Color Based on Specified Background Color
Posted: 28 Nov 2006   Updated: 8 May 2007   Views: 70,876   Rating: 4.76/5    Votes: 91   Popularity: 9.32
Licence: Not specified      Bookmarked: 93   Downloaded: 0
A method for programatically determining the appropriate foreground color based on the specified background color

General Graphics

Replacing Part of an Existing Bitmap
Posted: 28 Jul 2006   Updated: 28 Jul 2006   Views: 33,143   Rating: 3.73/5    Votes: 31   Popularity: 5.57
Licence: The Code Project Open License (CPOL)      Bookmarked: 23   Downloaded: 235
Copy a bitmap over a portion of another bitmap
Render Text On A Bitmap (and other stuff)
Posted: 28 Sep 2008   Updated: 28 Sep 2008   Views: 20,717   Rating: 4.43/5    Votes: 27   Popularity: 6.35
Licence: The Code Project Open License (CPOL)      Bookmarked: 39   Downloaded: 268
Put text on a bitmap, make your winform app go full-screen, and say hello to some simple LINQ code.

C / C++ Language

Formatting Behavior in COleDateTime for MFC8
Posted: 3 Aug 2006   Updated: 3 Aug 2006   Views: 14,837   Rating: 3.67/5    Votes: 11   Popularity: 3.82
Licence: Not specified      Bookmarked: 10   Downloaded: 81
A passable workaround for the COleDateTime formatting behavior in MFC8.
Using CodeProject - A Day In the Life of an Application - Part 3 of 5
Posted: 27 Jan 2007   Updated: 27 Jan 2007   Views: 18,603   Rating: 4.63/5    Votes: 21   Popularity: 6.12
Licence: The Code Project Open License (CPOL)      Bookmarked: 15   Downloaded: 220
The right way to code using CodeProject for occasional support
Using CodeProject - A Day In the Life of an Application - Part 1 of 5
Posted: 27 Jan 2007   Updated: 15 Apr 2008   Views: 34,888   Rating: 4.77/5    Votes: 42   Popularity: 7.74
Licence: The Code Project Open License (CPOL)      Bookmarked: 86   Downloaded: 324
The right way to code using CodeProject for occasional support
Using CodeProject - A Day In the Life of an Application - Part 2 of 5
Posted: 27 Jan 2007   Updated: 15 Apr 2008   Views: 21,149   Rating: 4.80/5    Votes: 24   Popularity: 6.63
Licence: The Code Project Open License (CPOL)      Bookmarked: 22   Downloaded: 282
The right way to code using CodeProject for occasional support
Using CodeProject - A Day In the Life of an Application - Part 4 of 5
Posted: 27 Jan 2007   Updated: 15 Apr 2008   Views: 16,736   Rating: 4.55/5    Votes: 20   Popularity: 5.92
Licence: The Code Project Open License (CPOL)      Bookmarked: 16   Downloaded: 227
The right way to code using CodeProject for occasional support
Using CodeProject - A Day In the Life of an Application - Part 5 of 5
Posted: 27 Jan 2007   Updated: 12 Jan 2010   Views: 27,318   Rating: 4.65/5    Votes: 22   Popularity: 6.24
Licence: The Code Project Open License (CPOL)      Bookmarked: 25   Downloaded: 268
The right way to code using CodeProject for occasional support

C#

Reputationator - CP Narcissists Rejoice! Part 2 of 4
Posted: 14 Aug 2011   Updated: 20 Aug 2011   Views: 5,018   Rating: 4.81/5    Votes: 16   Popularity: 5.79
Licence: The Code Project Open License (CPOL)      Bookmarked: 9   Downloaded: 123
Keep more detailed track of your Codeproject reputation points.
Reputationator - CP Narcissists Rejoice! Part 3 of 4
Posted: 14 Aug 2011   Updated: 20 Aug 2011   Views: 7,806   Rating: 4.83/5    Votes: 22   Popularity: 6.46
Licence: The Code Project Open License (CPOL)      Bookmarked: 19   Downloaded: 297
Keep more detailed track of your Codeproject reputation points.
Reputationator - CP Narcissists Rejoice! Part 4 of 4
Posted: 20 Aug 2011   Updated: 30 Aug 2011   Views: 5,198   Rating: 4.81/5    Votes: 7   Popularity: 4.05
Licence: The Code Project Open License (CPOL)      Bookmarked: 9   Downloaded: 165
Keep more detailed track of your Codeproject reputation points.
Reputationator - CP Narcissists Rejoice! Part 1 of 4
Posted: 14 Aug 2011   Updated: 30 Aug 2011   Views: 10,095   Rating: 4.93/5    Votes: 30   Popularity: 7.26
Licence: The Code Project Open License (CPOL)      Bookmarked: 32   Downloaded: 295
Keep more detailed track of your Codeproject reputation points.
Overriding App.Config Settings for Multiple Objects
Posted: 17 May 2008   Updated: 17 May 2008   Views: 26,031   Rating: 4.30/5    Votes: 18   Popularity: 5.39
Licence: The Code Project Open License (CPOL)      Bookmarked: 27   Downloaded: 105
One method for loading common and object-specific data from your app.config file.
Share User Settings Between Applications
Posted: 17 Dec 2008   Updated: 17 Dec 2008   Views: 20,800   Rating: 4.73/5    Votes: 9   Popularity: 4.52
Licence: The Code Project Open License (CPOL)      Bookmarked: 41   Downloaded: 154
A not-so-dotNet way to allow multiple programs to share a single settings file

VBScript

Determining The Ideal Text Color Based on Specified Background Color (For VBScript)
Posted: 7 May 2007   Updated: 7 May 2007   Views: 15,884   Rating: 3.57/5    Votes: 9   Popularity: 3.40
Licence: The Code Project Open License (CPOL)      Bookmarked: 16   Downloaded: 0
The VBScript version of my C# article about the very same thing

Game Development

Anagrams - A Word Game in C#
Posted: 7 Apr 2008   Updated: 7 Apr 2008   Views: 54,341   Rating: 4.60/5    Votes: 31   Popularity: 6.85
Licence: The Code Project Open License (CPOL)      Bookmarked: 37   Downloaded: 936
The classic word game using words and letter scores allowed in Scrabble

STL

Binary Sorting Into a std::list
Posted: 9 Dec 2002   Updated: 9 Dec 2002   Views: 84,093   Rating: 3.18/5    Votes: 23   Popularity: 4.33
Licence: The Code Project Open License (CPOL)      Bookmarked: 13   Downloaded: 0
One technique for performing a binary insertion sort on a std::list

Algorithms & Recipes

Persistent String Parser
Posted: 30 Jul 2007   Updated: 21 Dec 2008   Views: 35,740   Rating: 4.33/5    Votes: 19   Popularity: 5.53
Licence: A Public Domain dedication      Bookmarked: 39   Downloaded: 141
Parse a string with quoted elements, insert/add/delete elements, and is CLS compliant

Cryptography & Security

Create and Share (with a client app) a Random Encryption Key
Posted: 4 Oct 2010   Updated: 5 Oct 2010   Views: 14,458   Rating: 4.97/5    Votes: 17   Popularity: 6.11
Licence: The Code Project Open License (CPOL)      Bookmarked: 35   Downloaded: 109
One way to create a completely random encryption key, and sharing it with a client application

Date and Time

Scheduling Future Dates
Posted: 1 Oct 2008   Updated: 1 Oct 2008   Views: 28,963   Rating: 4.69/5    Votes: 55   Popularity: 8.17
Licence: The Code Project Open License (CPOL)      Bookmarked: 77   Downloaded: 153
Implement repetitive tasks at consistent intervals

DLLs & Assemblies

Get Your DLL's Path/Name
Posted: 30 Nov 2006   Updated: 30 Nov 2006   Views: 77,846   Rating: 4.38/5    Votes: 49   Popularity: 7.40
Licence: The Code Project Open License (CPOL)      Bookmarked: 42   Downloaded: 571
Two methods to retrieve the path/name of a VS2002 or higher DLL from within that DLL.

Programming Tips

Reliable Floating Point Equality Comparison
Posted: 4 Dec 2006   Updated: 4 Dec 2006   Views: 59,744   Rating: 3.02/5    Votes: 39   Popularity: 4.80
Licence: The Code Project Open License (CPOL)      Bookmarked: 17   Downloaded: 0
Compare floating point numbers for equality at programmer-specified precision.

String handling

Creating a Unique String Using a UUID
Posted: 11 Dec 2001   Updated: 12 Dec 2001   Views: 143,795   Rating: 3.39/5    Votes: 32   Popularity: 5.10
Licence: The Code Project Open License (CPOL)      Bookmarked: 16   Downloaded: 0
A small function to either accept or create a UUID* and return a CString
String Parsing Class (supports quoted strings)
Posted: 19 Jan 2001   Updated: 14 Mar 2002   Views: 142,478   Rating: 3.89/5    Votes: 53   Popularity: 6.70
Licence: Not specified      Bookmarked: 38   Downloaded: 1,021
Parse strings with specified delimiter and specified quote character
Keeping It Clean - String Function Wrappers for VS2005
Posted: 17 Nov 2006   Updated: 17 Nov 2006   Views: 54,253   Rating: 3.79/5    Votes: 24   Popularity: 5.23
Licence: Not specified      Bookmarked: 10   Downloaded: 0
A technique for making stdio functions compile clean regardless of the Microsoft compiler used

Threads, Processes & IPC

Multithreading, Delegates, and Custom Events
Posted: 7 Feb 2010   Updated: 17 Mar 2010   Views: 48,896   Rating: 4.94/5    Votes: 70   Popularity: 9.12
Licence: The Code Project Open License (CPOL)      Bookmarked: 270   Downloaded: 712
Tie it all together and not lose your mind in the process

Debug Tips

Debug With Apps Displayed on Secondary Monitor
Posted: 29 Nov 2006   Updated: 29 Nov 2006   Views: 30,472   Rating: 4.52/5    Votes: 19   Popularity: 5.79
Licence: Not specified      Bookmarked: 26   Downloaded: 303
Here's some code that will automatically start your app on a secondary monitor if it's compiled with debug info.

Hardware & System

Build Your Own NAS Device
Posted: 14 Apr 2008   Updated: 10 Jan 2011   Views: 148,146   Rating: 4.87/5    Votes: 62   Popularity: 8.73
Licence: The Code Project Open License (CPOL)      Bookmarked: 109   Downloaded: 0
How to go about buildingyour own NAS device

Interviews

A Coder Interview With John Simmons
Posted: 14 Sep 2011   Updated: 14 Sep 2011   Views: 14,944   Rating: 4.97/5    Votes: 45   Popularity: 8.21
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 John Simmons.

Work Issues

Being a Programmer
Posted: 24 Oct 2008   Updated: 24 Oct 2008   Views: 81,338   Rating: 4.79/5    Votes: 196   Popularity: 10.98
Licence: The Code Project Open License (CPOL)      Bookmarked: 160   Downloaded: 0
My views on how to be a proper programmer
No blogs have been submitted.
No video articles have been posted.

Average tips rating: 4.72

Dialogs and Windows

Control Resizing on a UserControl in WinForms [Tip/Trick]
Posted: 28 Feb 2010   Updated: 21 May 2010   Rating: 4.67/5    Votes: 3   Popularity: 2.23
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 0
Control resizing is a bit more mysterious than it might appear at first glance.
Multiple User-Selectable Main Forms [Tip/Trick]
Posted: 22 Nov 2011   Updated: 22 Nov 2011   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
Allow any nnumber of forms to be used as a main form with easy transitions between forms.
Multiple Subsequent "Main" Forms in C# Apps [Tip/Trick]
Posted: 21 Jan 2010   Updated: 22 Nov 2011   Rating: 4.86/5    Votes: 38   Popularity: 7.67
Licence: The Code Project Open License (CPOL)      Bookmarked: 15   Downloaded: 0
A useful technique that could be used for winform apps which require a login dialog.

Grid & Data Controls

DataSet to String to DataSet [Tip/Trick]
Posted: 10 Nov 2011   Updated: 10 Nov 2011   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
If you use DataSet.GetXML, it returns the Dataset in the form of a XML string. Using Dataset.ReadXml will populate a Dataset from an XML string (or a stream).Lastly, your premise for the tip itself is flawed. Ninety nine times out of 100, a report is indeed SUPPOSED to query the database. ...

Menus

Automatically Display Menu on Hover [Tip/Trick]
Posted: 14 Sep 2011   Updated: 14 Sep 2011   Rating: 5.00/5    Votes: 4   Popularity: 3.01
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
How to automatically display a winforms menu when the mouse is hovered over an item

ASP.NET

Resolving Paths in a Multi-Folder WebSite [Tip/Trick]
Posted: 3 Mar 2010   Updated: 23 Jun 2010   Rating: 4.75/5    Votes: 8   Popularity: 4.29
Licence: The Code Project Open License (CPOL)      Bookmarked: 12   Downloaded: 0
A low-impact method for getting the appropriate path on a web page.
Call A Page Method from a Subsequent Page [Tip/Trick]
Posted: 17 Jun 2011   Updated: 17 Jun 2011   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
Back-tracking to make sure code is processed before the current page executes
Resolving PostBackUrl and button_Click events [Tip/Trick]
Posted: 21 Jun 2011   Updated: 21 Jun 2011   Rating: 3.33/5    Votes: 3   Popularity: 1.91
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
How to execute code in the current page AFTER navigating to a new page.
No More Session Variable Misspellings [Tip/Trick]
Posted: 22 Jun 2011   Updated: 23 Jun 2011   Rating: 4.67/5    Votes: 6   Popularity: 3.70
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
One way to guarantee uniqueness and avoid misspelling your session variable names

Silverlight

Get The URL For the Page Serving Your Silverlight App [Tip/Trick]
Posted: 20 Apr 2010   Updated: 21 May 2010   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
Dorothy was right - there's no place like home.
Silverlight 3 - Merged Dictionary Rules [Tip/Trick]
Posted: 17 May 2010   Updated: 21 May 2010   Rating: 4.50/5    Votes: 4   Popularity: 3.01
Licence: The Code Project Open License (CPOL)      Bookmarked: 6   Downloaded: 0
Follow these guidelines for trouble-free dictionary merging in Silverlight
Silverlight Exceptions Via the ErrorWindow [Tip/Trick]
Posted: 9 Jun 2010   Updated: 9 Jun 2010   Rating: 5.00/5    Votes: 4   Popularity: 3.01
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
The Silverlight navigation app ErrorWindow exposes the last exception thrown, but doesn't show the INNER exceptions. Here's how you can do it.
Silverlight - Programatically Re-using the Same Style [Tip/Trick]
Posted: 19 Jun 2010   Updated: 19 Jun 2010   Rating: 4.75/5    Votes: 5   Popularity: 3.32
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
What to do if you want to resue a style for more than one component of a particular type on a given Silverlight Page
Silverlight: Use KnownColor Through the Backdoor [Tip/Trick]
Posted: 5 Aug 2010   Updated: 12 Aug 2010   Rating: 5.00/5    Votes: 8   Popularity: 4.52
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 0
Get around another irrational and arbitrary omission in Silverlight
Get Mouse Click relative Position [Tip/Trick]
Posted: 11 Aug 2010   Updated: 12 Aug 2010   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
If you need to get the position the mouse was clicked, in relation to a specific UI Element, this might help
Is Your string usable in the SL4 RichTextBox [Tip/Trick]
Posted: 7 Mar 2011   Updated: 7 Mar 2011   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
Extension method that checks for a properly Xaml-ized string
Get Your Silverlight MainPage [Tip/Trick]
Posted: 9 May 2011   Updated: 9 May 2011   Rating: 4.64/5    Votes: 9   Popularity: 4.29
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
Get access to your Silverlight MainPage object

Web Security

Maintain Query String after Forms Authentication cookie expires [Tip/Trick]
Posted: 5 Jul 2011   Updated: 5 Jul 2011   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
I do it this way:0) Create a base page class, and store the current page's url (you can do this any number of ways, so I'll leave it to your imagination):public class MyBasepage : System.Web.UI.Page{ public string CurrentUrl { get; set; } }1) Store the page's Url to a...

Database

"Column name Create Date contains an invalid XML identifier as required by FOR XML; ' '(0x0020) is the first character at fault." [Tip/Trick]
Posted: 5 Jan 2011   Updated: 5 Jan 2011   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
You can also enclose your column name in brackets, like so: [Create Date]
The Pain and Anguish of DTS Script Debugging [Tip/Trick]
Posted: 26 May 2011   Updated: 26 May 2011   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
When all else fails, fire off some events and bask in the glow of the IDE's Progress tab.
Clear a DataRow Item (as opposed to deleting it) [Tip/Trick]
Posted: 26 Jul 2011   Updated: 26 Jul 2011   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
One way to effectively zero the columns any DataRow object.
The Evil That is "Select *" [Tip/Trick]
Posted: 25 Jul 2011   Updated: 10 Aug 2011   Rating: 4.88/5    Votes: 34   Popularity: 7.50
Licence: The Code Project Open License (CPOL)      Bookmarked: 7   Downloaded: 0
Just say no to SELECT * in your SQL

General Graphics

Count Number of Unique Colors in an Image [Tip/Trick]
Posted: 18 Feb 2011   Updated: 19 Feb 2011   Rating: 5.00/5    Votes: 7   Popularity: 4.23
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
Determine the number of unique colors in an image

.NET Framework

.Net - Use The Framework [Tip/Trick]
Posted: 13 Jan 2010   Updated: 22 May 2010   Rating: 4.89/5    Votes: 17   Popularity: 6.02
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 0
Don't reinvent the wheel - use the one that's already on the cart.
The Windows API: Learn It - Live It [Tip/Trick]
Posted: 18 Jan 2010   Updated: 22 May 2010   Rating: 5.00/5    Votes: 15   Popularity: 5.88
Licence: The Code Project Open License (CPOL)      Bookmarked: 6   Downloaded: 0
Don't drink the kool-aid. You still need to know how to use the Windows API in .Net apps.
Expect the Unexpected [Tip/Trick]
Posted: 5 Apr 2011   Updated: 6 Apr 2011   Rating: 4.64/5    Votes: 10   Popularity: 4.64
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 0
Never assume you know what the framework is going to do

Windows Communication Foundation

Use Custom Events from your WCF ServiceHost [Tip/Trick]
Posted: 26 Jan 2011   Updated: 26 Jan 2011   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 6   Downloaded: 0
When you need to communicate with the app that contains your ServiceHost object, use custom events

Windows Presentation Foundation

Simulate WPF ListView Column Width Set to "*" [Tip/Trick]
Posted: 29 May 2010   Updated: 29 May 2010   Rating: 4.40/5    Votes: 5   Popularity: 3.08
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
One technique for having a column width that grows/shrinks with ListView width

Algorithms & Recipes

See if a Flags enum is valid [Tip/Trick]
Posted: 10 May 2011   Updated: 10 May 2011   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
See if an integer value is a valid value for the given "flags" enumerator
See if a Flags enum is valid [Tip/Trick]
Posted: 7 Jul 2011   Updated: 7 Jul 2011   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
.Net 4 has the enum.HasFlag() method, which kinda obsoletes this tip. :)

Date and Time

Partial DateTime Object Equality [Tip/Trick]
Posted: 19 Jan 2011   Updated: 19 Jan 2011   Rating: 4.80/5    Votes: 12   Popularity: 5.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 9   Downloaded: 0
Determine if specified date/time properrties are equal
Find the count of a weekday between two dates without iterating/looping [Tip/Trick]
Posted: 10 Nov 2011   Updated: 10 Nov 2011   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
How about this?public static class ExtendDateTime{ public int CountWeekDays(this DateTime thisdate, DateTime thatDate) { int days = Math.Abs((thisDate - thatDate).Days) + 1; return = ((days/7) * 5) + (days % 7); }}Usage would be like this:DateTime...

Internet / Network

Pass Dynamic List of Parameters to Web Service [Tip/Trick]
Posted: 7 May 2010   Updated: 21 May 2010   Rating: 4.63/5    Votes: 8   Popularity: 4.18
Licence: The Code Project Open License (CPOL)      Bookmarked: 7   Downloaded: 0
Make interfacing with your web service simpler and more maintainable
Scanning Folders On A Network Share [Tip/Trick]
Posted: 6 Jun 2010   Updated: 6 Jun 2010   Rating: 4.25/5    Votes: 4   Popularity: 2.41
Licence: The Code Project Open License (CPOL)      Bookmarked: 5   Downloaded: 0
It's not as simple as just calling DirectoryInfo.GetFiles()

Programming Tips

Setting non-numeric grid row/column sizes in WPF/Silverlight [Tip/Trick]
Posted: 11 Apr 2010   Updated: 22 May 2010   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
Programatically set grid row/column sizes (yes, even "Auto", "*", and "X*" - thanks Nish).
ObservableDictionary! [Tip/Trick]
Posted: 22 May 2010   Updated: 22 May 2010   Rating: 4.93/5    Votes: 6   Popularity: 3.84
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
In WPF/Silverlight, you might want to bind to a dictionary. Here's a couple of websites I found.
A Generic Comparison Class for Collection Items [Tip/Trick]
Posted: 4 Mar 2010   Updated: 26 Aug 2010   Rating: 4.67/5    Votes: 9   Popularity: 4.53
Licence: The Code Project Open License (CPOL)      Bookmarked: 12   Downloaded: 0
You probably have better things to do than writing tedious comparison methods.
Bind Enum data to Dropdown List By Sorting [Tip/Trick]
Posted: 26 Dec 2010   Updated: 26 Dec 2010   Rating: 5.00/5    Votes: 4   Popularity: 3.01
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
Can't you just call Enum.GetNames(), and then bind to the collection returned by that method?
Using Extension Methods To Avoid XML Problems [Tip/Trick]
Posted: 23 Apr 2010   Updated: 21 Jan 2011   Rating: 4.91/5    Votes: 9   Popularity: 4.68
Licence: The Code Project Open License (CPOL)      Bookmarked: 6   Downloaded: 0
Extension methods can help you avoid sticky situations.
Is Your App Running As Administrator? [Tip/Trick]
Posted: 19 Jan 2011   Updated: 24 Jan 2011   Rating: 4.94/5    Votes: 24   Popularity: 6.81
Licence: The Code Project Open License (CPOL)      Bookmarked: 33   Downloaded: 0
How to make your app detect whether or not it's running in admin mode.
Does Your App Know Where it's Running [Tip/Trick]
Posted: 1 Feb 2011   Updated: 2 Feb 2011   Rating: 4.96/5    Votes: 17   Popularity: 6.10
Licence: The Code Project Open License (CPOL)      Bookmarked: 8   Downloaded: 0
How to determine if your .Net app is running in the Visual Studio IDE
How to Toggle String Case in .Net [Tip/Trick]
Posted: 9 Feb 2011   Updated: 9 Feb 2011   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
StringBuilder mystring = new StringBuilder("AbCd");for (int i = 0; i < mystring.Length; i++){ char c = mystring[i]; mystring[i] = Char.IsLower(c) ? Char.ToUpper(c) : Char.ToLower(c);}
Admit When You're Wrong, Delete the Code, and Move On [Tip/Trick]
Posted: 4 Apr 2011   Updated: 4 Apr 2011   Rating: 4.81/5    Votes: 15   Popularity: 5.65
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
What to do when the "you're a moron" epiphany smacks you in the head just after you've convinced yourself you're pretty clever.
Dynamically send WCF endpoint in Silverlight [Tip/Trick]
Posted: 17 May 2011   Updated: 17 May 2011   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
This is how I do it (we determine the host and select the appropriate endpoint).// these are the endpoints define in the webconfig filestring LocalHostEndpointName = "LocalHost_Endpoint";string ProductionEndpointName = "Production_Endpoint";string CurrentEndpoint = "";//...
Setting Enumerators From Questionable Data Sources (for C# and VB) [Tip/Trick]
Posted: 20 Feb 2010   Updated: 9 Jul 2011   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: The Code Project Open License (CPOL)      Bookmarked: 6   Downloaded: 0
Avoid exceptions when setting enumerators from unknown/untrusted sources.
Reverse of a string without using the Reverse function in C# and VB [Tip/Trick]
Posted: 23 Jul 2011   Updated: 23 Jul 2011   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
I wouldn't create a class for this. I'd make it an extension method, and then do this:public static class String Extensions{ public static string Reverse(this string value) { value = // do your reverse code here; return value; }}// Usage:string x...
Delegates Are Good, and Good For You [Tip/Trick]
Posted: 24 May 2010   Updated: 29 Aug 2011   Rating: 4.82/5    Votes: 19   Popularity: 6.15
Licence: The Code Project Open License (CPOL)      Bookmarked: 16   Downloaded: 0
Using a delegate could pull your butt out of the fire when you don't want to refactor code to add functionality.
Exception Handling - Not Just a Good Idea [Tip/Trick]
Posted: 20 Dec 2011   Updated: 20 Dec 2011   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
You have everything you need to do your job as a developer. You just need to use them.
Could not find a part of the path while doing a File Copy [Tip/Trick]
Posted: 2 Mar 2012   Updated: 2 Mar 2012   Rating: 3.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
If at all possible, never give your code the opportunity to fail. If there's any possibility at all that you can prevent an error condition from being raised, do it. try{ if (!string.IsNullOrEmpty(FileName)) { string newPath = System.IO.Path.Combine(FilePath,...

String handling

Extension Methods to Reverse a String and StringBuilder Object [Tip/Trick]
Posted: 1 Jan 2011   Updated: 1 Jan 2011   Rating: 4.33/5    Votes: 3   Popularity: 2.07
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
We're up to .Net 4 and MS *still* hasn't given us this simple functionality

Uncategorised Tips and Tricks

How to DEFINITELY Delete a Rogue Windows Service [Tip/Trick]
Posted: 11 Jul 2011   Updated: 11 Jul 2011   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
42!

Design and Architecture

Personal Agility - Thinking Outside Your Own Box [Tip/Trick]
Posted: 24 Jan 2010   Updated: 22 May 2010   Rating: 3.00/5    Votes: 2   Popularity: 0.90
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 0
Essential programmer skill - the ability to approach a problem from more that one direction.

Scrapbook

Helpful Sci-Fi Movie Survival Tips [Tip/Trick]
Posted: 26 Jan 2010   Updated: 22 May 2010   Rating: 4.94/5    Votes: 19   Popularity: 6.32
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
Humor - Things to consider when your're out and about when the world starts to come to an end.

Testing and QA

Windows Service Gotcha (or Test Your Code, Regardless of How Small Your Changes Are) [Tip/Trick]
Posted: 22 Jan 2010   Updated: 22 May 2010   Rating: 4.61/5    Votes: 8   Popularity: 4.16
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
No change is too small for a complete regression test.

Author Resources

Formatting your CodeProject Article [Tip/Trick]
Posted: 13 Jan 2010   Updated: 22 May 2010   Rating: 4.74/5    Votes: 9   Popularity: 4.55
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
Bad formatting will delay the approval of your articles. Follow these basic rules to avoid that delay.

John Simmons / outlaw programmer

Software Developer (Senior)

United States United States

Member

I've been paid as a programmer since 1982 with experience in Pascal, and C++ (both self-taught), and began writing Windows programs in 1991 using Visual C++ and MFC. In the 2nd half of 2007, I started writing C# Windows Forms and ASP.Net applications, and have since done WPF, Silverlight, WCF, web services, and Windows services.
 
My weakest point is that my moments of clarity are too brief to hold a meaningful conversation that requires more than 30 seconds to complete. Thankfully, grunts of agreement are all that is required to conduct most discussions without committing to any particular belief system.


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