The Ctrl-Z of Browsers

February 21, 2009 at 9:04 PMBen

In today's tabbed browsing world, maybe you find yourself opening and closing tabs left and right.  If you're into the keyboard shortcuts, that would be Ctrl-T and Ctrl-W respectively   What if you accidentally close a tab?  This happens to me most often when either I thought I was done with the website I was on, or I thought the tab I was on was a new tab with nothing to go 'back' to.

Fortunately, the good browsers out there offer a Ctrl-Shift-T keyboard command to open up the last tab you closed.  I like to think of it as the "ctrl-z of browsers".  This keyboard command is very handy because you can actually keep pressing Ctrl-Shift-T to open up all the tabs you previously closed.  Each tab you re-open not only opens up with the page you were on when the tab was closed, but the browser history for that tab is also preserved.  So once you re-open a closed tab, the entire 'Back' button browser history is there.

Ctrl-Shift-T works in Firefox and Chrome.  It doesn't appear to work in Safari/Windows and doesn't work in IE7.  That's what I meant by this keyboard shortcut working in 'good' browsers   It does appear to work in IE8.

Since discovering this keyboard command it's something I use probably at least once a day.  Sometimes many times a day!

VS Intellisense Mental Lapse

February 8, 2009 at 11:03 AMBen

Yesterday I was working on a C# web site project in VS 2008.  After making some modifications to a class in the App_Code folder, when I later went back to the codefile for an ASPX webpage, intellisense no longer recognized the class or methods of the class I was earlier changing.  I wasn't getting the normal coloring for the class name and no intellisense listing of the class's methods.  Right-clicking on the class or its methods and trying to 'Go to Definition' resulted in a message stating it couldn't find the definition (or something to that effect).

I could build and run the site with no errors.  I tried closing and re-opening the solution, tried closing and re-opening VS, tried deleting all the files in the Temporary ASP.NET Files directory, tried restarting IIS and tried rebooting the PC.  Nothing worked.  After rebooting the PC, intellisense even stopped recognizing another App_Code class.  Life without intellisense sucks!

What finally did work was to right click on these classes in the solution explorer, select the 'Exclude from Project' option which excludes the files from the project by giving the files .exclude extensions, and then I right-clicked on the files again to Include them in the project.  That cured intellisense.

SSL Certificate for WWW and no WWW

February 1, 2009 at 12:14 PMBen

I was recently buying a SSL certificate and remembered being on a website where some HTTPS pages had a WWW host in the url and other HTTPS pages didn't have the WWW prefix.  I vaguely remember from when I last bought a SSL certificate, you would normally indicate the host name you are buying the SSL certificate for -- whether it be,,  And the SSL certificate would only be valid for that exact host.

There's also wildcard SSL certificates that cover all hosts.  These certificates are a lot more expensive.  Wildcard certs cover,,  Interestingly, it appears SSL certificates do not necessarily cover cases where you have no host -- i.e.   An example of this is the customer login page at the hosting company where I have this blog hosted.  If you examine the certificate, it looks like it uses a wildcard certificate as the common name is *  However, if you remove the WWW from the url, my browser (Firefox) warns of an invalid security certificate.  What a sour deal ... you spend the extra money for a wildcard certificate and it doesn't even work when there's no host name!  I'd suspect that may not be the case with all wildcard certificates ... it probably depends on who you buy the certificate from.

In my case, I didn't need a wildcard security certificate, but I was hoping I could cover both and  One option would be to buy two separate SSL certs, one for and one for  Fortunately a few SSL certificate sellers cover both WWW and no host in a single certificate as a standard feature.  GoDaddy was one of the two places I found that offered this.  I didn't search around that much though.  GoDaddy's SSL certificate is dirt cheap at just $30.  What a great deal considering how expensive SSL certs once were.

