Windows Installer Cleanup Utility

May 22nd, 2007 Comments off

If you have ever used MSI installation packages involving Windows Installer, you are probably aware of its nuisance. I can deal with the fact that it’s a pain to create decent installations without shelling out hundreds or thousands of dollars for third party tools such as Wise and InstallShield, but I just can’t cope up with the fact that my customers can’t install or uninstall an application built using Windows Installer for no apparent reason. When using the Add/Remove Programs applet in the Control Panel, sometimes MSI packages can’t be removed. I have a system with BizTalk Server installation that I can’t get rid of. There are even issues around upgrading an application and at times the installer complains and won’t budge.

To alleviate some of the pain, Microsoft finally came up with a Windows Installer Cleanup Utility, that can be used to remove all references to a given application from your system. This utility just saved me a few hours worth of work when Installer refused to uninstall a given application from my system so that I could install a newer version. Without this utility I would have had to go through and search my registry for all references to the application and remove them by manually hand. Then, if I was lucky, I would be allowed to install the newer version of the application. With this utility I removed the application from my system in seconds and painlessly installed the newer version after that.

JScript Eval Method In C#

February 6th, 2007 Comments off

JavaScript and JScript languages provide a convenient Eval method that allows for dynamic evaluation of expressions. This functionality can be duplicated in C# using Microsoft’s JScript CodeDomProvider and Reflection.

Following class automatically compiles an in-memory assembly using JScript CodeDomProvider. The Eval method uses this assembly to dynamically evaluate specified expressions:

using System;
using System.CodeDom.Compiler;
using System.Reflection;
using Microsoft.JScript;

/// Implements JScript/JavaScript Eval like
/// functionality in C# to allow dynamic evaluation
/// of expressions.
public static class ExpressionEvaluator
    #region Private Members

    private static Type _evaluatorType;
    private static object _evaluatorInstance;
    private static readonly string _jscriptEvalClass =
    @"import System;
class JScriptEvaluator
public static function Eval(expression : String) : String
return eval(expression);


    #region Private Methods

    /// Creates a dynamic in-memory assembly using JScript.NET
    /// to evaluate expressions.
    private static void Initialize()

        CodeDomProvider compiler = new JScriptCodeProvider();

        CompilerParameters parameters = new CompilerParameters();
        parameters.GenerateInMemory = true;

        CompilerResults results = compiler.CompileAssemblyFromSource(parameters, _jscriptEvalClass);

        Assembly assembly = results.CompiledAssembly;
        _evaluatorType = assembly.GetType("JScriptEvaluator");
        _evaluatorInstance = Activator.CreateInstance(_evaluatorType);


    #region Public Methods

    /// Evaluates specified expression using reflection
    /// on the assembly generated in Initialize() method.
    /// The expression.
    /// A string representing evaluated expression.
    public static string Eval(string expression)
        if (_evaluatorInstance == null)

        object result = _evaluatorType.InvokeMember(
        new object[] { expression }

        return (result == null) ? null : result.ToString();



Using this class, we can execute statements such as:

        Console.WriteLine(ExpressionEvaluator.Eval("2 + 9"));

Anthem.NET – An AJAX Library for ASP.NET

December 7th, 2006 Comments off

A¬†coworker introduced me to Anthem.NET, which is an AJAX library for the ASP.NET platform. Within the last year or so, quite a few AJAX libraries have surfaced, including Microsoft’s ASP.NET AJAX (formerly known as ATLAS), and other free and commercial products. Some of these are pretty decent, while others are not even worth investigating. Anthem.NET, with it’s impressive functionality, belongs to the former group.

Some of the features of Anthem.NET include:

  • Free and open source
  • Support for .NET 1.x and 2.0
  • Seamless integration with Visual Studio 2005
  • Broad browser support (IE, Firefox, and Safari)
  • Support for Mono
  • Familiar ASP.NET postback style functionality
  • Support for ASP.NET ViewState
  • Support for web user controls

You can download Anthem.NET from SourceForge.

Microsoft LogParser

August 15th, 2006 Comments off

It’s kind of ironic that soon after I finished writing a log viewer for my log4Net XML logs, I came across this universal log parsing tool by Microsoft called Log Parser 2.2. I started playing with it and it seems pretty good at what it does. You can create nice looking HTML reports and even charts from your log data (xml, csv, tsv, active directory objects, registry, etc.). All it takes is some basic SQL skills, and you are on your way to producing meaningful views / reports out of your log files. The beauty of the tool is in its extensibility; you can parse an array of data types using this tool.