• Your typical Xdebug primer for OSX

    I will be presenting Xdebug at the Drupal Melbourne Meetup next month. For those who are interested, here is a primer about the various tools I use, and there should be enough information for most people to set these tools up for themselves. I am focussing on my personal development environment, including MAMP (Free version) and Netbeans IDE. The benefit of MAMP is that it now ships with Xdebug. The main points I cover in this article are:

    • MAMP configuration
    • Editing php.ini to enable Xdebug
    • Pretty error messages with Xdebug
    • In-line debugging in Netbeans
    • Creating a cachegrind profile
    • Visualising the cachegrind profile with Graphviz
    • Creating a trace file with Xdebug
  • A Drupal autocomplete file for Sublime Text 2

    After trying Sublime Text 2 for a day I’ve already fallen in love with its simple but elegant interface. I’m generally a fairly happy user of Komodo IDE but don’t really like is klunky interface and occasional crashes and its often slow response. What I do like about Komodo is its ability to scan through your project and provide autocomplete suggestions, something that Sublime Text 2 doesn’t do.

    So I decided to write a script to fill some of this gap in Sublime Text 2. The script simply scans through a specified directory and creates a json formatted sublime-completions file from all the functions it finds.

  • How to create a custom Views handler

    Ever wanted to alter the output of a date field in Views beyond what a custom date format can do? I needed to be able to show a node’s created date formatted in two different ways depending on whether the date is today or before today: All nodes in my view with a created date of today should only show the time posted, while nodes older than today should show the full date and time posted.

  • Upgrading this site from Drupal 7 alpha 6 to beta 1

    For some reason I wasn’t aware of there being no upgrade path between alpha version of Drupal. This makes total sense, the api and schema keeps changing a lot before the beta so extra time is needed to maintain the updgrade path and it would be better spent elsewhere. Unfortunately I had decided to create this site on Drupal 7 alpha 6 a little while back so when the beta came out a few days ago I decided to try to upgrade.

  • Quick tip: Getting Komodo 6 Database Explorer working with MAMP

    Just trying out Komodo 6's new Database Explorer and came across the usual error when trying to access MAMP's mysql through a socket due to its location not being the expected /tmp/mysql.sock. One of the usual solutions for this kind of problem is to symlink MAMP's mysql.sock to /tmp/ but I don't really like that due to having to redo it on restarts.

    Instead, when you set up your MySQL database connection in Komodo, simply enter the full path to the socket file in the Hostname field, like so: /Applications/MAMP/tmp/mysql/mysql.sock

    Job done.

  • Using field level permissions to allow 'view in list' but not 'view full node' in Drupal

    As Drupal’s view permission doesn’t differentiate between a view in a list (output by Views) and a full node view it can be hard to meet the requirements of some clients who want to ‘tease’ their users by showing lists of titles without giving full access to the node.

    Stella Power wrote about one way to do this which made me write up my method in this blog post.