June 2008

Weekly review: Week ending June 1, 2008

June 1, 2008 - Categories: weekly

Last week:

  • Gave two presentations in person: I.B.Millennials at the Regional Technical Exchange at Sheraton Parkway, and Top 10 [IBM] Web 2.0 Tools You Should Try at the TechConnect event at the IBM Toronto Lab.
  • Much progress on the Drupal project I’m working on. =) I’m getting the hang of theming it, too!
  • Progress on my book. It’s a lot easier when I think about blog posts instead of 2000-word chunks, and blog readers instead of book readers… =)
  • Applied for clearance from Japan (for permanent residency application)
  • Assembled paperwork for extension of work permit
  • Checked out a whole bunch of books from the library. Hooray!

Next week:

  • One virtual presentation: Taking It Offline/Online – how to combine your online and offline social networking
  • Do more work on the Drupal project – theming, multisite
  • Wicked Cool Emacs: filtering spam, scoring mail, setting up profiles
  • Send application for extension of work permit
  • Check with University of Toronto regarding reference letter

Drupal: Lather, rinse, repeat – Cleaner development with installation profiles and Makefiles

June 1, 2008 - Categories: drupal, geek

I’m beginning to really like Drupal, a PHP-based content management system. Working with Drupal feels almost like working with Emacs because of the number of hooks that people have designed into the system. =) So here’s a Drupal tip for fellow newbies.

When you’re developing a site in Drupal, it’s a good idea to make sure that you can reproduce your setup on a different system. One way to do that is to periodically do a fresh install of Drupal with your modifications, and see if everything still works.

For example, on my system, I have an installation profile that enables and sets up Drupal the way I want. I also have a script that deletes and recreates the database, then restores the default settings.php. To refresh my system, all I have to do is type “make clean”, then open my Drupal site in the browser. After I specify the installation profile for my project and the database connection details, Drupal sets everything else up. Because I use installation profiles and source code control (svn on this project), I can commit my changes, update the copy on the test server, and easily reproduce my system there. Using installation profiles saves me the time that I would’ve spent setting up and configuring all the modules (and in the right order!), and this practice can help you too.

Here’s how to get started:

  1. Make a copy of sites/all/default/settings.php before you configure your system, or get the settings.php from a clean (never-installed) Drupal directory. I like putting this copy in sites/all/default/settings_default.php.
  2. Create an installation profile for your system. The easiest way is to use the install_profile_wizard module to generate a base installation profile, then modify it as needed. Put this profile somewhere in your profiles directory.
  3. Create a Makefile, shell script, or batch command that drops the database you’re using, recreates the database (granting any permissions necessary), and copies sites/all/default/settings_default.php to /sites/all/default/settings.php

Then, when you’re developing code, you can just call your Makefile/script/batch command to start from a (relatively clean) database.

Lather, rinse, repeat.

Drupal: Adding lines to settings.php in an installation profile

June 2, 2008 - Categories: drupal, geek

Installation profiles can make it easier for you to test and reproduce your configuration. But what if you need to do more than what Install Profile Wizard detects? For example, parts of the Domain Access module ask you to add lines to your sites/default/settings.php. Fortunately, PHP allows you to set up your install profile to write to files during installation.

