Thursday, 29 October 2009

I've been doing some work with the Unity IoC container recently and had to configure some generic types so I thought I'd post some of the examples here so that I'd have some to refer back to more than anything else a blog post tends to be less likely to get lost that an old post-it note.

Xml config to configure mapping for a specific generic type, note the use of [[]] to define the generic type. Inside the square brackets you specify type name and the assembly containing the type. In both example `1 signifies the generic parameter:

<type type="Data.Repository.IRepository`1[[Poco.Address, Poco]], Data.Repository"
      mapTo="Data.Repository.LinqRepository`1[[Poco.Address, Poco]], Data.Repository">
  <lifetime type="singleton"></lifetime>

Xml config to configure open generic type mapping:

<typeAlias alias="IRepository`1"            
" /> <type type="IRepository`1" mapTo="Questern.ActiveOrderManagementSystem.Data.Repository.LinqRepository`1,
"> <lifetime type="singleton" /> </type>


Thanks to Marceli for helping out with this!!

posted on Thursday, 29 October 2009 19:52:26 (GMT Standard Time, UTC+00:00)  #    Add Comment | Comments [1]
 Tuesday, 27 October 2009

SyncToy Logo Despite having a laptop I still find I'm often carrying documents between various computers on a USB pen so I and needed a convenient way to sync the changes made on the USB pen back onto my hard drive. To solve this problem I found SyncToy from Microsoft. This offers a really convenient way to keep my files in sync thanks to a simple and intuitive interface.

You can see just how clean the interface is from the screenshots. SyncToy 2.0 Main Screen All you need to do is click the "Create New Folder Pair" button. This produces another simple dialog that allows you to select the two folders you wish to keep in sync. Setup new folder pairing

Click then next button and you will be presented the the second of the three dialogs that setup the folder pairing. Here you have three radio buttons, "Synchronise", "Echo" and "Contribute". What I really found useful was the label to the right of the radio buttons that gave a clear and helpful description of what each of the radio buttons means. For example the explanation for the synchronize option reads "New and updated files are copied both ways. Renames and deletes on either side are repeated on the other side." As I will be working with code and will have new files, updates to existing files and possibly some deletes that I want kept in sync between my main computer and my pen drive this is the option I choose. However if you only want a one way synchronization choose "Echo". Or if you don't want deletes synchronized between the two folders select the "Contribute" option.

Specify actions for pairing

The last screen gives the option to enter a name for the pairing this is just a useful tag that will allow you to identify the pairing in the list of pairings you've created. Click finish and you will be presented with a summary screen that gives you all the details of what you have just created. Summary of pairing On this screen you should notice two actions that you can click on. The first "Change action." allows you to change what you are doing e.g. change from synchronize to echo. The second action link "Change Options." gives you the ability to take finer control of the synchronization. Here you can specify specific file types to include in the synchronization or files types that should not be copied as part of the synchronization.  Along with controlling the file types you have the option of excluding certain file types from the synchronization by clicking the "select subfolder" action link. The best thing about this screen is the level of help provided if required. Simply mouse over any of the controls and you'll get a clear and concise help message describing what the control is for and in the case of the free text entry fields used to control the file types the help gives examples of how to format what you enter into these fields. Options for the pairing

The last two buttons I'll take about are the "Run" and "Preview" these are clear cases of doing what it says on the tin. Run will run the synchronization and depending on the actions you have selected it will delete, copy, update and add the files and folder in one location to the other. However the preview is really nice as it gives you the ability to see what will happen as a result of clicking the "Run" button. You can see from the screenshot the results of running a preview on one of my pairings. Preview results showing what will happen when Run is clicked

This is a tool that I recommend anyone who works with USB pen drives go and checkout, it's easy to use, works well and so far has done all I want of it.

You can download SynToy free from Microsoft, at the time of writing 2.0 is the latest version.

posted on Tuesday, 27 October 2009 18:54:52 (GMT Standard Time, UTC+00:00)  #    Add Comment | Comments [0]
 Monday, 26 October 2009

Just completed my fresh install of Windows 7 64-bit and one thing that has impressed me right away is that my media card reader now works! Since I moved from Vista 32-bit to Vista Ultimate 64-bit I was unable to get a working driver and had give up any hope of being able to use the card reader. It hadn't DriverProblemworked with the Beta copy of Windows 7 so I was really surprised when I got a message in the task bar telling me to fix an error with one of my drivers.  I'd searched the Internet high and low looking for a 64-bit driver and now all of a sudden Windows 7 had found one, so after a quick download and install I was able to take the SD card from my Canon and put it into the card reader and it works!!

You can see that I now can access the card just like any other drive in windows explorer.  myDriverIt's a small thing but it now means I don't have to connect my Camera to a USB port in order to download my pictures. So far for me Windows is doing what it says in the adverts, "Your PC simplified". I've worked with Linux, OS X and all previous versions of Windows and this is the first time I've been this happy with a new operating system, here's hoping the honeymoon period keeps going.

posted on Monday, 26 October 2009 19:25:41 (GMT Standard Time, UTC+00:00)  #    Add Comment | Comments [0]
 Sunday, 25 October 2009

expandExplorerFolders In Windows 7 the navigation pane in explorer doesn't expand the folders as you navigate the hierarchy. I kind of liked the folders expanding as I go down through the hierarchy. If your like me and want to have the folders in the navigation panel auto expand click the 'Organize' menu and select 'Folder Options', on the General tab you will see a section 'Navigation Pane' simply tick the second tick box as shown in the side picture.

posted on Sunday, 25 October 2009 09:39:23 (GMT Standard Time, UTC+00:00)  #    Add Comment | Comments [1]
 Friday, 23 October 2009

CLCL context menu example CLCL is a clipboard caching utility and one of the many tools I can't work without. This handy little tool allows you to add multiple items to the windows clipboard and then select which item you want to paste from the clipboard. The standard Ctrl+C and Ctrl+V keys work as normal but you also have an addition Alt+C option, this will display a context menu that allows you to select the item you wish to paste from the clipboard. The tool is free and trust me you'll find the benefit of this when editing and working across multiple files. As you can see from the screenshot it also supports pasting images from the clipboard. 

This tool was also mentioned in the book "The Productive Programmer" which I have previously reviewed on my blog.

posted on Friday, 23 October 2009 16:36:24 (GMT Standard Time, UTC+00:00)  #    Add Comment | Comments [0]