Drupal and content purgatory

Let’s jut say you’re migrating content from a static site to a Drupal-based site.  Let’s say that you don’t want to migrate the content all at once and want to roll out the new Drupal-based site ASAP and migrate content as you’re able to.  One thing that you could do is to make your old site static.mysite.com and your new Drupal-based site mysite.com.  Then use the Custom Error module and this snippet to automatically redirect to content on the old static site.  If the content isn’t in either place, they’ll get a 404 from the webserver of the static site.

howto make a quarter sheet daily planner from an ical file in linux

My Planner

Update: Photos of my planner! Mine is on the left, next to a moleskin to give you an idea of the relative size.  Below is what each day looks like.

Inside of my planner

I use Sandy for most of my calendaring, but don’t have a PDA or mobile phone with a convenient calendar app (and can’t afford one).  So, I needed a paper daily planner that could be generated on a weekly basis from the events that I shoot into Sandy.  I find that it’s no too hard to do a daily paper->electronic sync to update my calendar in Sandy.  Sandy has an ics export which is really nice if I want to view my appointments along with appointments from my other calendars (like my work one, managed by Webcalendar).

What you need:

  • Calendar software that supports printing a daily view (I used KOrganizer)
  • psutils package

Import your remote calendar(s)

I first imported my calendar into KOrganizer (File->Import->Import Calendar and then entered the URL of my iCal feed in the Location field) .

Print the calendar to a postscript file

I printed a page for each day of my calendar with  File->Print and then chose Print Day for the Print Style.  I selected a month worth of dates for the Date & Time Range.  I clicked Print and chose the Print to File (Postscript) option for the printer Name.  The ability to print to a file came with my default KDE setup, but it shouldn’t be too hard to get this ability from whatever printing management system you’re using.

Make the postscript file 4up

I used the psnup program to put four days on one letter sized page.

 ghing@silvertongue:~/tmp$ psnup -pletter -b0.25in -4 planner.ps planner-up.ps

The above options say that the output paper size is letter, that there should be a .25 inch margin around each page (I did this to allow for a binding on the left hand side of the sheets), that there should be 4 pages from the file planner.ps combined into every one page in the output file planner-up.ps.

Open the postscript file and print it

I used evince to open and print my planner.

Cut the pages into quarters

I used a paper cutter to cut the printed pages into quarters.  Take care to keep track of the order of pages so it’s easier to assemble your calendar.

Find a cover and a binding

For mine, I used part of the cover of a notebook that I dumpstered in Bologna and held everything together with a butterfly clip that I got from the supply closet at work.  Be resourceful!

webserver_auth module for Drupal 5

I’ve been playing around with Drupal for work and wanted to use mod_auth_kerb to authenticate Drupal users. The Webserver Auth module seemed helpful, but only worked in Drupal 4. I got the module working with Drupal 5.5 running on Apache 2.2.3 using mod_auth_kerb 5.1.

Link to my patch to make webserver_auth-4.7.x-1.x-dev work with Drupal 5.x
Link to documentation  on updating  Drupal 4.7 modules to Drupal 5.

drupal contemplate module with postgres

I’ve been working on setting up a Drupal instance for work and have, for the first time been using Postgres for the database instead of MySQL. I was installing the Content Template module and got errors when the module tried to create the tables by default. I think the problem is with the fact that the CREATE statements in contemplate.install use MySQL-only data types.  It seems that others have reported this problem as there is an issue on the Drupal site at http://drupal.org/node/172775 .

I was able to create working tables manually with the following syntax:

CREATE TABLE contemplate (
    type character(32) DEFAULT '' NOT NULL,
    teaser text NOT NULL,
    body text NOT NULL,   rss text NOT NULL,
    enclosure character(128) NOT NULL,
    flags integer DEFAULT 0 NOT NULL,
    PRIMARY KEY (type)
);CREATE TABLE contemplate_files (
    site character(255) NOT NULL,
    data bytea NOT NULL,
    UNIQUE (site)
);

I made a patch to contemplate.install that fixed this issue. download

Once I got past the table creation, the module still returned SQL errors when I tried to update the template for a CCK content type. This seemed to be due to a problem with the SQL syntax. I made a patch to contemplate.module that fixes this in Postgres. I don’t know if it ends up breaking MySQL in the process. download

Oh yeah. I’m using Drupal 5.5 with contemplate 5.x-1.8 and Postgres 8.1.9

profile_export drupal module

Helping out with the AMC website, I threw together a quick Drupal 4.7 module (haven’t tested it on newer version of Drupal yet) to export user profile data generated by the profile module to a CSV file suitable for import into a spreadsheet program.

UPDATE: After searching the Drupal website, I realized that someone had already invented this wheel.

Link

scpush

My job is letting me work while I’m on tour.  For the most part I can just log into machines remotely.  I log into my workstation and from there, I can get access to internal machines.  I just keep a screen session running so I can pick up where I left off.  However,  I’ve run into frustrations when I have to copy images that I edit on my notebook to a remote host that is beyond my SSH gateway.  So, I made a simple script called scpush that copies the file from my notebook the a dropbox directory on the SSH gateway and then copies the file from the gateway to the ultimate destination.

Published
Categorized as hacks