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.

Posted in C#, WPF, code, xaml | Tagged , , , | Leave a comment

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.

Posted in tips, version-control | Tagged , , , , | Leave a comment

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

Posted in tips, version-control | Tagged , , , , , , , | Leave a comment

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
Posted in C#, WPF, code, xaml | Tagged , , , , , , | Leave a comment

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

Posted in tips | Leave a comment

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 !!!
Posted in career advice | Tagged , , , , , | Leave a comment

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 !

Posted in tips | Tagged , | Leave a comment

SQL Azure Notes

My invitation code for SQL Azure CTP finally arrived. I had been waiting for this.

sqlazure-manage.png

You can create a database in from the SQL Azure Management page, shown above.

After you have created the database, of course, you can use DbUpdater with your SQL Azure databases. Here is the command-line :
DbUpdater.exe ..\SqlScripts /server:”tcp:SERVER.ctp.database.windows.net” /db:DATABASE /user:”USER@SERVER” /password:PASSWORD /confirm:true

And you will need this DbUpdater.exe.config file :

<?xml version=”1.0″ encoding=”utf-8″ ?>
<configuration>
<appSettings>
<add key=”file-prefix” value=”db” />
<add key=”file-extension” value=”sql” />
<add key=”schema-versions-name” value=”schema-versions-table.sql” />
<add key=”baseline-name” value=”baseline.sql” />
<add key=”post-script-prefix” value=”post” />
<add key=”post-script-always-apply” value=”true” />
<add key=”exe-file” value=”C:\Program Files\Microsoft SQL Server\90\Tools\Binn\SQLCMD.EXE” />
<add key=”exe-args” value=’-U %UserName% -P %Password% -S “%ServerName%” -d %DbName% -i “%SqlFile%”‘ />
<add key=”dialect” value=”NHibernate.Dialect.MsSql2000Dialect” />
<add key=”driver_class” value=”NHibernate.Driver.SqlClientDriver” />
<add key=”connection_string” value=”Server=%ServerName%;Database=%DbName%;User ID=%UserName%;Password=%Password%;Trusted_Connection=False;” />
</appSettings>
</configuration>

You can run sqlcmd.exe directly to execute t-sql scripts on SQL Azure. Here is a sample command :
sqlcmd.exe -S SERVER.ctp.database.windows.net -U USER@SERVER -P PASSWORD -d DB -i “baseline.sql”

I received these errors when I executed my SQL Server 2005 scripts on a SQL Azure database -

  • ‘ANSI_NULLS’ is not a recognized SET option.
  • Deprecated feature ‘SET ANSI_PADDING OFF’ is not supported in this version of SQL Server.
  • Deprecated feature ‘More than two-part column name’ is not supported in this version of SQL Server.
  • Deprecated feature ‘Data types: text ntext or image’ is not supported in this version of SQL Server.
  • Deprecated feature ‘Table hint without WITH’ is not supported in this version of SQL Server.

These are not the limitations of the SQL Azure platform. SQL Azure is based on SQL Server 2008 Database Engine. The complete list of deprecated features in SQL Server 2008 are listed here along with the replacements (if any) : Deprecated Database Engine Features in SQL Server 2008 – MSDN.
After modifying the scripts to replace the deprecated features, the scripts could be executed without any further issues. All stored procedures, triggers and views were created without any errors.

The following error is a SQL Azure limitation.

  • ‘Filegroup reference and partitioning scheme’ is not supported in this version of SQL Server.

Here is more detailed information on unsupported T-SQL – Unsupported Transact-SQL Statements (SQL Azure Database) – MSDN

Posted in sql | Tagged , , , , , , | Leave a comment

Is Scrum Bad For Developers ?

SoCal CodeCamp was a blast. Thanks to everyone who attended my presentation : If it walks like a Scrum.

The slide-deck can be downloaded from here.

If it walks like a Scrum.png

Posted in career, psychology, tips | Tagged , , , | Leave a comment

GUI Prototyping Tools

Special purpose UI prototyping tools, like the ones listed on C2 Wiki, offer a convenient blend of usability and flexibility. I have tried some of these tools. I was looking for something that -

  • doesn’t become unwieldy when used to prototype a large and complex GUI
  • allows me to use my own screenshots/images/icons
  • allows me to modify the prototype without making it a hair-pulling experience.
  • can prototype all aspects and artifacts of modern web and desktop interfaces, specially -
    • tree controls  - you will be surprised how many prototyping tools don’t have this. Pencil, I am looking at you :)
    • tabbed panels  - can you position your tabs at the bottom ? on the right edge ?
    • film strips
    • ribbons
    • NavBars

