Skip to navigation

Variable scope in JavaScript

November 14th, 2007

Here’s a very nice summary of the scope of variables in JavaScript, i.e. where in your script they’re availalbe.

An important point that I needed for a script: If you need to declare a variable inside a function but need its scope to be global, omit the var keyword.

Drupal: how to disable broken module manually

November 14th, 2007

I did something wrong applying a patch to a module. This resulted in a broken site — I wasn’t able to see the Administration page anymore to disable the module (or any page for that matter).

Log on to your server via SSH.

mysql -p

Gets you into mysql.
To see your databases:

show databases;

To pick the drupal database:

use drupal;

Then, substituting the module name for module_name below:

UPDATE `system` SET `status` = '0' WHERE `name` = 'module_name' LIMIT 1;

Finally:

quit;

Drupal form tweaker module

November 14th, 2007

The Drupal Form Tweaker module lets you change the way users can select vocabulary/ category terms when they submit content. By default, this is a dropdown list, which is a bit ugly and especially annoying to use if you want to select multiple terms. With form tweaker, you can set the terms to be presented as radio buttons or checkboxes instead. Much nicer and easier to use.

Note that you set these preferences in Administer → Content type, not in the Category/ Vocabulary settings.

Quod Libet: last.fm scrobbler plugin error solved

November 12th, 2007

Activating the last.fm plugin for scrobbler submission resulted in this error:

ImportError: no module named lastfm

It works after

sudo aptitude install lastfmsubmitd

During installation, leave last.fm login and password blank (I don’t want to have this report system-wide under my name) and set permission for group audio. Then, set your username and password directly in the last.fm audioscrobbler plugin.

Addendum

It seems I don’t even need this. Quod Libet (1.0) on the laptop shows the same error message, no matter whether I have the “Audioscrobbler Submission” plugin activated or not. (The error message shows up when I click on the “Show Errors” button in the plugins selector window). However, activating the plugin and entering last.fm username and password scrobbles just fine.

Drupal border-spacing

November 5th, 2007

In my version of Drupal (5.something), with the theme I’m using (B7), if you try to set the distance between table cells using CSS border-spacing, this has no effect. You have to also set border-collapse: separate;