September 2010

20 Sep

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. NirvanaHQ

I'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. Homebrew

These 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. Ttytter

The 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 Pro

I'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 Chrome

I 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.

18 Sep

New Book: Drupal 7 Module Development (released in RAW)

in drupal, learning drupal 7 module development

Learning Drupal 7 DevelopmentLearning 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.

Learning Drupal 7 Development

Learning Drupal 7 Development

Learning Drupal 7 Development

Learning Drupal 7 Development
15 Sep

PHP Phar command line errors on OS X: Running 'php some.phar' generates '?????'

in os x, phar, php, php 5.3, programming, pyrus, snow leopard

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.

09 Sep

Varnish: Reloading VCL configuration files with varnishadm

in varnish

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 Connections

In 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 File

Now we can reload the file using varnishadm.

At the console, we connect to our varnishd instance with varnishadm:

$ varnishadm -T localhost:81

From the Varnish admin console, we issue a pair of commands:

vcl.load reload01 /usr/local/etc/varnish/default.vcl
vcl.use reload01

The 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.

07 Sep

Configuring MacGDBp for Debugging a Local Debian Virtual Machine

in Debian, drupal, mac, macgdbp, os x, virtualbox, xdebug

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.

03 Sep

jQuery Checkboxes: Checking and unchecking the right way

in html, javascript, jquery

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 checkbox