Here’s the code I added to the end of the profilename_profile_final() function:

    // Add the following to the end of settings.php
    $file = fopen("sites/default/settings.php", "a");
    if ($file) {
      fputs($file, "\$cookie_domain = '.transitions2.org';\n");
      fputs($file, "require_once './sites/all/modules/domain/domain_conf/settings_domain_conf.inc';\n");
      fputs($file, "require_once './sites/all/modules/domain/domain_prefix/settings_domain_prefix.inc';\n");
    } else {
      drupal_set_message("Can't add domain-related lines to sites/default/settings.php");

Hope it helps!

Drupal: Storing data in the user profile

June 2, 2008 - Categories: drupal

If you want to store data in the user profile, here’s an example of a quick and dirty way to do it:

global $user;
if ($user) {
  $array = array('fieldname' => 'value_to_save');
  user_save($user, $array);

Then access it with $user->fieldname. For more configurability, check out the Profile module.

Drupal makes me feel like Bruce Lee + Jackie Chan

June 2, 2008 - Categories: drupal, sketches

Fast. Powerful. And having a heck of a lot of fun.

Emacs Gnus: Filter Spam

June 7, 2008 - Categories: emacs, wickedcoolemacs

(draft for an upcoming book called Wicked Cool Emacs)

Ah, spam, the bane of our Internet lives. There is no completely
reliable way to automatically filter spam. Spam messages that slip
through the filters and perfectly legitimate messages that get
labelled spam are all part of the occupational hazards of using the

The fastest way to filter spam is to use an external spam-filtering
program such as Spamassassin or Bogofilter, so your spam can be
filtered in the background and you don’t have to spend time in Emacs
filtering it yourself. In an ideal world, this would be done on the
mail server so that you don’t even need to download unwanted
messages. If your inbox isn’t full of ads for medicine or stocks, your
mail server is probably doing a decent job of filtering the mail for

Server-based mail filtering

As spam filtering isn’t an exact science, you’ll want to find out how
you can check your spam folder for misclassified mail. If you download
your mail through POP, find out if there’s a webmail interface that
will allow you to check if any real mail has slipped into the junk
mail pile. If you’re on IMAP, your mail server might automatically
file spam messages in a different group. Here’s how to add the spam
group to your list of groups:

  1. Type M-x gnus to bring up the group buffer.
  2. Type ^ (gnus-group-enter-server-mode).
  3. Choose the nnimap: entry for your mail server and press RET (gnus-server-read-server).
  4. Find the spam or junk mail group if it exists.
  5. Type u (gnus-browse-unsubscribe-current-group) to toggle the subscription. Subscribed groups will appear in your M-x gnus screen if they contain at least one unread message.

Another alternative is to have all the mail (spam and non-spam)
delivered to your inbox, and then let Gnus be in charge of filing it
into your spam and non-spam groups. If other people manage your mail
server, ask them if you can have your mail processed by the spam
filter but still delivered to your inbox. If you’re administering your
own mail server, set up a spam filtering system such as SpamAssassin
or BogoFilter, then read the documentation of your spam filtering
system to find out how to process the mail.

Spam filtering systems typically add a header such as “X-Spam-Status”
or “X-Bogosity” to messages in order to indicate which messages are
spam or even how spammy they are. To check if your mail server tags
your messages as spam, open one of your messages in Gnus and type C-u
g (gnus-summary-show-article) to view the complete headers and
message. If you find a spam-related header such as X-Spam-Status, you
can use it to split your mail. Add the following to your ~/.gnus:

 (setq spam-use-regex-headers t) ;; (1)
 (setq spam-regex-headers-spam "^X-Spam-Status: Yes")   ;; (2)
 (require 'spam) ;; (3)
 (spam-initialize) ;; (4)

This configures spam.el to detect spam based on message
headers(1). Set spam-regex-headers-spam to a regular expression
matching the header your mail server uses to indicate spam.(2) This
configuration should be done before the spam.el library is loaded(3)
and initialized(4), because spam.el uses the spam-use-* variables to
determine which parts of the spam library to load.

In order to take advantage of this, you’ll also need to add a rule
that splits spam messages into a different group. If you haven’t set
up mail splitting yet, read qthe instructions on setting up fancy mail
splitting in “Project XXX: Organize mail into groups”. Add (:
spam-split) to either nnmail-split-fancy or nnimap-split-fancy,
depending on your configuration. For example, your ~/.gnus may look
like this:

(setq nnmail-split-fancy
;; ... other split rules go here ...
(: spam-split)
;; ... other split rules go here ...
"mail.misc")) ; default mailbox

(draft for an upcoming book called Wicked Cool Emacs, more to come!)

A geek’s guide to Toronto

June 8, 2008 - Categories: friends, geek, life

Geek guide to Toronto

Gino Ledesma (one of my friends from university) is in Toronto for some training, so I spent the afternoon showing him some of my favorite geek places. =) He was blown away by the size of the Toronto Reference Library (and I showed him Robarts Library, too – no stacks access, though =( ). We enjoyed walking through the Royal Ontario Museum (particularly the Philippine section with, err, basket-like cellphone holders). Guidebooks wouldn’t have told him about Active Surplus or the Linux Caffe. =) And I might go with him to the science centre next weekend. (I love the place!) Ah, geeks hanging out…

Zemanta Pixie

Weekly review

June 8, 2008 - Categories: weekly

It seems that all I did at work this week was struggle with CSS and HTML. (Darn you, IE6!) And there’s more of that next week, too. Ah, front-end development work. I’m learning way more than I want to know about the inconsistencies of the box model, floating behavior, and other quirky things that plague web designers. There’s a reason I stick to back-end code…

The rest of life has been quite interesting. Between my recently-rejoined krav maga classes and the Manila-hot humidity that’s been hitting Toronto recently, I’ve been… hmm… glowing, right, that’s the term. Whatever happened to “temperate” weather? Oh, well, at least it’s sunny. And when it isn’t sunny, nature takes care of watering the garden for me.

My cantaloupe seeds have finally germinated. I had started another batch indoors after birds and resident wildlife snacked on the seeds I optimistically sowed outside. (“But it said late May to early June!” “Also requires at least five nights of more than 23’C.” “Oh.”) Two of those seeds grew roots, so I carefully planted them outside. I’m not sure if they’ll manage to grow before winter sets in, but it’s fun even as a science experiment. The rosemary sprigs are growing quite well, too, and I hope a few of them will take the hint and start branching out. I’ve sown some lettuce and basil seeds as well, although I suspect that rabbits will get to the lettuce long before we will.

Slight progress on my book – half an article written. I hadn’t really explored Emacs’ spam-filtering features before, so this is new ground for me.

Next week: two presentations and more development work. Oh, and more yoga and krav! We’ll see if I survive.

Learning Japanese? Here are some useful resources

June 9, 2008 - Categories: japan, japanese, learning

One of my friends is planning to learn Japanese, so I thought I’d put together some tips for him and for other people.

If you’re planning to learn Japanese, I have some Japanese-related bookmarks on del.icio.us that you might find useful. =) You might also want to check out what other people have bookmarked for japanese+language.

I particularly recommend this quick and dirty guide to Japanese, Jim Breen’s WWWJDIC and the example sentence search. You can download the examples file from the FTP server for totally awesome local lookup. I wrote some code in Emacs to make this easier (and to insert random taglines into my blog posts =) ).

