Subscribe: Nauman Leghari's Blog
Added By: Feedage Forager Feedage Grade B rated
Language: English
application  assembly  code  codestore  database  erlang  file  google  net  new  nhibernate  otp  project  rails  start 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Nauman Leghari's Blog

Nauman Leghari's Blog

Blog about technology, media and other interesting tidbits


SequenceViz is going Pro

Sun, 01 Feb 2009 17:21:00 GMT

This is one of the things on my mind for quite some time. As with most other software developers, I wanted to start a microISV to experience the whole product development cycle. To get an idea wasn't as important as the execution so I decided to take one of my open source project to begin with. And that project is SequenceViz.

SequenceViz is my latest open source project which was very interesting to work on and received a lot of community attention. According to the codeplex stats, the number of downloads are +25000 and that didn't include the downloads before I put it on codeplex. Although this number is not the reason behind selecting SequenceViz.

The work on SequenceViz Pro is already started and if everything goes according to the plan, I'll be releasing the beta of SequenceViz Pro soon. This blog will become the primary source for any updates on that project along with my twitter feed.

So What'll happen to SequenceViz @ Codeplex:
The plan is to leave the open source version as it is and I'll not be taking it any further. I'll also remain as project coordinate so If you're willing to improve the open source version then please contact me.

GmailSync on codeplex

Wed, 19 Nov 2008 22:49:00 GMT

By far the most popular tool that I published is GmailSync which was also features on Lifehacker. But as I get busier in other projects, it is getting difficult to put more effort into it. Its been a while since I put the last update so I've decided to upload the sources hoping that I can find someone to lead on this.

You can download the binaries and check out the sources from the following url. As the source code is not the best I've written so I'm willing to work with anyone who is interested.

SequenceViz 0.11 :: Reflector Addin support

Mon, 13 Oct 2008 21:42:00 GMT

Just uploaded the latest release of SequenceViz which now includes the Reflector plugin with the WPF renderer.



SequenceViz 0.9 :: WPF based Sequence diagram viewer

Wed, 24 Sep 2008 18:57:00 GMT

Until now, SequenceViz uses the GnuPlot tool to generate the SVG file that is then rendered in the IE control embedded in the application. Although this worked to prove the concept but there were problems with rendering large diagrams and security issues in Vista. Now thanks to Meile Zetstra who provided the WPF implementation for the diagram viewer I have released a new version with this functionality.



Hope you'll like this release and as always, provide your comments and suggestions to improve the application.

SequenceViz 0.7 :: Quick search

Sun, 10 Aug 2008 21:01:00 GMT

I managed to spend some time on SequenceViz this weekend and added quick search functionality. Because the diagrams are not linkable so it is difficult to navigate between methods and types. One thing that could help now is to search for the type or method that you'd like to navigate to and it will take you to the first result.

As always, please enter your comments or suggestions here.




CodeStore - Part 4 of n (Refactoring, Hudson CI Tool)

Mon, 21 Jul 2008 19:23:00 GMT

