Monday, March 16, 2015

SQL Formatting and more with SQL Pretty Printer


Formatting SQL statements, for improving code readability, and maintainability when the SQL statement is changed , or when fields are added, is  one of the tedious job I need to do during development . 

SQL Server still does not have any formatting option -   to make the above statement look better . Hence,   I pasted team as it is ,  even knowing that  Stringbuilder would have done justice , and maintaining the SQL statement shall be a little difficult compare to the formatted statement.

Later, while searching for a quick solution to the above, I came across SQL Pretty Printer.  On using it, I found it an amazing tool, which has the following features.

Main Features
  • Formats SQL statements
  • Beautifies SQL statements, alomg with customizable templates.
  • Converts SQL to various language formats, C#, VB, HTML
  • Converts C#, VB, PHP code to SQL; I have only tested with C#, and have seen it working
  • SQL Re-factoring / Renaming of Tables and Columns .

The short video below  explains the functionalities of the software.




The software comes in three versions ; namely desktop , SQL Server Addin and Visual Studio Addin.

I have used the Desktop version, and found it very handy and useful tool, for formatting SQL statements and converting them to relevant programming language syntax.

My Wish List :

While SQL Pretty Printer does as promised, I have prepared a small wish list :
  • Conversion of SQL to parameterized queries.
  • Conversion of SQL to LINQ – converting old SQL statements shall help developers to use LINQ and its functionalties.

Tuesday, June 24, 2014

Visualize your goals with Goalscape


Setting goals in life is mandatory for all of us. Though, we can chalk out plans and work towards achieving them, we still don’t get the complete picture of how much we have covered or how much is still left to accomplish the goal. A goal tracker shall be a good solution; but a tracker which displays the progress visually would be the appropriate choice; and Goalscape does that perfectly.

Overview

Goalscape is best defined on its website, as visual goal management software; to develop and communicate the key elements of any complex project: overall structure, priorities and progress tracking. It’s an Adobe Air application; available for the desktop and the web ( Goalscape Connect).

Please see below, the goals and sub goals I have defined for a product. Goalscape's circular format reinforces the fact that resources (especially TIME) are limited: time spent for one goal can’t be spent anywhere else.

Using Goalscape

Goalscape Desktop


The tool has a very user friendly and intuitive interface. The primary goal is made up of sub goals and neighbours. While sub goals can be considered as a child node of the parent goal; neighbours are in the same level as other sub goals.
The picture below illustrates the use of the primary goal, subgoals and neighbours.

Primary Goal - “Product”
Sub Goal –“Vision”, “Pricing” , “Development”, “Support”, “Marketing” – they are also neighbours.


There are a several things to note in the picture. One can add notes, resources and tags to a particular goal. Sliders can be used to set the importance and progress. Resource management can also be done, by specifying Responsible, Start Date and End Date.

The sub goal “Need” has a grey arc, which depicts the progress of the respective goal.  Progress aggregates upwards into the parent and higher level goals (all the way to the Main Goal at the centre) in proportion to each subgoal's importance.



The size of each goal's slice indicates its importance (relative to its neighbours).   In the picture below, I have set different importance for the sub goals -  Need ( 31 % ), Identifying users ( 28 % ), Value ( 18 % ) , Crowdsourcing ( 9 % ), Product Continuity ( 14 % ). Since the goal slice of “Need” has the highest importance level, it is followed by the others.  All the sub goals are important, but imagine the plight of an excellent product, which is needed either by very few people or by none.


Filtering by Highlighting

The Highlight feature is a filtering option in Goalscape. Probably the word “highlight” is more appropriate in the Goalscape context, as the tool only filters out the goals matching the dates, resources and tags.



I have added the tag “stakeholders” and “users” to Need and Product Continuity; as a product shall cease to exist if both of them don’t want the product.  In the highlight bar, when I highlight both the tags, only “Need” and “Product Continuity” are being displayed in white, while the others which don’t have the tag are being greyed out.  The highlighting can also be done for dates and responsibilities.

