Posts Tagged ‘Software’

.NET Tools: NDepend static analysis tool, leave T-Pain behind.

June 1st, 2009 5 comments

The release of Visual Studio 2008 brought along Code Metrics to the IDE‘s ‘out-of-the-box’ functionality (I’ve been overusing that phrase thanks to our resident CRM Consultant at work!). This was a major boon for .NET developers to get a clear idea of health of what they write, Visual Studio 2005 gave FxCop integration that provided much needed static code analysis for .NET assemblies. Together these tools provide a peek into the deep depths of the project your working on, it benchmarks the correctness, performance and security implications, localisation, design issues amongst other metrics. Damn useful if you’ve inherited – as I often do in my consultancy life – someone else’s code base with little or no documentation. They say code is the best documentation right? (oh gosh, not one of those projects!)

Whilst both the metrics in VSNET and FxCop give you a low level understanding of your code – based on framework guidelines, what if you want more in depth understanding of what your ‘working with’ rather than how you use the .NET framework? How many methods derive from a certain control – remember we’re doing static analysis here, no Resharper loving! Or how maintainable the assemblies are. What are the methods with more than 30 lines of code? (hint: need to refactor!)

This is where NDepend comes in. NDepend is a static code analysis tool on steroids – and I’m not exaggerating here. You will love NDepend long time as I do right now.

Load up NDepend, point to your assemblies, then let NDepend think a little and it will spit out a plethora of information for you to take in.

The NDepend UI – VisualNDepend

There is however one caveat, the first time you use it – and I know this will happen to the majority of users, you’ll probably get overwhelmed with what you’ll be displayed with:

NDepend Paint.NET Analysis

NDepend Paint.NET Analysis

So you can reproduce this with the trial of NDepend, I’m looking at the latest Paint.NET release. But once you get over your initial sense of wonder and disbelief you can start to demystify the UI and the beauty of NDepend. Dont worry, theres plenty of documentation and help to get you on your way, I’ll cover those later ūüôā

First, we have a Class Browser to the left that lists all the assemblies that are being anaylsed – this includes the assemblies you selected (black!) and the assemblies that were added automajically by NDepend as dependencies (blue).

To the right of the class browser is our Metrics visual representation (those black balls actually mean something – Marty!). We can tell NDepend to show us (visually via the Code Metrics display) the top 10,20,50-5000 methods. Double click on any item in the view and it will automatically jump to the source (in the working VS.NET instance if available) for you to inspect further. Theres also deep integration with Visual Studio too – again later!

Underneath the Metrics window we have the Dependency Graph on the left and the Dependency Matrix on the right. This view gives us an idea of the coupling between the assemblies in our list.

The World of CQL

Then we have – what makes me get jiggy wif it, the CQL Query window. CQL is Code Query Language, and its just as your thinking, its SQL for Code. Armed with a basic understanding of CQL you can get some really useful information about your project – infact the report that gets generated by NDepend already contains a bunch of metrics for you and comes with over 85 metrics to begin with in a heavily documented specification – with examples. Writing a simple bit of CQL like the one below, will give you a representation of all public methods that contain more than 30 lines of code.


Neat huh? Thats only an example from the features page, there’s lots more. We can even setup a constraint to notify us when we exceed a threshold.

WARN IF Count > 0 IN SELECT METHODS WHERE NbILInstructions > 200 ORDER BY NbILInstructions DESC

This will warn us when we have methods that exceed 200 IL instructions. You can even combine a bunch of them and workout a metric to benchmark which methods you need to refactor, heres one from the report that gets autogenerated by the VisualNDepend tool:

WARN IF Count > 0 IN SELECT TOP 10 METHODS /*OUT OF "YourGeneratedCode" */ WHERE 

                                           // Metrics' definitions
     (  NbLinesOfCode > 30 OR              //
        NbILInstructions > 200 OR          //
        CyclomaticComplexity > 20 OR       //
        ILCyclomaticComplexity > 50 OR     //
        ILNestingDepth > 4 OR              //
        NbParameters > 5 OR                //
        NbVariables > 8 OR                 //
        NbOverloads > 6 )                  //

     // Here are some ways to avoid taking account of generated methods.
     !( NameIs "InitializeComponent()" OR
        // NDepend.CQL.GeneratedAttribute is defined in the redistributable assembly $NDependInstallDir$\Lib\NDepend.CQL.dll
        // You can define your own attribute to mark "Generated".
        HasAttribute "OPTIONAL:NDepend.CQL.GeneratedAttribute")

