Friday, December 26, 2008

Get hosting environment

My friend asked:
What is easiest way to get to know about type of web server?

Why not with our age old friend 'telnet'?

[harsha@JD11AF08 ~]$ telnet 80
Connected to
Escape character is '^]'.
GET / HTTP/1.1

HTTP/1.1 200 OK
Date: Fri, 26 Dec 2008 16:36:23 GMT
Content-Length: 573
Content-Type: text/html
Last-Modified: Sat, 03 May 2008 10:52:12 GMT
Accept-Ranges: bytes
ETag: "72b52dbebadc81:20844d"
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET



Same thing can also be obtained with HEAD

Tuesday, December 23, 2008

CLR version on client

Click once deployment requires CLR to be present on target machine to verify manifest. Following snippets help in detecting the same.

Snippets work with IE5+ and Firefox 3+ only. They fail with Chrome.

Server Side:

protected void Page_Load(object sender, EventArgs e)
bool clrOK = Request.Browser.ClrVersion > new Version(3, 0);
if (clrOK)
Response.Write("CLR Version : " + Request.Browser.ClrVersion);
Response.Write("This machine does not have Microsoft .NET Framework version 3.5 SP1. Install and try again.");

Client Side:

<script type="text/javascript">

DetectCLR(targetVersion) {
//Gets CLR version on IE5+ and Firefox 3+
var uagent = navigator.userAgent;

//Form regular expression
var clrRegExp = new RegExp(".NET CLR \\d.\\d.\\d{5}", "g");

//Get Matches
var clrversions = uagent.match(clrRegExp);

//Is CLR present
if (clrversions == null)
document.write("Please install Microsoft .Net Framework 3.5 SP1 and try again");

//Possible .NET CLR versions for v2 and above
//.NET CLR 2.0.50727
//.NET CLR 3.0.04506
//.NET CLR 3.5.21022
//.NET CLR 3.5.30729
var arraylength = clrversions.length;
var clrversiondetected;
for (var i = 0; i < arraylength; i++) {
//document.write(clrversions[i] + "</br>");
clrversiondetected = (clrversions[i] == targetVersion);

if (!clrversiondetected)
document.write("Please install Microsoft .Net Framework 3.5 SP1 and try again");
document.write("CLR Version : <b>" + targetVersion + "</b>");

return clrversiondetected;

Saturday, December 20, 2008

BOSS Linux - Bharat Operating System Solutions

I just came across BOSS.

BOSS (Bharat Operating System Solutions) GNU/Linux distribution developed by  C-DAC (Centre for Development of Advanced Computing) derived from Debian for enhancing the use of Free/ Open Source Software throughout India. BOSSGNU/Linux - a key deliverable of NRCFOSS has crossed another milestone by releasing version 3.0. BOSS GNU/Linux Version 3.0 is coupled with GNOME and KDE Desktop Environment with wide Indian language support & packages, relevant for use in the Government domain. Currently BOSS GNU/Linux Desktop is available in almost all the Indian Languages such as Assamese, Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi, Oriya, Punjabi, Sanskrit, Tamil, Telugu, Bodo, Urdu, Kashmiri, Maithili, Konkani, Manipuri , which will enable the mainly non-English literate users in the country to be exposed to ICT and to use the computer more effectively.

Friday, April 11, 2008

How to access explicit interface methods from another method

Explicit interface methods are prefered to instance members for following reasons

a) They are accessible only through interface

b) They support multiple levels of inheritance chain

Some insight. Take this example.

a) Take simple console application

b) Add an interface

c) Implement interface

d) Create Object of the class and try to access interface method

e) Cast it with interface and access

f) Call another explicit method method

g) Call another explicit methos by casting this object with interface

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

namespace ClassMonitorLibrary

public class Program
//Entry point
public static void Main(String [] args)
#region Not accessible directly
//Object is accessible
//IFile im = (IFile)(new InterfaceMethods());
InterfaceMethods im = new InterfaceMethods();
im.GetFile("Data.txt", 10);

