Currently playing on my computer (tune in: pls, asx)
The Daily Biff
     
 
Mon, 22 Dec 2008

Blosxom Plug-in Mods: paginate
I use the paginate plug-in (r1.2) on my blog. This plugin gives me the ability to show "older entries" and "newer entries" links at the bottom of my blog pages. However, I found that the page counter did not work correctly if I specified a category path or a date range... so I fixed it.

You can download my modifications to the blosxom paginate plugin in the full context of the file itself, or as a patch. My cvs development log for the paginate plugin is also available.

:: Posted by rus on Mon, 22 Dec 2008 11:50 pm
:: Filed under /contrib/blosxom


Blosxom Plug-in: urlsafe
I discovered recently that my rss feed was not validating because my recent entries about 台灣 use chinese ideograms as file names. Links to these blog entries embedded within the rss feed must not contain "high ascii" characters, but must be escaped instead. So I escaped them inside of a new plugin ("urlsafe") that I wrote today.

More information about the urlsafe plug-in can be gleaned by reviewing the source code (my perl reads pretty easy), or by reading the man page. I have provided links to both (as well as my development log) below:

:: Posted by rus on Mon, 22 Dec 2008 11:50 pm
:: Filed under /contrib/blosxom


Blosxom Plug-in Mods: readme
I use the readme plug-in (v2003-11-12) on my blog. This allows me to post "read me" files in certain categories and paths. I made a small modification to the plugin to check for the file "README" (in all caps) instead of "readme" (in lowercase). Just a personal preference.

You can download my modifications to the blosxom readme plugin in the full context of the file itself, or as a patch. My cvs development log for the readme plugin is also available.

:: Posted by rus on Mon, 22 Dec 2008 11:50 pm
:: Filed under /contrib/blosxom


