Thursday, April 21, 2005

Disaster Struck! and Recovering...

One fine morning one of our main servers went down... so I thought why not upgrade to Mandrake 10.2 (I still like this name against Mandriva). Can you see the clouds lining along the horizon!!! Not even a week Mandrake 10.2 (or Mandriva LE2005) has been released, I am yet to read a review (not even an amateur review). I already had Mandrake 10.2 beta running (more or less OK) on the my test partition. Disaster struck when I decided to upgrade my working partition from perfectly running Mandrake 10.1 to Mandrake 10.2.

Install procedure: There was nothing wrong in the installation procedure; I am just including it here for completeness. Note that, Mandrake is yet to release CD ISO images - the new release is only available via ftp (for free access). I used the standard urpmi approach:

  1. Added Mandrake 10.2 sources (and PLF sources too so that I can upgrade all of them) from EasyUrpmi. While adding the URLs, replace official in them by devel. The files in official are broken (read in /.).
  2. If you havent done this before, add the PLF signing key.
  3. urpmi urpmi
  4. Logout from kde. Go to text console, log in as root, stop X (e.g. init 3). Rest of the commands are to be given at the console prompt.
  5. urpmi --auto-select --auto
  6. It will automatically update all your packages, except the kernel. Look out for missing file errors. In case of any missing file, get the file manually from any other mirror and install maually.
  7. urpmi kernel - get the standard one - 2.6.11-6mdk-1-1mdk
  8. Fix lilo.conf with any additional kernel parameters and reboot.

Okay till now. It booted fine (nice, transparent lilo choosing screen). At the kdm login prompt, somehow the display (rather the fonts) didnt look fine. They looked a bit fuzzy. Anyway, went ahead and logged in as my test user (in case the user explodes, I dont want to loose my data :) ). The font problem continued. Rest were OK. Logged out and logged in as me. Hmm... fonts dont look good. Tweaked with the anti-aliasing settings, hinting setting, changing the fonts, sizes ... nothing worked.

Fixed it now by using Freetype-2. Followed the steps of this page and to some extent the font settings from this page. BTW, I found that freetype with anti-aliasing looks better than freetype without AA, so I left AA on. Look for yourself.

Original font rendering. Look how the curved letters like "o", "s" etc. are a bit hazy.

After making the changes (with AA turned on).

Freetype without AA (using Tahoma).

Freetype and AA. Current settings.

Next thing to test is sleep/hibernate. Suspend to ram (S3) works as before - still the video reinitialization tool (video_post by Venki) is needed. Major problem with hibernate/suspend to disk(S4/S4b). Resume from hibernation doesnt work - no matter what I do (tried all the possible suggestions from different forums, faqs). At last, following a bug report, installed the mm-kernel It seems that is the only rescue as of now; once I fully recover from the upgrade-trauma I will try the latest kernels to see if the bug is fixed. The mm-kernel works OK and everything works (in fact, there was an earlier bug due to which lid-opening events were not caught properly and I had to manually press the power button to wake it up from S3; now just opening the lid wakes it up).

Oho, suspend and resume works but USB mouse (havent tried other USB devices) doesnt wake up from sleep. Replugging it seems to make it work. Had to change the script to modprobe -r uhci-hcd; modprobe -r echi-hcd before and modprobe uhci-hcd; modprobe echi-hcd after both S3 and S4 sleeps.

With 10.1, whenever I inserted a USB pen drive or my USB camera, an icon used to show up on the desktop. 10.2 uses KDE3.3.2 (backported from KDE 3.4) - and uses hal and it is supposed to improve the behaviour a lot. Now I have to turn on "Show unmounted hard disks" in control-center so that a desktop icon shows up when USB devices are inserted (as a result, my linux partitions also show up on desktop which I dont need nor like - but I guess I will to fix them later).

Having the annoyances mostly removed, I should mention that I installed beagle. Its great and once I figure out how to open up files/directories from within beagle, it would become indispensable.

Thats it for now,
- d.

Thursday, April 14, 2005

Colourful knotes

The default knotes is pretty stupid looking. I was looking for a chance to make it better (read: suitable for my taste). As usual Qt3.0 became the obvious bottleneck. Anyway, managed to do it at last. Now it looks quite okay to me (the screenshot is excessively colorful - my default color is lightyellow and pastel shades).

- d.

PS: the image of the pushpin is from google image search. I should have acknowledged it and verified that it not copyrighted. But I dont remember from where I got the test image - if anybody has any objections, I wont use it anymore.


Many times I encounter nice quotes/comments/sentences which I wish I could jot down at some place. Why not use ny Weblog to do so ? That way I can collect them later.

From /. entry of Linux_Cant_Kill_Windows by Noksagt:

I use Linux on the desktop... A long-time colleague in an adjacent office walked in, glanced at my desktop, and said "I thought you ran Linux".

After Quote (Context):All I had displayed was the fluxbox window manager with firefox, gvim, and a matplotlib window from a python session. I had to switch vterms to convince him, as I was running Linux, as he also assumed Linux was all CLI. He should've known better too: He wasn't some PHB, but someone who used X11 and fink under OS X!

Sunday, April 10, 2005