Good luck and have fun!

IBM Pass It Along – social learning!

June 10, 2008 - Categories: enterprise2.0, ibm, web2.0

I’m happy to share that one of my favorite Enterprise 2.0 tools within IBM is now available on the Internet. IBM Pass It Along is now available on Alphaworks, a public IBM site for people interested in trying out emerging technologies–all you need is a free ibm.com account. IBM Pass It Along is about sharing what you know and learning from other people. If you have a how-to you’d like to share, create a topic for it. If you’re curious about something, request it. If you’re just curious about the crazy tools we use within the enterprise, check it out! =)

Here’s what I love about Pass It Along, and I think you’ll love it too:

  • You can find out who’s learning a topic and see what else they’re interested in. Sharing what I know becomes a lot more fun when I can see who’s learning, because it gives me feedback that what I’m sharing is useful. Lists of people are much better than anonymous hit counts because I can view their profiles to see what else they’re interested in.
  • You can learn from other people’s contributions. People can add links, related presentations, discussion topics, and other updates. For example, the "How to Make the Most of Your Commute" topic I started within IBM drew lots of interesting suggestions.
  • You can create a place for discussions. I give a lot of presentations, and Pass It Along topics are a terrific place to hold follow-up discussions and reach out to more people. I post my presentation material using the Presentation Wizard and include the URL of the Pass It Along topic on my slides. It’s a great way for learners to connect with each other, too.

I also really like how a newbie like me can create value for other people by sharing what I’m learning. =) Whee! I’m copying some of my public content over, and you can find my topics on Pass It Along.

IBM Pass It Along on Alphaworks is a public site open to everyone. Access controls will follow soon, so you can limit topic access to just your organization if needed. IBM Pass It Along is even better inside your organization, where you can link it up with your employee directory or do all sorts of other cool stuff.

Check it out – it might be a great fit for your organization!

IBM Pass It Along

Notes on backporting modules from Drupal 6 to Drupal 5

June 10, 2008 - Categories: drupal

I needed a web statistics module for a Drupal-based project at work, and integrating an external web statistics module seemed to be the way to go in terms of performance and features. BAWstats integrates the popular AWstats web statistics analyzer into Drupal. The module was developed for Drupal 6, so I spent a few hours backporting it to Drupal 5. I don’t know if I can send a patch back (might have to do some paperwork), but anyway, here are some notes so that (a) I can remember how to do this in the future, and (b) it might save you some time.

Backporting from Drupal 6 to Drupal 5: Change the menu items

  • Move the menu path from the array key to the path attribute.
  • Rename

    page callback to callback and page arguments to callback arguments.

  • Remove the file and file path attributes. Move the included files to include_once lines for now, and look for instances of include that need to be changed to include_once. Read the included files to check for unintended execution.
  • Change tokenized menu items (%/%/%) to ones that dynamically build the menu path (arg(1) . ‘/’ . arg(2) . ‘/’ . arg(3)). Don’t forget – this shouldn’t be cached.
  • Change 'access arguments' => array( to 'access' => user_access( or something similar.

Those were most of the changes I needed to make in order to backport bawstats to Drupal 5. Seems to work so far… =) More notes when I run into other things!

Drupal meetup in Toronto later – 7:00 at the Drake

June 10, 2008 - Categories: drupal

Instead of self-defense and yoga classes today, I’m going to the Lullabot meetup for Drupal developers over at the Drake (1150 Queen St W, 7:00 PM – 10:00 PM).

Should be fun. =)

Setting up your Drupal development environment

June 11, 2008 - Categories: drupal, geek

People found the 7-minute impromptu braindump I gave at last night’s Drupal Toronto meetup useful enough to vote it the best talk, so I thought I’d write it up. =)


  • Use source code control. No, seriously. Use it. Religiously. It’s going to save you someday. CVS is popular. Subversion is also easy to set up. It’s a must when you’re working with other people, but even if you’re on your own, it’s really handy to be able to go back to previous versions or to check your changes.
  • Get to know your integrated development environment (IDE). For example, I use Eclipse + PHP Development Toolkit (PDT) + Xdebug, and the keyboard shortcuts save me so much time and make it easier for me to think about my code instead of thinking about editing my code. F3 to jump to a function definition, Ctrl-Shift-R to open a file by typing part of the filename, Ctrl-space to complete text… I’ve also gotten XDebug integration to work, so I can step through code and examine variables without putting var_dump everywhere. Know your tools.
  • Add the XDebug extension to your PHP installation. Even if you don’t get XDebug integrated with Eclipse, you’ll like the new and improved var_dump and other debugging functions. I’ve heard good things about Zend Debugger, too.
  • Put your entire Drupal directory into your project in the IDE, not just your site-specific code. You can even check your entire Drupal directory into your source code control repository. This makes it easier to look up functions in Drupal core, not just your sites/all/modules directory. You _could_ version-control just your site-specific code (profiles/, sites/, etc.), but set-up becomes a little more complicated.
  • Use an installation profile to manage your configuration. Experiment with things using the administration interface, then create/update an installation profile that sets up a brand-new Drupal installation. This will save you lots of time and head-scratching when you need to reproduce your setup.
  • Make starting from scratch easier, and do it often. I have a Makefile that drops my database and recreates it, resets my settings.php, and even opens up a Firefox browser that uses my installation profile to set everything up from scratch. Drupal 5: Copy your settings.php to settings-default.php or something like that before you install your system, then copy settings-default.php over settings.php when you want to refresh your setup. Drupal 6: Delete settings.php when you want to refresh your setup.


  • Use multiple profiles. You can start completely independent Firefox processes by using profiles. For example, you could have your default profile with all the bells and whistles, and a test profile with just FireBug. You can log in as different users, too. Use this command to start a new Firefox process: firefox -ProfileManager -no-remote
  • Install and use FireBug. Best web development extension ever. I use this to examine the document object model, debug my CSS rules, experiment with my CSS and HTML on the fly, and monitor the network requests.
  • Set up quick searches for drupal.org and php.net. You can define quick searches by creating bookmarks that use keywords and %s placeholders in Location:. Example: Do a quick Google-search of Drupal.org by adding a bookmark with Location: http://google.com/search?q=inurl:drupal.org+%s and Keyword: gd (short for Google Drupal). To use your new quick search, type Ctrl-L or Alt-D to get to the address bar, then type gd keywords. Set up ways to search php.net and drupal.org/project, too. =)