GoDaddy briefly explains this feature in this help topic.  What I wasn't sure about was when creating the CSR that you submit to the SSL certificate seller, I wasn't sure if I should put or for the common name (CN) field in the CSR.  The website I had previously seen where HTTPS worked with and without WWW was using a GoDaddy SSL cert and the common name on the cert was just without the WWW.  And then I ran across this post where the blogger discussed this feature of the GoDaddy SSL certificates, and towards the end of his post, he says,

Therefore, to summarize the solutions, I can say that you can use a wildcard certificate or issue two separate certificates that both cost money and may not be a good option for many cases. You can also look for a SSL certificate issuer that automatically includes the base domain name when you generate one for the domain name with "WWW."

This last part sounds like you would generate a SSL certificate with as the common name -- not  But, when I examined his SSL certificate, the common name doesn't have the WWW!  Anyhow, I decided to include WWW in my common name field, sent the CSR to GoDaddy, received the certificate, installed it, and the good news is my site works both with and without the WWW.  Looking at the certificate fields when examining these SSL certificates from GoDaddy, of the ones I've seen, they all have a field named "Certificate Subject Alt Name" where the field value is:

Not Critical
DNS Name:
DNS Name:

This may be the field that tells the browser the certificate is valid with or without the WWW.  In summary, it appears you can probably put either or in the common name (CN) field of the CSR when purchasing the SSL certificate from GoDaddy.  I included the WWW in my common name, and the certificate is valid with and without the WWW host.

Posted in: General

Tags: ,

Windows 7 Versioning

January 12, 2009 at 9:49 PMBen

Beta 1 for Windows 7 was just released last week.  I haven't downloaded it, but happened to catch this blog post from the Windows team on Windows 7.  The official name for the next version of Windows will be Windows 7.  This name obviously came from the fact that the internal version number of this release of Windows would be version 7.0.  Windows 2000 is 5.0, XP is 5.1, Vista is 6.0, and this next one will be 7.0, hence the name Windows 7.  Apparently not!  The RTM version of Windows 7 will have an internal version number of 6.1.

Microsoft's reasoning for this boils down to maximizing application compatibility.  Programs and drivers that require themselves to be run on a build of Windows with a major version of 6 (or sometimes less) would continue to run on Windows 7 which will still have a major version of 6.  Yet, I thought Microsoft's been saying Windows 7 is a brand new operating system, and not just a more stable or improved version of Vista?!  Many have suggested the name for the upcoming OS should just be Vista SE, as in second edition.  Not a bad idea, actually!

I'm perplexed to understand the situation.  I can already see this versioning issue causing confusion by users trying to troubleshoot OS and application software issues on forums and other support channels.  The reason a major build number exists is to differentiate between major builds of software.  Although Windows 7 is looking a lot like a less resource hungry version of Vista, there's still the whole new touch screen functionality being added and early reports of Windows 7 Beta 1 show that some people are experiencing crashes in Beta 1.  Being just Beta 1, crashes are expected, but if Windows 7 was just a more solid Vista with some minor enhancements, then I wouldn't expect any crashes, nor would I expect it to take 10+ months from this Beta 1 release until Windows 7 RTM's at the end of 2009 or early 2010.

From my point of view, it's quite evident there's enough changes going on in this upcoming release of Windows that an increment in the major build number should be made.  Although Microsoft is trying to maximize application compatibility by keeping Windows 7's major build number at 6, I wouldn't be surprised if there will be some applications that allow themselves to run or be installed on Windows 7 because the major build number is 6, but crash or operate incorrectly because of differences in Windows 7 and Vista.  I can only assume the version of Windows that will have an internal build number of 7.0 is going to be the next major release after Windows 7.  What a needlessly confusing situation!

Posted in: Opinion

Tags: ,

Would Like to Switch to Chrome, but ...

December 26, 2008 at 12:05 PMBen

I spent a couple of days using Chrome as my primary browser.  Chrome came out of beta on December 11th, and its version number is already over 1.0.  There's a number of nice things I like about Chrome, but for now, I've switched back to Firefox.