Blosxom Plug-in: rsstitle
I have a habit of putting markup tags (like '<i>...</i>, <b>...</b>, etc) in my blog entry titles. Unfortunately, this makes for bad form in the corresponding rss entry titles. So I created a plugin to strip out any markup from titles for the benefit of using in the rss stream. Easy cheesy.

More information about the rsstitle plug-in can be gleaned by reviewing the source code (my perl reads pretty easy), or by reading the man page. I have provided links to both (as well as my development log) below:

:: Posted by rus on Mon, 22 Dec 2008 11:50 pm
:: Filed under /contrib/blosxom


Blosxom Plug-in Mods: postheadprefoot
I use the readme plug-in (v2.0b4-5) on my blog. The plugin allows an author to append the contents of a "posthead" file to the header of a blog-generated document if found for a specific path. Likewise, the contents of a "prefoot" file (if found) are prepended to the footer of a document. I used this to document my ratings system for my beverage review categories. I made one small modification to this plugin which splits the posthead and prefoot markup into two parts; then I only build the final posthead or prefoot data if required. This eliminates unnecessary inclusion of empty tags just about everywhere.

You can download my modifications to the blosxom postheadprefoot plugin in the full context of the file itself, or as a patch. My cvs development log for the postheadprefoot plugin is also available.

:: Posted by rus on Mon, 22 Dec 2008 11:50 pm
:: Filed under /contrib/blosxom


 
Wed, 27 Sep 2006

Blosxom Plug-in Mods: calendar
I use the calendar plug-in (v0.6). This plug-in produces the monthly calendar at the top of on the left hand sidebar on each page of my blog. Before today, I was using this plug-in pretty much modification-free. But I found that under certain circumstances, the plug-in will get stuck in an infinite loop; namely, when the month extracted from a PATH_INFO request is out of range. So I added some simple month range checking and now it is much happier. My modifications can be reviewed and downloaded here:

:: Posted by rus on Wed, 27 Sep 2006 10:44 pm
:: Filed under /contrib/blosxom


 
Mon, 07 Aug 2006

X10 Home Automation Using a CM11A Deivce on FreeBSD
A little over three years ago, I bought an X10 CM11A Serial Inferface Controller. Then using some very handy Perl modules I wrote a small piece of software that completely controls the outdoor lighting for my home. The lights come on at sunset and are all off by sunrise. It's a great little system and pretty easy to implement (on FreeBSD).

I chose the X10 CM11A Serial Interface Controller because there is a Perl module (ControlX10::CM11) explicitly written for the hardware. Because the CM11A connects to my computer via the serial port, ControlX10::CM11 is dependent on the Device::SerialPort Perl module. Consider the following sample code:

#!/usr/bin/perl

use Device::SerialPort;
$serial_port = Device::SerialPort->new('/dev/cuaa0',1);
die "Can't open serial port $serial_port: $^E\n" unless ($serial_port);

$serial_port->error_msg(1); # use built-in error messages
$serial_port->user_msg(0);
$serial_port->databits(8);
$serial_port->baudrate(4800);
$serial_port->parity("none");
$serial_port->stopbits(1);
$serial_port->dtr_active(1);
$serial_port->handshake("none");
$serial_port->write_settings || die "Could not set up port\n";

use ControlX10::CM11;
receive_cm11($serial_port);
send_cm11($serial_port, 'A1');
send_cm11($serial_port, 'A1');
send_cm11($serial_port, 'AJ'); # J is on; K is off
send_cm11($serial_port, 'OJ'); # J is on; K is off

When executed, this code will send an X10 signal that will turn on any X10 modules with an address of 'A1'. Not very interesting since there isn't any code logic to determine when the "on" signal should be sent. In order to determine when I should send "on" and "off" signals to my different X10 lighting modules, I use the Astro::Sunrise Perl module. It is a handy little module that will quickly determine the sunrise and sunset time for a latitude and longitude on any given day. Here is small snippet of code that generates sunrise and sunset times for my general location:

#!/usr/bin/perl

require Astro::Sunrise;

$long = -122;
$lat = 47.5;

$date = localtime(time);
print "$date\n";
$sunrise = Astro::Sunrise::sun_rise($long, $lat);
print "sunrise at $sunrise\n";
$sunset = Astro::Sunrise::sun_set($long, $lat);
print "sunset at $sunset\n";

Nice and simple and easy.

For my home automation software, I turn on all of the lights at sunset. Then I have different sets of lights turn off at specific times as the night progresses. Furthermore, I wanted to add a bit of randomness to the off events so that it didn't just look like the lights were going off at the same exact time every night. The lights that I choose to stay on all night are turned off at sunrise (or more specifically 1 hour before sunrise).

Here is the code that runs my home lighting; I call it from cron every minute of the day. Have fun with it!

(Update Thu Aug 10 00:08:53 PDT 2006 // fixed some punctation mistakes)

:: Posted by rus on Mon, 07 Aug 2006 8:23 pm
:: Filed under /contrib/x10


 
Wed, 15 Mar 2006

Blosxom Plug-in Mods: comments
I use the comments plug-in (v0.6) on my blog. This allows visitors to contribute their snarky thoughts and feelings about my blog content. I have made considerable modifications to the original plugin, including:

  1. trap on reloads after POSTs to prevent duplicate entries
  2. e-mail comments posted back to a specified address
  3. obfuscate posted e-mail addresses
  4. better subject and title support
  5. require password to post comment

You can download my modifications to the blosxom comments plugin in the full context of the file itself, or as a patch. My cvs development log for the comments plugin is also available.

:: Posted by rus on Wed, 15 Mar 2006 8:08 am
:: Filed under /contrib/blosxom


 
Mon, 06 Mar 2006

Baby Name Libraries
I scraped a few sites to build my baby name library, including the Social Security Administration. Direct downloadable copies of the "basic" versions of my boy and girl name libraries are available:

:: Posted by rus on Mon, 06 Mar 2006 11:35 pm
:: Filed under /contrib/babynames


Baby Name Regex Search
As I mentioned previously, we are expecting another girl. Furthermore, our previous name of choice ("Olivia") is a very common one (at least going back for the past 5 years). So Kristy and I hunkered down around the computer and tried to find a good alternative to "Olivia".

While looking, I decided that the search interface at many of the baby name sites was just too limiting. For example, we like the nickname "Liv" but it is pretty hard to search for all names that have "liv" somewhere in the beginning, middle, or end of the name. Enter perl (see perl, see perl run, run perl run!).

Using a small script, I scraped a bunch of names off of a few web sites that seem to have a fairly comprehensive list. Using those names, I built a small local library for my own personal use. Then I authored a very simple interface to search the library using any (well... most any) regular expression. It makes baby name searching that much more fun! Here's the link:

So if I punch in 'liv' and search (on the extended lib), I get a small set of alternatives to Olivia. I did a bunch of other regex searches. For example, the regex "^(a|e|i|o|u)[a-z]{4}(a|e|i|o|u)$" will yield all six letter names that begin and end with a vowel. If you aren't familiar with regular expressions, here are some other examples:

    RegexFunctional Meaning
    ^zstarts with 'z'
    a$ends with 'a'
    ^z.*a$starts with 'z' and ends with 'a'
    ^e.*ana$starts with 'e' and ends with 'ana'
    ^[a-z]{3,4}$ all 3-letter and 4-letter names

The links provided by the search utility go to a handy little site that provides the meaning, origin, and relative popularity of the name.

(Update Mon Mar 13 14:34:22 PST 2006 // fixed an html problemo)

:: Posted by rus on Mon, 06 Mar 2006 11:16 pm
:: Filed under /daily_journal/2006, /contrib/babynames


 
Sun, 05 Mar 2006

Blosxom Plug-in Mods: storytitle
I use the storytitle plug-in (v0.5) in order to include a nice page title on each individual blog entry page. I made just one minor tweak to the code, but other than that I pretty much use it out of the box. My mod can be reviewed here:

(Update Fri Mar 17 00:16:47 PST 2006 // added link to original source)

:: Posted by rus on Sun, 05 Mar 2006 1:25 pm
:: Filed under /contrib/blosxom


Blosxom Plug-in Mods: categorytree
I use the categorytree plug-in (v1.7) to show the nifty by-category display of my blog entries on the right hand side of every page of my blog. I made one minor modification to the original code; I added a new class to differentiate a top-level category from a sub-category. My mod can be reviewed here:

(Update Fri Mar 17 00:12:01 PST 2006 // added link to original source)

:: Posted by rus on Sun, 05 Mar 2006 1:22 pm
:: Filed under /contrib/blosxom


Blosxom Plug-in Mods: flatarchives
I use the flatarchives plug-in (v1.0) to show the convenient summary of blog entries by month on the right hand side of every page of my blog. Other than just one very minor tweak I made to the code, I pretty much use it out of the box. My mod can be reviewed here:

(Update Fri Mar 17 00:15:01 PST 2006 // added link to original source)

:: Posted by rus on Sun, 05 Mar 2006 1:16 pm
:: Filed under /contrib/blosxom


Blosxom Plug-in: multicat
I love my blogging software - blosxom. It's just so light, compact, and easy to use. Blosxom is especially nice for someone like myself that prefers to use a mouse as little as possible while using a computer. I can use the command line to author a new blog entry using vi, spell check the new entry using aspell, modify the blog entry's publication date using touch, and use the standard unix file system commands to insert my new blog entry into my blog file structure (i.e. my blog's category heirarchy). And I can do all this as fast as I can type the commands at the shell prompt.

There is one limitation of blosxom that I just recently bumped up against. The limitation is a byproduct of using the blosxom data directory structure to double as the blog's category heirarchy. Each blog entry lives in one directory, and thus one category. Sure, a blog entry can be copied into (or a link made in) another directory to associate the entry with a secondary category, but then blosxom will show that entry multiple times. So, that's no good.

I wanted to find a way around this behavior primarily because I wished to associate the daily journal entries (located in "/daily_journal/2006") that I composed about our recent trip to Vancouver with a new category (something like "/vacations/2006/vancouver"). That way, I could still read my daily journal in a linear fashion using a URL like:

    http://rus.berrett.org/blog/daily_journal/2006/

yet, at the same time, access just the journal entries that detail our Vancouver vacation using a URL like:

    http://rus.berrett.org/blog/vacations/2006/vancouver/

(Note: the above examples of URLs to access blosxom blog entries presume that my modifications to blosxom with regard to "viewing by date" have been applied to the blosxom installation).

With that goal in mind (one entry - many categories), I set to the task of creating a blosxom plug-in that will allow me to "file" a blosxom entry under one or more different categories while, at the same time, suppress the display of the multiples. I was able to create a plug-in (which I've named "multicat") that does exactly that.

The "multicat" plug-in allows me to easily classify a single entry under many different categories (i.e. different directories) using symbolic links. The multicat plug-in controls when the symlinks to the entries are displayed and when they are hidden. Thus, the display of duplicate entries (which is the normal blosxom behavior when symlinks to files are encountered) is suppressed. Support for the comments plug-in and the writeback plug-in is built-in. Comments (or writebacks) that are added to or appear on a source entry will show up in the symlinked entry and vice versa.

I think what I have done is very clever and I'm very pleased with the result. I can now create symlinks to blog entries in other secondary categories and, in effect, file a single blog entry under multiple categories. This was something that was impossible to do before (and I scoured over many different other blosxom plug-ins) and, ultimately, I think it could be very useful to the blosxom blogging community at-large (but I could be wrong about that).

So, using the example above, I can now build a URL to access all of the entries in my daily journal that are just about our recent trip to Vancouver. Check it out:

Note that each of those entries has not one, but two, categories that it is associated with. Mission accomplished.

More information about the multicat plug-in can be gleaned by reviewing the source code (my perl reads pretty easy), or by reading the man page. I have provided links to both (as well as my development log) below:

cheers!

(Update Mon Mar 13 00:47:59 PST 2006 // fixed a grammatical error)

:: Posted by rus on Sun, 05 Mar 2006 1:22 am
:: Filed under /contrib/blosxom


 
Sat, 04 Mar 2006

My Modifications to Blosxom
I use blosxom (v2) for my blog software. It's lightweight, simple to setup and administrate, written in Perl, and free to use and alter. Blosxom uses the file system as its organizational structure. Directory names become category names. Files are blog entries, and blog entry titles are simply the first line in each file. The file modification time is used as the blog entry's publication date. Managing a blosxom blog is nothing more than creating, editing, and manipulating files.

I've made just one minor modification to blosxom (see log). I wanted to be able to use all numeric directory entries, but this conflicted with blosxom's built-in "view by date" capability. The feature allows for the creation of URLs to isolate blog entries by date. The general form of such a blosxom blogi URL is:

    http://blog_url/[optional_category_path]/[YYYY]/[optional_MM]/[optional_DD]/

This is a great feature of blosxom. Unfortunately, blosxom out of the box prevents me from using all-numeric directory names such as a year (e.g. '/daily_journal/2005' or '/daily_journal/2006'). I think this was simply a small oversight by the original blosxom developer, and so I've added some code to correct it.

You can download my modifications to blosxom in the full context of the file itself, or as a patch. My cvs development log for blosxom is also available.

(Update Fri Mar 10 14:23:17 PST 2006 // updated links and link titles)
(Update Fri Mar 17 00:09:24 PST 2006 // added link to original source)
(Update Fri Apr 7 12:58:43 PDT 2006 // added clarity to description of mods)

:: Posted by rus on Sat, 04 Mar 2006 11:01 pm
:: Filed under /contrib/blosxom



         

March 2010
Sun Mon Tue Wed Thu Fri Sat
 
19 20
21 22 23 24 25 26 27
28 29 30 31      

About
柏忠毅 的 'the Daily Biff'
Rus Berrett's weblog

Contact Me
Email: rus at berrett dot org
AIM: biffordtdavis

Search 'The Daily Biff'



Proclamations
Exaggerated opinions of my own importance. Proceed with caution.

Buy Me Stuff
My wish list is my gift to you (yes, shameless, I know).

Subscribe
Subscribe to a syndicated feed of my weblog, brought to you by the wonders of RSS.

Categories
You can isolate posts by category using the following links.

  •   ·x10 (1)
  •     ·2005 (23)
  •     ·2006 (18)
  •     ·2007 (17)
  •     ·2008 (27)
  •     ·2009 (21)
  •     ·2010 (4)
  •     ·kids (3)
  •     ·pies (1)
  •     ·meat (22)
  •     ·cola (2)
  •     ·milk (2)
  •     ·meat (1)
  •     ·utah (5)

Archives
Past entries are available for review.

Blogroll
These are a few blogs run by my esteemed friends and colleagues. My personal comments about the blog (and its author) can be accessed by clicking on the "wtf?" graphic to the immediate right of each entry (wtf = "What the flip?" as in "What the flip is grandma doing at the sand dunes?").

Family

What the flip is "Yatyk's Musings"?  And who the flip is Mark Berrett?

Friends

What the flip is "The Improvist"?  And who the flip is Dan Brian?
What the flip is "The Borel-Cantelli Lemma"?  And who the flip is Norm Jones?


    
 
    Valid CSS!

Valid HTML 4.01 Transitional

Powered by blosxom