Validating an Australian drivers license number using Regex
Tuesday, February 2nd, 2010The following code snippet demonstrates validation of an Australian drivers license using Regex.
The following code snippet demonstrates validation of an Australian drivers license using Regex.
Ever wanted to return a table with unknown set of columns from your SQL stored procedure? Yes, you can. Say thanks to SQL XML.
(more…)
The following code snippet demonstrates how to get the most recently modified file from a directory.
(more…)
With Windows Vista getting popular and Windows 7 fast approaching there will soon be a lot of applications running on these platform. Some of the scenarios need to read the OS name dynamically from code. The commonly used method is to extract the OS name using System.OperatingSystem object. It provides a Platform and version number using which you can deduce the OS name.
Even wondered how to use a Java or Jar file in .Net ?
Well, the answer can be complicated or it can be simple too.
(more…)
I love the really cool Action Filter’s in ASP.Net MVC. I use it to keep my code clean and reusable. This post is not about what is an Action Filter but is more about how to use them to have cleaner and reusable components.
(more…)
Sometimes we need to expand the TextBox dynamically based on the length of the entered text. TextBox does not have a AutoSize property by which it can adjust it’s size based on the content. On way of calculating the Width for the TextBox is using the Graphics.MeasureString and calculating the Pixel width. This method has it’s Pros and cons.
Ever wanted to find out the different drives or just the removable drives on the machine ?? The DriveInfo class is the answer to your prayers.
Generally we get the executing directory path using the HttpContext.Request.PhysicalPath etc. In IIS7 this won’t work. We cannot access the HttpContext.Request object in Global.ascx.
This is the way to do this,
int binPos = HttpRuntime.BinDirectory.LastIndexOf("\\bin");
string executingDirectory = HttpRuntime.BinDirectory.Remove(binPos);
Have fun.
This one really struck me hard. I am doing a threading scenario with some UI feedback marshaled back on the UI thread. And you won’t believe it, I am amazed to find CheckAccess missing from the Dispatcher object. Intellisense wouldn’t just show me CheckAccess(). Rubbing my eyes and again checking, it still seems to have vanished…