Archives 2008

Ubuntu 8.10 on my Dell Inspiron 1525

I got a new laptop about a year ago directly from Dell. I did this for two reasons, they had a good deal, and I wanted to support a company that supported Linux! So far I’ve been very impressed, it worked right out of the box and about the only thing that I did to it in the first few months was upgrade the OS to 7.10 (Gutsy).

Of course, that didn’t last long. I soon started messing around with beta versions of Ubuntu, doing some messy upgrades and installing patches in a fairly piecemeal fashion. After about 9 months of this and breaking various things, 8.10 (Intrepid) came out and I decided a fresh install was called for.

 

After backing up any files I needed (and took the opportunity to get rid of a lot of rubbish I’d accumulated on the harddrive) I booted up from a fresh Ubuntu 8.10 DVD. After a fairly standard install which has been documented in many places on the web, I booted into a fresh copy of Ubuntu.

All I can say is, fantastic, everything just worked. Even down to pairing up one of my bluetooth headsets and being able to use it automagically in Skype. The only thing that I would like is the ability to specify LDAP authentication as part of the installation process. I had the option many years ago with Mandrake/Mandriva, but for some reason Ubuntu is lagging behind.

This brings me to a point. Even a long term Linux user is still shocked that an install on a supported laptop worked flawlessly. I think that if Linux gets to the point where I am shocked that something doesn’t work as it should, then Linux is ready for prime time. Tho’ on that note, we’re still waiting for Windows to get to that stage!

About the only main configuration that I’ve done so far is LDAP authentication with credential caching incase the network isn’t available. The last thing that I want to get working is some form of syncing for some of the more critical configuration files, such as my pgp keyring, mail config and bookmarks.

As far as Ubuntu is concerned, 8.10 is a great step forward. Bluetooth works well, hot plug of devices detects the correct type of device and offers various options. Network Manager has taken a great step forward with, for me, just the addition of being able to configure a mobile phone as a bluetooth 3g modem missing, but supposedly this is on its way.

Next step is to re-install my main desktop and see how it handles the triple monitor! 🙂

Metal, A Headbanger’s Journey

Just watched a fantastic documentary last night called “Metal, A Headbanger’s Journey“. It is a walk through metal history, talking about the roots of the music, the culture and the stereotypes. Produced and staring a long term metal fan, who also happens to be qualified anthropologist. Lots of interviews with the original rock/metal icons such as Lemmy, Alice Cooper and Bruce Dickinson, along with some of the more recent bands such as Slipknot and Lamb of God. Well worth a watch, or even better, to buy!

Sony E-Book Reader + Linux

Guess what, I’ve got another gadget! I decided to take the splash and get one of the new Sony ebook readers, the PRS-505. I’d heard a lot about the e-ink displays, but never seen one in real life.

Well, so far I’m impressed. The resolution is fantastic, very readable in just about any light, infact it is pretty much just like reading a real book. Even better, it plays very well with Linux due to the fact that the reader itself, along with any memory cards inserted, act as a simple usb mass storage device. Plugging the reader into my laptop simply opens up the drives in seperate windows meaning I can just drag and drop any supported document. Of course, some formats work better than others. TXT and RTF files are the simplest format and work well, tho there are no chapters or any other fancy information. PDFs are more or less usable, tho they usually need to be zoomed in which ruins the layout. The best format that I’ve found so far is LRF which is Sony’s binary format for the PRS-500 and PRS-505.

 

This is all well and good, but there is a better way to move the files over, and also convert different formats. Calibre is a free python program which acts as conversion software, ebook library, and will also copy the files to your reader. Installation under Ubuntu is extremely straight forward, just run the following:

 sudo apt-get install  python-setuptools python-imaging  libqt4-core libqt4-gui \
                      python-qt4 python-mechanize imagemagick \
                      xdg-utils python-dbus python-lxml python-beautifulsoup \
                      help2man
sudo easy_install -U calibre
sudo calibre_postinstall

Instructions for installing on other systems (including Windows and OS X) can be found on the Calibre download page.

The library functionality lets you add any ebooks that you have and search for cover images, the ISBN, publisher and sometimes a brief synopsis. The conversion software will allow you to convert any type of supported file into either EPUB or LFS, even automatically detecting chapters in TXT and RTF files. Finally, once you’ve added your books and converted them to your prefered format, simply plug your reader in and click the copy button. Once the files have been copied over you can unmount the filesystems and read the books on the reader!