kubuntu: Try-1

Tried kubuntu 5.04 live-cd today (actually wanted to see the inbuilt compositing of kde - how does the eye candy do on my 845GL). More or less OK. Enabled transparency/shadows are things are pretty much OK (didnt crash during the 30 minutes I was working in Kubuntu).
I was using the live cd, so I had to fix a few of the default settings (below), but other than that Kubuntu lived up to its reputation of flawless hardware recognition (ummm... perhaps my hardware is pretty common, recent Mandrakes did the same too).
  • Anyway my first reaction was the small vga boot screen - used live vga=791 as boot parameter for subsequent times.
  • Next, X server started in a small screen. Changed the /etc/X11/xorg.conf file to add Modeline:
    ModeLine "1024x480" 65.00 1024 1032 1176 1344 480 488 494 563 -hsync -vsync
    • If the modelines arent proper, you would see the following in /var/log/Xorg.0.log
      • The resolution you want (e.g. 1024x768) is listed as "*Mode ... (1024x768):" - so the video card can support this video mode (look for the '*' before 'Mode'; only "Mode ..." means that video mode is unavailable).
      • But, right after the mode listing you will notice that the monitor rejects this mode
        not using mode 1024x768 (no mode of this name)
  • Also, fixed the hsync and vsync values (ubuntu used values for a generic monitor). For my Dell laptop panel, they were
    HorizSync 31.5-48.5
    VertRefresh 59.0-75.0
  • Enabled Composite extension.
    Section "Extensions"
    Option "Composite" "Enable"
  • Logged out of Kubuntu and then used ctrl-alt-backspace to restart X.
Didnt have much time to test the other features of KDE 3.4. Will do so (and report interesting findings, if any). But I did make one observation, the eye candies are good. Gradual menu opening, smooth window appearing but all of these come at the cost of time. Without any animation, the menu, windows would show up instantly and now with them, there is some delay before they are fully displayed in a usable state. It looks like I wouldnt like these fancy animations (as I didnt like the minimization genie effect of OSX). But its too early now - let me install KDE 3.4 fully and let it speak for itself.
Thats all for now,
- d.

Saturday, April 9, 2005

Adding fade-effect to kslideshow

I recently transferred some amzing photos from my long-term buddy Siddhartha Saha. What better use could they be put to other than using them as slideshow screensaver. And KDE screensaver comes with a kslideshow (/usr/bin/kslideshow.kss) which is just the perfect slideshow screensaver. Well, not quite.

kslideshow contains all the fancy inter-slide transition effects, horizonal lines, blobs, chessboard, spiralling ... except, the smoothest one - fading. While xscreensaver-gl is a much improved screensaver with fading and other fancy effects, it didnt make sense for kslideshow not to have this effect. One night of Qt-trial-and-error made me realize why this is the case.

First, I got the kdeartwork module from kde CVS. The kslideshow.kss source is in more or less contained in slideshow.cpp. Highly undocumented with quite short variable names; still it didnt take long to understand how the various effects were implemented.

Ended up after adding three effects (also removed the lines which randomly chose transitions - I fixed it to only one specific transition).

1. Added a different form of vertical lines transition that was fading. Currently I use this transition for kslideshow.

2. Added a true fading transition by adding alpha transparency to the previous image and adding alpha opacity to the next image, in small steps. A bit of qimage and qpixmap manipulation. Soon came to realize that manipulation alpha on a qpixmap requires visiting every pixel and manually adding alpha value. Boohoo... cant just set a transparent qbrush and paint the image with that brush. Optimistic me is waiting for Qt 4.0 which has transparent qbrush and qpen - giving the much sought after effect of transparent drawing. Anyway, visiting every pixel to change the alpha (found that I need to change alpha in steps of 8 from 0 to 255 to achieve smooth blending) is a bit too much (even on my modest 1024x768 desktop). The effect is cool but unusable due to high CPU usage. OpenGL based texture manipulations or smarter way of adding alpha to a few pixels at a time might give better performance. I will have a better idea when I fund out how xscreensaver-gl looks like.

3. Added a sweeping fading separator between the two images. Nothing great. I was just trying to see how I can get away by manipulating only a few pixels at a time.

I had in mind to change the kslideshow configuration to allow the user to choose which transition(s) he/she wanted. But now I dont feel like doing it - lets wait for Qt 4 when the alpha blending can be actually used.

- d.

Tuesday, April 5, 2005


While writing C-code, I frequently needed some local variable to temporarily store some value or create arrays with size fixed at runtime (not using malloc). The dirty workaround I used was the scope trick.

void f() {
int b,c;
/* large code segment */

int temp = somefunction(b);
/* avoiding calling somefuntion multiple times */
c = (temp > 0 ? temp : anotherfunction(temp));

Recently I was debugging some code where I saw a variable declaration in the middle of a scope (illegal in C89) but compiling perfectly with gcc3.4. That led me to C99. C99 has a lot of improvements - making life a lot easier for the programmers. For more, check the standards or look here. Just a side note, gcc 3.x supports C99 to some extent. To see the difference between the two standards, compile using gcc -std=c89 -pedantic file.c.

- d.