Whats more, because NDepend is language neutral you can query any managed assembly. Theres so much goodness you can get from CQL, most of your needs are already documented in the specifications.

Healthy coder == healthy code right?

NDepend also gives us a representation of what state the code is in with the generated report.

Paint.NET Abstractness vs Stability

Paint.NET Abstractness vs Stability

This metric – based on Robert C Martin’s Abstractness vs Stability paper. To quote the paper’s Abstract directly:

This paper describes a set of metrics that can be used  to measure the quality of an object-oriented design in terms of the interdependence between the subsystems  of  that design.   Designs which are highly interdependent tend to be rigid, unreusable and hard to maintain.
Yet interdependence is necessary if the subsystems of  the design are to collaborate.  Thus, some forms of dependency must be desirable,
and other forms must be undesirable.   This paper proposes a design pattern in which all the dependencies are of the desirable form. Finally, this paper describes a set of  metrics that measure the conformance of a design to the desirable pattern.

In the case of Paint.NET we can see that we’re all over the bottom corner of the image. What does this mean?

First we have the two ends of the scale.

  • Y – Abstractness
    This measures how abstract the assembly is, can it be extended without recompiling? Lots of interfaces and base classes help here.
  • X – Instability
    Measures how much this assembly is utilised by its public interface. For most third party component (from vendors) they’ll fall into the less instability area, so you have to ensure that any changes are properly managed to avoid breaking clients.

Then we have two zones.

  • Zone of uselessness
    This is when an assembly is very abstract and extensible but no-one uses it you’ll find it closer to this area.
  • Zone of Pain
    This is when an assembly is referenced (or have lots of dependants) and is not very extensible – no abstract implementations.

One thing to note though, the words ‘Pain’ and ‘Uselessness’ may be a bit harsh in its wording. If you – like me – have a core ‘framework’ that you write have it locked down and reference it muliple projects then they should indeed fall into the ‘Zone of Pain’ assuming that you have ensured its stability and realise the consequences of breakages later on. Most third party products will fall into here – we’re talking your UI Controls, Sharp components etc.

Ideally you’d want to be hovering in the green area cosey with the line in the middle for your core product.

Would you like Documentation with that?

As mentioned earlier, NDepend comes with lots of help, firstly we have – what I used, the Getting Started screencasts, tutorials, CQL Documentation with *actual* usable examples.

Scott Hanselman has also released a nice cheatsheet for NDepend that will go well hanging next to your PC.

Integrating NDepend to Integration Server

At home (and at work) we use Jetbrains TeamCity, you can easily integrate NDepend into TeamCity by following Laurent Kempé directions.

If you use CruiseControl.NET, you’ll find Robin Curry‘s guide on integrating NDepend to NAnt and CruiseControl.NET useful.

Integration with your favourite tools

NDepend fully integrates with Visual Studio and Reflector.

NDepend Options Integration

NDepend Options Integration

The integration in Reflector – which reflect that of Visual Studio integration.

NDepend Reflector Integration

NDepend Reflector Integration

Gives you one click access to some common metrics.


If you want to get a good understanding of your project – or someone elses, metrics will help you greatly to give you an impression of the health of the project and NDepend will come in quite handy for you. We only _barely_ scratched the surface with this blog post, I’ve spent a good chuck of a week using NDepend and find it ubber useful in my work life – partly because it involves reparing the mess others have left – but it also serves as a good reminder of how you should write code.


Fine Print: Full Disclosure

I was offered a license to NDepend by Patrick Smacchia and given the chance to write my thoughts on this product, I was not paid to review this product – feel free to send some moola if you want to though ūüėČ

{lang: 'en-GB'}

Sun-shine lolipops: VirtualBox 2.2.4 comes out of the oven

May 31st, 2009 No comments

Sun Microsystems (pwnd by the Oracle) has release VirtualBox 2.2.4.

VirtualBox 2.2.4 (released 2009-05-29)

