You all must have heard about HTML5 the new standards of markups.

HTML5 is a cooperation between the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG).

WHATWG was working with web forms and applications, and W3C was working with XHTML 2.0. In 2006, they decided to cooperate and create a new version of HTML.

Some rules for HTML5 were established:

  • New features should be based on HTML, CSS, DOM, and JavaScript
  • Reduce the need for external plugins (like Flash)
  • Better error handling
  • More markup to replace scripting
  • HTML5 should be device independent
  • The development process should be visible to the public

It reduces the amount doctypes, encoding and meta tags on your webpage, have introduced lot of new markup tags such as <article>, <canvas>, <footer>, <Video>, geolocation etc. which makes your webpage source much more understandable for the search engines.

Also, It looks much more cleaner than the HTML4 / XHTML

HTML5 development is still under progress, and expected to be a public standard by 2020 or 2022.

Most of the latest browsers have started adding HTML5 support, however all the HTML5 tags are not available till date, Google Chrome supports most of the HTML5 tags, Firefox supports few and IE supports the least.

New tags are good, but the most userful feature in HTML5 I found is the local / web storage. It is a good replacement of browser cookies to store anything at client side.

One of the common disadvantage of cookie is that they are included with every HTTP request, thereby slowing down your web application by needlessly transmitting the same data over and over.

How to use localstorage in HTML 5:


<script type=”text/javascript”>





<script type=”text/javascript”>




Try this out, so far i have tested it on IE8, mozilla FF 4.0 & 5.0, Safari, Chrome, Opera and Rockmelt, they do support this local storage feature.

For more details on HTML5 and localstorage visit:


Another useful feature of delegates is the ability to execute a method asynchronously. That is, through a delegate, you can begin invocation of a method and then return immediately while the delegate executes its method in a separate thread. Your page execution does not need to wait for that method to complete.

The following example demonstrates the use of delegates for asynchronous method invocation. To see this in action we need a method that simulates a lengthy operation, such as writing data to db logs, record page hits that can be asynchronous, and do not affect the end client response.

public delegate void LongTimeTask_Delegate(string s);

protected void Page_Load(object sender, System.EventArgs e)
if (!Page.IsPostBack)

// databind of all the controls

LongTimeTask_Delegate d = null;
d = new LongTimeTask_Delegate(LongTimeTask);

IAsyncResult R = null;
R = d.BeginInvoke(“TestString”, null, null); //invoking the method

In the above load event of the page after binding all the UI controls we need to perform a lengthy operation to record something in DB or any IO operation file.
We are initializing the deligate with the LongTimeTask method, and delegate.BeginInvoke will call the method below asynchronously. Later we will see how to know if the method invokation completed successfully or not.

public void LongTimeTask(string s)
// Write your time consuming task here

Now, if we would want to perform an another operation after the above method is completed, That is called callback approach, add the async call back event in beginInvoke:

//using callback approach
R = d.BeginInvoke(“TestString”, new AsyncCallback(TaskCompleted), null);

public void TaskCompleted(IAsyncResult R)
// Write here code to handle the completion of
// your asynchronous method
The above method will execute on completion of LongTimeTask method.

We can also wait untill the LongTimeTask is execution is completed or not, but then that will not serve the purpose of calling it asynchronously, but still you would need it somewhere:

//this will block until the asynchronous operation is complete

Try it out at your end, I have just given you the skeleton that I have tried, It works fine, but just be careful, as this works on a separate thread, which might sometimes consumes a lot of memory / CPU usage.

I was developing an application to post xml data to a URL (REST call) using and C#. The endpoint was hosted with a third party vendor and they had a much secured hosting environment. Their endpoints were https and they installed and generated the private client certificate (a password protected .p12 file) on their servers to prevent unwanted requests / hits.

So to access their endpoints one has to have that client certificate, basically any request to the endpoints should have the client certificate enclosed with the request data, even if you are requesting it from browser window you have to have that certificate installed in your browser.

To resolve the same first I installed that certificate on my development server, then I could able to request that URL from browser window. But when I did the same using my C# code using httpwebrequest object I got 403 forbidden error as the request was not sending the client certificate with xml data.

Ideally, if you have any .cer file you can add it with request object by using X509Certificate class but in case of private client certificate it just doesn’t work for that you have to use X509Certificate2 class, Here is the code snippet. You need to place the .p12 file in your webserver’s hard drive.

public string PostData(string DataToPost,string URL)
String result = “”;
String strPost = “RequestXML=” + DataToPost;
StreamWriter myWriter = null;

HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(URL);
objRequest.Method = “POST“;
objRequest.ContentLength = strPost.Length;
objRequest.ContentType = “application/x-www-form-urlencoded”;

objRequest.ClientCertificates.Add(new X509Certificate2(@“E:\Certificate\clientcertificate.p12”, “password”));

myWriter = new StreamWriter(objRequest.GetRequestStream());
catch (Exception e)

HttpWebResponse objResponse = HttpWebResponse)objRequest.GetResponse();
using (StreamReader sr =
new StreamReader(objResponse.GetResponseStream()))
result = sr.ReadToEnd();

// Close and clean up the StreamReader

return result;

Wanted to share an unfortunate experience, I lost my brand new Samsung Galaxy ace android phone near my place, same day I went to the nearest police station to lodge an FIR. Respected Police officer didn’t lodge the complain but asked for a letter from my service provider, mentioning that the SIM card belonged to me. I told him I dont want to file an FIR for SIM card, I want to file it for my phone, Sim card i can get it blocked, and anybody who has stolen my phone was not using my sim, he/she has already switched off the phone. But police man didn’t listen so I had to leave to get the required letter.

I went to Vodafone gallary and explained the situation, the store owner said he can block the sim right away but will not provide any such letter that the SIM card belonged to me. I got the sim blocked, and requested him for the letter but he again denied and said Vodafone doesn’t provide any such letter. I called up vodafone customer care as well, but got the same response.

I returned back to the police station told them that Vodafone doesn’t provide any such letter and requested the officer to lodge the FIR for the handset, I had the bill of handset too, officer said the complaint wont be recorded unless I bring the letter from Vodafone. I had to leave. He also showed me few past applications from other victims, they had submitted the letter from their service providers.

I knew that my phone is gone but I still needed to file this FIR just in case in future if anyone misuses my phone but these bunch of fools were driving me crazy, it was my phone, my sim, i had every possible and required document with me, but still they were not helping me out.

I had no choice but to write a harsh email to vodafone nodal officer and mumbai appeal center. In that email I explained everything and requested for the letter.

After three days I received the response they confirmed that the SIM card belonged to me in the email. I took the print out of that email, ran to the police station, this time around the officer did lodge the complaint.

This time I told the officer if police can track my phone using the phone’s IMEI number, it is very much possible to be tracked, both police and service provider can track the phone by its IMEI number, anyone who is using the phone, on any call being made using any sim card from that phone can be tracked. Officer told me that only service provider or samsung can track the phone.

Next day I went to Samsung gallery, asked for the same, they said only police or service provider can track your phone, we cant help in this regard.

I once again visited the vodafone gallery, asked them if this kind of tracking is possible or not, they said we cannot track your phone only police or your handset company can track.

This is a dead end now.

Where to go, which door to knock? I will once again write an email to both Vodafone nodal officer and Samsung’s customer care.

Being a developer I know that the tracking is very much possible, but being a normal citizen who doesn’t want to bribe anyone I cant help myself.

Just wanted to share this, if anyone of you has any solution please do share.

In one of the module I came across to the situation where a physician needs to input their DEA number on a form and we have to validate the DEA Number, either using javascript or C#. I was provided with the algorithm from client and we had to write a javascript / c# function for the same. First I tried searching it on Google for some ready made stuff, but I could not found any, so written my own function to validate a DEA number. Here is the code snippet in both Javascript and C#:

private bool DEAValidation(string DEANumber)
if (DEANumber != null && DEANumber != “” && DEANumber.Length == 9)
string strDEAFirstLetter = DEANumber.Substring(0, 1).ToUpper();
Response.Write(“strDEAFirstLetter: ” + strDEAFirstLetter);

if (strDEAFirstLetter != “A” && strDEAFirstLetter != “B” && strDEAFirstLetter != “M” && strDEAFirstLetter != “F”)
return false;

string strDEASecondLetter = DEANumber.Substring(1, 1).ToUpper();
string strValidNums = “0123456789”;
if (strValidChars.IndexOf(strDEASecondLetter) < 0 && strValidNums.IndexOf(strDEASecondLetter) < 0)
return false;

int iThirdDigit = int.Parse(DEANumber.Substring(2, 1));
int iForthDigit = int.Parse(DEANumber.Substring(3, 1));
int iFifthDigit = int.Parse(DEANumber.Substring(4, 1));
int iSixthDigit = int.Parse(DEANumber.Substring(5, 1));
int iSeventhDigit = int.Parse(DEANumber.Substring(6, 1));
int iEightDigit = int.Parse(DEANumber.Substring(7, 1));
int iNinthDigit = int.Parse(DEANumber.Substring(8, 1));