There's two big things I like about Chrome.  I like how each tab runs as in its own isolated process within Windows.  I leave my browser open all day, usually with Gmail open in one tab at a minimum.  Not all the memory from closed tabs in Firefox seems to get reclaimed and firefox.exe usually shows up using around 150 KB of memory mid-day even if only Gmail is open at that time.  Firefox 3 is supposed to be a lot better than Firefox 2 for preventing memory leaks, and I'm sure it is.  150 KB of memory is not a big deal, either.  But the Chrome architecture of running each tab as its own process has the big advantage of basically guaranteeing all memory used for a tab will be completely reclaimed once that tab is closed.

The other big item I like about Chrome is how you can easily drag a tab out of the Chrome window into a new Chrome window.  Especially if you have multiple monitors, this is a really great feature when you want to see two or more tabs at the same time.  I was breaking the tabs out into separate windows when composing an email in a web interface or when typing messages on forums / blogs.  I could compose my messages while seeing other information I'm referencing in the other Chrome window at the same time very easily.  After I was done composing, I would drag the tab back into the main Chrome window.

I'm back to Firefox now as a primary browser because of some features not yet available in Chrome.  The big one being Firebug.  I didn't realize how often I right-click on an element to inspect it in Firebug, check the Net tab, etc.  I also like how when you change the text size in Firefox (i.e. zooming text), how Firefox remembers the size you last had when coming back to a website.  In Chrome, you have to adjust the text size again every time you go back to a website.  Also, URLs in the status bar when you hover your mouse over a link are often truncated because the space Chrome allocates to show the URL in the statusbar seems to be a fixed width.  There's actually a lot of extra room to show the entire URL, and I hope this gets resolved soon.

So for now, Chrome is not yet ready for prime time (for me).  Google is of course working on lots of improvements for Chrome.  This includes adding an extensions framework so people can start developing extensions for Chrome.  I haven't heard of any type of Firebug for Chrome initiative, but for me, something like this would add mega value to Chrome.  I plan on sticking with Firefox which has treated me well, but checking back on Chrome every once in a while.

Posted in: General

Tags: , ,

Folders vs. Tags

December 19, 2008 at 6:05 PMBen

I still see web-based and desktop-based email applications which only support folders to file email away into.  I'm a Gmail user and have the luxury of using tags to organize emails.  Tags are actually known as labels in Gmail.  But whatever the name, tags are in my mind, unquestionably superior to folders.

I don't remember talking to anyone who said they do not find the tag system better than the folder system.  And even if a person felt more comfortable associating an email with only one identifier, a single tag can be put on an email as multiple tags are of course not mandatory.  Given the benefits of tags over folders, I can't see why any company developing an email application would not want to replace the old, inflexible folder system with a tagging system.

Folders and tags are not limited to just the email world.  They exist for bookmarking urls too.  Tags were introduced in Firefox 3 which now supports both folders and tags.  I don't regularly use other browsers, but taking a glance through IE7, Safari and Chrome, it appears FF3 is the only browser among these that supports tagging bookmarks.  FF3, Safari and Chrome also have search capability to find bookmarks.  This may seem like a given, but I don't see any bookmark searching capability in IE7.  FF3 also introduced a very cool concept of saving the criteria used in a bookmark search as a "virtual bookmark folder" so you can later click on the virtual bookmark folder to see real-time bookmark matches satisfying the saved criteria.

I use multiple tags for my bookmarks too.  I've actually been using Google Bookmarks since before FF3 was released, so I've unfortunately never spent any significant time using FF3's bookmark tagging.  The big advantage of Google Bookmarks being that I can access all of my bookmarks on any computer since my bookmarks are stored on Google's servers.  I just need to log into my Google account to access these bookmarks.  Google makes it easy to bookmark a page too with a bookmarklet they provide and I keep in my Firefox bookmarks menu.  So bookmarking a site into Google Bookmarks requires just as little work as it would be to bookmark a site into Firefox.

