Peter's Blog

Redefining the Impossible

Items filed under microblog


Set up personal, private (hopefully) microblog on dedicated server. No it won't be full of juicy details about my sex life, it's more for general notes not worthy of wide publication. I'll see how it pans out, it may be too much of a stream of consciousness thing to be much use to casual observers. If I recall correctly, James Joyce's drivel great literature is stream of consciousness stuff.

Access to dedicated server is much quicker than the site5 server, like it's on a local lan. This may be for two reasons:

  • it's all mine
  • it's hosted somewhere in Germany, i.e. on the same continent as me.

I've decided not to try upgrading it to Fedora Core 4 for now, I will try to keep it clean for as long as possible. I found the MySQL-Python rpm in the Fedora 2 stuff so I was able to get the Microblog running and now I can't think of any packages I want.

I'll fiddle some more before I migrate petersblog.org. I need to figure out how to use plesk to create user accounts with ssh access, I'm doing everything as root which is a no no.

Been reading bad comments about oneandone's tech support. Still no feedback on the problem with plesk I had after a day, don't care much. Bad tech support on an unmanaged server is no surprise.


Filed under: microblog mysql


I am writing this using my Microblog setup in VIM. This is the first test post. If you can read this then that is a good thing.

If you can read this then I can edit as well as post and that is even better.

I have set things up so that I can edit one of three blogs (Work, peters, personal) by typing (for example):

:e blog/Work

in vim.

This will read in all the postings for today where I can edit them or add new ones. I then type:

:w

to update or publish the posts. This is much easier and quicker than using the drupal web interface to do anything.

I can type:

:e blog/Work/-1

to edit yesterdays posts.

Hopefully we are seeing the dawn of a new era of more than one post a day.


Filed under: microblog vim


My Microblogging tool is coming together. This is my vision for a blogging tool that is:

  • Fast to post with so posting is as lightweight as possible
  • Supports tagging to organise the posts. I have decided that tagging is preferable to putting articles in a rigid tree hierarchy.

I decided on the following architecture:

  • VIM as an editor. For me this is by far the quickest way to do data entry
  • I create however many posts in an single page and post them in one go
  • I use Vim's python scripting to send the file full of posts to the server via an xmlrpc call
  • The server implements a python cgi script to process the file full of posts. It splits the files into seperate posts and submits them to Drupal one by one. Drupal is the backend database and is also a reporting tool.

Most of the processing is done by the cgi script. I could post directly from VIM to Drupal, post-by-post but the Drupal blogapi does not support awtags and I'd rather write some python to do it that struggle modifying the php code. The cgi script also supports reading back a days-worth of postings so I can also edit existing posts.

Using VIM I was able to create a nice syntax-highlighing definition to make the posts easy to edit. Here is an example of how it looks in VIM:

This is the title
    23 August 2005 12:34
    [some stuff]
    This is a posting in Vim. I can create stuff in VIM much faster than I
    can type it in textarea in a web browser.

    As posts support basic html markup, html tags are <i>syntax highlighted</i>.

    It will syntax-highlight python:
    <python>
    for i in range( 10):
        print "Python rox"
    </python>

    It shows blocks with a green mark in the first column.

    It will syntax-highlight php:
    <php>
    $strStr = "What is the dollar for?";
    </php>

    It marks out my verbatim blocks:
    <verbatim>
    This is preformatted.
    </verbatim>

The format of the posts is a title line followed by date/timestamp and a list of tags, followed by the post itself, indented to delineate it. For me the syntax highlighting is the killer feature, I am almost word-blind without syntax highlighting. I stole the idea fromwas inspired by The Vim Outliner.

I won't post all the code here as it's too big to post inline and it is highly likely that nobody else is interested anyway. It's not quite finished, I still have a few issues to resolve:

  • VIM macros to help in posting, such as filling in the date.
  • Support for multiple blogs: work blog, personal note blog and this blog. How to cross post?
  • Any way to handle images/attachments?

I call it the Microblog, micro to emphasise the fine-grained nature: not big laborious articles (like this one) but short pithy notes.