December 2007 Archives

Working widgets in MTOS

Yesterday I upgraded Webquills.net to the "Boxing Day" build of MTOS. I was pleased to find that the widgetized sidebar is now activated for the default theme. I had tried (admittedly not very hard) to get the widgetized sidebar working in a previous build, but all I got was empty space.

Actually, with the Boxing Day release, you still get empty space by default, because although the widgetized sidebar is enabled, the sidebar components aren't actually populated with any widgets.

Creating your own widgets works pretty much like you would expect. I created a Google AdSense widget just by pasting the AdSense code into a new widget and wrapping it in a couple of nested divs classed with "widget" and "widget-content" respectively, code that I copied from the pre-built widgets. I was also able to modify some existing widgets without any trouble.

But I see that a new nightly build is out, so this is probably old news. Still, I'm gratified to see steady progress being made. The nightly builds are firming up. Some people have reported intermittently about upgrade issues, so you'll probably want to wait for the stable release to upgrade an older Movable Type installation. If you're starting up a new blog, the nightly builds should prove good enough at this point.

Perl 5: The grass is plenty green

A few months ago I wrote a missive lamenting the coolness going on in other languages in terms of web frameworks and the dearth of magical leaps forward in Perl. Well, I take it all back. Serves me right for not recognizing hype for what it is.

Each of the frameworks from other languages that I examined promised great leaps in productivity for programmers of that language. But what I came to realize was that these were improvements that I had already experienced in Perl. The streamlining did not come from the language at all. One scripting language, it seems, is pretty much as good as the next when it comes to productivity for the skilled programmer. No, the great leap forward came from applying a well organized web application development framework and its associated tools to the problem of web development, where before there had been no organized solution and only a rudimentary tool set.

But I have been using Perl web application frameworks for years. (I use the plural of framework because TIMTOWTDI in Perl.) Apache+mod_perl is an amazingly rich web application framework on its own. Perl was (I believe) the first scripting language to be embedded in the web server itself, and is still the best option for manipulating the rich, complex internals of Apache. HTML::Mason's ApacheHandler is a simple layer on top of mod_perl that is a highly effective solution to certain classes of problems. Richer, more modern frameworks like Catalyst and Jifty do more for you, but also require you to do more learning to get productive. In Perl, we're spoiled for choice, which is a problem all its own. But the point is, the other scripting languages haven't beat Perl in the web framework race. They are just now catching up!

This is certainly not a call for Rails developers to switch to Perl. Why should they? The fact of the matter is that web frameworks in whatever language are substantially similar to one another, because they are each a solution to the exact same problem, built under similar constraints.

Programmers should use whatever language fits their mind best, because that is where they will find themselves most productive. For some people, that's Java. (Some people are weird.) For some its Python or Ruby. More power to you. But if you are productive in Perl, don't be lured away to some other language by the greener-looking grass on their side of the fence.The grass is plenty green right here.

Don't believe it? Subscribe to Webquills.net via RSS or Email and learn all about it.

Wordpress to MTOS: An easy migration (so far)

With the recent and long-awaited release of Movable Type Open Source, I undertook to port my blog at Webquills.net to the new MTOS.

Why MTOS?

I've never felt comfortable publishing my content in proprietary software. Even if I could obtain it gratis, I was always paranoid that the license would change out from under me and I would suddenly find myself in a panic trying to port my content to some other system. So I started blogging on the GPL-licensed Wordpress, and I liked it well enough.

I am a Perl programmer by trade, and though my PHP skills are reasonably good, I would feel much more comfortable hacking on Perl code. MTOS is written in Perl so it gets points. That's my first reason for switching.

My second and more pressing reason to switch to MTOS is its static publishing model. I run my blog on a web server that's light on memory, and what memory there is, I like to use for my own web development. Using a heavy Apache/PHP process to serve a page whose content has not changed in weeks is a luxury that I'd rather not have to pay for. I'm willing to trade slightly delayed publishing for lightweight static file serving.

Installing MTOS

Installing MTOS was pretty simple. Not quite as simple as installing Wordpress, but simple enough that anyone comfortable with a Unix shell (or well-skilled with their FTP client) can get it done without breaking a sweat.

Be warned, however, that as of this writing no "stable" builds of MTOS have been released. I'm using one of the nightly builds, and it works fine for me, but you may run into some issues. If that bothers you, stick with the commercial version until the first MTOS stable release comes out.

I pretty much followed the installation instructions for Linux. I created a MySQL database for MTOS to use, and a new user with full permissions on the database. Then I grabbed the latest nightly build from the MovableType.org archive. Simply untarring it into my chosen destination was enough to get started. Then I walked through the "install wizard" filling in the blanks as needed. None of the questions were particularly tough to answer. :)

After completing the installation, I got some warnings that MTOS did not have permission to write to the /mt-static/support/ directory. Apparently this is where MTOS stores uploaded files and its own reports. I did a chown www-data mt-static/support so the web server could write there, and the complaints went away. I also had to do this to the output directory where I told MTOS to write my blog.

Migrating the content

The step that surprised me the most was migrating my Wordpress content to MTOS. It was shockingly easy. I entered the Wordpress admin area and selected Manage -> Export from the menus. Pressed the button, and I have a Wordpress eXtended RSS feed (WXR file) containing all my posts, comments, and categories (and probably other stuff too).

Then I went to MTOS and clicked to System Overview -> Import. I set the type to WXR and uploaded my Wordpress data. Snap! Just like that MTOS had my posts, comments, and categories all sorted out and ready to use. I punched the publish button and had a web site ten seconds later.

Final cleanups

I picked the most boring MTOS style I could find (because a blog should resemble its owner :P), and made just one customization. I wanted to point users to my FeedBurner feed instead of the local one. I picked Design -> Templates from the menu, then picked Template Modules and edited the Header module. I also had to change the "subscribe" link in the Sidebar modules. (Well, it wasn't as easy as it sounds. It took ten minutes of clicking around to find the right bit to edit. Still, it wasn't exactly hard, either.)

That done, I republished, and was ready to go.

The trickiest part of the migration had little to do with either Wordpress or Movable Type. It was simply that the URLs for my blog entries were going to change under the new system. But cool URIs don't change, so I needed to create a translator for the old ones. I handled this using a simple Apache directive with some Regex Fu.

 RedirectMatch permanent ^/(\d\d\d\d/\d\d/[^/]*)/?$ \
http://www.webquills.net/scroll/$1.html

More to come?

I'll probably publish some more comments about MTOS as I get used to using and customizing it. In the interim, I can say that the migration process from Wordpress to MTOS is surprisingly easy and should not be considered an excuse for not switching!

About this Archive

This page is an archive of entries from December 2007 listed from newest to oldest.

November 2007 is the previous archive.

January 2008 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.2rc2-en
Creative Commons License
This blog is licensed under a Creative Commons License.