Computing: page 1
Redis: under the hood (internals)
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 starts up and initializes itself, and how it handles the request/response cycle with a client, as a way of explaining it to myself, hopefully in a clear fashion. Read more ⇒
15 Excellent Resources for PHP Extension Development
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. Printed books: Sara Golemon’s Extending and Embedding PHP Advanced PHP Programming by George Schlossnagle Building Custom PHP Extensions by Blake Schwendiman Online articles and presentations: The Internals section of the PHP manual Kristina Chodorow’s PHP Extensions Made Eldrich on her blog in 2011: Installing PHP Hello, World! Read more ⇒
Per-tag RSS feeds for Tumblr from notes.husk.org
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. Read more ⇒
php_ssdeep Fuzzy Hashing PHP Extension
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 etc. All the technical details of fuzzy hashing are described in his 2006 journal article Identifying almost identical files using context triggered piecewise hashing. Read more ⇒
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 way quickly. Read more ⇒
Batch remove extensions in Ubuntu
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 *. Read more ⇒
Getting gearman to install on Ubuntu
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 karmic main My sources file was also located at /etc/apt/sources.list and not /etc/sources.list as stated in the original post from JSJoy. Read more ⇒
In this video, John Resig presents his 6 Secrets to becoming a j…
Firefox with Radio Inputs and it’s Annoying Autocomplete 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. if ($.browser.mozilla) { $("form").attr("autocomplete", "off"); } Read more ⇒
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 not any HTML formatting. Read more ⇒