Monday, March 15, 2010

Running VS2008 on a Netbook

As I am not always home but still want to be able to work on my personal project, at the lowest cost possible, I finally bought myself a brand new ASPIRE ONE 532h from ACER. This one ships with the new Intel Atom N450, 1 GB of Memory, a 160GB HDD and a 3 cell Li-ion battery that last around 4 hours. 

I installed Visual Studio 2008 Professional on it and I have to admit that it runs fine as long as you don't try to open or build a huge solution. The 10.1 inches screen does the job but when writing code into VS I strongly recommend going full screen using the "view" menu or the "Shift + Alt + Enter" shortcut. See for yourselves in the following screenshots.

Monday, March 8, 2010

Tablet PC : ExoPC Slate

After having been particularly disappointed by what the iPad will be, I started searching the web for other tablet PCs and I finally found something that might suit my needs. The ExoPC Slate. I don't think I'll buy the first version, which should be on the shelves pretty soon maybe even before the iPad as it is now suppose to be released in april, but I might give it a try later if reviews are good.

Update on march 14th : I learned last week that the ExoPC slate should finaly come out this summer. It will be assembled in Quebec instead of China to provide a better control on quality. Until then they might work on the battery to get a device that will last longer.

Saturday, March 6, 2010

Regular Expressions

Regular expressions provide a flexible way for matching patterns in text and are commonly used in syntax highlighting systems for example. They can also be used to validate data input like Email addresses format.

Personally I use regular expression as soon as I need to find many different occurrences of a string that have a common pattern. For example I once needed to insert links into diverse technical PDF manuals that were split by chapters and sections, respecting a standard nomenclature i.e. “ManualTitle-CH01” for the chapter 1. Each document referring to the other ones as “Chapter XX” or “Section XX” and containing internal references like “Figure XX”. In cases like that you can have hundreds or thousands different string to search meaning maybe hundreds lines of code while regular expressions could accomplish the task with a few.

In order to use the Regular Expressions in Visual Studio you need :
using System.Text.RegularExpressions;
Here is a small code example for finding multiple pattern matches.
private void findMatches(string text)
 Regex pattern = new Regex("Chapter\s(\d+)|Section\s(\d+)|Figure\s(\d+)");
 MatchCollection matches = new MatchCollection();

 matches = Regex.Matches(text, pattern, RegexOptions.IgnoreCase);
 foreach(Match m in matches)
  /*Work with the match here, generate and insert link etc.*/
Here are a couple of links that might prove usefull :
Regular Expression Syntax
Regular Expression Language Elements
Regular Expression Tester
I hope this first post may help some of you.