Exporting and Importing

Goalscape also allows user to export their Goalscape’s to PNG, PDF , DOCX,  Mindjet Mindmaps and several other formats. I found the export feature for DOCX and PDF interesting, as a report of the complete goals, sub goals, importance and other goal related facts are generated. Please find the exported “Product Roadmap”  for your understanding.

The import feature, allow Microsoft Project XML and Mindjet mind maps to be imported to Goalscape. I find importing MS Project interesting, as Goalscape shall provide a visual representation, rather than the boring GANTT charts. I have not used the import feature, but I believe it shall work as expected.

Goalscape Connect

Goalscape Connect is the web version and useful for people / teams who want to collaborate the goals with their colleagues. Besides having all the features of the desktop version, it has the real time collaborative features like uploading Goalscape file, chat and sharing.



The Connect version has the following features:-

•  The online project is always the latest version.
•  All participants can access and update the same project at the same time
•  Project administrators can set access privileges for participants individually (View, Edit, Admin).
• Users working on a shared project can see who else is in it and what they are doing (with appropriate warnings about simultaneous updates to the same goal)
•  A central organisational model can be rolled out, for people in different geographies to build their own specific implementations:  and hence ideal for distributed teams and remote coaching.
•  Goal Chat: instant messaging on individual goals, with 'in line' attachments and email notification options.

My Wish List

I would like to see the following features in upcoming versions of Goalscape
        a)    Change the background colour of goal slices.
        b)    Set the font of the goal title in bold.
        c)    Would like to have a Justify option for the Notes section.

Now, it’s time for you, to try out Goalscape, and post your comments. If you feel you would like more features please let them know by filling up the online survey.

I believe you shall like it, as much as I do.

Sunday, April 27, 2014

Displaying the column names for MS Project in C#


Whilst, MSDN provides a very updated and informative developer reference for MS Office  suite in general; it seems to have missed out the same for MS Project .

I was recently developing a MS Project addin in C# using VSTO, and came across several challenges ; but I am happy to say I completed the addin in due time.

The following code displays the name of the columns in the currently open project .

   MSProject.Project activeProject  = Globals.ThisAddIn.Application.ActiveProject;
    MSProject.Table prjTable = prjTable.TaskTables[activeProject  .CurrentTable];

    for (int i = 1; i <= prjTable .TableFields.Count; i++)
    {
         MSProject.PjField field = objTable.TableFields[i].Field;
         string colName  = Globals.ThisAddIn.Application.FieldConstantToFieldName(field).ToString();
        MessageBox.Show(colName);

    }
         
    if (activeProject  != null)
    {
        Marshal.ReleaseComObject(activeProject  );
        objProject = null;
    }

    if (prjTable != null)
    {
       Marshal.ReleaseComObject(prjTable );
       prjTable = null;
    }


There are two other points that should be noticed in this post :-

a) Usage of for loop instead of foreach loop. According to OOM.NET: Part 2 - Outlook Item Leaks , foreach  loops causes a memory leak while for does not. I am following this principle for all the Office addins.

b) Usage of Marshal.ReleaseComObject - Its usage is mandatory as all the objects being dealt with are COM objects

.

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.

Monday, August 29, 2011

Hiding the scroll bar in Checklistbox

Recently I was working on a checklist box control, which was disabled  but did not prevent the vertical scroll bar from appearing. As I had to to keep the checklist box disabled,  I added a panel  on to the checklist box, but still the horizontal scroll bar was visible. Please see the comparison in the picture.



The only resolution I could come was to hide the scroll bar of the checklist box from appearing. I wrote the following code and instantiated an object of it, and it did the trick.

Thursday, November 25, 2010

Implementing Timeout feature in C#

The timeout feature is a handy tool in computer programming , when the user wants to execute some code  after a specific time period . Normally the timeout feature can be acheived by the Sleep command. The following code has a sleep for 2 seconds; also note that Sleep blocks the calling thread .

