Tech

En till Good Old Blogs webbplats

First alpha of OAuth Connector released

A module I’ve been working on for a while is OAuth Connector – a module that enables a Drupal site to easily let their users log in through OAuth API:s like Twitter’s. A short screencast of how it works: Over a year ago we needed Facebook Connect for one of our projects. Looking at the…

Läs mer

On the uselessness of array_merge_recursive()

I guess that most people have run afoul of the monstrosity that is array_merge_recursive(). In short a merge of array(‘a’=>2, ‘b’=>3) and array(‘b’=>4) gives you array(‘a’=>2,’b’=>array(3,4)) which isn’t the result that one would expect. So, as usual, I’ve created a gist that outlines the problem and gives a more sensible alternative. http://gist.github.com/271920

Läs mer

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

A future for Services – 3.x?

Services is a module that makes it easy to provide web services using Drupal. What services doesn’t do is to allow the definition of separate API:s. This is something we need to fix if we want to turn services into a real web-service framework. Consider the following: Today all installed services are always available on…

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

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

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

The danger of id numbers as keys in PHP arrays

Putting id numbers as the key in an array can look like a pretty smart decision at first – but it certainly has its pitfalls. PHP considers numeric keys as array indexes – if you eg. do an array_merge() on an array the index will be rebuilt and start from 0 again – no matter…

Läs mer