elliot's blog

Installing Xdebug for PHP 5 on Ubuntu "Feisty Fawn"

Xdebug is a PHP debugger with nice Eclipse integration. Here are some instructions for installing it (assuming you already have Apache 2 and PHP 5).

This article explains in more detail, but isn't Ubuntu-specific. It does detail Eclipse configuration for Xdebug in detail, though.

You need to be root to do the installation.

First off, install Xdebug. This isn't packaged for Ubuntu, so you need to do it with PECL. So install PECL if you don't have it:

apt-get install pecl

Use PECL to install Xdebug:

pecl install xdebug

Configure PHP 5 to use Xdebug by adding these lines to /etc/php5/apache2/php.ini (somewhere near where the other extension= lines are):

zend_extension=/usr/lib/php5/20060613+lfs/xdebug.so

[xdebug]
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.remote_host=127.0.0.1
xdebug.remote_log=/var/log/apache2/xdebug_remote.log

Note you need to use zend_extension= to load the extension, and you should use the absolute path to the module (.so file) to do this. Otherwise it fails.

Check using PHP info, e.g. add a file called phpinfo.php to your web root:

<?php phpinfo(); ?>

Then call it in your browser. Check that there is an Xdebug section displayed.

That's Xdebug installed. See the article linked at the start of this entry if you want to integrate with Eclipse.

Haiku by Basho (17th century)

Drizzly June -
long hair, face
sickly white.

Dreamhost invitation codes

Note: I keep this page up to date with my currently-valid codes, so disregard the comments from people who say they've used them.

I've got 5 Dreamhost invitations, which you can use to sign up for Dreamhost hosting. They can be used once only, and give the following benefits if you use one to sign up:

  • Increase hosting plan features to 2TB disk and 20TB bandwidth.
  • Give $150 off a 5-year signup or $200 off a 10-year signup. (That would be $267 for 5 years hosting, or $514 for 10 years; with 2TB storage.)

Obviously, I get a few quid if any uses my codes :) I like Dreamhost a lot, and use my hosting for backups (they give a massive disk allowance), to run my Subversion repository, and to host experimental Rails (they support Phusion Passenger) and PHP applications.

Here are the codes:

  312559460095
  954046739122
  218045114524
  371122736379
  651598559782

Go to https://signup.dreamhost.com/ and use the 12-digit code in the "promo code" field. Let me know if you use one of them.

s33r 0.5.4

I stopped working on s33r, my Ruby Amazon S3 library, a few months ago. I thought Marcel Molina's S3 library had outstripped mine in terms of features and completeness, I had less time for developing on it, so I handed it over to Tiago Macedo, who's made a few improvements in the meantime.

However, I recently got an email from none other than Geoffrey Grosenbach. I knew he had used (and even presented about) s33r, and he was asking whether it supported virtual domains for bucket naming. It didn't. But given a request from Geoffrey, I couldn't do anything but add the feature. Hence the release of a new version.

It's interesting going back over the code, as I wrote it a while back. Even though I only wrote it maybe a year or so ago, it's striking to me how much I've improved as a developer since then. There's plenty of stuff in there I wouldn't do now; and it's obvious to me that the code is a bit convoluted and badly modularised. I could do better now, I'm sure. I put this down to the fact that my coding (full time at work) is now scrutinised by other people, and they make me defend and explain what I'm doing, which improves my design work; also, the fact that it goes into commercial products and has to be performant and testable and readable makes me write more carefully and conscientiously; plus I've spent a lot of time thinking and reading about design while I've been at Talis, which has improved how I approach coding generally. Maybe I should go back and do a rewrite :)

Have fun generating band names

My friend Roger has just made his first blog post. I helped him get set up with Blogger and some free file download service and I'm pleased to see he's written a nice first post, including a downloadable file of one of his musical adventures.

At present, he's looking for names for his latest band. To be honest, the selections he has on show are less than inspiring. Fortunately for him, the Band Name Maker online is on hand to generate some rather curious, and occasionally half-decent, band names. For example:

  • Actor Of The Bipolar Fish
  • Hawk Purse
  • Shell Of The Frozen Shiver
  • Gold Implant
  • Jolly Champion
  • Phat Church
  • Reverent Freeway
  • Blazed Mammal
  • Busted Power
  • Hardly Place And The Incoming Reject
  • Barbed Of The Jumping
  • Kumquat Lantern
  • Second Night Of The Yellow Operator
  • Pickled Paranoid

I think "Second Night Of The Yellow Operator" is my favourite there. Though I've never had problems thinking up band names:

  • Truncated Edifice
  • Yaibotchun Combo
  • Two Hands Falling
  • Giant Child
  • Quinn And Jane
  • Fed Bag C
  • Spill Twins
  • The Black Lab
  • No Vehicles Without Boats

Then again...

RailRoad patch

Another patch of mine has gone into an open source project. I did it so long ago, I'd actually forgotten all about it. The project: RailRoad, which creates nice class diagrams for your Rails models. My patch extended it to include plugin model classes in your diagrams. Always gratifying to have my stuff included in this sort of project.

New captchas installed

