If anything can drive this Irishman into a fit of cursing, it's the need to create a regular expression quickly. With a little application, I know I could learn to create them myself but I figured some time back that the frequency with which I use them would not equate to the time invested in the study. So, I either have to rely on ones that I have, and can never locate, or turn to a good tool.
Well, I was reading Professional ASP.NET 3.5 in C# and VB by Scott Hansleman and others recently when I saw mention of a Regular Expression Editor in VS 2008. This was news to me! Then I noticed a regular expression facility in the Find and Replace tool (CTRL-F); how long has that one been around? Anyway, it was just what I needed for some basic regex's for email and phone numbers.
The only problem is trying to find the thing... they couldn't have hid it better if they tried. First, you have to be in design view to begin to locate it. Do people actually use design view? Then you have to refer to the control's properties window and click on the button next to the ValidationExpression property to launch the editor. Obvious, huh? :-|
Granted, it's pretty basic but if you're in a hurry this will save you some Googling time! I wonder is it possible to extend this tool to add in one's own custom regex's for reuse?
One more thing: Scott's book is a great reference with over 1600 pages of info. I have only two gripes about it: 1) If you read it in bed you'll need a hoist to avoid the hernia, and 2) The entire book is based on the Web Site template. What were they thinking of?
Here's another new toy I stumbled upon - the new AutoCollage tool from Microsoft Research. This is a very easy-to-use image processing program which will automatically create a polished collage from a folder of your favorite pics.
This is a really handy way to create personalized Christmas cards on the fly and avoid the shopping lines at the mall! All you have to do is pick a folder and click a button. Download the one month trial here.
Here's a short video presentation of AutoCollage in action :-)
Here's a code sample that might come in handy. This is a CheckBoxList for a fictitious Real Estate broker who wishes to maintain a list of features for each property listing entered in the system. Typically, you would create a form to add a listing and another to edit an existing listing. Loading the selected values for a CheckBoxList from the database often causes confusion and this snippet uses a Non-Typed-DataSet and a stored procedure.
Here's the code to grab the selected values from the in-memory DataSet...
This is the call to the stored procedure from the DALC (Data Access Layer Class); the business layer method is simply a pass-through call.
Next up is a pretty basic stored procedure which simply grabs the fields containing the text for the ChekBoxList items and the corresponding boolean value, indicating whether or not they were originally selected.