Multi-site / virtual hosts

  • Simplify switching between your computer and your remote server. If you’ve set up your local system for virtual hosts and you have a remote server for testing, you’ll want to be able to switch between testing locally and testing remotely. Set up your local system to respond to all the domain names for the site (ex: example.com, foo.example.com, bar.example.com) and a local subdomain (ex: local.example.com). Set up your remote server to respond to all the domain names for the site (example.com, foo.example.com, bar.example.com) and a remote subdomain (ex: test.example.com). Then set up your /etc/hosts (c:\windows\system32\drivers\etc\hosts on Microsoft Windows) to look like this: localhost local.example.com
    remote.server.ip.address test.example.com example.com foo.example.com bar.example.com
    #remote.server.ip.address example.com foo.example.com bar.example.com

    local.example.com will always resolve to your computer, test.example.com will always resolve to the other computer, and everything else depends on which line is active. # comments out a line. When you want to switch to testing on the remote server, add # to the beginning of the line for example.com… and remove # from the line for your remote server. If you want to automate this even further, write a script that swaps different /etc/hosts files around.

Hope that helps! I’d love to find out what you’ve done to tweak your environment. Feel free to share your tips here!

Storytelling in presentations

June 12, 2008 - Categories: communication, presentation, speaking, story

Angelina Gan asked me if my storytelling approach is based on Peter Orton’s (wonderful!) presentation on using storytelling in business, so I thought I’d share how I started telling stories and what my favorite resources are.

I don’t know exactly why I started telling stories instead of listing bullet points. Maybe it was because of the never-ending march of bullet-ridden presentations. Maybe it was because I kept skimming through business books that were all numbers or pithy sayings without anecdotes to make those statements come alive. Maybe it was because I watched terrific presentations highlighted on the Presentation Zen blog. Maybe it was because of the books I read about telling success stories to deepen your relationships with people, influencing change through story-telling, and telling effective stories. Whatever it was, I started collecting stories and sharing my own.

I’d taken up writing flash fiction (really short stories, typically 55 words long) in 2005, and that turned out to be surprisingly useful. Reading other people’s flash fiction stories taught me that you could tell a story with conflict and character development in a paragraph or two, and that it was fun keeping an eye out for story material. I had originally gotten interested in flash fiction because it felt like a code optimization challenge, and because the stories were short enough for me to write during lunch or a subway ride, on pieces of paper or even on my cellphone. I never felt particularly literary (and in fact had gotten Ds in my English classes in university for lack of effort), but finding and telling stories (or in this case, making them up!) turned out to be a lot of fun.

So when I came across the business applications of storytelling–from social networking to influencing technology adoption–and I saw how it dovetailed with my passions, I jumped right into it. I started collecting stories. For example, I started my master’s research by collecting stories about how people used Dogear (an enterprise social bookmarking system by IBM) so that I could figure out how people were using it in their work and how they could use it even more effectively. I collected stories to help me not only convince people to try out new tools but also give them models to follow and people they could relate to. I also told stories about what I was doing and how I was doing it, and that helped me get to know a lot of people as well. Besides, I love “catching other people doing well”–telling other people’s success stories, especially when they don’t realize they’re doing well.

The results? People act on what I share. They make my stories their own. Not only that, people also tell me that they enjoy my presentations and that my enthusiasm is contagious. Giving presentations – telling stories, having conversations – has become a lot more fun.

How do I find stories? I keep an eye out for things that happen in real life, like this conversation I had with J-. There’s a seed of a story in there, and by telling part of the story, I make it easier to remember later on. I also enjoy reading people’s blogs, because they tell stories from their experiences as well. I read a lot – it certainly helps to have a public library within walking distance. Whenever I come across a particularly good story in any of these sources, I write it down, I bookmark it, I add it to my notes. When I work on presentations, I’ve got a general idea of relevant stories that I’ve come across, and then I use my notes to look up the details.