Whether it be emails or bookmarks, tagging has proved to be really helpful when looking for stuff later.  There's probably lots of areas other than email and bookmarks where tagging would be useful as well.  If you're stuck with the restricting folder system for emails or bookmarks, I'd suggest requesting your provider to upgrade their app to a tagging system or, if possible, move to a provider that supports tagging.

TimeZoneInfo - A Small .NET 3.5 Gem

December 7, 2008 at 4:10 PMBen

One new handy class introduced in the .NET 3.5 framework is the TimeZoneInfo class.  This class allows you to get date and time information for any time zone in the world.  Prior to .NET 3.5, the framework exposed methods to get date and time information only for the time zone the server was set at.

I've used this class to find the date/time of a place other than where the server is located.  If you're lucky, the server your website is running on will be in the same timezone you want to save and display dates and times for.  Even if you're in a different timezone, let's say in New York and your server is in California, well you can just add 3 hours to the server time to get New York time.

It isn't always this easy living in Arizona where daylight saving time (DST) is not observed.  In the summer, Arizona is in the same timezone as California (PST) three hours behind the east coast and in the winter, Arizona is in MST two hours behind the east coast.  Your server may be in Arizona but you want a west coast time for your application, or your server may be in California and you want Arizona time for your application.

If the server is in Arizona, and you want to know what time it is in California, you can use the TimeZoneInfo class to find this out.

TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
DateTime PstDateTime = TimeZoneInfo.ConvertTime(DateTime.Now, tzi);

PstDateTime now contains the current date/time in California.  This code will work year round as daylight saving time and any other adjustment rules are taken into account by the ConvertTime() static function.  So, in the winter, PstDateTime will be one hour earlier than Arizona time and in the summer, PstDateTime will be the same as Arizona time.  This functionality makes life very convenient since you don't need to worry about trying to calculate when DST starts and ends each year.

You may even want to just know if daylight saving time is in effect for any given date/time value.

bool IsDaylightSavingTime = tzi.IsDaylightSavingTime(PstDateTime);

This tells you whether it is daylight saving time for PstDateTime.  Let's check the status of DST for two different dates:

// false
bool IsDaylightSavingTimeAprilFirst2000 = tzi.IsDaylightSavingTime(DateTime.Parse("4/1/2000"));
// true
bool IsDaylightSavingTimeAprilFirst2008 = tzi.IsDaylightSavingTime(DateTime.Parse("4/1/2008"));

There's actually a handful of other static and non-static members of the TimeZoneInfo class available that can come in handy depending on your needs.  Members such as GetUtcOffset(), ConvertTimeToUtc(), DisplayName, etc. provide a wide range of built-in capability.  The list of available time zones you can pass into the FindSystemTimeZoneById method can be found via the GetSystemTimeZones method.

Posted in: Development


Apple Software Update - Oh No!

November 24, 2008 at 12:26 PMBen

I have three pieces of software from Apple installed on my computer.  iTunes, Quicktime and the Apple Software Update service.  Safari is installed on a virtual machine, but I digress.

Every few weeks, the Apple Software Update service pops open a window telling me updates for iTunes/Quicktime are available.  I like to keep my software up to date, but the updates for these programs are ridiculous.  The entire application needs to be downloaded for the update.  This amounts to around 80 MBs.  Then, because the entire program is being installed, the installation (er, I mean "update") takes an additional minute or two, and finally a system reboot is required for changes to take effect.

This entire process is wrong in so many ways.  The download should only be a delta / diff download consisting of what's actually changed.  Instead of an 80 megabyte download, it should be a few megs at the most.  It shouldn't take so long for the update to be applied, and a required system reboot doesn't make sense.  iTunes and Quicktime are just applications -- not system applications or DLLs that can't be updated while Windows is running.  Something is not designed correctly with this software if files cannot be updated while Windows is running.  Perhaps the system reboot requirement wouldn't be necessary if the update was just the changed bits and not the entire application.

