How to Succeed in Open Source (or Things I Learned from Writing My First Rules Condition)

My colleague Mattias keeps giving me one piece of great advice that I just keep forgetting.

When you want to accomplish something, look at a piece of code that already does sort of what you want to do, copy and paste it, and modify it to work like you want it to.

Today I wrote my first Rules condition and I struggled for a quite some time with accessing the parameter I wanted from my condition function. I wanted a node object, and despite digging through the documentation I couldn’t seem to get it right. (Or, as it turned out, I actually got it right but must’ve mistyped something, but that’s beside the point.) Giving up, I turned to Mattias and as soon as he’d understood my plight he told me to look at an exisiting condition that did just that – accessed a node object.

For example, the very standard “Content is of type” condition.

Problem solved in less than two minutes. I am writing it down in the hopes of actually remembering this all by myself next time.

Filefield Zip – a Drupal module for zipping filefield files.

Micke and I are building a module! I have built modules before, but mostly custom modules for specific sites and only one that was ever intended to be released (but it never was).

We’re calling it Filefield Zip, and it takes files from one or more selected file fields and zips them into one single zip-file. Right now, that’s all it does, but we’re planning to add Views support for a link to download the zip file and a whole bunch of other features. This module started as a project for a NodeOne client whose site is on Drupal 6, so for now the module is for D6 with plans to port it to Drupal 7 when we have time.

Why are there so few female developers?

Currently I’m the only female developer at my office, and one of a total of four in the company (and two of the four are currently on leave). We had an interesting discussion over lunch about this that mostly dealt with experiences during childhood, even though it somehow degraded into space cowboys…

Anyway, thinking back to my own upbringing, we always had computers at home but my parents’ neither encouraged nor discouraged computer use. They were just there. I remember played Digger, a Pacman clone, on my dad’s Toshiba laptop with DOS. When we got Windows 3.11 and a colour printer, I used to collect horse pedigrees and print them out with a pretty headline, and I liked changing the colours and layout of my Windows 3.11 desktop.

Then we got Windows 95 and the internet, and I think it was my dad who gave me HTML4 for Dummies, for some inexplicable reason. Like so many others I carefully hunt-and-pecked my first site in NotePad, and it was all about me. And horses. Probably mostly about horses.

And it was lots of fun!

My own empirical research into why my female friends and classmates don’t pursue a career in development (web or software) shows that they tend to prefer designing. I understand that, I love designing and that’s where I started, but part of why I got into the development  was because I wanted to make my designs work. Not just be a static Photoshop file – pretty, but useless – but to be something that people could use.

I guess I have no answer to the question, but I find it strange that there seem to be so few women interested in such a creative and exciting line of work. It’s just so much FUN! :D

Drupal vs. WordPress

I have received a few quips about working with Drupal and yet using WordPress for my blog. To that I say, use whatever fits best for the project you’re working on.

  • Despite what any Drupalistas might say ;) , setting up a blog with WordPress is faster and easier than with Drupal. WordPress’ famous simple install process is just that – stupidly simple and fast.

    But Drupal is pretty straightforward to install too, you might say, especially for someone who is working with Drupal and has installed Drupal a fair number of times by now. Yet, WordPress is still easier and faster.

  • WordPress is a blog from the moment it is installed. No setting up content types and configuring image filters and installing a WYSIWYG editor of choice – it’s all just there. Write and publish, bam!
  • Sorry, Drupalistas, the amount of well-designed themes for WordPress is just infinitely larger. I think this is because of the many web designers who have discovered WordPress as an easy way to make websites for clients, i.e. the WordPress community has a larger amount of developers coming from the designer end of things than Drupal.

    This did not factor into my decision to use WordPress since I made my own theme. What did matter is that I can put together a WordPress theme in my sleep while theming a Drupal site still requires me to be at least somewhat capable of focusing.

  • And finally, WordPress’ back-end is just prettier. And I like pretty things.

Some day, I’m going to make a really pretty Drupal admin theme.

Get Drupal permissions machine names

I just spent about 20 minutes trying to find a list of all available permissions and their machine names. Turns out that 1. since modules can set their own permissions, there is no definite list and that explains the lack of such a list in the documentation, and 2. it’s dead easy to find out on your own installation.

Go to the administer permissions list, find the permission you want, inspect the checkbox for that permission and there it is! The value of the checkbox is the machine name of the permission. Beats having to programmatically loop through module permissions or to search through every module’s files for permissions code, which are two solutions I found on the interwebs.