Category Archives: Tech Notes

Add an Internet Explorer specific stylesheet

You can add a Internet Explorer (external link) specific stylesheet to your WordPress (external link) theme using the following code:

<!--[if lt IE 6]>
   <link type="text/css" href="<?php bloginfo('template_url'); ?>/ie6.css" media="screen" rel="stylesheet" />

This will link to a Internet Explorer 6 only stylesheet using conditional comments, the ie6.css file should be located in the same place as the standard css file.

Firefox and pre font-size

My website stylesheet sets the overall font size to be 76.1%, this was working fine except for Firefox and the pre tag, it would render fine in Internet Explorer but Firefox would shrink the font size down. In order to get around this I used the following CSS:

pre, code {
   font-size: 123.9%;
   *font-size: 100.0%;

The asterisk in front of the font-size command means it is strictly invalid CSS which is ignored by Firefox but is still parsed by Internet Explorer.

Chromifying Firefox

Or how I learned to stop worrying and make Firefox look like Chrome.

When Google Chrome was released it suddenly dawned on me that Firefox did not blend very well with Windows Vista. The main problem is the complete lack of transparency which when comparing Firefox with the standard Vista dialogs was an obvious difference. As with most things Firefox this problem has been solved by an add-on called Glasser (external link). This is currently an experimental add-on so you will need to create a Mozilla login before you can download it, but I have been using it successfully for weeks now with no stability problems. It does cause some issues with the menubar but these can be solved by installing another add-on called Personal Menu (external link), this hides the menubar and moves it elsewhere onto the browser window.

How to validate an email address in .NET

There are various ways to validate an email address from .NET, the choice of which one to use is based on how restrictive you wish to be to your end user. This articles details the following methods of email validation:

  • Email format validation
  • Domain name validation
  • Mail server validation

The simplest is the email format validation as it merely checks the format of the supplied email address and not if any of it is valid, the slightly more complicated is the domain name validation is where the domain name after the @ sign is extracted and the domain is checked to see if it exists. The most complicated is the SMTP lookup where the actual mail servers are contacted and communicated with in order to see if the email address is valid. A worthy note is that as each version becomes more complicated you are also increasing runtime and also the chance of a false negative, ie. that a valid email address will flagged as invalid.

Continue reading How to validate an email address in .NET

.NET charting with ZedGraph

When trying to create graphs from within a .NET program there are many routes, most of which are commercial products.
Recently I found myself needing a free .NET graph package which also had to meet the following requirements:

  • Free
  • Works in ASP.NET
  • Able to plot multiple graph types, including bar, line and pie
  • Useful help system to aid with integration

Continue reading .NET charting with ZedGraph

How to display loading text whilst processing

Occasionally when writing ASP.NET pages you may find that the Page_Load subroutine will take a long time to complete and therefore the final page will not be viewable by the end user until the processing has completed. It is possible to send some HTML to render before the Page_Load subroutine has finished using the Response.Write and Response.Flush commands.

Continue reading How to display loading text whilst processing

How to take a screenshot in Team Fortress 2

Team Fortress 2 (PC) (external link) allows you to take screenshots in game without requiring third party software. Firstly you will need to ensure that a screenshot button has been configured in game, this is setup under the Options menu and is located at the bottom of the scrolling list:

TF2 Screenshot Key Setting

As you can see in the screenshot I have configured my screenshot key as F5, once in game pressing F5 will create a TGA screenshot.

To find the the created screenshots you can have to navigate to the following folder where <steam id> is your login id, if one of the folders does not exist then try the other one:

  • C:Program FilesSteamsteamapps<steam id>team fortress 2tfscreenshots
  • C:Program FilesValveSteamsteamapps<steam id>team fortress 2tfscreenshots

TGA files are not very common and as such you generally won’t be able to view them without additional software such as Quicktime. In order to convert them into more manageable files such as JPG or BMP I use the open source image program GIMP, it’s a bit overpowerful for this task but is very easy to use. If you have trouble with it you could try IrfanView instead which is more user friendly.