The one that met all these requirements and more (and blew me away) is Balsamiq Mockup.
Disclaimer : I requested and received a complimentary license from Balsamiq.

This video was embedded using the YouTuber plugin by Roy Tanck. Adobe Flash Player is required to view the video.

  • Balsamiq Mockup’s usability is what attracted me at first and then it was just a series of surprises, one after another.
  • You can click on the widget “legend” to toggle aspects of the widget on and off. Very slick !
  • You can link (aspects of) widgets to other mockups. This allows you to build some interactivity into your prototype. Very cool !
  • You can clone a mockup with a button click – to prototype a transition.
  • I could use my own images/screenshots and sketch them (basically,  applies a sketch transformation on the image) !!! If you think that sketchy look of the prototypes looks unfinished, you should read this.

Here are some things I wish I could have in Balsamiq -

  • name (and search for) individual widgets in my mockup
  • select multiple widgets by dragging over an area
  • auto-group when dropped on containers (or other widgets)
  • stretching container stretches everything in it, I wish I could have some control over it
  • register my own mockups as library widgets
  • zoom in and out

Just to be thorough, here are some other approaches I have used in the past -

  • Using a RAD tool like VisualStudio is great way to prototype. You have to be very proficient, like a GUI developer ;) , with the tool of your choice. Otherwise, it is can be an excruciatingly slow approach. The best part of this approach is that the interactions can be prototyped seemlessly and some of the feasibility doubts can be cleared early on. The problem with this approach is that the prototype can be mistaken as the actual product and the effort /scheduling expectations of the stakeholders can become hard to manage. Read Joel Spolsky’s brilliant observations on The Iceberg Secret, Revealed. Also, when the prototype looks like a finished product, type of feedback you receive is usually not strategic, it is narrower. Read more about this on Creating Passionate Users article.
  • When you have an existing UI (perhaps from a 3rd-party library’s demos) that can become the basis for your new UI, it makes sense to use screenshots of your existing UI and modify them using image editors like Paint.NET or Photoshop or even MS Paint. It is a quick way to produce a prototype but the expected changes to the prototype must be minimal. Otherwise, you will find yourself spending long hours with your image editor.
  • General purpose drawing programs, like dia and Visio, can be used to create UI prototypes. With these type of tools, you will probably need to work with building blocks that are a bit too granular, although you may be able to procure widgets/stencils for some of these tools to make things easier. These tools have a some learning curve and less than fluid usability.
Posted in tips | Tagged , , , , , | Leave a comment
  • Twitter Updates

  • Notes

    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 (0)

    Online Backup Solution
    Finalized online backup solution : JungleDisk. I can run it on all of my machines without paying extra. I get to keep the ownership of my data – by using my own Amazon S3 storage. Backed up all family photos – all 30 GBs. Feeling good (0)

    Switched to Thematic
    I have switched to Thematic theme on this blog over the weekend. I created a child theme after playing around with the customization hooks. I added a widgetized area below main asides, did some css modifications and created a three column, flexible layout just the way I wanted. I am so glad I switched to Thematic. ThemeShaper forums are very helpful. These articles were just what I needed to get started : How to make a child theme for WordPress and How I used a WordPress Child Theme To Redesign My Blog. (0)

  • BookShelf

    Planned books:

    • ASP.NET MVC in Action

      ASP.NET MVC in Action by Jeffrey Palermo, Ben Scheirman, Jimmy Bogard

    Current books:

    • Pragmatic Thinking and Learning: Refactor Your Wetware (Pragmatic Programmers)

      Pragmatic Thinking and Learning: Refactor Your Wetware (Pragmatic Programmers) by Andy Hunt

    • Working Effectively with Legacy Code

      Working Effectively with Legacy Code by Michael Feathers

    Recent books:

    • How I Got Published: Famous Authors Tell You in Their Own Words

      How I Got Published: Famous Authors Tell You in Their Own Words by Ray White

    • Pro WPF: Windows Presentation Foundation in .NET 3.0

      Pro WPF: Windows Presentation Foundation in .NET 3.0 by Matthew MacDonald

    • Programming Windows Presentation Foundation

      Programming Windows Presentation Foundation by Chris Sells, Ian Griffiths

    • Advanced MVVM

      Advanced MVVM by Josh Smith

    View full Library

Close
E-mail It