Blogs
The Oxford Comma
Submitted by joachim.noreiko on Wed, 30/06/2010 - 16:59Here's a little function I wrote today because I needed to be able to turn a list of between one and three items into a string like 'apples, oranges, and pears', 'apples and pears', or just 'stairs'.
I figured I might as well handle everything in one place, and throw in the option to have an 'or' instead of an 'and'. There may be occasions you don't want the Oxford comma, but I can't think of any.
/**
Using Constants For Permission Names: WHY?
Submitted by joachim.noreiko on Wed, 30/06/2010 - 15:19I keep seeing this sort of thing in so many modules:
define("MY_MODULE_PERM_ACCESS_WIDGETS", 'access widgets');
// Names changed to protect the guilty ;)Am I missing something, or is this utterly pointless?
Setting Up Git And Gitosis On CentOS 5.2
Submitted by greg.harvey on Wed, 09/06/2010 - 15:51This article is a tweaked version of several tutorials around. Many of the original links courtesy of Adrian Simmons. Thanks to all the others who gave me loads of help in IRC and thanks to Jerad at Lullabot for inspiring me to dive in to Git with this article.
Sharing An NTFS External Drive On A Linux Network With NFS
Submitted by greg.harvey on Thu, 20/05/2010 - 12:29For my own sanity I'm blogging this, since every time I have to do it I end up jumping through the same hoops and cursing myself for not blogging it!
I have a USB external drive on one of my machines. I want it shared across the network. It's an old Windows drive formatted as NTFS. Here are the steps:
1. On the "server" install required services and applications. As root:
$ yum install nfs-utils ntfs-3g ntfs-config fuseFUSE should be there already, but just in case. The GUI for ntfs-3g is optional.
2. Make sure the NFS services is enabled and loads on boot:
Panels 3 And The 960 Grid System
Submitted by greg.harvey on Wed, 12/05/2010 - 20:47This post was going to be longer, but I just lost the entire completed document because the worst (and probably most expensive at $15/day, yes DAY) mobile Internet provider in the world, EVER, just dropped my connection mid-submission and for the zillionth time today. So you'll have to make do with an angry and hurried synopsis of what I would've written.
Installing 3G USB Modems On Linux
Submitted by greg.harvey on Wed, 28/04/2010 - 11:27So, last night I lost not inconsiderable amounts of time and sleep to a Vodafone Italy 3G USB key. Trying to get these things set up is supposed to be fairly straightforward, however the end-to-end process is not really documented anywhere, as far as I can tell. Maybe for individual devices, but not in any generic way.
Since this is the second time I've done this now, and in both cases it was a pain in the ass, I am documenting some generic steps so I don't forget what I need to do all over again!
Free SSL With VPS.NET
Submitted by greg.harvey on Thu, 08/04/2010 - 21:22Ok, so this is *purely* for my memory, a kind of bookmark. But VPS.NET, the hosting company I often use for virtual machines, does free SSL certificates for all customers:
http://www.vps.net/forum/public-forums/announcements/233-free-and-unlimi...
Here's how you get one and configure it. (Using the VPS.NET Centos 5.4 64 bit LAMP image, and with ISPmanager Pro - also free from VPS.NET - as the server control panel. This is my usual set-up.)
- Set up your VM in the usual way
Once & Only Once: The Conversion To Drupal 7's FieldAPI
Submitted by joachim.noreiko on Tue, 06/04/2010 - 15:06I'm not a fan of repeating myself, or of doing the same work twice. So when I first got a look at FieldAPI back at DrupalCon Paris, my thought after 'Wow this is going to change everything,' was 'Every module that converts its custom data storage to this is going to be doing the same work, over and over'.
Drupal 7 Cheat Sheet: The Database
Submitted by greg.harvey on Tue, 30/03/2010 - 10:29This is a quick post while it's fresh in my head, regarding porting your contributed modules to the Drupal 7 API. This post specifically focusses on database manipulation and provides the like-for-like changes. If anything here is wrong, or could be done better, please let me know!
First up, individual results:
<?php
/*
* Remember this?
*/
$value = db_result(db_query("SELECT some_field FROM {some_table}"));
/*
* Forget it! It now looks like this:
*/
$value = db_query("SELECT some_field FROM {some_table}")->fetchField();
?>Scared Of Features? Don't Be!
Submitted by greg.harvey on Fri, 26/03/2010 - 13:55I'm an experienced Drupal developer. I've been embedding stuff in code for ages now. Views, Panel pages, ImageCache presets, even putting CCK content type exports in to hook_install() implementations just to try to keep stuff in code. Many of you are probably in the same boat. Keeping stuff in the database brings all sorts of ugly deployment and performance issues, so we avoid like the proverbial plague.

