Sunday, 28 February 2010


I received an email the other day from Patrick Smacchia, the lead developer of probably the best known .NET dependency analysis tool NDepend a couple of days ago, letting me know that version 3.0 is now available.

It also pricked my conscious that a fair while back Patrick had given me a license for NDepend v2.0 and only asked that I post about my experiences using it. It is now way overdue for me to return the favour… so what are my thoughts?

First of all, what is it? As I understand it NDepend is a static analysis tool that looks at the dependencies between classes and assemblies. Whereas FxCop might look at individual lines of code to detect sub-optimal patterns, NDepend takes a step back and looks at the big picture of how your application is architected – especially how loosely coupled (or not) your classes are (which is normally a desirable aim).

Probably the main thing I like about NDepend is the dependency graph it can generate. I've found this useful both for getting a thumbnail sketch of your current solution (especially if it has evolved a bit over time), and also to a rough idea of the architecture of a legacy application that you've just been handed.

One other feature that appeals to my sense of keeping your code in good order is how it can highlight potential version mismatches between assemblies and also symbol files. When your build process becomes slightly more complicated this can be handy to ensure all your ducks are in the right row and version :-) The version differences may not be a problem for compiling and linking, but if your PDB file is wrong then you're going to get misleading or minimal stack trace information – something better avoided in the first place.

The final feature that can be quite illuminating for me is the dependencies matrix. This is a table (matrix) that shows the interdependencies between all your assemblies. Because it adds up the totals, you can quickly identify where an assembly may only have one (or even no) hard dependencies on another assembly and consider refactoring to reduce your coupling if appropriate.

There are also features of NDepend that to be honest I'm happy to know are there but haven't had a chance to make use of in a real way yet. It has a very comprehensive inbuilt query language, and could add some real value to a continuous integration build system – where you're keen to set some code quality benchmarks.

If you're still not convinced, there's a whole bunch of demo and tutorial videos on the NDepend site that can explain the range of features a lot better than I can.

Version 3.0 adds new features including:

  • Better integration with Visual Studio, including support for VS 2010
  • NDepend projects can now be a part of a Visual Studio solution
  • Improved performance
  • Integration with Reflector

In summary I have found NDepend to be a really useful tool to have in my toolkit, and I'd like to thank Patrick and his colleagues for the opportunity to have access to it.

Saturday, 27 February 2010

Changing the location of "Import Pictures and Videos using Windows"

For some reason, if you uncheck the "Prompt for a tag on import" under the "Import Settings" of the Windows 7 "Import Pictures and Videos" wizard, then as far as I can tell there is no way to get back the "Import settings" dialog again.

A quick search of the registry reveals that these settings are stored under the following key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Photo Acquisition

For example, there's a "Camera and Portable Device" subkey with a value named "RootDirectory", and also one named "FilenameTemplate". Changing these should alter where the wizard saves photos.

Comparing this subkey with the "OpticalMedia" and "Scanner" subkeys showed one interesting difference. All three have an AcquisitionFlags value, but the latter two had it set to 0x82 whilst the former was 0x8a.

Reverting the AcquisitionFlags value to 0x82 in the following registry key seems to restore the import wizard to prompting you for an optional tag, and allowing you to click on the "Import Settings" link again:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Photo Acquisition\Camera and Portable Device

To make this change yourself, follow the following steps (with the standard warning that editing the Windows Registry incorrectly can completely mess up everything!):

  1. Run regedit.exe
  2. Navigate through the registry tree to find the following subkey:
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Photo Acquisition\Camera and Portable Device
  3. Double-click on the "AcquisitionFlags" value
  4. Type in "82"
  5. Click on "OK" and close the Registry Editor

Thursday, 25 February 2010

ReSharper 5 – Structural Search and Replace

I found a use today for a new feature that will be in ReSharper 5.0 - "Structural Search and Replace". Essentially it's a way to add code matching templates into R# to add new refactoring patterns in addition to those that come in the box.

