Code Validation in TortoiseSVN pre_commit_hook

If you want to abort a commit if your code fails certain rule and you don’t have access to the SVN Server to configure a hook. What do you do ?

Assuming you are using TortoiseSVN, you can configure a Client-Side hook.

Here is an example – Say you want to abort commit if you have a comment in your code that starts with //Do Not Commit. You can create a PowerShell script that validates all the files in your changeset and use this script as a Client-Side pre_commit_hook in TortoiseSVN.

TortoiseSVN-Settings-HookScripts
TortoiseSVN-Settings-HookScripts

The pre_commit_hook configuration :

Configure-Hook-Scripts
Configure-Hook-Scripts

//Powershell script : pre_commit.ps1

$donotcommit = “//Do Not Commit“;

$changeset = Get-Content $args[0];

foreach($file in $changeset)
{
if( Get-Content $file | Select-String $donotcommit -quiet )
{
Write-Error$file contains code that you are not supposed to commit. [$donotcommit]“;
exit 9;
}
}

Now, if your changeset has a file with a comment starting with //Do Not Commit and you click on OK to commit this change, the commit will be aborted with this error message –

pre_commit_hook-validation
pre_commit_hook-validation

Using Model-View-ViewModel in WPF Applications

I am presenting at SoCalCodeCamp this weekend (January 30th, 2010) – Advanced WPF – Using Model-View-ViewModel in WPF Applications.
tasklist-mockup
tasklist-mockup

Agenda :

1. Roles of the M-V-VM triad
2. Why use M-V-VM ?
3. Characteristics of the ViewModel
4. Build a Sample WPF Application using M-V-VM



Resources :

  1. MSDN Magazine Article and Sample Application Download
  2. Martin Fowler’s description of the ‘Presentation Model ‘
  3. Jeremy Miller’s ‘Build Your Own CAB’ series

Use Legacy Printer From Windows 7

I have NEC SuperScript 870 laser printer connected to my Home PC. I was not able to print to this printer from my new HP dv6-1375dx Windows 7 laptop. My machines are connected via Hamachi. Here is what I did to get around the lack of NEC driver for Windows 7 (I found this tip here) –

1. Created a new printer (pointing to the same LPT port that is connected to NEC 870) on my Home PC using HP Laser Jet III driver.

2. Shared this new printer.

3. On the Windows 7 laptop, I dropped the document I wanted to print on this new printer. Voila !!!

Should you get into Silverlight or Flash ?

Take a look at these trend lines from Indeed.com (Yes, you read that right. That is EIGHTY THOUSAND percent growth in silverlight jobs) –
Here is the trend line for Flash jobs –
Growth is there but the total number of jobs are clearly stabilizing. Here are the absolute number of jobs –
Interesting numbers !!!

Session Recommendations for SoCal Code Camp @ USC

SoCal Code Camp is coming up on November 21st & 22nd 2009 at University of Southern California, Los Angeles. There is just an incredible lineup of sessions. If you are trying to make up your mind about the sessions to attend, here are my recommendations –

1. Attend as many of Llewellyn Falco’s and Woody Zuill‘s sessions as you can. Specially, Unit Testing The Easy Way and one of the Dojo sessions. Any one of these sessions will make your entire trip worthwhile.

2.Kristian Hermansen’s Get Hacked Live ..

3. Stacey Broadwell’s Using Technology & Social Media to Target Candidates & Jobs should be very useful. I attended her recent presentation at L.A. Dot Net @ UCLA, it was very informative.

4. and of course If it walks like a Scrum … by yours sincerely.

I am planning to attend as many of the following sessions as the schedule allows –

* Algorithmic Trading in C#
scott hodson

* Automated Grid layout in Silverlight and WPF
Richard Fencel

* Building nTier Applications with Entity Framework Services
David McCarter

* Experiencing Agile Through Games
Carlton Nettleton

* Interoperability in the Cloud
Alejandro Espinoza

* Rapid Prototyping with Expression Blend
mark bosley

* One of Paul Sheriff’s WPF presentations

* SCRUM CLUB: Agile Requirements Gathering Workshop!
Amanda Abelove

See you there !

Using DbUpdater with MySql

DbUpdater can be used with mysql.

Here are the files you need to jumpstart the integration – DbUpdater-MySql.zip

1. You might need to change the path to mysql.exe in mysql-exec.bat.

2. Modify values in mysql-sample-command-line.bat.

Make sure mysql.data.dll is placed in GAC or in the same directory as DbUpdater.exe. Connector binaries can be downloaded from here –
http://dev.mysql.com/downloads/connector/net/6.1.html