Saturday, May 04, 2013

Analayze your code with Ndepend

Ndepend is a static code analyzer  for .NET projects. It performs analysis of the project codebase;  and provides metrics, graphs and reports ; all of which helps a developer to enhance the code quality. I would like to  thank Patrick , for developing it, and also for providing a licence to me.

Post code analysis, Ndepend provides several tools to better your code . 

1) Dependency Graph - As the name implies, the graph  displays the caller and the callee in the project. This is important as it provides a birds eye view , when the code base is large.

2) Queries and Rules explorer - This is an amazing tool , which displays areas where the code needs improvement. The explorer addresses several sections - architecture, design considerations, dead code etc . I am providing a snapshot below :-


Once a rule is selected ; the query and rules editor automatically creates a CQLinq syntax , executes the query and displays the result. Alliteratively , the developer can also write a query ( for those not covered by Ndepend ) and get respective results.

3) Metrics - The Metrics window displays the usage and relevance of the code being analyzed.  The developer can use the metrics, to view where are the methods being called directly or indirectly. Besides methods, developers can also view metrics of namespaces , fields  ; which come in very handy to understand calling sequences and workflow in large projects.

4) Dependency Matrix - The dependency matrix is a visual representation of the methods being used, and the methods using them . I am posting a screenshot below .


The following is the representation of the green and blue colour .

The Matrix Cell is Green because the method (in column) is used by the method (in row). 

The Matrix Cell is Blue because the method (in column) is using the method (in row). 

More features can be found here.  Overall I find it a great tool ; I shall update this post once I come across new features.

Monday, May 28, 2012

Interface based programming in C++

This is a small example of the interface I had designed for exposing SkypeKit functions in a DLL .
In the below sample,  only the interface ISkypeClientLib is being exported.

// This interface is exported from the DLL
   1: class SKYPECLIENTLIB_API ISkypeClientLib
   2: {
   3: public:
   4:     virtual bool Connect(char* strAccountUID,char* strAccountPWD) = 0;
   5:     virtual void LogOut() = 0;
   6: };
   7:  
   8: // Forward declaration
   9: class CSkype;
  10:  
  11: class CSkypeClientLib: public ISkypeClientLib
  12: {
  13:     public:
  14:         CSkypeClientLib(void);
  15:         virtual bool Connect(char* strAccountUID,char* strAccountPWD);
  16:         virtual void LogOut();
  17:   
  18:     private :
  19:         CSkype *pSkype ;
  20: // more code
  21:  
  22: }
  23:  

Monday, April 09, 2012

Creating an Office Ribbon in Outlook

I have stared working on an Outlook addin which shall have the most commonly used utilities needed. I shall be releasing the tool as freeware , but till then let me share how can you integrate an Office Fluent Ribbon to Outlook.

I am using Addin Express to do this , and below are the steps I have followed

1) Add a AdxRibbonTab and ImageList in the Visual Designer.
2) In the Imagelist one can add several images , and access them by the index, 0 being the first image in the Imagelist.
3) Add the buttons in the Ribbon tab, in my case I have added two Convert to PDF, and About.

Now you can tie up the button events and write your code there.



Wednesday, April 04, 2012

Enabling and disabling Office Addins programatically using C#

The following code is an example for enabling / disabling Outlook addins.

I have used the Interop.Outlook as I was developing for Outlook. If you want to do this for other Office applications, eg, Word , Excel, Powerpoint, please reference the respective interop.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Core;
using Microsoft.Office;
using Microsoft.Office.Interop.Outlook;


private static void Connect(bool bStatus)
{
  // More code
   
objComAddin.Connect = bStatus;

}
}

Monday, February 27, 2012

Time Tracking using Fanurio

Productivity is often a measure of the time spent to get the task done. However, often during our work, sometimes one might get busy with several other things . like preparing a meeting agenda, responding to personal emails – which distracts the person from the original work. The time tracking in this scenario becomes a bit complex as one did not work on the assigned task for the entire eight hours.

A time tracking tool, like Fanurio is very handy to tackle software project management . The user can start the timer, when starting the actual work, and pause / resume the timer when he/she is working on something else ( eg. responding to personal emails). The tracking lets the user know what is the exact number of hours he had spent for the primary task. This also lets the client know the actual time spent for the projects, and thereby provide transparency between the user and the client for hourly jobs.
When the user is idle for a considerable time, the tool can also let the user know using notifications – at times notifications might act as a reminder to start the main task.