For example, Microsoft recommends (and Code Analysis/FxCop generates appropriate warnings) if you are doing a comparison between a string value and an empty string, to use the String.IsNullOrEmpty() method.

I always wanted R# to make this change for me, and now I can:

  1. Go to Resharper | Tools | Patterns Catalog
  2. Click on 'Add Pattern'
  3. Enter "$value$ == "" " in the Search Pattern textbox.
  4. Click on 'Add Placeholder' and add an 'Expression' placeholder named 'value' of type System.String
  5. Enter "string.IsNullOrEmpty($value$)" in the Replace Pattern textbox
  6. Ensure Pattern Severity is set to at least 'Show as suggestion'
  7. Click on 'Add'

R# will now use this pattern and highlight code that matches. You can then hit the QuickFix shortcut (Alt-Enter by default) and get a smart tag offering to refactor/replace your code.

 Resharper 5 - Smart Tag showing option to replace with String.IsNullOrEmpty

If you can't wait for the final release of ReSharper 5 (due in the next few months) then install beta 2 or one of the recent nightly builds.

Tuesday, 23 February 2010

Passed 70-451

If one wasn't enough this week, today I passed another exam – 70-451 PRO: Designing Database Solutions and Data Access Using Microsoft SQL Server 2008.

Combining that with yesterday's success means I am now a Microsoft Certified IT Professional (MCITP): Database Developer 2008.

Doing the exams are an interesting (and educational) process but they have other advantages too – they'll be useful to my employer (LobsterPot Solutions) and might benefit efforts for me to become a Microsoft Certified Trainer.

Monday, 22 February 2010

Passed 70-433

This morning I took the Microsoft exam "TS: Microsoft SQL Server 2008, Database Development 70-433". I was quite chuffed after I hit the 'Finish' button and it said I'd passed!

One thing different about today's exam was that I chose to do it at Rockfort International Pty Ltd. An impressive name, but it turns out they appear to be a 2-man outfit in a quite tiny office. I wasn't even sure I was in the right place until the guy turned up and confirmed that yes they did do exams! Having said all that, once I sat down at the exam PC it was pretty good – quiet, comfortable and the PC had a reasonable screen. I've done most of my other exams at Excom, and last time I was there they still had a crumby old CRT monitor (running at a really low refresh rate) and that room had pretty noisy air conditioning. So even though the office may not be quite as swish, I'd rate the actual examination environment higher.

Over the weekend I was doing some study toward the exam and came across the following things that were new to me. Some of them may be obvious to others, but they're not things I've used before or been aware of.

  • You can create filtered indexes (an index that has a WHERE clause)
  • An indexed view needs to use WITH SCHEMABINDING, and as a consequence the index must be UNIQUE CLUSTERED.
  • Run a table-valued function against all the rows of a query using APPLY.

