December 2009 Archives

Posting to Movable Type From Emacs

| 1 Comment | 1 TrackBack

I stumbled across weblogger.el which is an xml-rpc interface for posting to several blog engines, including Movable Type which I use. And I thought: Hey, why use that somewhate crappy online editor for writing blog posts when one can use a fairly OK operating system to do the job (aka Emacs).

Setup

Download weblogger.el from the above link and also the requisite xml-rpc and load them in .emacs in the usual manner.

Run weblogger-setup-weblog and fill in the correct values for configuring the blogging engine. For Movable Type the URL endpoint is http://your.blog.url/mt/mt-xmlrpc.cgi. The user name is your usual username, but the password is the special API password which can be found and set on the bottom of the user page in the admin interface. After that it's just C-c C-n for a new entry. The setup will fetch all existing entries automatically so you can cycle through and edit too.

Caveats

It seems the current version of weblogger.el doesn't handle drafts properly against MT 4. The first version saved as a draft is published instantly :-/. Later saves keep the draft status. Also, the familiar C-c C-s for saving the buffer actually publishes. So you're going live pretty soon.

A MacOS X Keyboard Layout for Programming

| 3 Comments | No TrackBacks

I have previously created my own keyboard layout for windows and Linux in order to have a layout where the often-used keys in programming are more accessible than in the standard Norwegian layout. And when I recently got a (shiny) MacBook pro, I wanted to have the same keyboard layout for the Mac also. Consistency is key across machines, so the layout is the same as in the original progn keyboard layout (most braces and slashes available on home row or the row above). Downside is if decide to update it, I have to update three copies. Oh well...

In the windows and Linux I ended up mapping caps-lock to alt-gr and binding a lot of new key combinations using that modifier. I chose a similar although slightly different model for the Mac. I choose to use the caps-lock key as another alt key (set in the keyboard system preference) and then map keys to alt+for easier access. This means I loose the keys already bound on the alt key, but I keep the original keyboard layout easily accessible, and switching is a breeze. On the positive side, I don't mess with key bindings in either the Terminal app, Aquamacs (when fn is set to be meta) nor IntelliJ IDEA. Here's the finished new bindings: keyboard.png
Home row is the most important one, with often used characters, and the braces on homerow+1 on the right hand. Pointy brackets and pipe on the left hand.

Recipe

Here's how I created the new keyboard layout for mac running 10.6 Snow Leopard (I think it'll work on Leopard (10.5) as well, but haven't tested it). Finding an existing layout in the .keylayout XML format was quite difficult but I found an extended Norwegian layout which had some often used keys already mapped nicely, like «» and some others. So I used that as a base.

  1. Download Ukulele from the web page and install it.
  2. Either start from scratch defining keys in Ukelele or start modifying an existing keyboard layout.
  3. Open the character viewer (System preferences -> Language & Text -> Input Sources and select Character and keyboard viewer
  4. Drag characters from the character viewer while holding down the desired modifier key.
  5. Save under a suitable name. Be creative :-).
  6. Copy to "/Library/Keyboard Layouts" for access for all users or "~/Library/Keyboard Layouts" for just your user.
  7. log out and log in, and you should be able to choose the new keyboard layout from System Preferences.

I called my keyboard layout progn, like the others I have created and you can download it if you want to use it for further tweaking. I made it available under the same creative commons license as this blog, so remixing is allowed provided you make the re-mixed versions available to the world wide intertubes.

Doing do-release-upgrade on an offline ubuntu mirror

| 2 Comments | No TrackBacks
I have an offline mirror of the ubuntu package repositories for use on a network not connected to the internet. This works like a charm for updating packages on individual machines, but when it comes to doing a 'do-release-upgrade' to the next release, like these days I'm trying to upgrade to 9.10 Karmic Koala, we need some tricks to make this work. Firstly, sync your mirror so all the new packages of the new release are locally available. What you probably find is that the upgrade manager/do-release-upgrade software can't seem to find a new available automagically. So how do we accomplish this?

  1. update-manager and do-release-upgrade reads the file /etc/update-manager/meta-release to find the location of the meta-release file. This points to the internet location changelogs.ubuntu.com normally. And if you just mirror the package repos, the meta-release file isn't included. So we need to fetch it first: 'wget http://changelogs.ubuntu.com/meta-release'.
  2. Store it, for instance on the root of the internal mirror or some other convenient location, and put the url to it in the "URL" value in the /etc/update-manager/meta-release. If you're upgrading to a LTS release, fetch the meta-release-lts file too and repeat the process.
  3. Edit the meta-release file you just downloaded and substitute the external mirror address with the url for the internal mirror so all package locations match up. For me this was replacing 'archive.ubuntu.com' with 'explorer/mirror' since the internal mirror is available at http://explorer/mirror/ubuntu/. Make sure the file is readable via http (or file permissions if using file access to repo).
  4. Run update-manager or do-release-upgrade and the upgrade should work as you were using an internet mirror.

mini bio

Knut Haugen [Knu:t Hæugen], Norwegian software developer with a penchant for dynamic languages and anything to with developer testing. Agile methodology geek with bias on Lean and Kanban. Some pointers to other stuff by me

meta

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

November 2009 is the previous archive.

January 2010 is the next archive.

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