I got so sick of deleting spam off my website, I decided to install various Captcha modules to stop it happening. I've done a few quick tests, and they work far better than they did about 6 months ago. I've actually got a range of different, random captchas installed, ranging from ascii art, to phrase completion, maths questions, and missing letters. It does mean leaving a comment on my site is a bit like the Krypton Factor (for those of you old enough to remember that), but hopefully it will cut down on my spam (which was up to about 50 comments a day NOT being caught by the filters; upwards of 100-200 per day which were getting caught). I may even turn the spam filters off, as they always seemed to rate comments from my friends as spam, while letting through endless crap about viagra and porn.

Ruby Tuesday: miPlayer is some iPlayer Ruby shizz for Linux

Update: Paul's code is MIT licenced, so I'm putting mine out under the same licence.

A while back, I wrote some simple scripts for parsing the BBC iPlayer search pages, so I could get emails about programmes I was keeping an eye on. I also wrote a little Rack server interface so I could browse my search results easily. The downer was that I could only watch them online as downloads aren't supported on Linux, so I ended up having to go to the BBC website to watch them in a tiny window, or boot my Windows VM to download a DRM-crippled version.

However, Rob Styles noted today that there's a Ruby script out there (http://po-ru.com/diary/keeping-up-with-iplayer-dl/ by Paul Battley) which mimics an Apple iPhone, enabling you to download programmes as MP4 files without DRM. I don't have an iPhone, but I can't see why it should only be design know-it-alls who get this privilege. So I integrated that script with my Ruby/Rack web front end, spiced it up a bit, and away I go. I can now search for programmes and download the mp4s to my hard disk (if they exist - not every BBC programme has an mp4 version). Nice. Turns out Rack can also multi-thread in a decent fashion (unlike Rails), so I can even have several downloads running at once.

The code is attached. There's no licence on the download script I'm using, so I hesitate to release it under any kind of open source licence (yet). I'll contact Paul and find out what licence he's releasing under. I made a few modifications to his script to wrap it in a class for use in my app., but not many. See my previous entry (linked at the top of this post) for proper instructions/installation etc..

Also, please don't expect very clean, well-tested code here: it's something I've thrown together for my own use, and I'm putting it out there for others to use if they like. Also, I can't guarantee it will work on Windows at all. Enjoy.

Vegetable gardening

This year's gardening project, since we've recently moved house, is to have a vegetable patch. I'm not particularly fussed about where our fruit and veg. come from: we buy local organic mostly, but I'm not strict about it. So it's not through any sense of wanting to be self-sufficient or mistrusting suppliers. It's more a case of wanting a challenge; plus there's a sort of vegetable patch in the garden already; the aspect is good (south facing with some shady parts); soil is heavy clay but we had loads of compost we could add from pots, growbags and compost bins left by the last inhabitants; and I think it's something Madeleine will enjoy.

Anyway, I decided to start small with half a dozen easy to grow crops (germinate well, grow fast and are reasonably tough) which we enjoy eating or which taste better really fresh. I've gone for:

  • Spinach 'Tardy'
  • Lettuce 'Catalogna'
  • Sweetcorn 'Sweet Nugget' (short plants; I love corn on the cob)
  • Wild rocket
  • Pumpkins (that one was Madeleine's choice - they take up a lot of room, but I like pumpkin soup etc., you can make Halloween lanterns from them, and they're impressive plants)

My choices of variety were based on reading Organic Gardening by Charles Dowding, and browsing The Organic Gardening Catalogue. I ordered the seeds from the latter, which seems reasonably priced. Delivery was pretty fast and accurate. The book I mentioned is interesting and gives some good tips on when to sow and which varieties to go for. (I've been doing organic gardening for about 8 years and it's taught me to grow the things which want to grow, grow plants which resist the local pests, and to encourage beneficial insects and animals. So I fully expect lots of failures all the time when gardening, and use those failures as object lessons.)

We planted some in the "greenhouse" (more like a green polytunnel) in newspaper pots Madeleine and I made together using this Paper Potter implement, which is part of the fun. Madeleine likes making the pots and filling them with compost, pushing the seeds in, watering them. We also put a few wonky rows of seeds into one of the beds, as per instructions, and labelling them; though the wind and Madeleine's hands ensured that we'll probably just end up with a big mixed patch of all sorts of stuff. All part of the fun.

We're also doing sunflowers and nasturtiums, both of which are easy and produce good results. You can eat the nasturtiums too, of course.

This weekend I also harvested a load of spring onions which were already growing in the garden, planted by the previous owners, and have been making honey and mustard salad dressing to go with them. I'll probably be back onto making pickles before too long.

Here's hoping we get at least a few of our own plants to eat. I keep checking the pumpkin seeds we planted last week, hoping that some of them come up, as Madeleine seems quite keen on those growing. Wish us luck.

Today I saw a bullfinch

First time in my life I've seen one of these birds for real, and I'm 38 years old. I find that incredible. It was eating berries in the neighbours' garden.

Here's what the little fellow looked like:

(Photo released under a Creative Commons by-nc-sa licence by Marko_K; I took a picture, but it wasn't particularly clear, so I used this one instead.)

Syndicate content