Sunday, December 14, 2008

My Notes on Safari Nightly Build

To install safari nightly build

1. Go down to : and
2. Extract the file and run-nightly-webkit.cmd

You might need to run FindSafari.exe to seek out where Safari is installed in your machine

Thursday, December 04, 2008

Writting a SQL Profiler

In case you're wondering how to write a SQL Profiler to automate some of your task, here are some code that you might want to try out :)

Add reference to Microsoft.SqlServer.ConnectionInfo in your project and you are good to go!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.SqlServer.Management.Trace;
using Microsoft.SqlServer.Management.Common;

using System.IO;
using System.Configuration;

namespace MSSQLProfiler

public class MSSqlTracer

ConnectionInfoBase conninfo = null;

public string TemplateTraceFile { get; set; }
public string TraceOutputFile { get; set; }

public void StartTrace(string TemplateFileSource, string OutputFileName)

TemplateTraceFile = TemplateFileSource;
TraceOutputFile = OutputFileName;


/// Perform Database Tracing ////



private void RunTracing()

TraceServer tracer = new TraceServer();
tracer.InitializeAsReader(conninfo, TemplateTraceFile);
string BufferStr = "";

StreamWriter OutWriter = new StreamWriter(TraceOutputFile + ".trace", true);

while (tracer.Read())
if (tracer.IsDBNull(1))

BufferStr = tracer["TextData"].ToString();



private void Initialization()


private void SetupConnection()
conninfo = new SqlConnectionInfo();
((SqlConnectionInfo)conninfo).ServerName = ConfigurationManager.AppSettings["ServerName"];
((SqlConnectionInfo)conninfo).UserName = ConfigurationManager.AppSettings["Username"];
((SqlConnectionInfo)conninfo).Password = ConfigurationManager.AppSettings["Password"];
((SqlConnectionInfo)conninfo).UseIntegratedSecurity = false;