Conversion settings that I recommend are to convert all files to LFS format with 8pt fonts and 2pt spacing which is fine for me, but can be zoomed in if you want bigger print. Also, I like to insert a blank line between each paragraph to make the text more presentable. Lastly, I make sure that the chapter detection inserts any chapters found into the table of contents. So far I’ve found that these settings work with just about all my files. I’ve still to mess around properly with PDF files to find the best results for these.

Before converting any files, make sure that you have filled in as much of the information as possible for the book as some of this information will be included in the converted output making organisation a lot easier on the reader, especially if you fill in the series information to group books together.

All in all I’m glad I bought the reader. I think it will come in very useful, tho’ there are a few things that I hope will be improved on in future versions. One of which is a larger screen. The reader is about the same size as a standard paperback, which is fine, but the screen doesn’t fill the whole device. Sony could easily do away with the big round buttons on the bottom edge and make the screen a fair bit bigger which would improve the reading of PDF files no end. I’d also like to see slightly better contrast on the screen to make it more book like. As it is the background is grey and the black isn’t exactly a deep black so it can look a little washed out. I may be nit picking, but isn’t that what the net is for?! Of course the benefits definitely outweigh these couple of problems. Battery life so far seems phenominal, with the battery meter not moving off full charge yet! Supposedly I should be able to do about 6800 page turnsper charge, seeing as the e-ink technology only uses power when actually changing the screen. So far I’ve read a couple of books on it and not really noticed that I was reading a screen rather than a standard book, only noticing when my hand slipped and the cover closed without losing my place!

Well, hopefully I’ll get PDF files playing happily soon and then it will be pretty much perfect. In the meantime, it came with 100 free books, and I’ve been scowering project Gutenberg to find some books to read. Should be enough to keep me going!

Darren

Migrating Serendipity to Drupal

I’ve just finished moving my blog from running on Serendipity to a Drupal installation. Drupal seems a lot more stable and more customisable. Serendipity was only really a blog, but Drupal is a full content management system so I thought it might be a better idea to learn how it works!

Of course the trouble is I have quite a few articles written in serendipity and I needed to be able to transfer them easily. After searching around on the net, the only reference I could find was a dead link to an SQL script. Oh well, guess I’d better write my own. Read on for the instructions.

The main assumption here is that both Drupal and Serendipity are on the same server, with the same database. Its not a big deal if they are on different databases, its just that mine were and that how I’ve done the script. The other assumption is that all the articles are by the same user, and that they are all going to be going under a single user on the Drupal installation (UID 1). If you have multiple users, then it is still possible, but it would add another layer of complication to the script. If anyone needs some help, just give me a shout. Lastly, there should be no stories already in the Drupal database (ie. a fresh install)

In this script the Serendipity tables are prefixed serendipity_, and the Drupal tables are prefixed drupal_. In Serendipity, all the content is stored in one table, entries, whilst in Drupal they are split across two tables, node and node_revisions. Below is the script that will take all entries from serendipity_entries and place the relevant information in the correct tables for Drupal. The commands can be either run via the mysql command line, or in phpMyAdmin.

INSERT INTO
   drupal_node(vid, type, title, uid, status, created, changed, comment, promote, moderate, sticky, tnid, translate)
   SELECT id, 'story', title, '1', '1', timestamp, timestamp, '2', '1', '0', '0', '0', '0' FROM serendipity_entries;

INSERT INTO
   drupal_node_revisions(vid, uid, title, body, teaser, timestamp, format)
   SELECT id, '1', title, extended, body, timestamp, '2' FROM serendipity_entries;

Thats all it takes. All these entries should now be published under UID 1 in Drupal as stories with the original timestamp, promoted to front page, and full HTML enabled. If you don’t want the entries on the front page, change the third ‘1’ to a ‘0’ on the first bit of SQL. Change the second ‘1’ to a ‘0’ if you don’t want them published automatically.

I hope this can help someone.

Thankyou

OpenID working with LDAP

Something I’ve been meaning to get round to for quite a while is setting up an openID server. I’ve finally done it! Even better, this server is linked into my ldap server which allows for consistent passwords for everything. Getting it working took quite a while. The openid-ldap software was fairly tricky to configure and the apache configuration was a nightmare for me of regular expressions, something that in all my geek years I’ve managed to stay away from in any depth. (I’ve learnt a fair bit through osmosis, but never sat down and looked at some regexp documentation). Read on for my instructions on setting this up.

