Tech

En till Good Old Blogs webbplats

Talk on Services at Drupalcamp Stockholm 2009

I just held a presentation about services and my plans for services 3.x at Drupalcamp in Stockholm. Everything went well except that I was so nervous about running out of time that I teared through the presentation in 20 minutes. But here are the slides if you missed something. Check out the english version over…

Läs mer

Co-Maintainers Wanted!

The list of modules that I maintain has become quite long, and in the beginning of next year I’ll have a little daughter (if the nurse guessed right on the gender). So the time that I have for being a good maintainer will be very limited. If you feel that you’d like to help maintain…

Läs mer

Copying Ubuntu VM:s and eth0

Note to self: when copying virtual Ubuntu servers between machines the MAC address will be changed and a eth1 device will be added with the new MAC address. But it won’t be properly configured. Edit `/etc/udev/rules.d/70-persistent-net.rules` and remove the old `eth0` device and rename the `eth1` device to `eth0`. Then reboot and everything should be…

Läs mer

Dynamic vhost configuration

I’ve recently tried out a new way define my virtual hosts on my development machine. I’ve always had a configuration file in my home dir (that gets included from httpd.conf) that looks something like this: NameVirtualHost *:80 ServerName drupal.local DocumentRoot /Users/hugowett/Sites/drupal/public_html AllowOverride All Order deny,allow Allow from all <VirtualHost *:80> ServerName somesite.local DocumentRoot /Users/hugowett/Sites/somesite/public_html <Directory…

Läs mer

Ensuring that values are in an array

I’ve run across situations where I want to ensure that some values exist in a non-associative array (without getting duplicates). The way I’ve usually solved it is: if (!in_array(‘nid’, $fields)) { $fields[] = ‘nid’; } if (!in_array(‘title’, $fields)) { $fields[] = ‘title’; } This is kind of ugly, and the more values you want to…

Läs mer

Convenience scripts for Solr

This is a set of convenience scripts for daily drupal use of solr in a dev environment. When you use the apachesolr module in many projects it becomes somewhat boring to set up solr again and again. And when you have a whole team doing the same thing, this script becomes a time-saver. This little…

Läs mer

Code lost

If you’re anything like me you probably misplace some code every once in a while. I have a drupal module that I work on in both spare and work time, and I use it in many projects. I sat down just now and started coding on a feature when I realized that I’ve already done…

Läs mer

Caching the results of your functions

Sometimes when you use info-hooks to collect information from a arbitrary number of modules, or perform some other expensive or ”unknown cost” operation, you’ll start to feel the need to cache your results. If your function will be called several times during one request caching in a static variable will take off some of the…

Läs mer

Terminal tips and tricks

This is a collection of terminal (not as in life-be-gone) tips and tricks – good things to do with your terminal and bash. It originates from our old google code wiki and contains things picked up from http://blog.macromates.com/2008/working-with-history-in-bash and other places. There are some good tips over here too: http://programmingishard.com/code/tags/bash Using textmate as your svn…

Läs mer

PHP cli script for inverting hex colors

Here’s a gist of the script I used for creating the inverted NeoPro theme in my last post. This way I could do most of the conversion automatically and just tweak some stuff for contrast. http://gist.github.com/190235

Läs mer