This is a maintenance release. The following items were ?xed and/or added:

  • Windows Installer: ?xed a potential hang during installation
  • Windows Installer: ?xed several problems (bug #3892)
  • Solaris hosts: make it work with Solaris build 114 or later (bug #3981)
  • Solaris hosts: ?xed a bug serial port character handling found during loopback (bug #3120)
  • Linux hosts: adapted to the latest changes in VBoxManage list runningvms (bug #4034)
  • Windows hosts: ?xed a crash caused by host-only/bridged networking
  • Mac OS X hosts: ?xed access to host DVD with passthrough disabled (bug #4077)
  • Guest Additions: ?xed problems with KDE 4 not recognizing mouse clicks
  • Windows Additions: ?xed incorrect 8-bit guest color depth in Windows 7 guests
  • GUI: warn if VT-x/AMD-V could not be enabled for guests that require this setting (bug #4055)
  • VMM: ?xed occassional crash due to insuf?ent memory
  • VMM: ?xed hanging 64 bits Solaris guests
  • VMM: restore from a saved state occassionally failed (bugs #3984 and #2742)
  • Clipboard: ?xed a deadlock while shutting down the shared clipboard on X11 hosts (bug #4020)
  • OVF: ?xed potential hang during import
  • OVF: ?xed potential crashes during import/export on Win64 hosts
  • VBoxManage modifyhd –compact: ?xed bug which could lead to crashes and image corruption (bug #3864)
  • VBoxManage metrics collect: now ?ushes the output stream.
  • VHD: made VBoxManage internalcommands sethduuid work for .vhd ?les (bug #3443)
  • VHD: some .vhd ?les could not be cloned (bug #4080)
  • VMDK: ?xed creating snapshots
  • NAT: improvement of TCP connection establisment (bug #2987)
  • NAT: ?xed order of DNS servers in DHCP lease (bug #4091)
  • NAT: ?xed DHCP lease for multiple name servers (bug #3692)
  • NAT: ?xed a potential segfault if the host lost its connectivity (bug #3964)
  • Shared Folders: deny access to parent directories on Windows hosts (bug #4090)
  • Shared Folders: make rm/rmdir work with Solaris guests on Windows hosts
  • Networking: ?xed the problem with blocked receiving thread when a broadcast packet arrives too early to be handled by uninitialized e1000 adapter.
  • Networking: ?xed the problem that caused host freezes/crashes when using bridged mode with host‚Äôs interface having RX checksum of?oading on (bug #3926 and related). Fixes problems with TX of?oading as well (bug #3870)
  • PXE boot: Added support for PRO/1000 MT Server adapter.
  • Python bindings: ?xed keyword con?ict
  • SCSI: ?xed occasional crashes on Win64
  • Serial: allow to redirect the serial port to a raw ?le (bug #1023)
  • VRDP: ?xed a rare incorrect screen update

This release’s most significant update is the bugfix for truncating your files to 300Kb when attempting to compact the hard-disk – damn annoying! Update mos def.


  • VirtualBox 2.2.4 for Windows hosts x86/amd64
  • VirtualBox 2.2.4 for Solaris and OpenSolaris hosts x86/amd64
  • VirtualBox 2.2.4 Software Developer Kit (SDK) All platforms (registration required)

Enjoy, oh btw did you know that OpenSolaris 2009.06 is coming tomorrow (Monday?)

{lang: 'en-GB'}

COOL TOOL: WinRAR 3.90 Beta released with some ubber goodness!

May 1st, 2009 3 comments

Rarlab, the genius’s behind the WinRAR product have released a new beta version (v3.9)¬† which brings some impressive new features:

Changes in Version 3.90 Beta 1:

  1. WinRAR version for Windows x64 is available. If you use Windows x64, it is strongly recommended to install 64 bit WinRAR version. It provides a higher performance and better shell integration than 32 bit version.
  2. RAR compression speed is improved for multi-core and multi-CPU systems. This improvement is most noticeable in Windows Vista and Windows 7 operating systems.
  3. “Remove duplicate folders from extraction path” option in “Settings/Compression” dialog is replaced by more universal “Remove redundant folders from extraction path” option. This option will eliminate redundant archive name based folders from extraction path if you unpack an archive with “Extract to DestName\” context menu command and if archive root folder contains only one folder and no files.
  4. Changes in “Extraction path and options” dialog:
    1. “New folder” button creates a new subfolder in currently selected folder;
    2. F2 key renames a selected folder in the folders tree;
    3. F5 key updated the tree pane contents;
    4. Del key removes a selected folder in the folders tree.
  5. You can enable “Show seconds” option in “Settings/File list” dialog if you wish to see seconds in file dates in file list in WinRAR shell.
  6. “Where to check for SFX archives” options group in “Settings/Integration/Context menus items” dialog lets you to control processing of SFX archives in context menus. For example, if you frequently right click “.exe” files on slow network disks, you can turn off “Network disks” options to minimize the delay before displaying the context menu.
  7. If you sort files by name in the file list in WinRAR shell, WinRAR will use the new logical file name sorting, same as in Windows Explorer, considering digits in file names by their numerical value. So files will be sorted as 1.txt, 2.txt, 10.txt instead of previous 1.txt, 10.txt, 2.txt. This new sort behavior is available in Windows XP Service Pack 2 and newer.
  8. Ctrl+W key combination can be used to close the main WinRAR window also as WinRAR viewer windows. “View as Windows text” shortcut in WinRAR viewer changed from Ctrl+W to Ctrl+I.
  9. New command line switch -r- disables recursion completely. So ‘rar a -r- arc dirname’ command will add only the empty dirname folder and ignore its contents. By default, if dirname does not include wildcards, RAR adds its contents even if -r switch is not specified.
  10. If used when extracting, the new command line switch -ai forces RAR to ignore file attributes. When using this switch, extracted files will always have attributes assigned by operating system to a newly created file by default.
  11. If output file name is not specified in “cw” command, console RAR will send comment data to stdout.
  12. When compressing stdin data with -si[name] switch, RAR sets modification time of archived entry to current system time. Previous RAR versions did not fill this field, resulting in meaningless modification time for stdin.
  13. Message displayed when you place the mouse cursor on WinRAR tray icon includes the archive name now. Previously only time left and total percent were displayed for archiving operations.
  14. Bugs fixed:
    1. WinRAR could fail to open tar or tar.gz archive if such archive contained a file larger than 8 GB;
    2. WinRAR context menu did not work properly in Windows 7 beta if icons in context menus were enabled and user clicked a file inside of Windows 7 Library folder;
    3. previous WinRAR versions failed to rename files having 5 or more continuous spaces in the name. WinRAR shell does not display such spaces for safety reasons, because they can hide an actual file extension. But this security measure prevented the rename command to work properly.

The primary bits that got my attention was the native x64 release and the improved multi-threaded support for compression (the first two items – bolded). So naturally I downloaded the Windows x64 release and had a stab at doing some benches. This was a very quick test.

Test Setup


Specified in detail on the CPU-Z Validation page, otherwise an ASUS P5Q-Pro, Intel QX6850 @ 3Ghz with 8Gb of Corsair TWINX4096-6400C5 modules on two different hard disks:


Windows Vista Ultimate x64 SP1 (current as of 01/05/2009)

WinRAR was set to ‘Best’ Compression and ‘Create Solid Archive’.

Test Methodology

I looked around for the best bunch of files I could find to compress – and that’s easily reproducible. Funnily/nerdy enough, the Microsoft Enterprise Library 4.1 (Download from Microsoft) source folder was chosen – with build files already included (binaries, pdbs etc).

Folder statistics

  • Files: 5148
  • Folders: 742
  • Size: 230Mb (241,576,303 bytes)
  • Size-on-Disk: 240 MB (251,727,872 bytes)

You can download a copy of the files from me, its 5.8Mb compressed. (UPDATE: Doh! wrong linkage!)

WinRAR Versions

WinRAR v3.80 (x86) vs WinRAR v3.90 Beta 1 (x64)

Test Results

WinRAR 3.9 Beta 1 (x64) vs WinRAR v3.80 (x86)

WinRAR 3.9 Beta 1 (x64) vs WinRAR v3.80 (x86)

The final output size of the RAR file was 5.28 MB (5,541,888 bytes).

Wow, 10 seconds shaved off, the cores were definately being utilised far greater than the previous releases.


Unfortunately, the Beta¬† 1 release (for me atleast) doesn’t properly register the shell context menus, so if you like right clicking and doing “Add to Archive” you might find that missing even though you told it to use it – I did make sure I uninstalled the 3.8 release prior to installing 3.9 and rebooted just to be sure, but no dice.

So maybe its not ready for prime time just yet, but 3.9 will surely rock your socks with some multi-core McLovin.

{lang: 'en-GB'}

Windows 25 Years old

November 22nd, 2008 No comments

Completely forgot about a birthday, Windows turned 25 on the 10th of November.

On November 10th, 1983, Bill Gates first unveilled Microsoft Windows (v1.0) to the world at an unprecedented elaborate event at the Helmsley Palace Hotel (Wikipedia) in New York City. Windows 1.0 boasted a graphical user-interface to the MS-DOs world with menus, icons and multi-tasking. Not that I was around back then (I was born just under a year later) but here’s some screenies for your pleasure.

Windows 1.0 Boxshot

Windows 1.0 Boxshot

All for a cheap $99 and it even comes with Reversi. Steve Balmer, crazy back then, still a crazy guy today.

Belated Happy Birthday.

{lang: 'en-GB'}

HOWTO: Network Monitoring with nTop in Ubuntu

September 28th, 2008 5 comments

ntop is a network probe that shows how much the network is being utilised with very little overhead and impressive graphical representation via the web. Its definately a must-have tool if you run a fileserver.

The version of ntop on the ubuntu mirrors is 3.2.x, so I set out to update to the latest release this weekend (3.3.x released in June last year).

This install is being done on Ubuntu 7.10 using ntop 3.3.7.

First up lets download the distribution of ntop we’re going to be installing. This is the internode mirror in Australia, but you can find your closest mirror via sourceforge.

$ wget

Next we need to extract the files to a folder.

$ tar -xvf ./ntop-3.3.7.tar.gz

Next up lets install/make sure we have all the dependencies we need to build this version.

$ sudo aptitude update
$ sudo aptitude install build-essential linux-headers-$(uname -r) librrd2-dev libtool libpcap-dev tcpdump librrd2 rrdtool rrdtool-tcl libgdbm-dev libgdbm3 automake autoconf automake1.7 debhelper gettext html2text intltool-debian libgd2-noxpm-dev libjpeg62-dev libncurses5-dev libssl-dev libwrap0-dev po-debconf

Once the dependencies are installed you can go into the extracted folder and tell it to setup the environment and configure it.

$ cd ./ntop-3.3.7/
$ chmod +x ./
$ ./

This will make sure your environment is correctly setup and configure to build the necessary make files. There shouldn’t be any errors at this point as you have installed all the correct dependencies. Nextup we need to build the application and install it.

$ make
$ sudo make install

Then you can start nTop by running the following command:

$  sudo ntop -P /usr/local/lib/ntop/

There we have it, browse to http://localhost:3000 and you’ll be running the latest and greatest ntop.

{lang: 'en-GB'}

VWMare Fusion 2.0 out, comes with *FREE* McAfee Virus Scan to protect your Windoze…

September 17th, 2008 No comments

VMWare just released Fusion 2.0 which is a free update for 1.x users of the fruity OS, among the enhancements…

  • Greatly improved 3D performance and compatibility with DirectX 9.0c and Shader Model 2 software and games. (VMware Fusion runs best with the latest graphics hardware, like the NVIDIA 8800 GT, ATI Radeon HD 2600, and ATI Radeon HD 3870.)
  • When playing high-definition video (720p, 1080i, 1080p) in a Windows XP or Windows Vista virtual machine, VMware Fusion now uses hardware acceleration for smooth video playback

Which is quite a feat, whilst I’m not a Fusion user – No Apple, It just Works!!! – it seems the Fusion Hypervisor is doing some serious legwork now. Whats more (heh) VMWare even ‘collaborated’ with McAfee to give those Apple users a little something something for their Windoze experience:

Virus Protection and Firewall Included for Windows XP and Vista Virtual Machines

  • To keep your Windows-on-Mac experience as safe as possible, VMware Fusion includes a complimentary 12-month subscription to McAfee VirusScan Plus to protect your Windows investment


{lang: 'en-GB'}

VLC 0.9.2 Released!!!

September 15th, 2008 No comments

One of the most kick-ass players out there has just released a new version after more than 2 years in development. VLC 0.9.2 which comes with a spanking new UI and a host of cool new features.

enuff chit-chat, go download and install.

NOTE: The server is no doubt being hammered right now, so be patient.
{lang: 'en-GB'}

Sun releases VirtualBox 2.0 just couple of days after 1.6.6!

September 7th, 2008 1 comment

One of the hottest Virtualisation applications going around the internets these days is Sun’s recently aquired VirtualBox software suite. The bright folks at Sun have just announced version 2.0 release which is a couple of days after the 1.6.6 maintenance release.

Being a fan of VirtualBox from around the 1.3.x days when it was owned by Innotek and seeing it mature the way it has, its been quite impressive – if not for the wide platform compatibility and the fact that its a ‘free’ product for personal use that’s competitive with commercial offerings such as VMWare – which has been my fulltime VM product (loving VMWare 6.5 btw!).

VirtualBox 2.0 brings some uber goodness to the mix (from the changelog):

    This version is a major update. The following major new features were added:

    • 64 bits guest support (64 bits host only)
    • New native Leopard user interface on Mac OS X hosts
    • The GUI was converted from Qt3 to Qt4 with many visual improvements
    • New-version notifier
    • Guest property information interface
    • Host Interface Networking on Mac OS X hosts
    • New Host Interface Networking on Solaris hosts
    • Support for Nested Paging on modern AMD CPUs (major performance gain)
    • Framework for collecting performance and resource usage data (metrics)
    • Added SATA asynchronous IO (NCQ: Native Command Queuing) when accessing raw disks/partitions (major performance gain)
    • Clipboard integration for OS/2 Guests
    • Created separate SDK component featuring a new Python programming interface on Linux and Solaris hosts
    • Support for VHD disk images

    In addition, the following items were fixed and/or added:

    • VMM: VT-x fixes
    • AHCI/SATA: improved performance
    • GUI: keyboard fixes
    • Linux installer: properly uninstall the package even if unregistering the DKMS module fails
    • Linux additions: the guest screen resolution is properly restored
    • Network: added support for jumbo frames (> 1536 bytes)
    • Shared Folders: fixed guest crash with Windows Media Player 11
    • Mac OS X: Ctrl+Left mouse click doesn‚Äôt simulate a right mouse click in the guest anymore. Use Hostkey+Left for a right mouse click emulation. (bug #1766)

    Download your copy based on your Operating System:

    • VirtualBox 2.0.0 for Windows hosts x86 | AMD64 (only on Windows x64!)
    • VirtualBox 2.0.0 for Solaris and OpenSolaris hosts x86 | AMD64

    After installing 2.0, my 1.6.x images seamlessly moved to the 2.0 release with minimal fuss, just make sure you shutdown your VMs prior to upgrading to avoid hassles.

    Not to be forgotten is VMWare’s upcoming 6.5 release which is rolling full steam ahead!

    {lang: 'en-GB'}

    MSY Hacked! Firefox blocks!

    July 15th, 2008 No comments

    MSY( – dont go there yet!), one of the most competitive IT hardware stores in Australia recently got hacked and the site has embedded Net-Worm.JS.Aspxor.a worm. Only realised after I went to the site and Firefox blocked the page. You can read all about the hack and the effects on the Whirlpool Thread or Google Safe Browsing diagnostic page.

    Firefox Security

    Its always nice when someones got your back. Who knows MSY might actually endup making a proper website now instead of the messy FrontPage site that was.

    {lang: 'en-GB'}

    Ubuntu 8.04.1 LTS Released

    July 4th, 2008 No comments

    Ubuntu 8.04 was released when I was in Japan, but it didnt stop me from downloading it – sucked it up at ~5Mbps which was bloody ridiculous!

    Now we can finally get our hands on the first update to this LTS, Ubuntu 8.04.1 which contains – amongst a slew of bug-fixed packages – Firefox 3.0 Final. More information on the changes are posted on the Ubuntu mailing list release notification.

    I’m still running 7.10 on the server at home – until I get the bawls (and time!) to redo the lovely server ZEUS has become to be! In the meantime, my Dell M1330 is upgrading to the 8.04.1 release as I write.

    Grab a copy of Ubuntu 8.04.1 today!

    On a side note, just recently saw the release of Sabayon Linux 3.5 which brings some really cool things to the table, I’ve downloaded the LiveDVD and considering giving it a go.

    {lang: 'en-GB'}