Tuesday, May 30, 2006

Nice Font Rendering on SUSE 10.1

Fonts on Linux/Xorg are something that people seem to go on about a lot. Usually complaining how bad they look. For years now I've had no problem with fonts - for a while it was because I recompiled freetype packages with the bytecode interpreter turned on, but then SUSE started turning that on anyway, and I had nice looking fonts right out of the box. I think part of the reason I liked my font rendering though was because I like subpixel antialiased fonts, and most Linux people seem to like jagged edges instead. However, something changed in version 10.1, and my once nice looking KDE desktop started to look ugly. I couldn't quite put my finger on what was different, but something had changed.

But now I have nice fonts again. How did I do it? I added David Turner's libXft patches to my system, and suddenly things look nice. It doesn't really make sense though, as SUSE 10.0 couldn't have had those patches as they hadn't been written.

The details of how I did it: I backed up the existing libraries. Then I installed the xorg-x11 source rpm on my machine, ran rpmbuild to extract the source and apply existing patches. Then I applied the libXft patch and ran make from the Xft directory. I then copied the compiled libs into place, restarted X, and it all worked nicely:

cp /usr/X11R6/lib/libXft.a ~/backup/
cp /usr/X11R6/lib/libXft.so.2.1.2 ~/backup/
rpm -ivh xorg-x11-6.9.0-48.src.rpm
cd /usr/src/packages/SPECS
rpmbuild -ba xorg-x11.spec
cd /usr/src/packages/BUILD/xc/lib/Xft
patch -p1 < ~/libXft-2.1.7-lcd_rendering.patch
./configure
make
cd .libs
sudo cp libXft.a /usr/X11R6/lib/
sudo cp libXft.so.2.1.1 /usr/X11R6/lib/libXft.so.2.1.2

Now, I'm not saying this is the right way to do it. I reckon there's a reasonable chance it'll crash my machine at some point. But so far it's working fine. Oh, and if you copy libXft.so.2.1.1 across while you're still running X, weird things happen!

Unrelated note: I'm now using Smart to manage packages and updates on my machine, and it's a wonderful piece of software.

Saturday, May 27, 2006

Sterling Data Type

At work we recently moved offices. During the move we threw out a load of old manuals which aren't needed any more. I commandeered some of them, and while browsing through 'A PL/I Primer' (Copyright 1965 IBM) I discovered that PL/I has a facility for handling data stated in terms of British sterling currency value. What's so interesting about that, I wondered? I read on:

A sterling data constant ends with the letter L, representing the pounds symbol, for example:

2.4.6L

This sterling constant represents two pounds, four shillings, six pence.

Friday, May 19, 2006

A working ZMD/rug/libzypp/ZENworks setup

I have an updater setup in SUSE 10.1 which seems to work now. There are a few gotchas though. I'd recommend only using the command line tools, as the graphical tools seem to crash too often, leaving the ZMD backend in an unknown state. Also, although it looks like you're supposed to be able to install and remove software without being the superuser, it doesn't seem to work, so I do everything as root (using su).

First you have to register your machine. You can use the graphical version in YaST, but that didn't work for me, so I used suse_register -n from the command line. (If I didn't use the '-n' option it kept killing my network connection somehow!)

Although you can add just about any URL using rug and it says that it has added the service okay, you have to make sure you use the correct URL otherwise strange things happen. Also, if you did use the graphical tools to add a service and used spaces in the service names, they won't work.

First I had to add update services to the updater, whatever it is called (ZMD?). Please note that the name of the KDE-3.5-supplementary service is important - it doesn't seem to work if you give it a different name.

rug sa --type zypp ftp://ftp.mirrorservice.org/sites/ftp.suse.com/pub/suse/update/10.1/ SUSE-Update
rug sa --type zypp ftp://ftp.gwdg.de/pub/linux/misc/packman/suse/10.1/ Packman
rug sa --type zypp ftp://ftp.mirrorservice.org/sites/ftp.suse.com/pub/suse/i386/supplementary/KDE/update_for_10.1/yast-source/ KDE-3.5-supplementary
rug sa --type zypp http://ftp.gwdg.de/pub/linux/misc/suser-guru/rpm/10.1/RPMS/ SUSE-Guru

You can list the services using rug sl.

Then you have to subscribe to these services:

