February 2012
1 post
3 tags
.net magazine article: Create a Google Talk bot...
I have written a two part article for this months .net magazine detailing how easy it is to write a Google Talk bot with the evented power of Node.js. “Programming a chat bot was once the domain of the hardcore hacker, tapping packets as they passed over the wire from proprietary client applications to closed source servers, but not any more!” In issue 225 (out now) you will learn how...
Feb 3rd
January 2012
1 post
4 tags
Installing a MySQL UDF errors with Function...
When installing a UDF recently I got an annoying error message, which didn’t seem to want to go away. Deleting the function before attempting to remove it did not work so I used the following set of escalating commands to attempt to get it to install. But back to the error for a moment: bash > mysql -u user -p < installdb.sql Enter password: ERROR 1125 (HY000) at line 7: Function...
Jan 31st
October 2011
5 posts
4 tags
Nodester environment variables for sensitive data...
When I began using Cloudno.de recently to have a go at Node.js and CouchDB I stored my username and password in plain text in a configuration file. If you are also looking to get CouchDB going with CloudNo.de then my earlier Getting started with Node.js and CouchDB post may be of interest. The configuration file was fine for testing as nobody who came across the database login details could do...
Oct 27th
23 notes
5 tags
PHP extension writing: PHP Extensions Made Eldrich →
Since writing my 15 Excellent Resources for PHP Extension Development post in September last year Kristina Chodorow of 10gen (MongoDB) has written an excellent four part article on writing PHP Extensions on her blog Snail in a Turtleneck.
Oct 26th
17 notes
3 tags
Oct 23rd
30 notes
4 tags
Getting started with Node.js and CouchDB
Node.js and CouchDB feel like they were made for each other right from the very first time I used them. With the cradle node package the integration becomes even easier. Whilst both Node.js and CouchDB are open source with packages for most operating systems it maybe easier for you to start out using a hosted solution such as CloudNo.de (has CouchDB now) or Nodester for example. As far as the...
Oct 21st
32 notes
Oct 21st
July 2011
1 post
5 tags
How the ssdeep PHP extension came into being
Recently (well in a loose sense anyway) I had the need to build a document bank in PHP for a client at Mosaic. It was a fairly involved application with various public and private APIs for integration into the clients network of websites. The core PHP code was written on top of the Agavi framework and various PHP libraries for extracting text and meta data from documents. One of the major...
Jul 14th
15 notes
June 2011
3 posts
1 tag
Running a sane version of Linux on a Dell Inspiron...
I have ended up with a very old piece of hardware and of course the first thing I did was wipe the Windows 2000 installation and stick a few versions of Linux on it. Unfortunately it only came with 128MB of memory from factory so nothing would run very well. The PCMIA wireless card that came with it wouldn’t work with WPA2 under Windows 2000 so an upgrade was required. £5 later I got a...
Jun 22nd
3 notes
Jun 10th
3 tags
Jun 3rd
4 notes
May 2011
2 posts
3 tags
New version of the Agavi framework support for...
necora-markus: Released a new version of the Agavi framework support plugin for the shiny new NetBeans 7.0. Still depends on implementation versions of the PHP-plugin, so if something doesn’t work, please let me know. Prebuilt NBM available here, source code here. UPDATE: Even newer version available here. Should fix a null pointer exception.
May 5th
2 notes
2 tags
May 5th
102 notes
April 2011
2 posts
2 tags
Apr 28th
4 notes
3 tags
Why won't ssh-agent save my unencrypted key for... →
I recently was annoyed by always having to enter my private keys passphrase every time I wanted to do a git push to or pull from a public git repository. Turns out that if you are logged into a Gnome session on an Ubuntu machine it will automatically add you key to ssh-agent, but if you are logged into a bash session (as I was) then it won’t. So you can either manually do the ssh-add...
Apr 26th
March 2011
1 post
Mar 9th
166 notes
February 2011
1 post
5 tags
Gearman, PHP and mod_gearman_status on Ubuntu
Installing Gearman is pretty easy as there are packages for it in Ubuntu: sudo apt-get install gearman libgearman-dev The development headers (libgearman-dev) are only required if you need to compile a library for your programming language such as a PHP extension. To install the PHP module you would run: sudo pecl install channel://pecl.php.net/gearman-0.7.0 If you have trouble with the above...
Feb 11th
3 notes
January 2011
2 posts
2 tags
PHP Hangs When Fed 2.2250738585072011e-308 →
A pretty horrible bug when you assign the number 2.2250738585072011e-308 to a variable PHP will hang on Linux or Windows 32bit builds of PHP. This does affect $_GET and $_POST variables as well and as such could be an exploit in some PHP sites. So the following code will break your PHP for example: $var = 2.2250738585072011e-308; Or if a page is given a GET parameter like...
Jan 4th
1 note
5 tags
FullOctane: Bike and Car Blog →
I have setup a site to post all my automotive related discoveries. Currently I have two posts up there about fuel degradation and storage. Putting motorcycles into storage or “winterizing” can be an involved procedure so I have decide to cover it in a series of posts beginning with the fuel system in the post entitled ‘Winter Motorcycle Storage: Fuel System’. Continuing...
Jan 2nd
December 2010
2 posts
Dec 13th
1 note
3 tags
Logging global PHP objects and saving memory using...
Quite often when you are working with legacy code you will come across a mess of globals. Every single method will make use of the same global instance of the database class for example. So where do you begin to work with this massive impediment? Logging is a great way to see what methods and classes are being used by you application and where. To achieve this you would normally...
Dec 2nd
9 notes
November 2010
3 posts
6 tags
Set up a new port forward on a Draytek Vigor over...
I needed to add a new port forward to a router, but I did not have access to the web interface through a graphical browser. Attempts to get in using Lynx stalled as it seems the router will not serve up the frames in the interface independently of each other and it kept issuing 404 errors. Either way I had to use the telnet interface using the following command (replace 192.168.1.1 23 with...
Nov 20th
6 notes
sergeroyqcca asked: Hy Simon, thanks a lot for your blog, find it really useful.

While following your setup instruction for agavi in xampp, An error message comes up when I try create my agavi project stating: Error: Phing version could not be determined; Phing 2.4.0 or later required

The installation succeeded stating install ok: channel://pear.phing.info/phing-2.4.3
Nov 19th
9 tags
An Excellent Development Server for a Team of...
Introduction When working in a team it is very useful to have a central web server with multiple environments and a configuration as close to the live server as possible. This can be a bit of a nightmare though if you need to setup a new VirtualHost container in Apache every time a new project is brought on or when a developer wants to work on a version of the site in their own environment. The...
Nov 8th
5 notes
October 2010
3 posts
3 tags
Redis: under the hood (internals) →
I was curious to learn more about Redis’s internals, so I’ve been familiarizing myself with the source, largely by reading and jumping around in Emacs. After I had peeled back enough of the onion’s layers, I realized I was trying to keep track of too many details in my head, and it wasn’t clear how it all hung together. I decided to write out in narrative form how an instance of the Redis server...
Oct 18th
4 notes
6 tags
PECL Install Issues on Redhat
Installing via the pecl command can be a pain on Redhat. First off all you will need to install the php-devel package: yum install php-devel Then you will need ensure that the PEAR/PECL installer is at the latest version so as root run: pear update-channel pear.php.net pear upgrade pear You may need to force pear to upgrade itself by using: pear upgrade —force pear I had to use the...
Oct 6th
5 notes
3 tags
Forcing NetBeans to Use Unix (LF) Line Endings →
NetBeans usually uses the operating systems default line ending when creating a new file (it establishes this by what the JVM tells it). So for example in Windows it will automatically use CRLF and in Unix it will automatically use LF. This behaviour has its advantages, but sometimes you want to to be specific about the line endings you need. To do this you can add the following switch to your...
Oct 5th
3 notes
September 2010
3 posts
10 tags
15 Excellent Resources for PHP Extension...
Whilst developing a PHP extension recently I spent quite a bit of time researching exactly how to create an extension, the best practices and the DocBook format of the PHP manual for documenting the extension. By the time I finished writing the extension I had found some very good resources both on the web and in print. Online Articles or Websites: The Internals section of the PHP manual Wez...
Sep 20th
5 tags
The PHP ssdeep Extension is Now in PECL →
This means you can now install it easily by simply running: sudo pecl install ssdeep  There is also proper documentation in the PHP manual which can be found at php.net/ssdeep. For more information on the extension either see the PECL project page or the ssdeep PHP/PECL extension’s homepage.
Sep 18th
5 notes
4 tags
Per-tag RSS feeds for Tumblr from notes.husk.org →
I didn’t think that Tumblr offered per-tag RSS feeds, but after spending some time trying to hack the JSON output from the Tumblr API into my aggregated front page, I tried appending “/rss” to the URL of one of my tag archive pages, and somewhat to my surprise, it worked. Of course, RSS is… A nice Tumblr tip.
Sep 3rd
22 notes
August 2010
13 posts
9 tags
php_ssdeep Fuzzy Hashing PHP Extension →
Updated 16/9: php_ssdeep is now in PECL so I have updated this post to reflect that. On a recent project I needed a fast way to compare documents for likeness and return a percentage match. With much research and one unanswered Stackoverflow post later I came across Jesse Kornblum’s ssdeep utility intended for computer forensics such as looking for signatures in files when hunting rootkits...
Aug 31st
7 notes
Aug 25th
6 tags
A PHP wrapper for the unix at command
A project I am working on at the moment requires time delayed job queues and having found nothing yet that can manage it properly so I decided to wrap up `at` into a PHP class. This gives you simple methods to add, list and remove jobs from the `at` queue using object oriented code. The code is very simple and I have documented it reasonably well so along with the examples you should get on your...
Aug 24th
3 tags
Batch remove extensions in Ubuntu →
Sometimes you will want to batch remove extensions from a load of files: for i in $(ls *.png); do mv $i ${i%.png}; done If you want to remove extensions from files with a .txt extension then you would replace the two instances of .png in the script above with .txt. You can take the extension off of all files using the following: for i in $(ls *.*); do mv $i ${i%.*}; done I also extended...
Aug 24th
4 tags
If you are having problems getting Ubuntu atd...
If you just cannot get atd to start running check the permissions on your /var/spool/cron/atjobs and /var/spool/cron/atspool directories. The should be `chmod 770` and then `chmod +t`. Also they should be owned by `daemon:daemon`. I was getting this error when attempting to set new at jobs: Can’t open /var/run/atd.pid to signal atd. No atd running? If I tried to start the daemon through...
Aug 23rd
2 notes
5 tags
Getting gearman to install on Ubuntu →
Getting the gearman PHP PECL package to build on Ubuntu is problematic with many unaccounted for dependency issues. I only made a couple changes when following the instructions from JSJoy as I am running Karmic rather than Lucid I changed the apt-get sources to: deb http://ppa.launchpad.net/gearman-developers/ppa/ubuntu karmic main deb-src http://ppa.launchpad.net/gearman-developers/ppa/ubuntu...
Aug 23rd
3 tags
WatchWatch
In this video, John Resig presents his 6 Secrets to becoming a jQuery Ninja address on how jQuery is arguably the most popular and useful Javascript framework available today. — zoopy.com
Aug 19th
2 notes
Aug 18th
4 tags
Aug 15th
59 notes
5 tags
Firefox with Radio Inputs and it's Annoying... →
I recently had problem with Firefox’s autocomplete when using a jQuery star rating plugin. The linked article explains the problem more in depth and the code snippet below should get you going. http://gist.github.com/515910
Aug 10th
4 tags
Drop Cap with PHP Regular Expression
This is a simple regular expression I wrote to convert the first letter of an article into a drop cap. It will surround the first letter with a span tag containing the class drop-cap. You can then apply any styling you like to the span with CSS. It will skip over any HTML encoded characters or tags at the beginning of the article as well so it always highlights the first letter of the content and...
Aug 9th
4 notes
8 tags
Updated: Back up Tumblr Blog and/or Disqus... →
A simple and somewhat dirty script for backing up Tumblr and/or Disqus via its API to an SQLite DB. It now handles backing up Disqus comments to SQLite as well.
Aug 8th
7 tags
Backing up Tumblr blogs with PHP and SQLite →
I have knocked together a very simple and somewhat dirty PHP CLI script to download copies of an entire Tumblr blog through their API. I have imaginatively called it Tumblr Backup PHP. I will be adding extra features as and when I can. The first new feature on the list will be ability backup the associated Disqus comments at the same time. This script was developed on Windows so you will need to...
Aug 8th
6 notes
July 2010
1 post
WatchWatch
Julian Assange: Why the world needs WikiLeaks at TEDGlobal 2010
Jul 20th
June 2010
4 posts
3 tags
Jun 28th
2 notes
Jun 11th
2 tags
Jun 10th
1 note
3 tags
WatchWatch
Nice footage. Particularly interesting, I find, are the tyres when the dragsters are leaving the line.
Jun 7th
May 2010
3 posts
May 26th
286 notes
2 tags
Pirelli Diablo Rosso Corsa →
Taking wank factor to a whole new level you can customise your new Diablo Rosso Corsa tyres with special stickers bought through the Pirelli website.
May 26th