Blog

Does your PC Keeping Forgetting the Date & Time?

13. May 2009 13:34

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.

Tags: ,

Filed under: Hardware

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

14. April 2009 13:45

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

 

Tags: , , ,

Filed under: Windows | Software Development

Time to start testing your websites in Safari on Windows?

22. March 2008 13:31

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.

Tags: , , , ,

Filed under: Software | Web Browsers | Web Development | Windows

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

5. January 2008 13:24

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.

Tags: , , , ,

Filed under: Gadgets | Hardware | Windows

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

18. November 2007 13:11

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?

Tags: , , ,

Filed under: Hardware | Windows