These applications are mostly insignificant to me, so dealing with this update process is a pain when I need to close all my applications for the required reboot.

On a related note, the Apple Software Update service shows "Updates" and "New Software" in its UI window.  iTunes and Quicktime show up under "Updates".  Safari shows up under New Software since it's not installed on this computer.  No problem there, however, normally a checkmark next to Safari shows up by default.  I need to uncheck the box or else new software will be installed.  This, to me, is a somewhat dirty business practice.  Software update programs shouldn't be trying to slip new applications onto people's computers.  I recall seeing the Safari icon on the desktop of friend's computer recently.  He didn't know what the icon was and had never heard of Safari.  He does have iTunes installed on his computer though.  Hmm... I wonder if there's a connection there??

Posted in: Opinion

Tags: ,

Navigate to default document of current directory

November 4, 2008 at 8:15 PMBen

I was working on a web page where I wanted to add a link to take the visitor to the default document of the folder this particular page is in.  This page (e.g. page1.aspx) was in a folder (e.g. folder1).  I actually knew the default document in this folder was index.aspx, and could have just set the link's HREF to "index.aspx", but wanted to make this a little more generic so it didn't matter what the default document was.  Just to be clear, the location of the page I was putting this link on looked like:

Initially, I set the link's HREF to:


This worked well.  It would navigate the visitor to:

But then I needed to copy page.aspx to another folder (e.g. folder2).  So the page was going to exist in both folder1 and folder2.  Once I copied page.aspx to folder2, I could have manually edited the link to:


This didn't have a very generic feel to it and I would always need to remember to change the HREF if I needed to copy the page again to other folders.  So I decided to make this link a server side HyperLink control and create some fairly simple .NET code that would determine what the current folder the page was in by parsing the URL and setting the link's HREF so it would take the visitor to the default document of the directory the page was in.  Once the .NET code determined the folder the page was in, it ended up setting the HyperLink's NavigateUrl to something similar to:

HyperLink1.NavigateUrl = "~/folder1/";
       - or even -
HyperLink1.NavigateUrl = "~/folder2/";

The worked well, but I was surprised when I looked at the HTML source to see what the HREF resolved to.  It essentially looked like:

<a id="HyperLink1" href="./">Go to the root of this folder</a>

As you can see, a HREF of "./" is the default document or root of the current folder!  Instead of running this .NET code I created to parse the URL and determine the current folder name, all that's needed is just statically setting the HREF to "./".  This gave me flashbacks to the old DOS days where running a simple DIR command (in a directory other than root) always results in the first two lines being:

<DIR> .
<DIR> ..

The "." DIR refers to the current folder and the ".." DIR refers to the parent folder.  You can still see this today by opening up a command prompt and running DIR.

It's also worth mentioning that you can use "./" when redirecting a visitor in server side code:


I'm sure I'll now start finding lots of places to sprinkle "./" HREFs in!

Posted in: Development

Tags: ,

Commenting Code

October 30, 2008 at 8:15 PMBen

Do you add enough comments to your code?  Too many, perhaps?  The last few months, I've realized how helpful comments in source code can be.  Years ago, I wasn't a big comment guy.  I think I didn't want to spend the time commenting and felt like if I (or someone else) looked at the code for a couple of minutes, they would understand what's going on.  This is basically true, but comments remove or reduce the need to spend those few minutes studying the code to see what's going on.  When maintaining code, you still need to understand the code before making any changes, but spending 30 seconds, a minute or even a few minutes to add comments when you're writing code and everything is fresh in your mind is really proving to be beneficial when going back over code in the future.

There's also times when there are no comments and after spending a few minutes reacquainting myself with some code, I'm still not 100% sure if I fully grasp why something was done a certain way.  Comments are priceless for these cases too.

The other thing I've started doing as well is including a date with my comments (including the year!).  It all may seem unnecessary and a waste of time when writing code, but more times than not, pays off in the future.

Posted in: Development