Feed aggregator
My Five Favorite New Productivity Tools: Nirvana, Homebrew, Ttytter, Sequel Pro, and Chrome
I spend most of my days doing software development and system administration. And I am always busy, so streamlining any part of my workday can have a big impact on how much I get done and how good I feel about my productivity. Taking a look back over the last six months, I see that I have added a handful of new tools that have had a positive impact on my daily work.
1. NirvanaHQI've never been all that successful managing a todo list. But Nirvana has changed that. Nirvana does one thing very well: It helps manage todo lists. The user interface is great. It keeps everything front and center. It's easy to create new tasks and projects. It's easy to see what needs to get done today. And it's easy to organize all of your tasks into meaningful groups. The mobile web app runs remarkably well on my iPhone.
2. HomebrewThese days my routine work is done on a Mac. While there are many things to love about it, one thing I have long missed is the ease of installing new Open Source packages. Mac Ports was never my thing. But Homebrew is. It functions like a blend of Debian's apt-get and the BSD ports system. And it is not only easy to use, but easy to add new packages.
Now I'm running wget on my Mac.
3. TtytterThe first homebew package I created was for ttytter. Ttytter is a command-line twitter application. I love it's low key CLI interface, the ease of use, and the fact that it supports pretty much all of the twitter goodies that I want. Oh, and it can use Growl for notifications. Yes, I miss some of the pretty profile images. But otherwise, it's a Twitter dream come true.
4. Sequel ProI'm not a huge fan of GUI database management apps, but I have to admit that I am really enjoying Sequel Pro, an Open Source OS X tool for working with MySQL. With SSH tunneling (which it supports out of the box), I can use it to connect to everything from my local virtual machine to production servers.
5. Google ChromeI sorta hate to add "just another browser" to the list, but Chrome's crash proof tabs make it a big deal for me when I use large web apps (and work on unstable code). Plus, it's fast and seems to take less of a toll on my workstation that Safari.
New Book: Drupal 7 Module Development (released in RAW)
Learning Drupal 7 DevelopmentThe Learning Drupal 7 Module Development book is now in Packt's RAW (Read As we Write) program. This has been an exciting few months, as Larry (Crell) Garfield, Ken Rickard, Greg Dunlap, John Albin Wilkins, Sam Boyer, Matt Farina and I have all worked together to bring this book to fruition. As you no doubt know, Drupal 7 is still in the polishing stages. So is our book. But Packt has once again decided to release the book in RAW format, which means you can basically read the book as we write it -- and before we've added that final layer of glossiness ourselves.
The book is far more than an update of my solo effort, Learning Drupal 6 Module Development. Instead, it's an entire rewrite, with each of the members of this phenomenal team contributing chapters that best suit their own expertise. For that reason, I don't think I've ever been more excited about a book release.
While we have very conscientiously written this book to be approachable for the new Drupal developer, we have also made a concerted effort to cover the changes between Drupal 6 and Drupal 7. The experienced developer just looking to get up to speed should find this book a quick and valuable read.
Some of the things we cover:
- Theming for developers
- The block system
- The new Entities API
- Building admin interfaces
- The new Files API
- Nodes and permissions
- JavaScript
- Creating installation profiles
And as usual, the book is full of practical projects that will really get you started.
PHP Phar command line errors on OS X: Running 'php some.phar' generates '?????'
When I tried to run pyrus.phar on Mac OSX recently, I had a strange experience. Executing php pyrus.phar generated the output ??? and then exited. With a little more testing, I discovered that all of my Phar packages, when from from the command line, generate "garbage" output (a series of question marks, usually) and then exit.
Quite a bit of digging later, I discovered an old bug report (recently re-opened) that documents the problem and suggests a solution. In a nutshell, the problem is that the Zend engine Unicode checker is enabled by default in at least some versions of PHP 5.3. My Apple-built PHP package (included in the Snow Leopard releases) has this problem, and I suspect that other builds do too.
While there is no solution yet, the workaround is as simple as setting the following ini directive:
detect_unicode = Off
While I'm not a huge fan of this workaround, it definitely works. I simply added it to my /etc/php.ini file, and now I can run pyrus and other Phar files.
Varnish: Reloading VCL configuration files with varnishadm
Did you know that you can reload varnish VCL configuration files without restarting varnish? While I could find any clear mention of this in the manual, it turns out to be a simple two-step task accomplished using varnishadm.
Prerequisites: Having Varnish Listen for Admin ConnectionsIn order to reload using varnishadm, we need to have the varnishd instance listening for incoming admin connections. Here's an example showing how to start varnishd with an admin listener on localhost:81
Note the -T localhost:81 option. That's what tells Varnish what address and port to listen on.
Reloading a VCL FileNow we can reload the file using varnishadm.
At the console, we connect to our varnishd instance with varnishadm:
$ varnishadm -T localhost:81From the Varnish admin console, we issue a pair of commands:
vcl.load reload01 /usr/local/etc/varnish/default.vcl vcl.use reload01The first line tells varnishd to load and compile the VCL file (/usr/local/etc/varnish/default.vcl), and assign it the name reload01. If we wanted to see a list of all of the named configurations that varnishd currently has, we could use vcl.list.
If the new file loads and compiles okay, we will get a message on the console telling us that that is the case. Now that the file is loaded, we just need to tell Varnish to use that new file. That's what vcl.use is for. It takes as an argument the name of the configuration. In our case, this is reload01.
That's it. Within moments, varnishd should be using the new configuration.
Configuring MacGDBp for Debugging a Local Debian Virtual Machine
In my current Drupal development environment, I run an entire Debian server stack (LAMP + Memcache + Varnish, etc) inside of a VirtualBox virtual machine. On those frustration-laden occasions when I need to fire up the debugger, I use MacGDBp to connect to the virtual machine. Here's how I configure them. (If you just want to configure MacGDBp for debugging with MAMP or OS X's Apache, you may want to read an earlier article, and then check out the updates for Snow Leopard.
jQuery Checkboxes: Checking and unchecking the right way
When working with checkboxes in jQuery and JavaScript, sometimes all you really want to do is toggle the checked state of the checkbox. There are many examples of strange ways of accomplishing this, many of which are wrong or will only work on some browsers. Here is a correct (XHTML-correct) and compact way of doing this.
Check to see if a checkbox is checked // Returns a boolean, true if checked, false otherwise jQuery('#my-checkbox').is(':checked'); Check a checkboxThe Best Tool for Web Page Speed Evaluation
It seems that, for me, this is the year of website performance optimization. From working with nginx and a crazy memcached setup to recently deploying a handful of Varnish servers, I have been deeply entrenched in the world of website page speed optimizations.
Side-by-side
Building Homebrew Packages
ttytterRecently I have been using Homebrew to install Open Source tools on my Mac. I find it to be a little more to my taste than MacPorts. But when I wanted to install TTYtter, a small Twitter command-line client, I discovered that Homebrew doesn't yet have a package for TTYtter.
After a quick chat with JohnAlbin, I decided to try building my own Homebrew formula for TTYtter. John has also successfully built a homebrew package or two. He re-assured me that learning the system wasn't going to require a huge investment of my time.
Fifteen minutes later, I committed my new script to the project, and it is now being considered for inclusion in Homebrew's repository. And almost all of the heavy lifting is done by the homebrew toolchain and git.
How easy was it? Well... I simply followed the directions, and moments later had this recipe:
Data URLs and QueryPath: How to embed images into XML or HTML
QueryPath 2.1 is adding support for writing files directly into URLs using Data URLs. What this means is that you can encode and embed images or other documents straight into your HTML or XML.
Here's a simple example from the QueryPath 2.1 unit tests:
<?php $xml = '<?xml version="1.0"?><root><item/></root>'; qp($xml, 'item')->dataURL('secret', 'Hi!', 'text/plain'); ?>The above will generate an XML fragment that looks like this:
<?xml version="1.0"?> <root> <item secret="data:text/plain;base64,SGkh"/> </root>The important part there is the attribute secret="data:text/plain;base64,SGkh. This attribute includes an embedded text document with the contents Hi!. What we've done is encode the data and injected it as a document inside of the XML.
Sure, that's novel... but what would we want to use that for? How about adding images directly into a document?
Data URLs and QueryPath: How to embed images into XML or HTML
QueryPath 2.1 is adding support for writing files directly into URLs using Data URLs. What this means is that you can encode and embed images or other documents straight into your HTML or XML.
Here's a simple example from the QueryPath 2.1 unit tests:
<?php $xml = '<?xml version="1.0"?><root><item/></root>'; qp($xml, 'item')->dataURL('secret', 'Hi!', 'text/plain'); ?>The above will generate an XML fragment that looks like this:
<?xml version="1.0"?> <root> <item secret="data:text/plain;base64,SGkh"/> </root>The important part there is the attribute secret="data:text/plain;base64,SGkh. This attribute includes an embedded text document with the contents Hi!. What we've done is encode the data and injected it as a document inside of the XML.
Sure, that's novel... but what would we want to use that for? How about adding images directly into a document?
Reflections on Google Summer of Code
This was the second year that I have been involved as a mentor for Google's Summer of Code program. And in both cases, I've worked as a mentor for Drupal. Last year, I worked with sivaji on a project involving the Quiz module. This year, I worked with eabrand on QueryPath and the QueryPath module.
In both cases, the projects were highly successful. I'm thrilled to have had the opportunity to work with two very gifted up-and-coming developers.
I think one of the most critical questions to ask of any program like GSOC, is whether or not it produces the results (pedagogical and professional) that it is after. With both Sivaji and Emily, the answer is a resounding yes.
- Since finishing his GSOC project, Sivaji has begun his professional life as a web developer focused on Drupal. Recently, he and his colleagues started E-ndicus, a Drupal-focused software development company in his home town of Chennai.
- Emily is now a software engineer at HP. She continues to contribute to QueryPath, and was just this week featured on Google's blog. Last week, she joined me on the Drupal Dojo QueryPath session, too.
I doubt either of these individuals learned much from me during our GSOC projects. More than anything, it just takes hard work, persistence, and attention to detail to finish a GSOC project. But I've certainly learned a lot from them. And both Quiz and QueryPath have benefited enormously from the work of these two.
Reflections on Google Summer of Code
This was the second year that I have been involved as a mentor for Google's Summer of Code program. And in both cases, I've worked as a mentor for Drupal. Last year, I worked with sivaji on a project involving the Quiz module. This year, I worked with eabrand on QueryPath and the QueryPath module.
In both cases, the projects were highly successful. I'm thrilled to have had the opportunity to work with two very gifted up-and-coming developers.
I think one of the most critical questions to ask of any program like GSOC, is whether or not it produces the results (pedagogical and professional) that it is after. With both Sivaji and Emily, the answer is a resounding yes.
- Since finishing his GSOC project, Sivaji has begun his professional life as a web developer focused on Drupal. Recently, he and his colleagues started E-ndicus, a Drupal-focused software development company in his home town of Chennai.
- Emily is now a software engineer at HP. She continues to contribute to QueryPath, and was just this week featured on Google's blog. Last week, she joined me on the Drupal Dojo QueryPath session, too.
I doubt either of these individuals learned much from me during our GSOC projects. More than anything, it just takes hard work, persistence, and attention to detail to finish a GSOC project. But I've certainly learned a lot from them. And both Quiz and QueryPath have benefited enormously from the work of these two.
Slides for my Dojo presentation: "QueryPath: It's like PHP jQuery in Drupal!"
I posted the slides from yesterday's Drupal Dojo presentation. These should be much more readable than the video feed.
QueryPath: It's like PHP jQuery in Drupal! View more presentations from Matt Butcher.Drupal Dojo: "QueryPath: It's like PHP jQuery in Drupal!"
On August 17th at 12pm EDT (9AM PDT), I will be doing the Drupal Dojo session, "QueryPath: It's like PHP jQuery in Drupal!". To sign up, head over to the webinar signup.
I'm particularly excited about this for three reasons:
- Emily will be joining me to talk about her GSoC project.
- We will be discussing QueryPath 2.1 and the new Drupal 7 QueryPath module.
- The totally gorgeous new QueryPath logo (designed by Michael Mesker) will be unveiled.
This has been an exciting summer for QueryPath, and this webinar will preview many of the QueryPath technologies that are on the cusp of being released.
A PHP jQuery Library: QueryPath Overview
jQuery is a JavaScript library for efficiently working with HTML and CSS. Its chainable and compact API has made it a popular choice for web developers seeking to quickly build rich web applications. But did you know there is a PHP jQuery library? QueryPath is a PHP implementation of jQuery's interface. It provides all of the DOM manipulation functions, a full CSS selector engine, and as much of jQuery's other features as is practically implemented server-side. But that's not all. This powerful library delivers many server-side features designed to make working with XML services simple, robust, and reliable.