For example, I was preparing a presentation about University Relations and the Net generation. I didn’t want it to be a boring list of bullet points or advice. I could’ve rehashed the presentation I gave at the Technical Leadership Exchange, but I wanted to make the most of my opportunity to speak with a group that could really make the most of Web 2.0. I remembered that some months ago, I had come across a terrific internal blog post about how a demonstration of IBM’s internal social tools got an audience of university students really interested. I had bookmarked it as a story about Web 2.0 and recruiting, knowing that it would be useful someday. Well, that someday had come! I checked my bookmarks, went back to the blog post, refreshed my memory, and added it to my presentation. I’m sure that the story will make my point more effectively than a list of bullet points.

How can you get started with storytelling? Keep an eye out for story material. Develop a system for filing those stories so that you can find them again when you need them. Tell stories. I’ve linked to some of my favorite books in this post – check them out for more tips. Storytelling is effective and fun. Enjoy!

How to scale presentations up or down – the art of timing

June 12, 2008 - Categories: presentation, speaking

(More braindumping – not quite at the article level yet! =) )

When I plan presentations, I always start by coming up with the key message based on the objectives and the expected audience. The key message needs to be something I can explain in at most 30 seconds, and it needs to answer the audience’s question: “What’s in it for me?” The key message also needs to give people a way to act on that message. (Yes, even FYI presentations.) If I can’t explain what I want to say in 30 seconds, I mindmap and brainstorm and turn things over until I can.

There’s no point in working on the rest of the presentation until you know what you want people to take away. If you can’t say what you want to say in 30 seconds, think about the topic until you understand it well enough to say it in 30 seconds. When you figure out what your 30-second pitch is, you can use that as your abstract and you can use it in networking conversations at the conference/event/wherever. Very useful.

After I determine the key message, I pick three or so supporting points. This is also where I try to find a clever navigational structure or mnemonic to help me remember my points and to help the audience remember my points. Alliteration and acronyms are my favorite tools, but I occasionally come across a good metaphor, too. If I can’t find anything that fits, I try to at least get the rhythm of the words to sound right. (No, I haven’t given a presentation in iambic pentameter yet – but I’m tempted to! ;) ). A thesaurus helps me find synonyms that fit, and a dictionary (I usually use a kid’s dictionary) helps me spark the creative process with random associations and browsing. (Flip it open to a random page, pick a random word, and see if that’s useful.)

Resist the temptation to cram lots of points into your presentation. Find the minimum that you need to support your key message, then get those across clearly.

So there’s the 30-second pitch, the supporting points can be summarized over three minutes or so, and you can wrap it up and explain the next actions in another minute. When the presentation works as a 5-minute talk, it’s time to flesh it out to a 15-minute to 30-minute talk. You can do that by adding stories to the supporting points, keeping the key message in mind. Stories can take varying levels of detail, so they’re pretty flexible.

To take a talk from the 30-minute mark to the 60-minute mark, add more interaction and deeper stories. Good interaction tends to require a longer presentation slot because you need some time for people to shift into discussion mode (and you have to be comfortable with silences), and you don’t want to cut discussions off too early. If you’re doing interaction, don’t make question-and-answer the end of your presentation. Move question-and-answer into your presentation, then take advantage of the opportunity to summarize both your presentation and the discussion with a strong ending, emphasizing the next steps.

Longer timeslots such as 1.5 hours or 4 hours or even days need to be broken up with more interaction and variety. From my university classes (both attending and teaching), I learned that attention tends to flag after about 20 minutes. Mix things up and give people time to process the information. (And to stretch!) Resist the temptation to structure your presentation as one loooong presentation. Break your presentation up into more presentations, because it’s important for people to have review and closure.

In this approach, you’re building up from the core message. As long as you can make that point, you don’t have to worry about leaving material out. If you don’t overload your slides, you can quietly trim material in order to accommodate a particularly good discussion (or a long rant about something else) and people won’t feel cheated. =) If you find out that you have to talk for longer than expected (say, the next speaker is having technical difficulties), then add more detail or more stories or more interaction. If you find out that you have to talk for shorter than expected (say, the previous speaker had technical difficulties ;) ), focus on the key message and the supporting points.

Try it out for your next presentation. Start with your 30-second pitch, then build on it. When you get used to adjusting the timing on the fly, you’ll always be able to end on time.

Programmatically creating CCK nodes in PHP (interaction with the Path module)

June 12, 2008 - Categories: drupal

I’ve been experimenting with the Drupal Content Construction Kit, which promised to be a more flexible way to deal with custom node types in the Drupal content management system. However, I’m a finicky sort of person who likes being able to reproduce the setup from a fresh start, and CCK isn’t well-known for that. In fact, CCK nodes aren’t well-known for being easy to move from one server to another.

Following the instructions for programmatically creating, inserting, and updating CCK nodes will get you most of the way there. Here are some of the gotchas you’ll want to watch out for.

I was using Path to define aliases for my nodes and the path aliases were just not getting created. After lots and lots of tracing with XDebug, I found out that it was checking for user_access, but no user was active during the installation process. Solution: create the admin user and load it into a global $user variable.

I also spent a fair bit of time being very annoyed with CCK and creating nodes programmatically in my install profile. Turns out that you first need to use install_add_content_type to create the base node type, _then_ follow the instructions to drupal_execute the form that adds custom fields.

Here’s a quick sketch of the code:

function profilename_profile_final() {
  // lots of other code here
  install_add_user('admin', 'admin', '[email protected]', array(), 1);
  global $user;
  $user = user_load(array('uid' => 1));
    // take this from Install Profile Wizard
  node_get_types('types', NULL, TRUE);  // flush cache
  $content = array();
  $content['type'] = array(
   // take this from content copy export
  $content['fields'] = array(
   // take this from content copy export
function _install_create_content($content) {
  global $_install_macro;
  $type_name = $content['type']['type'];
  $_install_macro[$type_name] = $content;
  include_once drupal_get_path('module', 'node') .'/content_types.inc';
  include_once drupal_get_path('module', 'content') .'/content_admin.inc';
  $macro = 'global $_install_macro; $content = $_install_macro['. $type_name .'];';
  drupal_execute('content_copy_import_form', array('type_name' => $type_name, 'macro' => $macro));

Now I feel more confident about CCK…

Exploring the senses at the Ontario Science Centre

June 15, 2008 - Categories: life

A friend from university was in Toronto for the week, so that was a good excuse to go to the Ontario Science Centre. The current special exhibition is about Mars exploration and worth a visit, but the highlight of my trip was a challenge posed in the Weston Family Innovation Centre.

The science centre assistant explained that we were going to be blindfolded, and we had to find our way from a random point in the room back to the stairs where we began. Before the blindfolds were put on, we had five minutes to familiarize ourselves with the layout of the room and the different sounds and textures. (No smells to work with, and I certainly wasn’t going to taste anything!)

J- and I went first. We were blindfolded and taken somewhere, led around a few times, and sent on our way. Gino accompanied me and W- accompanied J- – not to help, but just to make sure that we didn’t bonk our heads on something. When it came to finding our way back, we had to work by ourselves.

I heard the faint tones of a piano keyboard to front-left, and I knew that was the oil-bubble exhibit. (I’d played with it a number of times.) I also knew that the exhibit was close to the center of the room, so walking away from it would get me to some kind of wall. On the way to the wall, I felt the tall plastic poles of the craft center in which I’d once spent an hour or two creating random things using felt and fuzzy pipe cleaners. I knew where I was. Finding the wall was then easy, and I knew which way to go. After that, it was just a matter of tracing the wall (which took me into a little-used maintenance area, apparently) and getting back to the stairs.

As I stepped on the red floor that marked the goal area, the science centre assistant noted my time and said he was blown away. It turned out that the science centre had been running the challenge for five months, and at 4 minutes and 29 seconds, I was just a few seconds behind the first-place record established by a guy who was actually blind and who had done the challenge twice. I laughed and told him that my background in computer science meant that I’d written my share of maze-solving problems. Also, I’d been into assistive technologies in my senior year, so navigating blind didn’t scare me–I knew totally awesome people who could do it. =)

I didn’t mind navigating without sight, building the map in my head. In fact, I enjoyed listening to the different sounds and figuring out where they were, guessing my location and confirming or adjusting my mental model with each thing I ran across. The experience reminded me of the Tactile Dome in San Francisco’s Exploratorium (another wonderful science center!), where I had a lot of fun figuring out what objects were embedded into the walls.

If I were to do it again (which is unlikely as this was the last day of the challenge), I would use just one long cardboard tube instead of trying to navigate with two, as I liked having a free hand to feel the textures and make sure I was on the right track. I would sweep the tube in front of me like the way that blind people use their cane to quickly check their path, and I would walk faster because I could trust it to tell me where the wall was.

That’s what it felt like, and I encourage you to give it a try if you encounter this challenge yourself. =) (Maybe your local science centre might find it interesting!)

Weekly review

June 15, 2008 - Categories: weekly

This week at work was mostly characterized by Drupal. I finally figured out how to use CCK and Views in Drupal 5, and I’ve even figured out how to programmatically create them (after much wailing and gnashing of teeth because of interactions with Domain Access and Path!). I’m looking forward to using this knowledge for awesome.

I also attended a local Drupal meetup. I ended up giving a 7-minute impromptu braindump on how to set up a great coding environment for Drupal. This won Best Talk and an extra-large T-shirt with the label "node monkey" (a clever reference to "code monkey" and Drupal’s node-based architecture). I haven’t figured out exactly what to do with that extra-large shirt yet, but it will involve T-shirt surgery so that I can wear it to the Drupal meetups without drowning in it. I may even have a series of hacks, if I plan it carefully. =)

I enjoyed giving presentations about social networking and Millennials during a virtual IBM conference and during a meeting of the IBM University Relations group. Next week, I’m going to give a talk on networking for new hires for the GBS Foundations new hire group.

Krav maga and yoga continue to be fun. I didn’t go last Tuesday because of the Drupal event, but I made up for that by skinning a knuckle during our Thursday session on combinations. Yesterday, we practiced quick offenses–slaps and headbutts from a neutral position. I have no illusions about my abilities–I’m definitely not going to pick a fight!–but it was fun exploring these things with such helpful and encouraging people in the class.

I had a lot of fun at the Ontario Science Centre this weekend, too.=)

Tonight, I hope to write most of an article that I’ve promised a colleague. Next week, I plan to wrap up most of the work for my Drupal-related project and resume working on an internationalization-related project. I’d also like to do more writing, which means resisting the siren call of Lego Indiana Jones… (But it’s so pretty on the PSP!)

Networking for new hires