Note – these were things I came across BEFORE I did the exam. I am definitely not indicating these topics were either in or out of the exam (and no, there's no hidden meaning here, I  really mean that). All I am saying is that by reviewing the curriculum I happened to learn some new things.

Finally, let me pre-empt the inevitable lazy sod who emails me and asks for some hints or answers to this exam (apart from the fact that by taking the exam, I've agreed to Microsoft's Non-Disclosure Agreement which includes not "Disseminating actual Exam content" ) ..

Do what I did – use the product, and know all (or enough of) the stuff it says you need to know and you should pass!

Sunday, 21 February 2010

BSOD - "A clock interrupt was not received on a secondary processor within an allocated time"

I mentioned yesterday that the Hyper-V server had been experiencing the Blue Screen Of Death with the message "A clock interrupt was not received on a secondary processor within an allocated time" (0x00000101). The problem is that it doesn't really give you any clues as to what was the cause of the error.

Yesterday morning I changed the BIOS defaults to "Fail safe" and things had been working fine… until this morning, when it crashed again. Researching this error is not that encouraging:

  • There are a few posts to forums where suggestions such as BIOS settings, defective CPU cores, RAM timing, CPU VCore etc are thrown up.
  • Almost every other reference I've seen also indicates the problem is seen when running a 64-bit OS.
  • AMD lists some basic checks but nothing very specific (I've already tried resetting BIOS settings, updated the BIOS to the latest firmware version

Presumably Microsoft are slightly more interested in the crash as today's Windows Error Reporting asked for me to submit extra debugging info. I'm happy to do that, though I don't expect to get any quick answers.

This is quite frustrating as until I can identify and resolve the cause of this problem, I don't have a lot of confidence in the server.

Saturday, 20 February 2010

Assembling the Hyper-V Server

Motherboard and PSU in desktop case Once I figured out my preferred components I emailed MSY and put in an order with MATS. However it turns out that just because MSY have something on their parts list, doesn't mean they have it in stock. I ended up having to go to their Plympton and City stores, and got the PSU from MATS as MSY didn't have that at all.

The case I used was from an old desktop PC. It can accept an ATX board, but as the previous motherboard was a slightly smaller model I had to do some "creative" metal work to move the hard drive bays around so that they could still fit inside the case and not bump into the motherboard.

Things that changed

RAM 2 x G.Skill Ripjaws DDR3-1600 F3-12800CL9D-4GBRL
Drive (Data) 2 x Seagate Barracuda 7200.11 SATA 3Gb/s 1.5-TB Hard Drives
UPS Eaton Nova 625 AVR

Noctua CPU Fan vs Ripjaw RAM

RAM next to CPU and Fan One reason I preferred the G.Skill Ripjaws RAM was that the heat spreaders were less intrusive than those on the "Trident" model. Having said that, once I went to clip the fans onto the Noctua, the wire clips on the RAM-side were in the way of the RAM. A bit of physical effort with a couple of pliers managed to bend the wire clips flatter against the heat sink such that the RAM could just slide past into the sockets on the motherboard.

Faulty RAM?

DDR3 RAM not seated correctly I added an old DVD drive I had lying around and went to install Windows Server 2008 R2. The installation proceeded as expected, then I noticed that the machine had suddenly rebooted. On restarting a message indicating that "Windows had not expected to shutdown" appeared. That's odd. Allowing it to continue then displayed a message that the installation had failed and to try again.

Hmm.. Just out of curiosity, I fired up the Memory Diagnostics tool and after ticking over it came up with a message indicating there was a problem! Restarting the machine I went back into the BIOS to see what it said there.. Only 6G of RAM??? Hmm. Now a visual inspection of the sticks of RAM and something looked wrong!

Reseating the RAM in the sockets and re-running the memory diagnostics and everything was happy again.

Enabling AHCI

I realised after I'd installed Windows Server 2008 R2 that I'd left the BIOS at the default settings, which included the SATA emulating IDE instead of AHCI. Because the boot disk was also connected this way, you can't just change the BIOS and reboot – you need to tweak the registry so that the ACHI driver gets loaded properly.


"A clock interrupt was not received on a secondary processor within an allocated time"

Lots of references to this online – some solutions suggest lowering the bus speed slightly. I fiddled around with these a bit but the crashes kept happening. I have no experience over (or under) clocking so I was quite out of my depth. Finally in desperation I changed the BIOS settings to the "fail safe" defaults. This appears to have done the trick.


An unfortunate side-effect of trying to re-use an old desktop case is that I don't think the cooling of the various components is as good as it could be.

Using HWMonitor I am seeing the following temperatures being reported:

Component °C
CPU Core #0 41
CPU Core #1 36
CPU Core #2 43
CPU Core #3 38
HDD ST314003 #1 53
HDD ST314003 #2 55

I'm thinking getting a proper-size case and possibly some extra cooling might help bring things down to a better level. It would also mean the disks would be slightly more secure in the case!


I now have a number of machines capable of gigabit networking but my trusty Billion 7402GL modem/router only has 4 100Mb network ports. I purchased a new Asus GX-D1081 8 port gigabit switch to enable better network performance. This also meant I could connect the Windows Media Center PC directly (it was previously using a wireless connection). After confirming the switch worked correctly, I then changed the network settings on all the gigabit-capable machines to enable "Jumbo frames" at 9K. I'm pretty sure this has resulted in a noticeable improvement in performance – especially when browsing pictures through the media center that are stored remotely on the Windows Home Server box.

Wednesday, 17 February 2010

Bring on the Lobster

I've now officially started as a Senior Consultant for LobsterPot Solutions.

David holding a knife and fork

Let's start cutting that code!

Saturday, 6 February 2010

Hyper-V Server

I've come up with the following list of components that should make a decent server using Hyper-V to experiment with various versions of SQL Server, Windows Server and also run Windows Home Server:
CPU Intel i7-860
Motherboard GA-P55A-UD5
CPU Fan Noctua NH-U9B-SE2
RAM 2 x 4G Kit DDR3 2000 Kingston HyperX
PSU Antec TP 550
Video 512MB 4350 Gigabyte
Drive (System) A-RAM SSD PRO series 32GB 2.5" MLC SSD
Drive (Data) 2 x WD 1.5TB
UPS Socomec NeTYS PE 600Va UPS
Most parts I'm planning to get from MSY with the exception of the SDD and UPS which I'll get from MATS Systems. I've seen comments that while MSY sell a cheaper SSD, the Indilinx-based drives (such the A-RAM) perform much better.
The video card is the cheapest I can find, as it will be hardly ever used (there isn't any on-board video on the motherboard).
The i7-860 has 4 cores and 8 threads. It uses the 1156pin packaging and seems to be reasonable value if you don't want to step up to the 1366pin 950/970 chips (which then require more expensive motherboards and RAM).
I'm thinking that a UPS might be a helpful addition to ensure this machine gets treated well as far as the power supply goes.
The motherboard has plenty of USB and SATA connections so should offer room for future storage expansion. I may end up throwing in some of my existing older/slower drives into this machine so that the Home Server can make use of them too.
I'd appreciate any suggestions/comments too.

Update: 7-Feb 9pm

Tuesday, 2 February 2010

Another Lobster in the Pot

David eating Lobster in Prince Edward Island

The year was 1994, and I was travelling with good friend Sally over to the US to attend the wedding of a mutual friend Cathy.

It was my first trip overseas, but Sally was an experienced traveller and suggested we do a bit of sightseeing in Canada, including visiting Prince Edward Island. As well as being a beautiful, picturesque island it also happens to be the setting for the Anne of Green Gables books.

On one of our excursions around the island we happened to stop at Fisherman's Wharf Lobster Suppers. As you can see, they supply a practical (if not very fashionable) bib. To be honest, I probably got more out of the 60 foot salad bar than the lobster, not being a huge seafood fan, but it was an experience nonetheless.

"That's nice Dave, but where's this trip down memory lane leading?", you say?

As Dean Hutton would respond, "I'm glad you asked!"

LobsterPot Solutions LogoWell I've been offered the position of "Senior Consultant" with LobsterPot Solutions!

I'll be working with Rob Farley and the rest of the LobsterPot team, providing consulting and training services around SQL Server and Business Intelligence. I also hope to bring my .NET application development experience to the mix.

I'm quite excited about this next step in my career. In some respects it seems like it will combine many of the best parts of some of my previous positions – the training and professional development support that I got working at UniSA, and the intellectual stimulation and enthusiasm of working with some seriously smart guys at Viterra/ABB Grain.

I start on Monday 15th February, so that gives me two weeks break – to do a few jobs around the house, take the kids to school, go for the odd bike ride, and do some more research on that Hyper-V server I'm planning to build.