I am pretty bad at dipping into my work email when I should be relaxing at home. (I do work from home, but if I don't have my work computer at home, I shouldn't be looking at work email.) So I decided to take some steps to stop my bad habits.
The first is easy and works cross-platform: I installed LeechBlock, a Firefox extension which you can configure to block you from certain sites on particular days/times, or if you access them for longer than a certain period. Now if I try to visit work webmail, LeechBlock blocks my access and prevents me from reaching the site. You can even tell it not to let you access its options during the block times, but as I was setting the block for the whole week, I thought I might regret it.
Second was a bit more technical and wouldn't necessarily work on Windows. But I added a firewall rule to my iptables configuration to prevent me accessing my work webmail domain altogether:
iptables -A OUTPUT -p tcp -s 0/0 --dport 443 -d 10.10.10.10/32 -j DROP
(obviously, replace 10.10.10.10 with the IP address of the domain you don't want to access).
Thirdly, I fixed my hosts file to point the offending domain at localhost, so if I try to go to it, I would just get my local web server instead. On Linux, just edit /etc/hosts and add a line like:
127.0.0.1 offending.domain.com
Now, I can undo all this, but it's a pain in the arse to do so, and will hopefully remind me I shouldn't be accessing work email when I'm not working :) Any other suggestions? (I tried putting a content block in my firewall, but it only seemed to work with HTTP domains.)
National treasure and all-round excellent guy Stephen Fry has recorded a video celebrating 25 years of GNU. Marvellous to see such a public figure supporting and explaining free software and open source. A good one for friends and relatives in need of explanations.
I like Amazon - who doesn't - but sometimes they don't have what I want, or they have it at some extortionate price. I also like to support smaller specialist music retailers, so thought I'd mention a few which have great catalogues, especially if you like electronic music:
Finally, we have a properly compatible, open source Java. I've grown to like Java more and more over the last few months, and I'm hoping this might encourage more open source developers to pick up the language.
Here's the original announcement.
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.
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:
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.
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 :)
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.
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.
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.