June 19, 2008 - Categories: connecting, passion, presentation, talk

I gave a presentation on social networking for new hires to the GBS Application Services Foundations new hire network.12 people attended, and a few more dialed in, including one person from Poughkeepsie. (Yay international companies!) We had a lot of fun during the roundtable introductions. After things settled down, I gave my presentation.

The key thing I learned while preparing the presentation is that people can get by without paying special attention to social networking, but some effort can help people really transform their lives into extraordinary ones. I talked about the intersection of passion, knowledge and skills, and opportunities. If you learn more about what you’re passionate about, you’ll find or create or attract opportunities to learn more about and practice those passions or to use your knowledge and skills. The more you learn, the more you’ll be able to appreciate your passions, and the more opportunities will be open to you. It’s a beautiful cycle that makes things get better and better.

I also gave a number of quick tips on how to be more effective at social networking using events, conversations, notebooks, business cards, personal sites, blogs, articles, presentations, and other tools and opportunities. All these things can help you learn, reach out, and share what you’re learning.

The key thing I learned while giving this presentation was that although people could quickly identify passions outside work, job-related passions didn’t come to mind. I believe that it’s possible to love your work. My dad taught me this. I know that even if there are difficult days and boring days and lost days, if there’s that underlying passion, all those days will be worthwhile.

I’m glad to say that my work allows me to exercise some of my passions. So, what am I passionate about?

I’m passionate about helping people connect. I believe that interesting things happen when we bring different kinds of people together, and that’s why I love how blogging and other forms of social media allow people to bump into people outside their teams. I not only get to help people connect and collaborate, I even get to help companies figure out how to help their people do so.

I’m passionate about helping new hires connect with the rest of the organization and vice versa. I believe that a good social network can not only help new hires learn what they need to learn but also get opportunities to discover and make the most of their passions. I want to help new hire networks challenge and catalyze people’s growth in addition to providing basic social support. I want to help new hires get connected and share what they learn. Because I’ve been helping people connect using these new tools, new hire networks approach me to find out how I can help them. =)

I’m passionate about helping people share what they’re learning. I believe that teaching as you learn helps you learn more effectively. I want to help people share the tidbits that they’re learning and passing those tidbits along to others who are learning too. I not only get to lead by example, I also get to coach others.

I’m passionate about spreading enthusiasm, energy, and passion. I believe that people can be happy at work and in life. I want to learn from people who are happy and successful, I want to be an example to others, and I want to help others along the way. I not only get to share my passions with my coworkers and with other people outside the organization, I also get to encourage others when they need that extra burst of energy.

I’m passionate about communication skills, presentations, public speaking, and storytelling. I believe that presentations should be more than just bullet points and that communication should be more than just talking at people. I want to share what people are learning, inspire people to action, and help them inspire other people in turn. I not only get to learn more about communication skills and practice them by frequently giving presentations, I also get to share what I’m learning and influence the way other people communicate.

What are you passionate about? What knowledge or skills do you want to develop, and what opportunities would help you be even more effective?


June 19, 2008 - Categories: Uncategorized

Check out this strip from PHDComics on the joys of visa paperwork. Been there, done that… <laugh&gt

Weekly review: Week ending June 22, 2008

June 22, 2008 - Categories: weekly

More Drupal work! This week, I wrapped up the first phase of my project at work. I’m starting to feel comfortable with Drupal–particularly the thorny combination of CCK, Views, Domain Access, and PHP code. I’ve deployed the code to the quality assurance server, documented my installation procedure in a script, and even set up a convenient administration interface to help the testers put the system through its paces. I’m starting to feel like a proper software developer. Oh my!

I gave a presentation on social networking for new hires on Thursday, and I learned a lot while preparing and presenting that presentation. I don’t have any presentations scheduled until mid-July, when I have three presentations scheduled in one week (two replays and one new presentation on technology evangelism). Time to start preparing for them…

In self-defense and krav maga class, we practiced groundwork, side kicks, back kicks, and getting out of side head-locks. I’ve got a long way to go before I can kick as well as the others do, but the guys make it fun. We often warm up with a shoulder-tapping game, which I like. I sometimes forget to breathe, though, and that makes me tire faster! <laugh> Gotta work on that.

It’s been quite an indulgent week on the personal front. On Friday, W- and I made up for long workweek days by taking off early and wandering around downtown. He introduced me to Burrito Boyz, this hole-in-the-wall burrito place that seemed to be quite a favorite among students and clubbers. Yummy! And then on Saturday, W- and I went on a classic dinner-and-a-movie date: an absolutely scrumptious elk steak dinner at the Corner House restaurant (the soft-shell crab starter is also not to be missed) and a movie (Iron Man, which got great reviews on RottenTomatoes). We even squeezed in a concert. Video Games Live happened to be playing near the movie theatre, so we listened to a number of segments before watching the movie.

I plan to spend the next week helping the quality assurance team test the system we’ve been working on, transferring some of my work to the new hires coming on board (I already know one of them! =) ), and preparing for the next few weeks. From mid-July to late August, my schedule’s going to be quite a whirl. Presentations, working remotely in Ottawa, then off to the Philippines for Diane’s wedding… Lots of stuff going on!

Web 2.0 @ Work: Creating a professional profile

June 22, 2008 - Categories: connecting, web2.0

