Nik's Technology Blog

Travels through programming, networks, and computers

Does your PC Keeping Forgetting the Date & Time?

Yesterday my aging desktop PC decided not to boot, and instead displayed this helpful error "CMOS Checksum Error".
In order to get it to boot into Windows I had to press Delete to go into the BIOS settings and change the configuration from "Halt on all errors" to "halt on no errors".  Upon saving the BIOS settings and restarting the error disappeared.

Sometimes though a PC with a dead CMOS battery will boot as normal but forget the date and time on each reboot.  This can lead to odd effects.  For instance I tried to logging into my webmail only to be told the SSL licence wasn't valid, not because it had expired but because my computer thought it was 2001!

CMOS Battery at Fault

Once I got into Windows I got a few "Windows has found new hardware" messages and my system clock had reverted to a day in 2001.
As soon as I saw my clock had forgotten the time and the date, all evidence pointed towards the CMOS battery being at fault.  Its funny how a simple little battery that most people don't even realise existed inside their PC can bring a computer to its knees.

Locating & Changing the CMOS Battery

In a desktop PC the CMOS battery is fairly straight forward to find.  They normally look like a large wrist watch battery, with CR2032 lithium batteries being the most common.  A simple search on eBay will find you a cheap replacement.  Just be careful removing and fitting anything on a motherboard, because any static electricity on your body could fry delicate computer chips.

CMOS battery on a desktop PC motherboard

On a laptop or notebook they are more difficult to find and generally more expensive.  On my Dell Inspiron you need to lift out the main battery and pull out a small flap to locate the CMOS battery.

Dell laptop battery housing

Location of CMOS battery in Dell Inspiron laptop

Dell Inspiron CMOS battery location

My Dell just so happens to take a 7.2V 15mAh Ni-MH CMOS battery, which again, performing a quick search on eBay will find you a replacement.

Fitting the new battery in either case is very straight forward.

Read more about Installing a CMOS Battery here.

Create a Simple Windows Service to Request a URL at Set Intervals

I needed a simple Windows Service to request a web page at set intervals indefinitely. Windows Services are the best way of doing this as they have the ability to start automatically when the computer boots up and can be paused, stopped and restarted. You can also get them to write events to the Windows Event log.

I found this Windows Service sample tutorial on The Code Project and downloaded the code to familiarise myself with the basics. The tutorial lacked a timer and the code to request a URL though so I had to add this functionality.

Visual Studio Standard edition doesn't have a Windows Service template, but you can still create a Windows Service, you just need to do a bit of extra work.

After some research and a bit of coding I added two new methods:

private void ServiceTimer_Tick(object sender, ElapsedEventArgs e)
{
this.timer.Stop();
DoWork();
this.timer.Start();
}

void DoWork()
{
WebClient client = new WebClient();
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");

Stream data = client.OpenRead(URL to request here);
client.Dispose();
data.Dispose();
}

I overrode the OnStart() method of ServiceBase to enable the timer and start it. I also overrode the OnStop() method to disable the timer.

The DoWork() method simply creates an instance of WebClient and reads in the URL you want to request.

Then in the constructor I set the timer interval and added an event handler to raise the ServiceTimer event when the interval elapses. The event handler simply stops the timer, calls the DoWork() method and then restarts the timer.

public static void Main()
{
ServiceBase.Run(new Service3());
}

public Service3()
{

InitializeComponent();
// Duration 1 hour
double interval = 3600000;

timer = new Timer(interval);
timer.Elapsed += new ElapsedEventHandler(this.ServiceTimer_Tick);

}

To install the Service you need to publish the project in Visual Studio. Then use InstallUtil.exe following the process below:

  1. Open a Visual Studio .NET Command Prompt
  2. Change to the bin\Debug directory of your project location (bin\Release if you compiled in release mode)
  3. Issue the command InstallUtil.exe MyWindowsService.exe to register the service and have it create the appropriate registry entries
  4. Open the Computer Management console by right clicking on My Computer on the desktop and selecting Manage
  5. In the Services section underneath Services and Applications you should now see your Windows Service included in the list of services
  6. Start your service by right clicking on it and selecting Start

Each time you need to change your Windows Service it will require you to uninstall and reinstall the service. Prior to uninstalling the service make sure you close the Services management console. To uninstall the service simply reissue the same InstallUtil command used to register the service and add the /u command switch.

e.g. InstallUtil.exe /u MyWindowsService.exe

When you install the service on a server you can find the InstallUtil.exe in the .NET framework folder e.g. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

 

Time to start testing your websites in Safari on Windows?

Apple recently added their Safari web browser to the Apple Software Update and pre-checked the box by default. This effectively means that a lot of Windows users will now, possibly without knowing it, have installed Safari.
I'm not going to discuss the ethics of this practice here, instead read John's Blog - CEO of Mozilla.

But what it means for the humble web designer or developer is that we should really be installing Safari on our Windows machines and adding it to the list of browsers we test our sites against as the number of users is bound to increase as a consequence.

Apple pushed Safari web browser through their Apple Updates service

Competition in the browser business is good and over the last few years Firefox has begun to gain ground on Microsoft's Internet Explorer domination. It has also forced the browsers to become more standards compliant, thereby helping web developers and designers design cross-browser, cross-platform web pages.

According to Apple, Safari is a standards compliant browser built on the open source WebKit project, so hopefully if your pages have been built to W3C standards they will require minimal checking, but it is always wise to test. Apple have a range of web developer resources for the Safari browser, including the Safari CSS support, Safari developer FAQ, and a general web development best practices guide.