if (timeout > 0 )
  Threading.Sleep(2000);


Now, what if the user wants to do a polling - there are several options like Timers, WaitforSingleObject , and many others according to your needs . The code I am providing below , also implements the timeout feature using the StopWatch class .

Monday, November 15, 2010

Facebook web mail to take on GMail

The internet war is heating up with every passing day. Though Google still dominates the web , Yahoo and Microsoft continues to explore the space with new strategies . Not sure if they can really beat Google, as Microsoft is mostly into desktop applications and Yahoo looks for money "everywhere" - remember they removed the POP feature in the free Yahoo mail and made it available only to paid customers . Very recently Microsoft has started providing a new look and feel to Hotmail and slowly rising as a nice email provider; event the Window Live 2011 is cool with the ribbon interface .


On the other hand GMail which launched just a couple of years back , has been providing extremely useful features ( POP /IMAP ) along  with integration of other Google gadgets. It also come with a  free  a 7GB storage that increases every day . In fact I have stopped using email clients and rely only on the webmail.

Sunday, October 24, 2010

DropMind : Product Review – Picture your Thoughts

Seavus has come out with a new mind mapping software DropMind . The product is available in different flavours – desktop ( Windows, Ubuntu, Mac ) , web based, mobiles and IPad. Making the product available for mobile devices looks very interesting and promising too.

Mindmaps are used for visualizing thoughts, software project management, brainstorming and project management too. The web version of DropMind can also be used as a web based project management tool for collaborating among users.

The Desktop Version
The desktop version uses the ribbon style interface, which has probably become the standard for most of the new applications. I started off by creating a simple mind map ( see below )
Project

Friday, September 17, 2010

Top effective utilities for productivity

During our daily work I often try to stay away from software "update notification", or use the respective latest product version which even without any additional features has a big memory footprint . I am listing down some of the products which have helped in getting more productive, with lesser memory footprint .

1. Notepad++ - This open source product, is probably the best editor out there. I am using it for several years , and I use it even for a single file. If you are working with multiple files ( like I do ), then the multi tabbed interface lets you switch back and forth . Its support for various programming language , diff / merge , XML Syntax editor and several other cool features doubles itself as the preferred programmers editor. If there was a plugin which could open *sln, *.mak files , then it might give Slickedit a stiff competition.

2. Q-Dir - How many times have you toggled between several Windows Explores , just to find the files(s) you were looking for . In my work place I need to have several of them open, as I have to look into several documents simultaneously . Couple of days back, while surfing the web, I found this excellent freeware and from the first day, I'm lovin' it. Moreover it has a very low memory footprint.
Presently I am using the basic functionality, but there are small icons n each taskbar which adds more functionality  to Q-Dir. I also have RecentX and its a handy tool too.

Wednesday, August 25, 2010

Google Chrome , about.blank problem / solution

I have using Google Chrome for quite sometime ; and I find it handy compared to other browsers .. Yesterday  I encountered a funny problem .

Yesterday, on typing any web address on my Chrome browser bar, I was being redirected to about.blank. Other browsers opened up web sites properly, but Chrome could not.

Monday, August 16, 2010

Change in feed

There shall be a change in the feed link , as I shall be moving the feed to a Google account. The present feed shall become inactive after 30 days .

Please feel free to vist my blog and resubscribe to the feeds.

Thanks for your patience.

Sunday, August 15, 2010

Calling Entrepreneurs - Techsparks

Entrepreneurship has been in the rise in India for quite some time, some of them leaving their normal day job, some starting it as a venture , while some others dropping from premier institutes to give life to their idea.


Wednesday, June 02, 2010

Review - Microsoft Visual C++ Windows Applications by Example

Microsoft Visual C++ Windows Applications by Example: Code and explanation for real-world MFC C++ Applications
The author initially starts the book with basic chapters in C++ , and then goes on to provide samples on Visual C++ . While the examples are good for new learners ; or who want to do their work "fast"  ; this is certainly not a book for those who want to learn Visual C++. 

