July 28, 2008

Emacs, Remember, and GTD

July 28, 2008 - Categories: emacs

Charles Cave has written an excellent Remember Mode Tutorial with useful templates for notes, receipts, books read, daily reviews, and all sorts of other good stuff. Check it out!

Kaizen: What would make our Drupal lives better?

July 28, 2008 - Categories: drupal, kaizen

Kaizen: relentless improvement.

We’re getting ready for the next phase of our Drupal project, and it’s a good time to think about how we can make our process better.

What worked well:

Drupal: Patching simpletest for Drupal 5 to understand the Location header

July 28, 2008 - Categories: drupal

Automated testing is part of good programmer hygiene. I wanted to write tests for both functions and Web-based interfaces in our Drupal project, but one of the tests I wrote was always failing. Many prints and var_debugs later, I found out that it was because simpletest didn’t do anything with Location: headers, which happen when you drupal_goto an external site. Here’s a first pass at fixing that behavior – patch sites/all/modules/simpletest/simpletest/browser.php:

Index: browser.php
===================================================================
--- browser.php	(revision 753)
+++ browser.php	(working copy)
@@ -321,6 +321,22 @@

         $this->_history->recordEntry(
                 $this->_page->getUrl(),
                 $this->_page->getRequestData());
+        $counter = 0;
+        $url = $this->_page->_headers->_location;
+        if ($url) {
+          $url = &new SimpleURL($url);
+        }
+        while ($url && $counter < 10) {
+          $this->_page = &$this->_fetch($url, $parameters);
+          $this->_history->recordEntry(
+            $this->_page->getUrl(),
+            $this->_page->getRequestData());
+          $url = $this->_page->_headers->_location;
+          if ($url) {
+            $url = &new SimpleURL($url);
+          }
+          $counter++;
+        }
         return $this->_page->getRaw();
     }

(update: okay, let’s try diff syntax highlighting with wp-syntax…)