Although there is not much in this project yet but I think there are few things that can be improved before moving ahead.   Moving castle configuration from the App.config file to its own file:   This is to remove the noise in the main application configuration file and it is as simple as extracting the castle configuration items into another file and passing that file name in the WindsorContainer constructor.     Abstract IOC container:   It is a good idea to abstract dependencies and therefore the reason of DI containers. But what about the DI container itself. One way to do this is to abstract it behind a separate class IOC.cs     Moving the engine implementation into a separate namespace.     Using Hudson as a Continuous Tool:   I have used CC.NET before and I remember that it wasn't a smooth setup. So for this project, I've decided to try Hudson.   Hudson is built on Java but it is extremely easy to setup and the .NET plugins for MsBuild, Nant, Nunit and support for running batch files makes it a viable alternate to CC.NET.  I found an excellent tutorial ( on setting up Hudson for .NET projects and believe me, it just works.    Once I completed the setup, the hudson dashboard looks like this. I've also checked in the configuration file that I used for this project.     Source:   Conclusion: In this post, I've done some small refactoring on the project structure and then used Hudson as a CI tool. In the next post, I'll start putting in more functionality into the project.[...]

CodeStore - Part 3 of n (Cecil, Moq)

Fri, 18 Jul 2008 21:38:00 GMT

This is the third part of the series on building CodeStore. In this blog post, I'll finish off the first user story which was 1)  As a customer, I want to query the Assembly data in the database so that I can get metrics about the assembly.   The story is further decomposed into two tasks:   a)   Read Assembly Data b)   Store Assembly Data in SQLite using Nhibernate.   We start with completing the unit test for AssemblyDataRepository. If you remember in Part II  that I changed the Nhibernate integration to use Castle Nhibernate repository and therefore passing in the ISessionManager to the repository classes.   So, to test AssemblyDataRepository I'm going to mock ISessionManager to test the behaviour of the method.  As this project is about learning so I've decided to use Moq ( as the mocking container.    Moq uses lambdas to set expectations which takes some practice to get used to. You can read more about Moq on Daniel Cazzulino blog (   So we start with a test for adding assembly data using the repository.     It uses the same test flow as other testing (mocking) frameworks. Setup data Setup mocks, expectations Run SUT Verity the expectations Once the test is passed, we can check off the second task of the story. I can write few more tests but let's not worry about that for now. The next thing to look into is actually parsing the assembly and extracting the required information from assembly metadata. To read IL, I'm going to use Cecil which can be downloaded from   The initial model for code analysis engine looks like this. (Please note that the following diagram is the snapshot taken at the end of this blog post)   I started with CodeAnalysisEngine whose job is to ask the CodeAssemblyLoader to load the assembly and then pass it to CodeAssemblyParser to do the actual information extraction.   Testing CodeAnalysisEngine:     The first two statements create the mock objects to use in the actual call. The next line sets the expectation to load the provided assembly file. The implementation of the SUT:     In the next test, I added the assembly parser in the constructor which prompts a change in the first test to take in another argument.     And the implementation now calls the Parse method on the assembly parser.     The next step is to unit test the CodeAssemblyLoader. This class is responsible for loading the assembly file using Cecil, so the test expects a call to Cecil's AssemblyFactory.GetAssembly method. Unfortunately AssemblyFactory.GetAssembly is a static call which makes it impossible to test. If it is Ruby then I can easily mock it but that's another thing :).   And, here is the implementation of CodeAssemblyLoader class     Testing CodeAssemblyParser is also not easy because of the same AssemblyFactory issue so I'm going to load the actual assembly but mock the repository to expect the add method.     Line no. 17 is loading the actual assembly. Then I mocked the repository and set it to the assembly parser. In the end, I set the expectation and call the method to verify.  The Parse method internally calls the AddAssemblyData method with the assembly definition.     So the unit tests are passing, I still need to implement the dependency injection configuration to run the application.   Setting up Castle configuration for dependency injection:   There are two different dependencies which we need to resolve here. First, CodeAnalysisEngine depends on the CodeAssemblyLoader and CodeAssemblyParser which it takes in as constructor arguments.     Second, to resolve the dependency in assembly parser for assembly data reposi[...]

CodeStore - Part 2 of n (SQLite, NHibernate)

Thu, 17 Jul 2008 21:28:00 GMT

 So, in the last post, I started creating a new application using TreeSurgeon and added Castle Windsor and log4net support. In this post, I'm going to describe how I added the Nhibernate support and the Castle Nhibernate facility.   User Stories: Because CodeStore is about storing metrics about an Assembly therefore I'm going to start by storing the assembly information. Therefore the first user story is:   1) As a customer, I want to query the Assembly data in the database so that I can get metrics about the assembly.   After breaking the story into tasks, we have: a) Read Assembly Data b) Store Assembly Data in SQLite using Nhibernate.   Although we can start with any task, but in this scenario I'll go with the second task which is about setting up Nhibernate to store data in the SQLite database.   Pre-Requisites: There are few things we need to download and setup before start coding. Download SQLite ADO.NET Database Provider ( The good thing about this provider is that it embeds the sqlite database engine so you don't need any more dependencies. Download SQLIte Database Browser to manage the database ( but you can also use the native sqlite engine to manage the database from console. Download NHibernate.   Once we have the required dependencies, we can start by creating a new datastore. SQLite Database Browser allows you to create a new database but you'll have to create a temporary table so that it can save it in the file.     Then I added a new class AssemblyData in our Core.Domain namespace.     Once all the fields are defined, I generated all the properties using Resharper (Alt+Ins)     It seems that Resharper doesn't generate the auto properties so you'll have to fix it (Ctrl + Enter).     Or you can just type the auto properties without any help which may be the quickest option :).   The next step is to create the nhibernate mappings file. When editing the mapping file, it is much better to add the nhibernate mappings schema to get intellisense in the IDE.         The complete mapping file looks like this. The build action should be set to embedded resource.                                       As we have the domain class and the corresponding mapping file, we can configure the application to use Nhibernate. For that, I created a separate hibernate.cfg.xml file in the Core application with the following contents. The properties are self-explanatory and you can always learn more by looking into the Nhibernate documentation.         NHibernate.Driver.SQLite20Driver     Data Source=E:\Code\CodeStore\data\codestore.db;Version=3;New=False;Compress=True;     NHibernate.Dialect.SQLiteDialect  [...]

CodeStore - Part 1 of n (TreeSurgeon, Castle Windsor, Log4net)

Wed, 16 Jul 2008 21:27:00 GMT

What is CodeStore? The idea behind CodeStore is to extract information about .NET assembly and store it in a database. One we have the data, we should be able to run standard SQL queries on the data store. Although, I'm planning to develop a WPF project to show some visualisation but let's see how it'll go.   So why CodeStore? I needed a pet project as it's been some time from my last one. And I get more into Ruby and Java, this gives me an excuse to keep up my .NET skills. This is also an experiment to maintain a running project diary on this blog.   Tools to use: Nhibernate: data access Castle Windsor: application plumbingLog4Net: logging (link) ... And many more   Setup: I started with setting up our development environment and one thing that proved very useful to me in the past is TreeSurgeon (  TreeSurgeon is an excellent tool to generate your development tree. It definitely saved a lot of time at the start of the project.     Once the solution is generated, we can quickly check if the build is working.     Code check-in: Then I created a project on google project hosting which is available at     I used TortoiseSVN ( to import the project and AnkhSVN ( for Visual Studio integration.    To ignore certain files, I've also setup the following pattern into TortoiseSVN global ignore pattern. (TortoiseSVN->Settings->General)   bin */bin obj */obj *.suo _ReSharper.* *.resharper *.resharper.user  *.user   Writing code: Now we can start plugging in Castle Windsor and setup the configuration to inject a simple class. To do so, I added the three castle dependencies into the CodeStoreConsole project.     And then using the following code inside Main() to resolve CodeAssemblyLoader.   var container = new WindsorContainer(new XmlInterpreter()) var assemblyLoader = container.Resolve("assemblyLoader"); assemblyLoader.Load();   As you can see, it is using WindsorContainer  which is used to read the configuration file and resolve the components from the configuration. And the configuration looks like this.                   You can view the complete application configuration file here. Here is the output when the application is executed.     At the moment, ILoader.Load() takes no argument, but we are going to change it so that it'll take in a file name. The target assembly is selected using the FileOpenDialog. This is a very common behaviour that I use so I think it would be better if I can put that in ReSharper Live Templates.     Now, I can use it using the shortcut.     After the code to open file, I added a new project in our solution which will be the target test case for the code analysis engine. Now, when the application is executed, we'll see that the file is successfully selected.     At the moment, I'm using Console.Writeline to print the output which is not ideal so I'm going to replace it with log4net.   One way to add log4net is to directly add it in your code (like I described in but there is also Castle Logging facility which makes it possible to abstract the logging engine (although you can also do this quite easily).   One that topic, I found a very useful blog post[...]

Blue Screen Of Death 2.0

Mon, 14 Jul 2008 13:22:00 GMT

The New Blue?

LinkList 13072008 :: Ganymede, Thrift vs Protocol Buffers and Port based Async Messaging

Sun, 13 Jul 2008 23:16:00 GMT

Things i like in Ganymede
Ganymede is the 3.4 release of the Eclipse project. Releasing 23 simultaneous projects itself it a really huge achievement.

Thrift vs. Protocol Buffers
First Cisco Etch, then Thrift and now Protocol Buffers. Is it the revenge of RPC?

Introduction to Port-Based Asynchronous Messaging

Democratizing the Cloud (Video)

LinkShrink - Learning Ruby on Rails

Sat, 12 Apr 2008 17:31:00 GMT

The best way to learn something is to develop an application with it. So when it comes to Rails, I decided [*] to develop a clone of TinyUrl.

Here is the screen shot of the website. The source code is hosted at google project hosting and you can find the summary of the development here.


[*] The suggestion to develop this as a starting point came via Adnan Masood who is running LinkCutter.



BookNotes : Practical Rails Projects

Thu, 27 Mar 2008 18:20:00 GMT

Once in a while; when I try to remember something that I read in some book some time ago, I don't usually succeed in that and then I have to start from scratch which is like DRY. So, I'm trying to do something new here by posting anything interested and useful that I read in a book. This is like a customized index to the book. The following notes are from a book titled "Practical Rails Projects". In my quest to learn as much languages as I can, I found it refreshing to learn about rails and ruby.  There are a number of things from Rails that I'd like to see tightly integrated with ASP.NET.  With more dynamic features in C#, ASP.NET MVC, MonoRail  and SubSonic, I'm sure it will be fun again to develop with .NET :). A little summary of the book. Pratical Rails Projects covers a niche area of learning. While you get to learn about the basics of Ruby and Rails in "Agile Web Development with Rails" and get in depth with "The Rails Way", you still need to learn how to effectively apply the technology on a real-life project. While many of the projects built in the book are not real-life examples but they all have the potential.  Anyway, you get the idea, right? So here are the notes: Chapter 1: About installing Rails, Setting up a project so skipping it.  Chapter 2: Stylesheets: YUI reset-fonts-grids.css for CSS layouts Freezing Rails: Freeze other gems: Chapter 3,4,5: MonkeyTasks: A Todo list application User authentication and management: acts_as_authenticated plugin before_filter, after_filter - AOP like methods on controllers Create model with --skip-migration to bypass the creation of migration file Chronic gem( gem install chronic) : natural language parser for date (Yesterday, this Monday etc) Calendar plugin: Design tip: Skinny controllers, Fat models Chapter 6,7,8: Exercisr : REST based application Mapping resources for REST scaffold_resource Authentication: restful_authentication Graphs: CSS Graphs:  Plugin: Sparklines: gem install sparklines Gruff: gem install gruff Scruffy: gem install scruffy (gruff for svg) Ziya Chapter 9: Blog application Typo: Rails startup process Schema.rb for complete database schema AOP around_filter Nifty Corners: Chapter 10: Simple Blog: Web Services, MetaBlog API, Blogger API Action Web Service: SOAP and XML-RPC based services Using ExtJS for Layout: Pagination: will_paginate plugin: svn:// Creating a URL with title text: title.gsub(/[^a-z1-9]+/i, '-') Permanent link: plugin: Adding comments to a web page: Tagging: acts_as_taggable, acts_as_polymorph Chapter 12, 13, 14: Comic: Caching Attachments: Attachment Fu, Page Caching: caches_page, expire_page. Will not work for different types of users. Cache sweeper Action caches: caches_action :index, :webcomic. Causes duplication Fragment caching: cache do .. End Rails forum: Chapter 15, 16, 17: Church Community Users, Profiles, Blog, Home Page, Comments, Photo Gallery, Rich edit control Batch image uploading with SWFUpload, activeupload Image cropping: works with attachment_fu Chapter 18: Gaming Trends: Rewrite of an old PHP project ExtJS layouts, grids Applying Rails database migrat[...]

LinkList 19032008 - Google Visualisation API, amCharts for ASP.NET and Django on IronPython

Wed, 19 Mar 2008 20:28:00 GMT

How Apple Got Everything Right by Doing Everything Wrong Google Visualisation API ( out of Gapminder ) Controls for amCharts running on IronPython  [...]

Linklist 03022008 - Dynamic programming design patterns, Erlang/C# AMQP Client, AOP

Sun, 03 Feb 2008 12:37:00 GMT

Design Patterns in Dynamic Programming

Introducing the Erlang AMQP Client

.NET/C# AMQP client library and WCP binding

Improving Agility in Visual Studio
( NAntAddin and NUnitAddin )

Using AOP in the Enterprise (Video)

Topics in High-Performance Messaging

Microsoft buying Yahoo?
- Google could be the beneficiary here as this could start a mass exodus of talented developers if the deal go through.

Integrating .NET and Erlang using OTP.NET

Wed, 09 Jan 2008 03:01:00 GMT

Summary: A simple example using OTP.NET to connect a .NET node to an erlang node. I have decided to write this after reading the article on "Integrating Java and Erlang" on so I highly recommend that you read that article before continuing here as there are many things which are already described there which I'm not going to repeat.   OTP.NET is a port to the Jinterface that the author used in the serverside article.  Here, I'll use the same process to integrate erlang code with a C# application.   [I found OTP.NET while browsing through the Jungerl code repository. Jungerl contains miscellanous utilities for erlang programmers]   The source code for the erlang mathserver application is also listed here. I've changed it to do multiplcation instead of addition and made it simpler by removing the send/receive code.   File: Mathserver.erl -module(mathserver). -compile(export_all).   multiply(First, Second) -> First * Second.   Now, you can try this code in an erlang shell to see if it is working   (1) >> werl.exe -sname servernode -setcookie cookie (2) (servernode@apollo)3> c(mathserver). {ok,mathserver} (3) (servernode@apollo)7> mathserver:multiply(10, 3). 30   (1) starts an erlang shell in a window using servernode as the short node name. The cookie is also required for security and you can see how we will use it in the client. (2) & (3) we then compile our application and call the exposed method to get the result back.   Before starting to write a C# Sharp application, we can quickly start another erlang shell to see if we can connect to our server node from a new node. >> werl.exe -sname clientnode -setcookie cookie >> (clientnode@apollo)3> rpc:call(servernode@apollo, mathserver, multiply, [10, 2]). 20   Once we are confident that the erlang application is working, we can close the client node shell and start devenv.exe and a new project .   The first thing we need to do is to include the reference to the OTP.dll file. You can either compile it yourself by downloading the source code from jungerl[sourceforge] or just download the sample application(sample download link). Please note that I've only included the dll in the sample and not the full source code.   Now you can add the following code to the main method.using System; using System.Collections.Generic; using System.Text; using Otp; namespace ErsharpClient  { class Program { static void Main(string[] a) { OtpSelf cNode = new OtpSelf("clientnode", "cookie"); OtpPeer sNode = new OtpPeer("servernode@apollo"); OtpConnection connection = cNode.connect(sNode); Otp.Erlang.Object[] args = new Otp.Erlang.Object[] {  new Otp.Erlang.Long(1), new Otp.Erlang.Long(4) };  connection.sendRPC("mathserver", "multiply", args); Otp.Erlang.Long sum = (Otp.Erlang.Long)connection.receiveRPC(); Console.WriteLine("Return Value:" + sum.ToString()); } } } This is exactly similar to the code described in the article therefore I'm not going to duplicate that information.   Download Sample Application    Other Links: [ServerSide Article] [JInterface] [OTP.NET Announcement] [Jungerl] [OTP.NET] http://jungerl.cvs.sourceforge.n[...]

Erlang Cheat Sheet

Sat, 29 Dec 2007 18:10:00 GMT

I have just uploaded v1.0 of my Erlang cheat sheet. There are too many things which are still left out so please provide comments and suggestion on what you would like to see in the next version.

Download Erlang Cheat Sheet 1.0 (PDF)


Microsoft Volta and its logo

Thu, 06 Dec 2007 21:23:00 GMT

Is it just me or the following logo of just released Volta looks familiar?


Google Scalability Conference

Sun, 08 Jul 2007 22:14:00 GMT

Some of the sessions from Google scalability conference are now available on Google Video.

YouTube Scalability

Building a Scalable Resource Management

Abstractions for Handling Large Datasets

Lessons In Building Scalable Systems

MapReduce Used on Large Data Sets

Scaling Google for Every User

SCTPs Reliability and Fault Tolerance