The book misses out on coverage of dialogs and provide very little  on SDI/MDI - but it provides numerous examples, which shall guide the user in creating an application easily . The examples ( Tetris , Draw ) can surely help to get started, but I dont agree that they are real life examples. The publisher has been kind to share a sample chapter for the readers.

This book shall help in getting a grasp of Visual C++ quickly., but this is not for the experienced users .

Sunday, February 14, 2010

Adding folders to a custom Outlook store

In continuation to my earlier post on creating an Outlook store, today I shall show you how to create custom folders for the store .
I started off by trying the MSDN way, and am providing the code below. The myStore refers to the Outlook.MAPIFolder which represents the custom store.

myStore.Folders.Add("First Folder", olFolderInbox);
myStore.Folders.Add("Second Folder", olFolderInbox);


While the first line created the folder for me , the second line greeted me with an execption "Invalid argument type" . I tried replacing the olFolderInbox parameter with the other permissible parameters of  OlDefaultFolders, but without success .It took me some time to solve this problem , but what I learnt was interesting.

If you look at the Folders.Add(Name,Type ) method you shall see that the Type is an optional parameter, and if you have not worked with Office Automation earlier in C#, you might be wondering how to populate the default parameter; and there was the problem .

Sunday, January 24, 2010

Creating a Outlook store programatically

Office programming has become much easier with Visual Studio for Office. Though the object model still needs to be know, but there is less of COM plumbing, and helper classes to make life easier .
Among the entire Office suite family, Outlook is probably the most used , and hence users prefer addins which can connect to other external applications, be it CRM or fetching data from web service and displaying in the Outlook dashboard
If you are really serious about Office Development,  you should get a copy of Add In Express, which makes office development very easy .  The Addin Express team has been kind enough to provide a 10% discount to the readers of this blogs and so you can grab a copy of Add In Express ( Standard , Professional, Premium ) at http://www.add-in-express.com/purchase/index.php using the discount coupon ADX-GSUJAY-ADX10.

The following code creates a MAPIStore programmmatically. I have used C# as the language. Though I have worked with MAPI , ( Simple and Extended MAPI ) with C++/COM, if you dont need Extended MAPI , C# is just fine . But again remember , that the entire Office Suie is unmanaged code, and C# is managed code , so you may have to do marshalling sometimes .


Outlook.NameSpace olNamespace = OutlookApp.GetNamespace("MAPI");
// Get the Default Inbox folder
Outlook.MAPIFolder olMapiFolder = olNamespace.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);

Outlook.MAPIFolder olCustomFolder;               
string path = "C:\\mydata.pst";
// Create a store

Wednesday, December 23, 2009

Develop Office Addins in a breeze – Part 1

Five years back I was working on a product, which included Word automation. The task was simple ; let the user create a new Word document from within the product . The product was being developed in Visual C++ 6.0 and there was no VSTO . The key idea behind this feature was Office integration .  I had done this using Word automation and COM plumbing with the Word Object Model.
If you are new to Offiice Development ;  and interested in getting a quick overview, I would recommend VSTO 3.0 for Office 2007 Programming. On the other hand if you want to get more deep ,  I would recommend Visual Studio Tools for Office 2007: VSTO for Excel, Word, and Outlook .
Why Office Add - Ins
Things have changed in the last 5 years. Visual C++ 6 has been replaced by the Visual Studio suite, Windows Programming has become much easier, .NET has evolved,  global economy has gone north and new innovative and useful products have made development easier.
Maybe if I was developing the same product today, the concept might have been different . My boss would have probably told me , “Hey , why not develop a product specific menu  in the Word application itself, so the user can directly talk to our app while using Word”. This approach makes much sense, as it not only addresses our need, but also makes the user feel more comfortable ( he doesn't have to start our application to access  the  specific features )
So I would have landed developing a Word Add-in , maybe using Visual Studio Professional Edition ( Extensibility –> Shared Add In Project )  or Visual Studio for Office ( haven’t used it ever ) .