int Total_3_5_7 = iThirdDigit + iFifthDigit + iSeventhDigit;
int Total_4_6_8 = iForthDigit + iSixthDigit + iEightDigit;

int FinalTotal = Total_3_5_7 + (2 * Total_4_6_8);

Response.Write(“FinalTotal: ” + FinalTotal.ToString());

if (iNinthDigit.ToString() != FinalTotal.ToString().Substring(FinalTotal.ToString().Length – 1, 1))
return false;

return true;
return false;


function DEAValidation(DEANumber)
if (DEANumber != null && DEANumber != “” && DEANumber.length == 9)

var strDEAFirstLetter = DEANumber.substr(0, 1).toUpperCase();

if (strDEAFirstLetter != “A” && strDEAFirstLetter != “B” && strDEAFirstLetter != “M” && strDEAFirstLetter != “F”)
return false;

var strDEASecondLetter = DEANumber.substr(1, 1).toUpperCase();

var strValidNums = “0123456789”;

if (strValidChars.indexOf(strDEASecondLetter) < 0 && strValidNums.indexOf(strDEASecondLetter) < 0)
return false;

var iThirdDigit = parseInt(DEANumber.substr(2, 1));
var iForthDigit = parseInt(DEANumber.substr(3, 1));
var iFifthDigit = parseInt(DEANumber.substr(4, 1));
var iSixthDigit = parseInt(DEANumber.substr(5, 1));
var iSeventhDigit = parseInt(DEANumber.substr(6, 1));
var iEightDigit = parseInt(DEANumber.substr(7, 1));
var iNinthDigit = parseInt(DEANumber.substr(8, 1));

var Total_3_5_7 = iThirdDigit + iFifthDigit + iSeventhDigit;
var Total_4_6_8 = iForthDigit + iSixthDigit + iEightDigit;

var FinalTotal = Total_3_5_7 + (2 * Total_4_6_8);

if (iNinthDigit != FinalTotal.toString().substr(parseInt(FinalTotal.toString().length) – 1,1))
return false;

return true;

return false;
return false;

Ever got fed up with creating all the code behind parameters for your stored procedures? I have. So, I wrote this stored proc to generate the C# code for me. This has been written for use with “Microsoft Data Application Block” (SQLHelper.cs), however it could be hacked around to write the code without using the MDAB or even to write the code in VB. The script handles both input and output parameters, setting the size of text types, and you could even use it for direct access to a view or table.

Using the code

To implement, just copy the code into Query Analyzer and run. This will create a SPROC called “usp_getCode”.

To use, just execute the SPROC passing the name of the SPROC you want the code for (see below). Note: don’t include any owner prefix, e.g.: (dbo.).

EXEC usp_getCode ‘mySprocsNameHere’

The message window in the Query Analyzer will write out all the code required for your class or code behind. There is a variable in “usp_getCode” called “@connName” which you can set to the name of your connection instance. By default, it’s set to “conn.Connection” – just alter this for your own project’s naming convention.

The code

@objName nvarchar(100)
Name: CS SPROC Builder
Version: 1
Date: 07/30/2010
Author: Shabbir
Description: Call this stored procedue passing the name of your
database object that you wish to insert/update
from .NET (C#) and the code returns code to copy
and paste into your application. This version is
for use with “Microsoft Data Application Block”.

Version: 1.1
Date: 07/30/2010
Author: Shabbir
Description: a) Updated to include ‘UniqueIdentifier’ Data Type
b) Support for ‘ParameterDirection.Output’

DECLARE @parameterCount int
DECLARE @errMsg varchar(100)
DECLARE @parameterAt varchar(1)
DECLARE @connName varchar(100)
DECLARE @outputValues varchar(100)
–Change the following variable to the name of your connection instance
SET @connName=’conn.Connection’
SET @parameterAt=”
SET @outputValues=”
dbo.sysobjects.xtype AS ObjType, AS ColName,
dbo.syscolumns.colorder AS ColOrder,
dbo.syscolumns.length AS ColLen,
dbo.syscolumns.colstat AS ColKey,
dbo.syscolumns.isoutparam AS ColIsOut,
INTO #t_obj
dbo.syscolumns INNER JOIN
dbo.sysobjects ON = INNER JOIN
dbo.systypes ON dbo.syscolumns.xtype = dbo.systypes.xtype
( = @objName)
(dbo.systypes.status <> 1)

