wombert: xkcd: Convincing
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 need to add a logging call to each and every method in the code base.Read On →
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.Read On →
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.Read On →
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 On →
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 channel-update 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 –force option because my version of PEAR was so old that the installer thought my version of Tar_Archive might not have been up to muster.Read On →
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 call to the NetBeans binary.Read On →
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 On →
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.
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.
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 On →
Copyright © 2003 - 2017 Simon Holywell. All rights reserved.