By Matt Butcher
php
Tek-X Webcast: A Developer's Intro to Drupal
Submitted by matt on Fri, 2010-03-05 15:35On March 12, 2010, I will be online with the folks from Tek-X giving a webcast on A Developer's Intro to Drupal. If you're just getting your feet wet with Drupal and are still a little confused about hooks, modules, themes, nodes, or even why Drupal isn't (fully) Object-Oriented, then this session is for you.
Tek-X Drupal Webcast
Using BetterAWStats in Drupal
Submitted by matt on Tue, 2010-02-16 15:33
Our current environment uses AWStats to analyze our HTTP server log files and build reports. Because it has privileged access to our data, and because it is open source, we can glean more information out of it than we could from proprietary hosted analytics platforms.
It turns out that there is a PHP front-end to AWStats (called BetterAWStats) that comes complete with a Drupal module. Here, I explain how we've installed and configured this module to get our AWStats data imported into our Atrium server.
A QueryPath script for checking on a sitemap
Submitted by matt on Mon, 2010-02-15 17:23
Sitemap ScoresI've been tuning our sitemap during the last few months, and one thing I needed was a quick tool to check on the effectiveness of various sitemap generation strategies.
To do this, I wrote a quick QueryPath script (see a full-sized image of the output). The script is explained below.
The code is pretty straightforward. It simply retrieves a URL, parses the sitemap contents, and then sorts them. Finally, it displays the top 100 entries. I've tested it on sitemaps with over 20,000 items. While it is a little slow on such a large document, it works fine.
#!/usr/bin/env php <?php require 'QueryPath/QueryPath.php'; define('MAX_ITEMS', 100); $sitemap = 'http://example.com/sitemap.xml'; $urls = array(); print "Parsing sitemap...\n"; $qp = qp($sitemap, ':root>url>loc'); $size = $qp->size(); $max = $size > MAX_ITEMS ? MAX_ITEMS : $size; printf("Found %d entries; printing top %d\n\n", $size, $max); try { foreach ($qp as $url) { $loc = $url->text(); $score = $url->nextAll('priority')->text(); $urls[$loc] = $score; } } catch (Exception $e) { print $e->getMessage(); } arsort($urls); $filter = "%d: %0.5f %s\n"; foreach ($urls as $uri => $score) { if ($i++ == $max) break; printf($filter, $i, $score, $uri); }; ?>
Basically, the script above simply fetches all of the URLs out of the sitemap, and then sorts them by their corresponding score. Only the top MAX_ITEMS (100) are shown.
LibRIS: A PHP library for RIS parsing and writing
Submitted by matt on Sat, 2010-02-06 15:22LibRIS is a library for parsing and writing RIS data.
Learn all about it at the official GitHub repository.
RIS is a data file format for handling reference metadata for scholarly resources. It is used by Reference Manager, EndNote, and other such tools. For that reason, it is broadly supported by online scholar-centered sites.
This library provides a simple interface for parsing and writing RIS data for bibliography management.
OS X: Installing MongoDB and the PHP Mongo Driver
Submitted by matt on Sat, 2010-01-30 12:09MongoDB is a full-featured object database. Since it is fast, versatile, and schema-less, you can develop a very complex data storage layer without an ORM, and without any tedious coding. For this reason, I have been investigating MongoDB as a storage layer for PHP. Here's how to set up an environment on OS X Snow Leopard.
In this blog we'll do the following:
- Install MongoDB
- Add some initial data to MongoDB
- Install the PHP PECL driver for MongoDB
- Write a short PHP Script that uses MongoDB
- Shut down the MongoDB server
OpenAmplify Drupal Series: Part 2 - Building a Mini Portal
Submitted by matt on Wed, 2010-01-27 22:30The Second in my three-part series on Drupal an OpenAmplify has been published on their community site. If you missed the first part, you may want to start there. Part three, coming soon, will cover the API, and will focus on development instead of configuration.
Part 2
In part two, I walk through the process of building a "mini portal" by taking semantic information returned from an OpenAmplify analysis of a node, and using that information in conjunction with other web services. For this demonstration, I released a new version of the module, and added support for Shopping.Com and Bloglines, both of which can return some impressively rich content.
QueryPath on WebMonkey
Submitted by matt on Tue, 2010-01-19 10:03It just came to my attention that a WebMonkey article (Parsing HTML? There's an App for That) from a few months ago suggested using QueryPath as an alternative to attempting to parse HTML by hand.
Appropriately, last week I wrote a QueryPath script to analyze a site and extract all links so that I could feed them to Siege and simulate something like a real load against a server. It's nice to be able to easily extract data from HTML.
Acquia Webinar: "Playing Nicely with Others"
Submitted by matt on Wed, 2010-01-06 10:57In our webinar Playing Nicely With Others: Integrating Drupal with Third-Party Data, Ken, George, Larry, and I talk about integrating various web services with Drupal. We talk about SOAP, content importing, digital asset management systems, and QueryPath (surprisingly, I'm not the one plugging QueryPath in this vid).
Thanks to Acquia for doing a fantastic job putting together their webinar series.
Fortissimo and Pilaster: Two projects
Submitted by matt on Mon, 2010-01-04 22:40I have released two projects today:
- Fortissimo: A PHP framework with a twist. It's scalable, it's not MVC, it's fast, and it's NSFW!
- Pilaster: A pure PHP document database that provides similar services to MongoDB or CouchDB -- only without the server.
Both are still under heavy development, but they are now at the point where others can start testing them and playing with them.
Phing: Fixing Output on OS X
Submitted by matt on Sat, 2009-12-26 18:18Using Phing on a Mac OS X console sometimes has a strange result: While the Phing script runs correctly, the console displays nothing. The reason for this is that the ANSI color codes used by some versions of Phing are not supported by OS X.
The solution is simple. Change the output logger.
$ phing -logger phing.listener.DefaultLogger ftest
This will use a non-colorized logger.









Recent comments
2 days 14 hours ago
4 days 27 min ago
4 days 59 min ago
4 days 1 hour ago
4 days 13 hours ago
4 days 13 hours ago
2 weeks 1 hour ago
2 weeks 21 hours ago
2 weeks 1 day ago
2 weeks 2 days ago