Drupal file_copy won't work outside of the Drupal instal

The selected file could not be uploaded, because the destination is not properly configured

This "feature" has bitten me before. It's one of those annoying Drupal things which would be fine if the error message wasn't so misleading.

What's happening is that file_copy() calls file_create_path()

<?php
function file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
 
$dest = file_create_path($dest);
?>

While file_copy() doesn't declare that it only works in the Drupal folders - file_create_path is clear about this.

Read more

Eclipse PDT and Subversion

Version conflicts to be aware of

Ubuntu 8.10 (Intrepid Ibex) now ships with Subversion 1.5 

You can't use a svn 1.4 client and a svn 1.5 client on the same working copy.

While the subversion integration in Eclipse is great I still prefer to do some things on the command line and some with kdesvn.

Then you need to upgrade your subclipse plugin to subclipse 1.4

If you can - then upgrade to Eclipse 3.4 

Read more

IE6 on VirtualBox - installing the network driver

One of the trial of web development is ensuring that your site works across a range of browsers.

Standards compliance is an important part of this - but testing cannot be avoided.

I work on Ubuntu, and use VirtualBox together with a licensed copy of Windows XP to test in a Windows environment, which also allows me to at least test the Sindows version of Safari.

Unfortunately Microsoft's decision to tie Internet Explorer closely with the operating system means that it isn't possible to install IE6 alongside IE7.

Read more

Ubuntu 8.10

Having just upgraded to Ubuntu 8.10 my key observation is that it's important to read the release notes first.

http://www.ubuntu.com/getubuntu/releasenotes/810

There are a few bugs which have affected me

Read more

How to read compressed Apache docs

One of the great things about Debian/Ubuntu is the consistency with which system documentation is placed in /usr/share/doc/

Assuming you have a web server installed this documentation is then available at http://localhost/doc/

But to keep filesize down - many files are compressed and have to be decompressed before you can read them.

The browser can actually do that compression on the fly - if it receives the right headers - what it needs to be told is that the content is compressed plain text.

Read more

svnversion

I just discovered a nifty little utility

Often working copies are only partially updated, this command gives a very quick command-line summary of the state of the working copy.

It's not as rich an output as kdesvn which will colour code all the updateable files, but its a standard part of svn so should always be available.

Name

svnversion — Summarize the local revision(s) of a working copy.

Read more

Number Crunching : Database vs OOP

For the last few months I've been working on a project that is part website and part data processing.

In theory the website is the bulk of the project, but in practice processing the data has taken a disproportionate amount of resources.

Data exchange with another organisation is always tricky - and in this case we have incoming data that doesn't conform to specification, business rules that change, and a daily data import to run.

The code I've been working on has been through a couple of versions, and now I have in mind a third

Read more

Drupal multisite with shared tables

Drupal allows you to create multiple sites sharing some or all of the same code and optionally sharing some database tables.

The documentation for the Drupal settings file
http://api.drupal.org/api/file/sites/default/settings.php/5/source

includes the following

<?php
/*
* To have all database names prefixed, set $db_prefix as a string:
*
* $db_prefix = 'main_';
*
* To provide prefixes for specific tables, set $db_prefix as an array.
* The array's keys are the table names and the values are the prefixes.

Read more

What is a Drupal node?

One of the things that is confusing about Drupal is the use of the word node.

Going to the dictionary doesn't help much:
http://dictionary.reference.com/browse/node
http://www.answers.com/topic/node

In my opinion "node" is just the wrong word.

When you read node think content.

Content (in the context of a website) means something that is displayed to users.

Content can be text, images, video, even flash games.

So when you create a node in Drupal you are creating content.

Read more

MySQL restore is very slow

It seems there is a bug in MySQL which is causing restores to run very slowly (hours instead of minutes)

http://bugs.mysql.com/bug.php?id=33057

The bug is fixed in release 5.0.67

But Ubuntu hasn't updated yet....

Fortunately this bug is specific to the command line client. 

Workaround: use the MySQL Administrator GUI instead.

Read more