Do you have a professional website, or do you just leave your professional profile up to random Internet search results or sparse corporate directory listings?

Although we have a terrific centralized corporate directory at IBM, I’ve found it very useful to also have a simple professional profile with a short biography, my contact information, and links to the other services I use on the intranet and on the Internet. Having one site that brings all of these things together makes it easier for me to help people get to know who I am, what I’m passionate about, and where they can find out more about me. I include this URL in my e-mail signature and in my presentations so that people can find me easily.

I use WordPress as a content management system so that I can quickly add links and pages without editing HTML. On my internal site, I use the Blueprint theme for WordPress. It’s clean and easy to read, and it fits with Big Blue’s color scheme. The front page explains who I am, what I do, and what my team does. It also links to places where people can check out my bookmarks, download my latest presentations, and so on.

To set up something like it:

  1. Download and install WordPress.
  2. Download and unpack the Blueprint theme to your wp-content/themes/ directory.
  3. Choose the Blueprint theme from the WordPress administration interface.
  4. Create a page called “About”. Fill it in with details about yourself.
  5. Set the About page as your site’s front page in the Settings – Reading menu.
  6. Create links to your profiles on other services and other related websites.

Trudge, trudge, trudge

June 22, 2008 - Categories: connecting, emacs, writing

Oh no, I’ve hit the slump.

I spent some time working on the Wicked Cool Emacs today. Spam filtering – not something I’d set up before. I’m writing it because I promised to write it, but I can’t shake off the feeling that this part would be better done by someone who’s passionate about Emacs and spam filtering. I have Google handle my spam filtering for me, so I haven’t needed to do anything more sophisticated. Still, not everyone’s going to have the same set-up, so it would be good to document that too.

I’m tempted to jump to a different chapter and start working on that, just to make working on the book fun again.

Holding my (quality assurance) horses

June 24, 2008 - Categories: geek

Okay, I really shouldn’t be making changes to a live system, even if we’re doing the quality assurance testing and there are lots of bugs I’m just itching to mark “closed”. =) It just becomes too much of a headache, trying to fix all the new bugs introduced by the fixes for the old ones… <laugh>

You’d think that I’d know this lesson by now. The last time I had a majorly stressful deployment was when I created a registration system for my university’s alternative class program. It was working all very well and good, and then–I don’t know, was it a feature request or a last-minute bug–I needed to modify it while everything was running in production. I remember getting into that heightened alertness that I used to feel during programming competitions, when I could feel the time pressure but I could also feel myself actively calming down and focusing on what I needed to do, muttering the mantra “don’t panic, don’t panic, don’t panic” as I tried to make small changes that wouldn’t break anything currently running.

Today, I’m not going to do that, and I hope to keep avoiding the stress. Today, if I spot any defects I want to close, I’ll work on it on my local system, commit the code, and wait until we close this phase before updating the server. =)

The apprentice’s road is long and full of lessons… =)

Quick weekly report, week ending June 29, 2008

June 30, 2008 - Categories: weekly

Next week, I’m going to write these weekly updates on Friday or something, so they don’t get squeezed into Sunday night. =)

This week:

  • Work: Welcomed new team member on board. Also, a CSS person joined our project team, hooray!
  • Work: More Drupal work, yay! Going through bugs reported in QA process.
  • Fight/fitness: headlocks, knees, 360′ defenses
  • Fun: Three movies (so spoiled!): Wall-E, You Don’t Mess with the Zohan (surprisingly funny), and Kung Fu Panda. Shopped for a few things to make life even better.

Next week:

  • Drupal, Drupal, more Drupal. =)
  • Promised to map Web 2.0 for business resources within the company. Time to break out the visualization tools.
  • Promised to put together a guide for speakers.
  • Promised to put together some resources for new hires.

Hooray, figured out Drupal 5 multi-step registration form with validation and invites

June 30, 2008 - Categories: drupal

The validation of multi-step forms in Drupal 5 was much less scary than I thought it would be, or maybe I lucked out by basing my code on something that already worked. =)

I had spent last Thursday and Friday searching the Internet for people’s blog posts about the topic. I came across exact descriptions of the problems I encountered, but no solutions–only notes about critical bugs in Drupal 5. Asking the developers in #drupal didn’t yield any tips, either. They told me to get ready for a world of pain.

Then I remembered that the password-reset module used a multi-step form, and validation actually worked. I had already incorporated part of the source code into one of my modules, and it was easy to extend that example. I defined a new multi-step form in my PHP code as a replacement for the system form in user/register. There were some complications around the fact that other modules modify the behavior of user_register, but I got the code to validate and submit the data. And it worked!

No code snippet, sorry. Too many interactions for me to explain neatly. Some hints:

  • You can use logic to set the value of $step.
  • Pass information to the next step using hidden fields.
  • Make sure the step field is included in your form template. Watch out for this if you’ve got a form template that specifies all the fields explicitly.
  • Captcha uses hook_form_alter to add a captcha based on the form_id. It doesn’t know about steps. You’ll need your own hook_form_alter to unset the captcha if you don’t need it on the other steps. Make sure your module runs after captcha by changing the weights in the system table.

So now I have a multi-step form that can skip step 1 (employee verification) if a valid invite code is provided, asks for CAPTCHA once, and does all the validation and user registration magic. Hooray!