//Simple interface
interface IFile
bool GetFile(string fileName, int length);
bool IsFileExists(string fileName);

//Interface implementation
class InterfaceMethods : IFile
bool IFile.GetFile(string fileName, int length)
#region how to access method
//if (((IFile)this).IsFileExists(fileName))

return true;

bool IFile.IsFileExists(string fileName)
return true;

Tuesday, March 18, 2008

Saturday, March 15, 2008

Vim settings

Back up and swap files that vim creates are sometimes frustrating; that too when you are working on source tree in version controlled directory.

Setting them off is desirable for such environments. Today I updated my Vim profile to do this and also found consolas font more appealing font for Vim editing on windows. Just thought of sharing profile file if anyone else interested in it.

 C:\Program Files\Vim\_Vimrc file 

set nobackup "Set off backup files"
set noswapfile "Set off swap files"

set guifont=Consolas:h12:cANSI

set stal=2

"GUI Options"
set guioptions-=T "No Toolbar"
set guioptions-=r "No right scroll "
set guioptions-=m "No menu "

"Color scheme"
colorscheme wombat "tried zellner, now wombat suits me best"

Friday, March 07, 2008

MsMUG Survey is conducting and online survey on Issues in the Manufacturing Environment.

Survey results will be published in Microsoft's forum.

During April 2-4, 2008, Microsoft will be hosting a forum specifically addressing issues in the Manufacturing environment. The Microsoft Manufacturers User's Group (MsMUG) has been working side-by-side with Microsoft in preparation for this event.

Monday, January 21, 2008

Visual Studio Task List feature - I regret for not knowing this earlier

Do you use Visual studio's Task List? Atleast I was't using it so far and I regret for not knowing this earlier.

How it works

It works like this, you might want to do something at code at later point in time, just add a comment in this syntax

//TODO: Add exception handling here

or you are doing code review and felt a message should have been logged here just add a comment like this

//LOG: recursive function, log depth of stack

or you might have felt a method has grown too big, it must be refactored, just add a comment where ever you felt like

//REFACTOR: break this part as a function

How to access

And visual studio has a window to search for all these comments and present them in a list.

To show task list select from View -> Task List

By default it shows user task, select for comments from combobox.

How to customize

You can set more tokens from Tools -> Options Check in image here. TODO, HACK, UNDONE and UnresolvedMergeConflict are default tokens in visual studio. I added LOG and REFACTOR.

Check how a

TODO: Clean up and Log Something in code is shown with. And it is a clickable target

Also you can sort all log messages or TODO's to attend once.

Also you can define user defined tasks too.

For that select User tasks option in Task List and add your taks.

I felt the option very handy and felt like sharing it.

Unit Testing for Native Code

As I am spending most of time in CLR sandbox these days, I couldn't realise that NUnit can't work for native code. But that is a bit disappointing, having spent those many years developing C++ code, I couldn't accept flag go down. YES there is a Unit testing framework available for native C++ too. It is called WinUnit and MSDN Febraury 2008 article Simplified Unit Testing for Native C++ Applications describes the details.

Salient features are

a) Its built as a regular C++ dll

b) You can run it from Command Line by passing dll name as argument to WinUnit.exe

c) You can integrate with Visual Studio Build process, so whenever you build the project Unit Tests are performed

Compared to NUnit:

a) It lacks UI

b) Lacks report generation features

Friday, January 04, 2008

xcerion XML internet OS/3

Today I got my beta account for xcerion. First impression is "it is awsome", but doesn't work in firefox.

It works only with IE 6 or 7 on windows. Its an xml based web operating system. Applications are developed using Model View Controller framework.

Though it is not from big giants like Microsoft and Google, it paved a way towards it. It may not be adapted in low bandwidth environments, though there is an offline feature.

Tuesday, January 01, 2008


Wish you and your family a very Happy, Prosperous and Cheerful Newyear 2008.