Showing posts with label Development. Show all posts
Showing posts with label Development. Show all posts

ADD FILE HEADER OR CHANGE LOG TO FILES IN VISUAL STUDIO BY USING MACRO

Adding the Macro:
1. Click “Tools” menu
2. Click “Macros” menu item
3. Click “Macros IDE…” menu choice
4. Right click on “My Macros”
5. Click “Add” menu item
6. Choose “Add Module…” (a module is a VB term for a static C# class with all static members)
7. Enter the name of “FileHeader” (or whatever you want to name your module)
8. Paste the code below and update any variables to match your organization or name

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics

Public Module FileHeader

    Sub FileHeader()
        Dim doc As Document
        Dim docName As String
        Dim companyName As String = "My Company"
        Dim authorName As String = "Benedict Alphonse"
        Dim copyrightText As String = "© 2009 My Company. All rights reserved"
        Dim Email As String = "benedictkmu@gmail.com"
        Dim Summary As String

        ' Get the name of this object from the file name
        doc = DTE.ActiveDocument

        ' Get the name of the current document
        docName = doc.Name

        ' Set selection to top of document
        DTE.ActiveDocument.Selection.StartOfDocument()
        DTE.ActiveDocument.Selection.NewLine()

        ' Write first line
        DTE.ActiveDocument.Selection.LineUp()
        DTE.ActiveDocument.Selection.Text = "#region File Header"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "// ******************************************************************************************************************"
        DTE.ActiveDocument.Selection.NewLine()

        ' Write copyright tag
        DTE.ActiveDocument.Selection.Text = "// "
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "//     " + copyrightText
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "// "

        ' Write author name tag (optional)
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "// " + authorName + ""
        DTE.ActiveDocument.Selection.NewLine()

        ' Write email  tag (optional)
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "// " + Email + ""
        DTE.ActiveDocument.Selection.NewLine()

        ' Write email  tag (optional)
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "// " + docName + ""
        DTE.ActiveDocument.Selection.NewLine()

        ' Write email  tag (optional)
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "//------------------------------Revision History---------------------------------------------------------------------"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "// Date             Author                  Change Log Comments"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "//" + DateTime.Now.ToString("MMM/dd/yyyy") + "        " + authorName + "               " + "Newly Created" + "                  "
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "//                                                             "
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "//                                                             "
        DTE.ActiveDocument.Selection.NewLine()
        ' Write last line
        DTE.ActiveDocument.Selection.Text = "// ******************************************************************************************************************"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "#endregion"
    End Sub

End Module

Macro Results This creates the following text inserted into the top of the source code document:
#region File Header
// ******************************************************************************************************************
// 
//     © 2009 My Company. All rights reserved
// 
// Benedict Alphonse

// benedictkmu@gmail.com

// ReportUtils.cs

//------------------------------Revision History---------------------------------------------------------------------
// Date             Author                  Change Log Comments
//Dec/01/2009        Benedict Alphonse               Newly Created                  
//                                                             
//                                                             
// ******************************************************************************************************************
#endregion
Adding Macro to Toolbar: To add this to a toolbar in your IDE:
1. Click “Tools” menu
2. Click “Customize…” menu choice
3. Activate “Commands” tab
4. Choose “Macros” category
5. Select “MyMacros.FileHeader.FileHeader” (or whatever you named it)
6. Drag command to your toolbar.
7. You can customize the icon, text, visibility of text/icon, etc. by right clicking on the toolbar button
8. Close customization dialog

Ultimate Developer and Power Users Tool List for Windows

I got to know that Scott Hanselman's 2009 Ultimate Developer and Power Users Tool List for Windows. This is very handy list. you can get more info of these lists from http://www.hanselman.com/blog/ScottHanselmans2009UltimateDeveloperAndPowerUsersToolListForWindows.aspx

Open source Error logger Frameworks for .NET Applications

I was tried to find alternate error logger framework for Microsoft Error logger framework since its bit heavy. I came to know to that few Error loggers which are more flexible and light weight for .NET Applications 1. Log4Net : is a tool to help the programmer output log statements to a variety of output targets. log4net is a port of the excellent log4j framework to the .NET runtime. 2. NLog : NLog is a free application logging library for .NET designed with simplicity and flexibility in mind. You can use NLog to write diagnostic traces from your application, so that they can be analyzed later. NLog can write your log messages to multiple targets. Among all loggers frameworks,Log4Net is best logger i have seen ever.

Open source WIKI Engines for ASP.NET Applications

I was asked to developed WIKI Pages for our application. I started looking to create a WIKI pages with fully functional. Finally I found few Open source WIKI engines written in .NET. Those WIKI engines providing source code which enables us to customize WIKI as per our requirement. I am listing here my findings. It would help developers who are all going to create WIKI for their applications :

  1. Deki Wiki
  2. ScrewTurn Wiki

  3. MindTouch DekiWiki

  4. FlexWiki

  5. SushiWiki

  6. Perspective Wiki Engine

  7. DotNetWiki

My choices are 1. Deki Wiki and 2. ScrewTurn WIKI.

Free Cheat sheets for all developers

Hi Everybody, This is my first actual post of this blog. I would like to share something about Reference cards and Cheat sheets for all developers. When I was googled, I found some nice Cheat sheets for all programming languages like C#, ASP.NET and Java in this site http://refcardz.dzone.com/ I hope it would more useful for all developers.