Rob's blog
Making Tags

I wrote my first VB.net app yesterday. I haven't touched Visual Basic since version 6, but recently I've been looking at Microsoft .Net tools. Mostly I just want to get up to speed and see how things are going over there. At the moment, Visual Studio 2010 Beta 2 is available for download free of charge. I installed it, rebooted a couple times, and made a new project.

Email Subaddressing (or "plus addressing") with Exim

You know the trick with gmail where the user can also use the address billg+whatevertag@gmail.com? Exim can do that too. It's called an email address suffix or sometimes plussed addressing. The official Exim manual shows it's pretty simple to add to your configuration. Their example shows just adding two lines to turn it on for local users:

  local_part_suffix = +* : -*
  local_part_suffix_optional

Most sites hosted on a VPS don't actually want to deal with just the email addresses for local users (these are users that have a shell account on the system). It's more likely there's a configuration section using the redirect driver. This seems to be the relevant part of the configuration at PowerVPS in /etc/exim.conf:

How I got my first Python Wave Robot running

I can't go through all the steps in a lot of detail here but I can give a basic overview.

I already had a development environment set up for Google Appengine on my computer. This uses PyDev in Eclipse. I'm not much of a Python programmer but I've done a little bit for Appengine, mostly just following the Google tutorials. For my robot, I created a new Google Appengine project and I created a new project hosted on Google Code (using Subversion because I'm comfortable with it). You can see the code for Q&A bot in my qnabot project.

Short bookmarklets for your Drupal 6 site

The Prepopulate module is only 65 lines of code. It does something really handy. It takes variables from the URL and uses them to fill in form fields. There are a couple ways this can be useful, like giving a link to a form that has some default value. Making bookmarklets is the other big use for this module. There are a couple examples in the Drupal handbook on Prepopulate, like this one I submitted:

javascript:u=document.location.href;
t=document.title;
s=window.getSelection();
void(window.open(%22http://example.com/node/add/customenode?edit[title]=%22+escape(t)+'&edit[body_field][body]='+escape(s)+'&edit[field_external_link][0][url]='+escape(u),'_blank','width=1024,height=500,status=yes,resizable=yes,scrollbars=yes'));

So this is pretty cool. But there can be issues with long URLs. HTTP doesn't limit the length of URLs but browsers do. I don't mean the URL of the bookmarklet here. When the surfer clicks the bookmarklet, the browser will create and follow a URL like

http://example.com/node/add/customenode?edit[title]=title&edit[body_field][body]=body&edit[field_external_link][0][url]=currentsiteurl

The highlighted parts of that url are the parts that are filled in by the page the user is visiting when they click the bookmarklet. The rest of it is controlled by our site, so we can make it shorter. I'd like it to look more like:

http://example.com/r?t=title&s=body&u=currentsiteurl

Overriding the Edit User Form in Drupal 6

This isn't really complex, just something I had to do recently. Sometimes you want to tweak a form in Drupal, like rearrange the form elements for example or add a little text that wasn't there before.

In this case I'm using the Password Policy module to enforce strong passwords. When a user makes a bad password, Password Policy will reject it and dynamically display a message that indicates why the password is unacceptable. It's a pretty cool feature but I'd like users to know what the requirements are before typing in a password. So I want to take the description of the policy and show it to the user in the description by the edit boxes where they can change their password.

Thumbnails for Samba Shares in Nautilus

Nautilus makes some nice thumbnails for media when viewed as icons. I got to like the feature but then I noticed it doesn't happen on Samba shared folders. To get the thumbnails to show, I had to go to Edit -> Preferences. This brings up the File Management Preferences dialog. On the Preview tab there are options that let you set previews such as thumbnails and audio previews for local files or all files. I'd like a few more options in there, like distinguishing between my LAN and the Internet, but so far we can choose between Never, Local and Always. Local will only make thumbnails for files on your computer. Always will make thumbnails for files on your computer or folders on Windows (SMB) shares. Never won't make thumbnails.

Processing 2008

Early last year (2008) I listened to David Allen's Getting Things Done and started applying the practices he lays out (here's the original book) . The system works great for me in many cases. I've gotten caught up on some stuff at the dentist, I've taken care of a lot of really boring jobs that I've put off for a long time. I've been able to keep track of little bits of information that I have to follow up on or pass on to someone. I've also been able to decide to not do a lot of things that don't fit in with my long-term goals. The one bit of advice that I'll give to anyone trying GTD is to read the material or listen to it over and over. Each time I get a little more out of it and I refine my system. I haven't done it all and it's not perfect but the improvement in my ability to finish projects has been immense.

Tip for XDebug on Ubuntu 8.10 with Eclipse PDT

After you've got PHP5 and Apache running on your Ubuntu development server, the next thing you'll want is Eclipse PDT. Shortly after that you'll need a debugger.

On Ubuntu 8.10, I set up Eclipse 3.4 (Ganymede) with the latest Release Candidate of PDT 2, it took forever because of some slow mirrors, but I'd recommend just buckling down and getting through it. Here's the step-by-step guide I found most useful. If Ubuntu someday gets PDT and Eclipse 3.4 in the repositories then just use that.

Copying crontab from Suse to Ubuntu

My OpenSuse 10.3 install was getting a little long in the tooth so I decided it was time for an upgrade. I installed Kubuntu 8.10 on a new drive a couple days ago. I ended up switching to Gnome from KDE so now I'm basically running plain Ubuntu. I've been doing non-stop configuring ever since. Today I wanted to get my cron jobs from my old install. I still have it on another drive so I'm able to see all the old files. I use crontab to set up cron jobs directly from the command-line. There's a text file that contains my crontab in each system. I found Suse 10.3 kept the file at /var/spool/cron/tabs. The new system, Ubuntu 8.10, keeps the crontabs under /var/spool/cron/crontabs. So I just copied the contents of the old one then ran crontab -e. In the editor that comes up I paste the old lines and start tweaking.

Setting svn:ignore for Drupal's settings.php

The Problem
It's important to keep track of changes to your software. I use Subversion for version control. One issue that's always been quirky for me is ignoring files. The authority on Subversion, the red-bean book, doesn't give a lot of depth on svn:ignore. It describes how to do what you may have done before in CVS and how to match groups of files. That's useful but I work on Drupal and I have the same set of files on multiple servers for development. These servers have the same files but different quirks with .htaccess and settings.php. So when I check in changes I don't want my settings.php from a development server overwriting the changes.

Syndicate content