rug sub SUSE-Update
rug sub Packman
rug sub KDE-3.5-supplementary
rug sub SUSE-Guru

You can list the subscriptions using rug ca.

You can type rug on its own to view a list of available commands. Some useful ones I've used are rug search package, rug install package, rug remove package, rug patches and rug update.

I find it useful to have another couple of shells open watching the tail of the zmd log files, just so I know whether something is happening or if it's all given up:

tail -f /var/log/zmd-backend.log
tail -f /var/log/zmd-messages.log

I haven't found an easy way of just getting rug to update a package to a newer version from another server. For example, I had Amarok 1.3 installed on my computer, and this morning I wanted to upgrade to version 1.4 from the Guru repository. The only way I found to do it was to remove the existing version and the install the new version by specifying the version number:

rug remove amarok amarok-helix amarok-libvisual amarok-xine
rug install amarok-1.4.0_0.3c amarok-helix-1.4.0_0.3c amarok-libvisual-1.4.0_0.3c amarok-xine-1.4.0_0.3c

If anyone knows a better way, please let me know.

Thursday, May 18, 2006

Ziprugenypp

I've just upgraded to SUSE 10.1 yesterday. When I say upgraded, I mean I replaced my hardrive with a new, 100Gb 7200RPM disc in my laptop and gave myself a fresh installation for a change.

SUSE 10.1 has lots of nice improvements over the previous version - such as being able to use NetworkManager to switch wireless networks on the fly. It also has a fancy new installer/updater called librummikub which offers all sorts of wonderfulness, such as being able to install new software from packman repositories and things like that.

The only problem I have had is that Zmdastardlypp seems to be specially designed to make you tear your hair out. When I was testing betas of 10.1 I saw the new updater icon in the task tray, but it didn't look like they'd finished writing it yet, so I thought I'd hold off playing with it until they had. Now I have a final install of 10.1, and it still looks the same.

Well, at least I was able to find some pointers on the web on how to make this rugmyast thing work, so I added some repositories to it and asked if there were any updates. Afraid not, it said, and then crashed. I played around with it for a few hours until I got it to recognise that there were some updates available, at which point it decided to spend an hour resolving dependencies. It didn't crash this time - I had to kill its process.

Today I had another go. It must be possible to get this zypzenyrug thing to work. So I tried the commandline this time. It started to do an update, and then said 'Update failed' after about 25%, without giving me any idea why. I think it just got tired. I tried again, but a transaction was already in progress. So I killed it. Mwuahaha! Eventually I managed to get it to do a full update. Hooray!

And then I tried to update to KDE 3.5 using the supplementary repositories. I updated a few bits, but then it decided I need to insert KDE-3.5-supplementary in media 1, which was difficult, as I didn't have a KDE-3.5-supplementary to insert. I eventually worked out that if I renamed the repository to match that name then it would work. And I have updated KDE and installed KOffice (although it decided I wanted version 1.4 the first time).

I'd write full instructions on how to get libzubyagrust to work, except I can't really remember any more, it's all turned into a blur of trial and errors. Lots of errors. And trials. But I think if they keep working at it, they might be able to produce a good updating product in a couple of years. (I'd use fou4s, but it doesn't seem to work on 10.1).

By the way, I'd recommend SUSE 10.1, just so long as you don't expect an easy ride. The bits that work (and that's most of it) are great!

Monday, May 01, 2006

Learning Ruby

I had a look at ruby a month or two ago, and decided that although it looked nice in concept, the syntax of the language was too horrible for me. After reading Aaron's blog entry I thought I'd have another looks at it, and although I still find large amounts of the syntax to be rather ugly, I really like other parts of the language, and I can see it being a pretty good scripting language. I might use it for prototyping KDE apps in future, and for writing shell scripts.

I'd really like a language which combines my favourite parts of Java, JavaScript, PHP, Ruby, C++ and C#. (Maybe some Lisp and Prolog too). I'd rather keep Perl and Bash out of it though. And I'd like that language to be usable for nearly everything, so I could develop KDE apps, shell scripts, web sites (client side and server side) all with the same language. But at the moment I haven't found one language which does everything, and I doubt I ever will. In fact, I'm not sure I really want that, because it'd probably be so complicated I'd never actually be able to use it for anything.