anabelle.foo's blog

CVSing back your drupal site.

The benefits of using source control are great. It is like working with another developer, to review your code changes, even if you are all by yourself, not to mention being able to rollback any changes that you have made.

When using drupal, I like to grab core, modules and themes using cvs rather than downloading files. I find it easier to keep core and modules up-to-date while maintaining the patches I might have applied to a module.

Getting started with Drupal recipe on MacOSX

Install AMP server for MacOSX

  1. Download MAMP
  2. move it to Applications
  3. make a mysql configuration change
  4. [mysqld]
    max_allowed_packet=64M
    
  5. check php.ini that memory_limit is 32M or more

Download Drupal with drush

  1. download and extract drush from http://drupal.org/project/drush

  2. wget http://ftp.drupal.org/files/projects/drush-All-Versions-2.1.tar.gz
    tar zxvf drush-All-Versions-2.1.tar.gz

Where is the drupal omnifunc for vim?

Recently I tried out omni complete in vim, and I love it. It is included in vim 7. This adds a function lookup for php, html, python, javascript, css, xml, sql and c amongst others.

To enable under your home directory in the ".vimrc" file add one line
:autocmd FileType php set omnifunc=phpcomplete#CompletePHP

Syntax Highlighting

In "~/.vimrc"

:syntax enable
:colors pyte
:syntax on

Pushing out your own tokens

If you are in need of custom tokens, here is an example of how to create custom token for a specific vocabulary.


/**
* Implementation of hook_token_values()
*/
function csm_support_token_values($type, $object = NULL, $options = array()) {
if ($type == 'node') {
$tokens['term-media-type'] = '';
$termArray = $object->taxonomy;
$tid_media_type = $termArray[15];
$term_obj = taxonomy_get_term($tid_media_type);
$tokens['term-media-type-tid'] = $term_obj->tid;
$tokens['term-media-type'] = strtolower($term_obj->name);
return $tokens;
}
}

Migrating from Bricolage to Drupal

If a customer has a Bricolage site, and wants to use some of the features of drupal, they can try out the Bricolage Integration module: http://drupal.org/project/bricolage

Otherwise, it is also possible to migrate from a Bricolage project entirely to drupal. To migrate data, I analyzed the database, to get unique ids (story__id) and the directory structure of the generated html files. Taxonomy and/or content type was determined from the directory structure, and main content was parsed from the html files.

Database Migration Part II

In the first blog on Database Migration this post skimmed some info on starting the journey. This blog posts is a little drier, and more detailed, listing some major steps of database import and a few code samples. Shown below is my partner in crime for the second project, Harry. The current methods used are always open to new methods of improvement.


Image courtesy of Steve Krueger

Database migration

In an attempt to clear my mind, and challenge myself, I asked Dave Olson if I could volunteer some time to help him blog an item or two. I was expecting to help write up about a local event around town, instead I was challenged a little bit more to my dismay.

Dave suggested to write a weekly blog post, about some of the work that I have been involved with. Of course he had answers to my protests;

I am sure somebody out there knows a better way than I, and I definitely don't know all there is to know on this subject. His answer, that is part of the reason one blogs, to get feedback from the community.

Should I be my blunt self, or put on a good company front, pasted with unicorns and butterflies? No, this is the new era of openness, one can be honest and open.

2008 wishlist

After my first pirate post as a new employee to RCS, 4 months later, here are some of my high hopes for Raincity Studios, Vancouver and open source everywhere.

Being one of the organizers of the Open Web Vancouver conference, I and other fellow organizers have invested a portion of our time gratis, for hopefully the benefit of the local opensource Vancouver community and neighbours.

SQL machinations

Recently, when performing a slew of alter table statements, I had to do some checking to verify, that I had not completely destroyed my database.

From unix commandline
$ mysqlshow --status my_table

From mysql commandline
> SHOW TABLE STATUS FROM my_database;
> FLUSH TABLES;
> SHOW INDEX FROM my_table;
> ANALYZE TABLE my_table;
> CHECK TABLE my_table;
> OPTIMIZE TABLE my_table;
> DESCRIBE my_table

PHP's filter extension

When I read about PHP's filter functions, http://php.net/filter, I had to try them out.

the install promises to be short and sweet: $ pecl install filter

in reality, it was anything but sweet, after a little searching around, here are the commands that I used with help from pecl bug 9680, for installation on feisty ubuntu:

> sudo apt-get install php5-dev
> sudo apt-get install libpcre3-dev
> sudo pecl install channel://pecl.php.net/filter-0.9.2