by Jonathan
on 25th Nov 2009
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.
by Jonathan
on 24th Nov 2009
in 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.
by Jonathan
on 21st Nov 2009
in Reviews
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.
by Jonathan
on 26th Oct 2009
in Random
Ah I see, it’s the 26th – Randall has decided to commemorate the end of GeoCities by redesigning the XKCD homepage to match how the majority of the Web looked about 12 years ago. Bloody hell is that how long I’ve been using the Web? I just turned 24 but now I feel really old!
by Jonathan
on 12th Aug 2009
in Google
Google has launched a beta of an upgraded search which it claims will make your search a whole lot faster.
It’s available to try now at http://www2.sandbox.google.com.
by Jonathan
on 11th Aug 2009
in Development, PHP, Wordpress
I recently came across a strange new error message on a new install of WP 2.8.3
Warning: Compilation failed: characters with values > 255 are not yet supported in classes at offset 16 in wp-includes/shortcodes.php on line <line-number>
From what I’ve read on various blogs, forums and articles this problem occurs when running an older version of PHP with an out-of-date PCRE library. PHP should come with it but sometimes is compiled with really old system versions that are on the server. That’ll teach me to install on a 4 year old server!
Thankfully the fix is fairly simple.
Open up shortcodes.php and find the function named shortcode_parse_atts. Replace the preg_replace line with the following:
[code lang="php"]$text = preg_replace("/[\x{00a0}\x{ff}]+/u", " ", $text);[/code]
So in future kids, make sure you’re running PHP5 compiled with it’s own libraries, not out of date system ones!
by Jonathan
on 11th Aug 2009
in Development, MySQL
At some point or other everyone needs to perform a conditional INSERT; one that is only executed after checking if the data is already in the database – so here’s how.