/0

Archive: November, 2009

Now is the time of @font-face

Up until a few days ago I didn’t give the @font-face part of CSS a second thought, but I think I may be about to give it another look. For anyone who doesn’t know, it allows you to use fonts stored on the web server in your web pages rather than having to rely on the visitor having the font installed on their machine.

How to prolong Laptop (Li-ion) battery life

Laptops batteries are a pain. After a couple of years we’ve all found that or battery life has dropped from the 4 hours we got originally down to 30 minutes if we’re lucky.

I’ve decided therefore to try and come up with some simple rules for making sure my laptop batteries last much longer than this, hopefully for many years.

Part 2 of my Real Review of the ASUS X5DIJ Laptop

Ok, it’s been a week, and so far the laptop is performing well. I’ve installed Office 2007 Enterprise, which is running well and programming websites in PHP has been easy peasy. I think the wireless card has to be the best one I’ve experience yet, although I’ve never had anything that you would call premium hardware on that front. But still, it seems faster than my PC’s connection which goes via 100Mbps Ethernet!

Get the centre of a Google Map as Latitude and Longitude

Here’s a nice little javascript function to get the Lat / Long coordinates of the centre of Google Maps – I found it prticularly useful once when creating a flash map which showed the locations of a national chain of golf fitting centres.


javascript:void(prompt('',gApplication.getMap().getCenter()));

To use it simply go to Google Maps, centre the map on the place you want the coordinates of, enter the code above into the address bar and hit enter. A nice text field alert will pop up allowing you to copy the Lat / Long values.

If you’re going to be doing this regularly you may find it useful to create a Firefox bookmark with the code set as the location. That way you can simply hit the bookmark and have the coordinates appear (as long as you’re on Google Maps that is).

Dynamically generate category meta descriptions in Magento

A friend of mine had a problem with his Magento store recently; all the product categories were using the default meta description which comes from the admin and he thought that this duplication might be affecting how Google indexes the site (he’s an SEO guru btw, so probably right).

You might say “why not just manually enter descriptions for each category” and you’d be right, that would fix the problem. But there’s a lot of categories and my friend is incredibly busy, he’s a Google consultant so funnily enough spends most of his time SEOing other people’s websites.

So in a nutshell here’s what we did.

How to tell if an HTML element exists using JQuery

Up until now I had assumed that if i need to detect the presence of (or lack of) an element on a webpage I could simply use the following:

if($('.elementClass')) { //some code here }

but I found today that this doesn’t actually work. Whether the element exists or not you will still get a JQuery object returned, which of course equates to TRUE.

So I decided to RTFM and found that the JQuery object has an attribute, ‘length’, which returns the number of elements. So of course it will be zero if the element wasn’t found. So my code, which runs if the element is present now reads:

if($('.elementClass').length != 0) { //some code here }

Simple eh? Of course you can also say == 0 if you want some code to run if an element isn’t found.

A Real Review of the Asus X5DIJ Laptop

I’ve just bought a new laptop, the Asus X5DIJ but when I was trying to decide whether it would be right for me or not I simply could not find any reviews of it online anywhere. So I’m going to fill the gap now with a review in 3 parts.

Part one will cover intial impressions of it.
Part two will be more in depth, covering everyday use.
Part three will come quite a bit later, after any problems have been found, and hopefully include some solutions if necessary.

All content and images (unless otherwise stated) copyright © 2010 Division By Zero - Credits