Monday 29 March 2010

How to Run a Windows Service as a Console App in Debug Mode

1. Right click on your windows service project, go to the properties and change the Output Type to Console Application.

2. In the Main method of your Program.cs file, write the following:

static class Program
{
///
/// The main entry point for the application.
///
static void Main()
{
Service1 service1 = new Service1();

if (Environment.UserInteractive)
{
service1.RunAsCommandLineApplication();
}
else
{
ServiceBase.Run(service1);
}
}
}

3. Add the following method to your Service1 windows service:

internal void RunAsCommandLineApplication()
{
this.OnStart(null);
Console.WriteLine("The Service is running.");
Console.WriteLine("Press return to quit application.");
Console.ReadLine();
this.OnStop();
}

4. Install your service using the svcutil.exe tool or using a Setup project

Now you can run your windows service as a console application in debug mode.

Friday 26 March 2010

Buy .NET Components and Controls

Why buying? you might find what you want free:
Commercial components from:

Git Source Control System


Overview
  • A distributed version control system (DVCS) unlike SVN which is centralized
  • Local branches
  • push = commit
  • pull = check out
  • merge = merge
  • Git created by the creator of Linux, Linus Torvalds
  • Design goals; speed, simplicity, strong branch/merge support

Windows PowerShell Commands
  • git --version
    • this command shows the Git version installed e.g. 1.9.2.msysgit.0
  • git init
    • Creates an empty Git repository
  • get config --global --list
    • Lists all the configured users
  • git config --global user.name "William"
    • Creates a global username
  •  echo "Hello, Git" > ReadMe.txt
    • Creates a ReadMe.txt file
  • git add ReadMe.txt
    • Adds the ReadMe.txt into the Git Repository and make it trackable

Thursday 25 March 2010

Source Control Comparison

http://versioncontrolblog.com/comparison/Git/Subversion/Team%20Foundation%20Server/Visual%20SourceSafe/index.html

Process Explorer

Process Explorer is great for:
  • Tracking down DLL-version problems or handle leaks
  • Tracking down which program has which file or directory open
  • Tracking down which process has which DLLs open or loaded

Wednesday 24 March 2010

Application Uninstallers

Sometimes you can't uninstall an application using Add/Remove Programs in Windows, so what can you do?

Revo Uninstaller:
Msizap:

Friday 19 March 2010

Code Comments Generator

GhostDoc:
"GhostDoc is a free Visual Studio extension that automatically generates XML documentation comments for methods and properties based on their type, parameters, name, and other contextual information."
http://submain.com/products/ghostdoc.aspx

Thursday 11 March 2010

Being Assertive is a Must

Assertiveness is a skill that every software developer must have, otherwise the developer's life soon or late would be miserable and too stressful. As software developers gain more experience, they would learn that being assertive is a must. Some never learn and always live in a miserable life:
  • When new works are added to your list that you feel it might affect the project deadline, you must shout out and explain.
  • When your managers set unrealistic deadlines for you, you must shout out and explain; negotiate.
  • When your managers ask you to say when your work is finished, you must almost always clearly shout that it is an estimate judging by what I know now.
  • If you are not sure about something, you must be honest, direct and open and say that I don't know or I am not sure now but e.g. I can investigate or guess
...