Win Advanced MVVM Book

Advanced MVVM CoverI am presenting a session on Building WPF Application using MVVM (Model-View-ViewModel) on May 15th at the Carolina Code Camp 2010.

I will dissect a Sample WPF MVVM application and then highlight the most important aspects of the MVVM by coding a brand new ViewModel and incorporating it into the application. You will learn about the Roles of the MVVM triad, the advantages of using MVVM and Characteristics of the ViewModel.

Attendees will be eligible to win two copies one copy (see below) of Josh Smith’s Advanced MVVM book as well as a few other WPF Books.

{ I will be giving away one hard copy version of the book instead of digital versions due to concerns about DRM protection and unclear gift guidelines at lulu.com }.

And the winner is … Mark Freeman !!! Congratulations Mark, your copy of “Advanced MVVM” is on its way. Thanks for attending the code camp and your feedback.

SVN Merge – Selecting Changesets

Here is a simple scenario – I have already merged changesets 45-55 from the trunk to branch b1. After this merge, more changes (56-60) were submitted into the trunk and I now need to merge those changes also to branch b1.

Which changesets do you select to merge ? 56-60, right ? Well, not exactly. It depends. If you are using Subversion merge command, you will need to specify 55-60. If you are using TortoiseSVN, you will select 56-60. You should keep this in mind if you are used to TortoiseSVN and you are attempting a merge using SVN merge command. Otherwise, you will end up with a merge without change 56.

Selecting changes to merge can become non-trivial when you don’t know which changes have already been merged. However, there is good news. With subversion 1.5, when you are selecting changes from source branch to merge into a target branch, don’t do it ! Subversion 1.5 onwards has built-in merge tracking. When using TortoiseSVN, if your intention is to merge all changes, just leave the changeset selection blank. Subversion knows which ones have already been merged and which ones to merge and it does it automatically. You can also select changes that have already been merged and those will be handled (excluded) automatically too.

There is a summary of what to expect from Subversion Merge-Tracking feature here – Subversion 1.5 merge-tracking in a nutshell.

There is detailed description of Subversion Merge-Tracking here and search for ‘mergeinfo property’ in Subversion documentation.

changes already merged appear in grey

The above screen-shot shows the changes already merged in grey. Thanks to Subversion’s mergeinfo property.

So, can I just stop worrying about changesets altogether, when merging ? There are a few caveats to how mergeinfo metadata is (and sometimes not) recorded. Read this for more information –  The Final Word on Merge Tracking.

Read about Subversion merging and branching here and TortoiseSVN merging documentation here – browse down to these sections : Reviewing the Merge Results and Merge Tracking.

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 !!!