Before we start

Before we begin, a few assumtions. This article assumes that you have:

  • A working permanent internet connection (DSL/Cable/Better)
  • An apache web server running and accessable from the internet over SSL, preferably with virtual hosting set up
  • A domain name that you want to tie your openid into and full control to add/change A/CNAME records
  • I did this on Debian, most distro’s should be similar but may use different directories
  • An LDAP server up and running (and working! – ie, tied into user logins, imap, etc)

Setup

My first step was to download the openid-ldap software and uncompress it into the root of your web server (eg. /var/www on Debian), then rename the directory to something easier to type.

cd /var/www
wget http://www.openid-ldap.org/releases/openid-ldap-0.8.7-noarc.tar.gz
tar xfzv openid-ldap-0.8.7-noarc.tar.gz
mv openid-ldap-0.8.7 openid
chmod a+r openid/ldap.php

You should be able to now access http://yourserver/openid to make sure it works. If you get any errors you’ll need to check your apache config. If everything is working then the next step is to get the ldap section working. In the openid directory open up the ldap.php and you will see a load of configuration parameters to edit. The important ones are:

$GLOBALS['ldap'] = array (
        # Connection settings
        'primary'               => 'yourldapserver',
        'fallback'              => 'yourbackupldapserver',
        'protocol'              => 3,
        'isad'                  => false, // are we connecting to Active Directory?
        'lookupcn'              => false, // should we extract CN after the search?
        'binddn'                => '',
        'password'              => '',
        'testdn'                => 'uid=%s,ou=People,dc=example,dc=net',
        'searchdn'              => 'ou=People,dc=example,dc=net',
        'filter'                => 'uid=%s',
        'nickname'              => 'uid',
        'email'                 => 'mail',
        'fullname'              => 'displayName',
        'country'               => 'c'
);

binddn and password shouldn’t be needed at all for most ldap servers to check if a user exists. If your server needs authentication, fill in these fields. You’ll also have to lock down the ldap.php file to restrict people seeing the plaintext password. testdn is the dn used to see if a uid exists. searchdn is the base under which to search for valid users.

To check that the ldap configuration is working, go to the url http://yourserver/openid/?user=at which you should see a welcome message. If not, go back and check your ldap configuration. There are some handy hints and tips in the openid-ldap README.

My next step was to set up some virtual hosting. This isn’t strictly nescessary, but it is the difference between an openid of http://www.example.net/openid/user and http://openid.example.net/user. Not much of a difference, but I wanted a challenge. For now, I will assume that we’ll just do a normal set up and I’ll leave the virtual hosting option up to the reader.

Because openid-ldap sends the username and password over basic authentication you should take it as a requirement to use your openid over SSL. I had a fun time getting this working along with the virtual hosting, but will leave this again up to the reader. There are countless helpful web pages out there to get ssl working on an apache web server.

Ok, once you have openid-ldap talking to your ldap server, SSL working, and possibly virtual hosting, it is time for the final bit of configuration. This part took me the longest to get working due to the mod_rewrite instructions that came with openid-ldap not working for me. For the openid to be kept simple and in the form url/user, rather than url/index.php?user=user, openid-ldap makes use of mod_rewrite in apache to (funnily enough) rewrite the url. To do this you need to edit the apache configuration for the directory under which openid sits to add:

RewriteEngine On

   RewriteCond %{REQUEST_URI}      !^/(.+)\.php(.*)$
   RewriteCond %{THE_REQUEST}      ^[A-Z][A-Z][A-Z]\ \/([A-Za-z0-9]+)\?(.*)\ HTTP/
   RewriteRule ^(.*)$        /openid/index.php?user=%1&%2

   RewriteCond %{REQUEST_URI}         !^/(.+)\.php(.*)$
   RewriteRule ^/([A-Za-z0-9]+)$  https://www.example.net/openid/index.php?user=$1

Restart apache and go to the url http://www.example.net/openid/. Hopefully you should see a welcome screen and a login button at the bottom. Click on the login button and a login box should appear. Type in your username and password, click ok, and you should be taken back to the login screen with a message that you are now logged in.

Thats it, you’ve got openid working. As mentioned, you can fine tune this to produce an easier url to type in, but this is a matter of preference. Hopefully someone may find this article useful. If you do, please drop me a mail or add a comment.

Thankyou.