$theTitle=wp_title(" - ", false); if($theTitle != "") { ?>
dabbling, frivolling, idling, loafing, loitering, playing and procrastinating
28 May // php the_time('Y') ?>
It’s going to be that time of year again soon, when a browser gets updated and all developers frantically have to make their websites compatible and all working fantastically. However, this time around the team behind Internet Explorer 8 are going to make this much easier on all us devs.
They are doing this by allowing the web-site itself to control which rendering engine IE8 will use when you browse. This will mean if you site is already compatible with IE7, it can also be compatible with IE8 by simply including one line of HTML in the header…
<meta http-equiv=”X-UA-Compatible” content=”IE=7″ />
This will apparently force newer version of IE8 to render the current page in IE7’s format, which from a standpoint on the priority of getting things upgraded, can allow it to go a few notches down on the list rather than being the number one.
For once it will be nice to worry about feature sets, improvements and bug fixing rather than worrying if the styling will still work when the next version of IE comes out.
Thank you Microsoft IE team!
27 May // php the_time('Y') ?>
This isn’t exactly on topic for my blog, and for the people who know me know that I don’t even drive, but it’s something that is just getting out of hand in the UK. For those who hadn’t been watching the news today, truck haulers have been protesting about the 2p increase on petrol coming in August. This combined with the future car tax increases adds up to it being almost astronomic to run a vehicle on the road.

So, we’re paying around 114 pence a litre here in the UK, what’s the same cost in the US? Lets do the maths…
Average price of a gallon of unleaded in USA is $3.93
Average price of a litre of unleaded in UK is £1.14
1 US gallon = 3.78 litres
1 litre = 0.264172052 US gallon
$1 = £0.506292p
£1 = $1.97493
UK Average for a gallon = £4.31 or $8.51
USA Average for a gallon = £1.99 or $3.93
Similar maths to get…
UK Average for a litre = £1.14 or $2.25
USA Average for a litre = £0.52 or $1.03
Price difference of 46%
The joy!
15 May // php the_time('Y') ?>

This is something I have been noticing over time, and has been steadily getting worse over about the past 2-4months. Back in the end of October last year I posted about how Gmail had finally added IMAP support to their giant web mail service, this was of course fantastic news! After various amounts of hacking with Gmail settings to get IMAP on my account I had it delivering my mail through Thunderbird with little to no effort.
Initially, this was fine, had no problems with it, a bit of confusion on how folders/labels worked, but once you get your head round it was ok. But I’ve just noticed that a growing problem is occuring, and it’s that the IMAP server they have, or the code behind it, just can’t keep up with demand anymore.
I find that especially in the mornings Gmail’s IMAP generally becomes completely un-contactable, and even if it is, my login details won’t work and Thunderbird will be constantly asking for them in its attempts to log me in. The length’s of these outages can range anywhere from 5minutes to 5hours, I’ve gone the entire morning without access sometimes. Obviously if I was really desperate to read my mail I would use the website, which I don’t think I have ever had problems with, but that’s not the point, I prefer to read my Gmail in a standard mail client.
Google had to come up with some sort of major hackery to get IMAP working with their product, is it finally showing the flaws now since that I suspect every man, woman and dog are using it? Only time will tell, I’d like to think that it’ll get better and these stability issues will disappear, as quite frankly I love my Gmail account, and it would be a shame and a major pain in the arse if I had to give it up.
14 May // php the_time('Y') ?>
This is sometihng that baffled me for a good few months until I finally figured out what the hell was going on. If you develop in rails chances are you’ll either be using Mongrel or WEBrick to run it locally, but sometimes when I went to start either of them I would get a “This port is already in use”, which wasn’t exactly fantastic.
I would look around to try and find out what was using it, but “netstat -a” doesn’t help much, it just says its taken by a local device on the machine, although it wasn’t just port 3000, it’s the entire range of 3000 to 3030 were “in use”.
Some days it would work, some days it would fail, from what I could tell it was completely random whether I would be able to start up the server. After senses of humours were lost to the pixies I finally worked it out, and it comes down to a little green icon with two arrows…
![]()
It’s ActiveSync, and you’ll have this program running if you have a PocketPC phone and if the phone is connected, say goodbye to those port numbers. It steals 3000-3030 straight away when you plug it in. Some solutions I have found are to unplug my phone, start Mongrel, then plug the phone back in. Although again, this working is random and highly frustrating. Currently I have resorted to unplugging my phone when I am developing in rails and plug it back in when I’m done.
I actually figured this out sometime last year, but saw someone come into #rubyonrails having the same problem and I thought I should probably share it.
6 May // php the_time('Y') ?>
This was more of a test to see how easy it would be to scrape some data using Ruby as I usually use PHP to do this for me. However when using PHP it always seems to be a mess of explodes and regexp’s to get what I want. So I wanted to see how other languages do it.

So first things first I found out which packages/libraries were around for Ruby, and admittedly there’s quite a few, however upon first look what appear to be the better ones don’t work out of the box. Which is a big shame, as I spent a good few hours trying to get scRUBYt! working on my Windows XP development machine, but in the end I had to admit defeat. It just wasn’t going to work properly even though I had followed every guide you could find to get it working in a Windows environment. I was a bit disheartened as this appeared to be the best one out there as its first example was exactly what I was looking for.

Alas, I moved on, had a quick look at Hpricot, but it didn’t seem to do what I wanted easily. After trying to find some examples of how they all worked I found srcAPI, which was very similar to scRUBYt however no matter how much I tried, I could only find one example, which was its own eBay one. It had a nice installation, just a gem, which worked first time (which one usually expects), from there I tried their example. I had read on their website that it uses Tidy to do the HTML cleaning, but you could use it without that if you told it to use the built in one, however it warns you that this should only really be used for testing, and and that was what I was doing I told it exactly that.
Scraper::Base.parser :html_parser
To cut to the chase, nearly 3hours, much googling and frustration later and the simplest of process’s it was refusing to scrape part of a table I already had. Telling it to use the built in one instead of Tidy was my downfall, the second I switched it back to Tidy (and a quick re-ordering of the loading code to stop it trying to load the linux version first) and it was working perfectly. This was someones comment about it all…
Phases of scrAPI usage:
1. Elation - Wow, this is so easy and powerful. I’m gonna scrape the world!!!!!
2. Despair - What the hell is the syntax for the selectors, I’m so confused, and there are no docs
3. Elation - scrAPI has great test coverage, you can learn everything you need to know about the selectors from the tests.
Couldn’t agree more, although instead of getting help from the test cases I got help within a scrAPI cheat sheet I found. Without that I would have probably given up and tried the next one in line.
So I’m now testing and doing more complex scraping with srcAPI, but for anyone who is a beginner to Ruby you may find this task quite challenging and probably beyond your scope of knowledge to begin with. The lack of documentation and examples for this made it increasingly hard, and most was done with guess work on how it was interpreting the HTML source code.
Bottom line, if you can get scRUBYt! working, go with that, it’s very powerful and from the examples I have seen, very programmer friendly and will allow you to get to the data you want fast. But if you can’t get it on the go, then there’s many others available including many I haven’t mentioned, but Google knows all! (apart from examples of srcAPI :P)