USB U3 Smart Drives: Drives That Make Your Applications & Data Portable

USB flash drives have increased in capacity in leaps and bounds since I last purchased one. In the few years since I bought a Crucial 128MB Gizmo!, the price of flash memory has been literally free-falling, due partly to economies of scale and the mass adoption of flash-based mp3 players.
The size and sheer variety of these devices is astounding, but what I wasn't expecting when I inserted the drive was for a Launchpad application to start running, pre-loaded with special software!

SanDisk u3 Smart Drive - Cruzer Micro 4GB

I had in fact purchased a 4GB SanDisk U3 Smart Drive. U3 is a technology developed by SanDisk which effectively creates a platform for developers to build applications that install directly onto the flash drive rather than the host computer. This means that not only can you take your data with you, but you can take your applications too!

U3 Smart Drive Launchpad

When you insert your U3 Smart Drive into a USB slot on any computer, the U3 Launchpad is loaded, which is effectively like the Window's start menu, but instead contains menus to configure the drive, run installed applications and access your data. Nothing is installed on the host PC, so you can take your applications and data with you and its all secure and synced with your data on your PC back home.

The software that's available includes Skype, Firefox, Opera, various password safes, Thunderbird, OpenOffice... The list goes on. Some applications are free, while others cost a small amount of money, but most have downloadable trials. Here's a full list of U3 software.

Watch the video below for a quick guide to the U3 Smart Drive technology.

Buying New PC Hardware? - Make Sure It Supports Vista!

It's fast approaching the anniversary of the release of Windows Vista to business users, home users have been buying new PCs with Vista pre-loaded since the end of January 2007.
I haven't upgraded to Vista yet; my DVD upgrade is still in its box. I've installed it a couple of times to have a play around with it, to see which pieces of hardware and software are compatible, but that's it.
There are a couple of reasons why I haven't taken the plunge. Firstly, my PC can run the new Aero UI on Home Premium, but when I add the CPU monitor widget to the desktop to see how well it copes, it tends to max my processor out just opening windows etc. This is probably to be expected with a 4 year old computer. The second reason is the hardware and software support for Vista. You would have thought that manufacturers would have started to factor in support for a new Microsoft operating system, wouldn't you?
The word that springs to mind when talking about Vista compatibility today is "patchy", and today is almost 12 months after the official launch!

Future Proof Your Hardware Purchases

Most people who buy hardware or software for their PC will be expecting it to work with Vista out-of-the-box. They don't want to be updating firmware, or worse still finding out that their new device only supports XP! Why does Microsoft bother having alpha and beta testing periods when the likes of Apple can't even make their flagship iTunes work?

My advise to anyone thinking of buying a new piece of hardware or software is to make sure it supports Vista, even if you're sticking to Windows XP for the foreseeable future. You never know when you might buy a new PC, and do you really want to have to replace your hardware once you've upgraded to Vista?

Windows Vista Upgrade

I finally received my Vista Home Premium upgrade DVD this morning. I got an email claiming it was being shipped earlier this month and commented on my thoughts here.

Unlike the retail versions of Vista you don't get the snazzy clear box with the rounded corner. I can't complain though, it came in a clear DVD case with a quick start guide and a new OEM Certificate of Authenticity (CoA). You may remember I bought a copy of Media Center 2005 with a Vista Upgrade voucher last year.

It also comes with a slip of paper that states the following:

Licensed Device. This Windows Vista software replaces the Microsoft Windows XP software that is eligible for the upgrade to this software. You may install and use this software only on the device on which you acquired the Windows XP software.

Reassignment to Another Device.

You may not reassign the license for this software to another device.

It also goes on to talk about transferring to a third party and support services.

This goes someway to answering some of my questions. When I get around to installing Vista I'll no doubt be adding some more posts here. I need to give my hard drives a spring clean before I can do that though ;-)

Windows Home Server

I signed up to test the new Windows Home Server Public Beta a while back and received an invitation to download and review it.

Like a lot of people I am frequently running out of storage space on my machines and needing to upgrade. I am also fairly concerned about data backups too, so much so that I upgraded my main machine a while back to include a SATA RAID 1 mirror for my core data over 2 x 320GB drives.

Most people however don't have the need or knowledge to set up a decent backup or redundancy solution, so Windows Home Server when purchased installed on a piece of purposely designed hardware should fill this gap in the market.

When I get a spare few minutes I'll download the DVD and test on an un-used machine. I'm particularly interested in the usability of the software since it will mostly likely be bought by and used by people who are not particularly technically minded.

From what I've heard it does not include Media Center (since it's a headless OS), but it features Windows Media Connect, so I'll be able to stream my music and video straight to my XBOX 360 without having to have my main machine running.

Vista Home Premium Upgrade Voucher

I finally received an email yesterday confirming my Vista Home Premium upgrade has been dispatched.

Way back in October 2006 I upgraded my main machine from XP Professional to Windows Media Center Edition in order to be able to stream content to my Xbox 360 in my living room. I bought an OEM version of the operating system with a Vista Home Premium upgrade voucher included.

On receiving it though I discovered what was needed to claim my upgrade. Microsoft don't make it easy I can tell you that now! Firstly the offer was restricted to system builders registered with Microsoft, this wasn't made clear on the site I purchased it from. It didn't phase me though, I registered and now receive lots of system builder spam :-)
I went ahead anyway and fingers crossed it's paid off and I'll get my hands on the new OS shortly.

My next problem is going to be installing it on my aging computer and trying to understand what pieces of hardware I can upgrade without having to re-validate my OEM copy of Vista. Oh what have I got myself in to?? :-)