Kevin's blog

Javascript field modifications in Drupal

Here is a quick little code snippet that can be added to a hook_form_alter() function in Drupal. It adds a little Javascript to automatically set a field value to upper-case.

// Modify this array to show the actual field names in your form.
    $uppercase_fields = array(
      'field_textfield1',
      'field_textfield2',
      'field_textfield3',
      );
    foreach($uppercase_fields as $delta => $item) {
      $filter .= "input:text[@name^=$item],";
    }
    drupal_add_js("
      $(document).ready(function () {
        $('$filter').change(function() {

Simple Drupal core updates

If you have terminal access to your Drupal website many administration tasks become much easier with a little familiarity with the command line. Here are two commands that I use to easily update the Drupal core files on a site.

First, we want to delete all files except the "sites" directory and the ".htaccess" file. This command takes care of that (note, the .htaccess file is hidden so it isn't returned by the ls command).
rm -R `ls --hide=sites`

Then we will extract the files from the Drupal core tarball.
tar --strip 1 -xzf path/to/drupal-6.xx.tar.gz

Domain Registrar Recommendation

Most people I talk to use GoDaddy for their domain registrations, but are dissatisfied or repulsed by the marketing, service, site design or other aspects of working with GoDaddy. I have recently worked with doteasy.com and they weren't much better. I have been using MyDomain.com for over a year and have been happy with the experience. The website is clean and easy to navigate. The prices are very reasonable. Based on my experience, I recommend MyDomain.com to anyone looking a domain registrar.

Unison server

One of the utility type programs that I use all the time is Unison. It does a very nice job of synchronizing two directories including propagating deletes.

I use Unison for synchronizing podcasts between my Ubuntu 8.04 server (running bashpodder) with my MP3 player (a Sansa Clip).

Files: 

Drupal 6 Image Handling

Images are an important part of most websites. When a lot of people successfully complete their first Drupal install, they are surprised to see that there is no image handling built-in. (BTW, this is resolved in Drupal 7.) There are many contributed modules on drupal.org related to image handling and it can be confusing and overwhelming to figure out which ones you need. The purpose of this post is to help new Drupal users to put the correct pieces together for robust and expandable image handling.

Here is the list of modules to enable image handling in Drupal 6.

Slow Menu Rebuild in Drupal

I manage a Windows server that is running Drupal and I recently had trouble with extremely slow database writes. This problem was the most pronounced when I loaded the Modules page (admin/build/modules). The Modules page load took more than 1 minute. At the same time the database was locked preventing any other page from loading. After looking at the database process list I could see numerous update queries on the menu_links and menu_router tables.

How to setup Ubuntu Desktop 9.04 on my laptop

I have been experimenting with Linux for several years and have been pleased by the progress Linux has made in that time. During the time that I have been experimenting with Linux, the Achilles heel has always been hardware support. When I first tried Linux the problem was with support for my Winmodem. More recently, the problem was with the Realtek 8187b wifi card in my Toshiba laptop. A few weeks ago I salvaged a Broadcom wifi card out of a dead computer and tried it in my Toshiba. Since then, Ubuntu 9.04 has been running very well.

Drupal Clean URLs on Windows

This post is a follow-up to my previous blog entry Drupal Installation on Windows.

I am going to explain the steps to enable Clean URLs when using Drupal installed with Wampserver 2. I will assume that you followed the steps listed in the Drupal installation on Windows post and have Drupal running successfully with Wampserver. So let's get into it.

Drupal Installation on Windows

This post is to give a brief overview of the Drupal installation process on Windows. This setup works well as a test or development environment.

  1. Install wamp server (from wampserver.com) Edit: The latest version of wampserver doesn't work with Drupal. See the note at the end of this post.
  2. Download Drupal. You can use either Drupal core from Drupal.org or Acquia Drupal from acquia.com.

How to setup Jungledisk on Ubuntu server

Introduction

Jungledisk is an excellent application for making backup copies of your data. The way it works is that Jungledisk works with online storage providers to encrypt then transfer your data to the online storage service. Please see jungledisk.com for more details.

Files: 
Syndicate content