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.
Get the centre of a Google Map as Latitude and Longitude
- Jonathan
- 28th Nov 2009
- Google Maps
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
- Jonathan
- 24th Nov 2009
- Javascript
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.
- Subscribe to our RSS feed currently serving 74 happy readers
- Follow @divisi0nby0 stay up-to-date with 40 other followers