SET @parameterCount=(SELECT count(*) FROM #t_obj)
IF(@parameterCount<1) SET @errMsg=’No Parameters/Fields found for ‘ + @objName
IF(@errMsg is null)
PRINT ‘try’
PRINT ‘ {‘
PRINT ‘ SqlParameter[] paramsToStore = new SqlParameter[‘ + cast(@parameterCount as varchar) + ‘];’

DECLARE @source_name nvarchar,@source_type varchar,
@col_name nvarchar(100),@col_order int,@col_type varchar(20),
@col_len int,@col_key int,@col_xtype int,@col_redef varchar(20), @col_isout tinyint

SELECT * FROM #t_obj
OPEN cur
— Perform the first fetch.
FETCH NEXT FROM cur INTO @source_name,@source_type,@col_name,@col_order,@col_len,@col_key,@col_isout,@col_xtype

if(@source_type=N’U’) SET @parameterAt=’@’
— Check @@FETCH_STATUS to see if there are any more rows to fetch.
SET @col_redef=(SELECT CASE @col_xtype
WHEN 34 THEN ‘Image’
WHEN 35 THEN ‘Text’
WHEN 36 THEN ‘UniqueIdentifier’
WHEN 48 THEN ‘TinyInt’
WHEN 52 THEN ‘SmallInt’
WHEN 56 THEN ‘Int’
WHEN 58 THEN ‘SmallDateTime’
WHEN 59 THEN ‘Real’
WHEN 60 THEN ‘Money’
WHEN 61 THEN ‘DateTime’
WHEN 62 THEN ‘Float’
WHEN 99 THEN ‘NText’
WHEN 104 THEN ‘Bit’
WHEN 106 THEN ‘Decimal’
WHEN 122 THEN ‘SmallMoney’
WHEN 127 THEN ‘BigInt’
WHEN 165 THEN ‘VarBinary’
WHEN 167 THEN ‘VarChar’
WHEN 173 THEN ‘Binary’
WHEN 175 THEN ‘Char’
WHEN 231 THEN ‘NVarChar’
WHEN 239 THEN ‘NChar’

–Write out the parameter
PRINT ‘ paramsToStore[‘ + cast(@col_order-1 as varchar)
+ ‘] = new SqlParameter(“‘ + @parameterAt + @col_name
+ ‘”, SqlDbType.’ + @col_redef
+ ‘);’

–Write out the parameter direction it is output
PRINT ‘ paramsToStore[‘+ cast(@col_order-1 as varchar) +’].Direction=ParameterDirection.Output;’
SET @outputValues=@outputValues+’ ‘ +REPLACE(@col_name,’@’,”) +’=paramsToStore[‘+ cast(@col_order-1 as varchar) +’].Value;’
–Write out the parameter value line
PRINT ‘ paramsToStore[‘+ cast(@col_order-1 as varchar) + ‘].Value = ‘+ REPLACE(@col_name,’@’,”) +’;’
–If the type is a string then output the size declaration
— IF(@col_xtype=231)OR(@col_xtype=167)OR(@col_xtype=175)OR(@col_xtype=99)OR(@col_xtype=35)
— PRINT ‘ paramsToStore[‘ + cast(@col_order-1 as varchar) + ‘].Size=’ + cast(@col_len as varchar) + ‘;’

— This is executed as long as the previous fetch succeeds.
FETCH NEXT FROM cur INTO @source_name,@source_type,@col_name,@col_order, @col_len,@col_key,@col_isout,@col_xtype
PRINT ‘ SqlHelper.ExecuteNonQuery(‘ + @connName + ‘, CommandType.StoredProcedure,”‘ + @objName + ‘”, paramsToStore);’
PRINT @outputValues
PRINT ‘ }’
PRINT ‘catch(Exception excp)’
PRINT ‘ {‘
PRINT ‘ }’
PRINT ‘finally’
PRINT ‘ {‘
PRINT ‘ ‘ + @connName + ‘.Dispose();’
PRINT ‘ ‘ + @connName + ‘.Close();’
PRINT ‘ }’
if(LEN(@errMsg)>0) PRINT @errMsg

All you then have to do is copy-paste and fill in the values you want to pass and catch any exceptions… (Yes you do have to write some code!).



Let me first introduce myself, I am Shabbir Husain Lathsaheb (@SHLathsaheb). Programming is both my passion and profession. I work with a Web Application Development firm as a Software Engineer and in my free time I am a consultant, I love to sleep and am a movie buff.

As my tag line says I am a lazy geek, I don’t tend to write that great blogs. I tried writting couple of times however gave it an average start. Now here is another attempt by me to present and place all my ideas, share experiences and put forth my point of views on various technologies (hopefully on some generic stuff too).

So stay tuned!! 🙂