Posted in July 17, 2009 ¬ 4:15 pmh.theDigitalAngel
In a few hours I will be leaving for Kharagpur, after spending a vacation of about two and a half months back here in beautiful Dehradoon valley. Before you continue please understand that this is more like a note to myself than anything else. Nevertheless, you are welcome to read ahead. As I was leaving Kharagpur I resolved to make these ninety odd days as fruitful as possible. And even though nothing is ever perfect I like to think I have succeeded in this to some measurable extent. Some stuff I started during the vacations is not yet complete – I intent to keep working on those specific goals once I reach Kharagpur and get settled in my new hall.
-
The Digital Circle
-
For various reasons I ended up writing up a lot of code in Java. Though no self respecting geek will consider writing code in Java a worthy pastime, I ended up learning a lot. The last time I coded in Java was a around three years back and now I discovered I could things with Java I previously could not. Specifically I ended up knowing a lot about the Android platform – well, enough to judge how crappy it really is.
-
I set up this very blog. For the record currently the blog is hosted on a free hosting provider (http://www.000space.com) and the domain name was bought from http://www.dynonames.com. I’ve also, very recently, set up Google Apps on my domain – now I have a really neat webmail interface at http://mail.playingwithpointers.com.
-
I am having a go at hacking the Linux kernel. Though I am nowhere near to writing full-fledged kernel driver modules or debugging kernel panics, I have learnt quite a few things. Currently I am following ‘Linux Device Drivers’ by Colbert, Rubini and Greg and ‘Linux Kernel Development’ by Robert Love. I know I still have a long long way to go but I know I’m getting somewhere (I know basic stuff about how the kernel memory paging, process management – how the scheduler works, writing a basic driver) and will continue to put in my best efforts.
-
Learned miscellaneous stuff about GNU/Linux – things ranging from some basic GNU utilities present in a typical distribution to licensing and patenting issues.
The Offliners
-
After two months of debating with so called logical theists I am finally a firm atheist. After a lot of thinking I’ve finally figured out exactly why theism does not make sense. Will probably write more on this in a later post.
-
Connected with a few of my old friends. Though I could not connect as much as I wished I could, but I did have fun.
-
Worked out big time. I hit the gym everyday for the past ninety days and lifted weights like an ox.
-
Tried to learn up new things as much as possible – looked up Wikipedia for every small thing that struck my curiosity.
-
Rediscovered coffee – I’ve already dedicated a post to this topic I think.
Posted in July 17, 2009 ¬ 11:14 amh.theDigitalAngel

My Desktop with AWN
I generally stay away from the my-desktop-is-flashy-so-what-if-it-eats-CPU crowd but I seem to have met my match. Day before yesterday I installed The Avant Window Manager. Currently I am running AWN on top of XFCE. I’ve removed the XFCE panel and now all I have is the AWN running at the bottom of my screen.

The AWN Popup Terminal
I absolutely love the popup terminal applet that comes with AWN. Though it is difficult to comment on how long I will find AWN as interesting as I find it now but, as they say, so far so good.
Posted in July 10, 2009 ¬ 3:57 amh.theDigitalAngel
I recently upgraded my boot-loader to GNU GRUB 2. It has several new interesting features which sets it apart it from the older version, now termed GRUB Legacy
Another reason for my upgrade to GNU GRUB 2 was that GRUB legacy it no longer being under active development – no new features will be added to it, ever. The GNU website cites messy code as the primary reason for this decision. GRUB 2, as of now, is relatively stable and will probably run properly on your system unless you happen to have a really weird configuration.
On a typical Arch GNU/Linux system a simple sudo pacman -S grub2 will do the job. The sweet little package manager actually will tell you about the new grub2 package conflicting with the older grub package and will offer to remove the older package for you.
One very important difference between GRUB Legacy and GRUB 2 is the configuration file – instead of /boot/grub/menu.lst the configuration file is stored at /boot/grub/grub.cfg. The format is also very different, a sample grub.cfg would look like
# Timeout for menu
set timeout=10
# Set default boot entry as Entry 0
set default=0
# Entry 0 - Load Linux kernel
menuentry "My Linux Kernel on (hd0,1)" {
set root=(hd0,1)
linux /vmlinuz root=/dev/hda1
initrd /initrd
}
# Entry 1 - Chainload another bootloader
menuentry "Chainload my OS" {
set root=(hd0,3)
chainloader +1
}
The numbering of the hard drives is also different – what was (hd0,8) on my system with GRUB legacy is now (hd0,9).
Coming to the more interesting stuff – you have the option of setting the font for the GRUB interface. You need to convert your fonts to the pf2 format before you can use them. GRUB 2 provides an utility for this conversion – grub-mkfont. I tried converting my favorite Monaco from ttf to pf2 but the menu seems not to like the height of the font – I probably need to pass some extra parameters to grub-mkfont, will work that out later. If your graphics card is currently supported you can actually display a high-resolution GNU menu and maybe even a nice background image (not those 14 color pictures supported by GRUB legacy but a proper JPEG or TGA image). You can do all this by something like the following:
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode="1024x768"
insmod gfxterm
insmod vbe
terminal_output gfxterm
if terminal_output gfxterm; then true ; else
terminal gfxterm
fi
fi
insmod tga
background_image /boot/grub/GrubSplash.tga
Overall the GNU GRUB 2 gives a nice feeling, it is stable on my Acer Aspire 4720z and when I boot up I get a nice 1024×768 background image (it is still unable to display a 1280×800 native resolution) and a nice and smooth font. The new GRUB is also slightly slower – you might notice a slight latency as the bootloader loads itself. In short, the new GRUB looks very promising and coupled with things like scripting support and real memory management one can guess how interesting the future will be.
Posted in July 7, 2009 ¬ 12:40 amh.theDigitalAngel
Guess what I just realized? Passive resistance is to ahimsa what open-source is to free software. The analogy just fits.
Posted in July 1, 2009 ¬ 4:30 pmh.theDigitalAngel
Here’s an interesting error I got while compiling C++ code during a TopCoder SRM.
LongStraightRoad.cc:43: error: no match for ‘operator==’ in ‘dist. std::map<_Key, _Tp, _Compare, _Alloc>::find [with _Key = std::basic_string, std::allocator >, _Tp = double, _Compare = std::less, std::allocator > >, _Alloc = std::allocator, std::allocator >, double> >](((const std::basic_string, std::allocator >&)((const std::basic_string, std::allocator >*)(& dest)))) == std::map<_Key, _Tp, _Compare, _Alloc>::end [with _Key = std::basic_string, std::allocator >, _Tp = double, _Compare = std::less, std::allocator > >, _Alloc = std::allocator, std::allocator >, double> >]
PS: As far as I know the new C++0x will do away with such cryptic template error messages
Posted in June 29, 2009 ¬ 6:30 pmh.theDigitalAngel
I have been using XFCE for around a month. Yesterday I tried installing gnome-do. The installation was successful but on running gnome-do I kept getting an 'Unable to open the session message bus.' error on my terminal. Today, after installing Banshee I faced the same problem.
Googling did not help – possibly because XFCE users do not user Mono applications much. After a little hit and trial I figured out that the problem could be solved by launching mono applications as dbus-launch <application-name>. So to start gnome-do you type dbus-launch gnome-do.
PS: The Super + Space combination does not seem to work either – I’ve changed it to <Alt><Ctrl>Z.
Posted in June 29, 2009 ¬ 12:51 pmh.theDigitalAngel
This month in Dehradoon I rekindled an old flame. Coffee.
The truth is that I find it difficult to get decent coffee inside the campus of IIT Kharagpur (at least when you live in the Madan Mohan Malviya Hall of Residence). You are either stuck with some weird synthetic high-sugar stuff handed to you by the Nescafe guys (not to mention the paper cups) or have to carry your ass to the Veggies / Eggies restaurant to sit about fifteen minutes for something slightly less shitty. And I, trust me, do not want to get started on the detergent-smelling coffee we were served inside the MMM mess.
As a coffee freak, the mug is as important to me as the coffee. I (naturally) prefer a large mug, in earth colors. Right now I am sipping from a beautiful hand-painted light-brown mug I picked up a year and a half ago from a national trader’s fair thing in Dehradoon. I actually carried this thing to Kharagpur – too bad I never got to use it!
As far as the brew is concerned I love the plain Nescafe (this is not an advertisement, I am just voicing my personal opinions). And by plain I mean plain, not fuckin 30 % chicory bullshit. And I like it strong, about one heaped tablespoon per cup.
I have learned a lot in my one year stint in Kharagpur – not take-notes-in-the-classroom learning but download-video-lectures-from-dc-and-actually-make-some-good-use-of-the-internet learning. But now I sit in front of my terminal, listening to Dylan and Rammstein (I know I’m weird), sipping an unusually strong brew of coffee, my legs completely sore from today’s workout, typing code (well not exactly, but that’s what I was doing few minutes ago) I feel myself reconnecting with a part of me which I had lost – a part of myself I had abandoned. That will not happen again. I will not let that happen again.
There! My first non-technical post.
Posted in June 22, 2009 ¬ 6:23 amh.theDigitalAngel
I finally did it! Now my root partition is, instead of a boring old ext3 a shiny new JFS parition.
The very first thing I did was build a new kernel with JFS support compiled into it. While configuring the kernel I also selected the deadline IO scheduler as the default scheduler since it tends to extract the best performance out of a JFS partition. Then I installed the new kernel. Now I needed some way to convert the existing root partition (in the device /dev/sda9) from ext3 to JFS. Since even after having installed every program I need (and two and a half desktop environments) the total size of the partition was a meager 9 GiB (compare that to a fresh installation of Windows Vista) this had a simple and safe solution – simply backup and restore the files. One nice automated way is to use some software like CloneZilla. I, however, like doing things my way. I burned an Arch Linux installation CD and started up my notebook from it.
The best part about the Arch Linux install live CD is that after booting up it gives you a very clean, no-frills bash environment to work on. Once I was up and running I did a simple mkdir /media/root and mounted the partition onto the new directory by mount /dev/sda9 /media/root. Since I was logged in as root I really did not need to use sudo or su. I also needed another partition with space to spare. I used /dev/sda5 – an ntfs partition. I mounted it by mkdir /media/backup and then mount -t ntfs-3g /dev/sda5 /media/backup. Instead of simply copying the data from /media/root to /media/backup I used TAR – cd /media/root; tar cvf * /media/backup/everything.tar. This actually sped up the process a little (or so I though) since it prevented the ntfs-3g driver from wasting time by allocating space for the tens of thousands of files. The entire thing took about twenty minutes to complete.
That done I unmounted the partition – umount /media/root and ran mkfs.jfs /dev/sda9. This warned me about losing all data and then converted the partition. The conversion, surprisingly, took only about a second or two.
Now it was time to restore the files again – I mounted the partition again using mount /dev/sda9 /media/root and extracted the tar files – cd /media/root; tar xvf /media/backup/everything.tar. Then I installed GRUB using grub-install. I restarted my system only to find the kernel unable to boot.
A little probing showed what was wrong – while initially installing Arch Linux the installer had configured my GRUB’s menu.lst to recognize my disk using its UUID. The reformatting some reset the UUID of my partitions (I really do not know how or why). I fixed that by changing the /by-uuid thingode>/dev/sda9. I know, I know - this was not the right way but it did work and I saved a lot of time. I had to fix /etc/fsatb for the same reason.
So now my computer boots faster, applications load without eating too much CPU and the system is more responsive overall.
Posted in June 19, 2009 ¬ 4:33 amh.theDigitalAngel
The i915 driver for the Intel GM965 is broken in kernel 2.6.30 – instead of getting 1280×800 framebuffer console you end up getting up getting 1024×768. Please note that the (overall) resolution is perfectly fine – only the text will appear to remain constrained in an imaginary 1024×768 box. This happens at least in Acer 4720z and probably in other boxes too which use the GM965 and have a TV out. What really happens is that the kernel mistakenly detects a projector connected to the TV-OUT even though there is none and sets the framebuffer resolution to 1024×768. This is evident from the output of dmesg –
...
[drm] TV-12: set mode 1024x768 18
...
This is especially annoying for people like me who
Like to use the console for things that do not require starting up X.org
Have painstakingly created a boot-logo which the wrong resolution is ruining.
Want every aspect of their computers to be flawless.
All the while I was trying to google with terms like “wrong resolution” and “changing the framebuffer resolution” only to find the forums invariably advising me to add vga=773 to the kernel boot line – something I knew would not work.
Anyways after googling with the above dmesg line I finally came across a patch which supposedly fixes the problem. When I tried to patch my kernel, however I got two failed hunks. So I tried to use my own hunking abilities and fired up my trusted vim.
To cut a long story short, the culprit is drivers/gpu/drm/i915/intel_display.c and you can download an edited version here. Just replace the file, re-compile and you are ready to go.
Posted in June 15, 2009 ¬ 3:27 amh.theDigitalAngel
I just discovered a new companion (no, not an iPod), but the MPD – Music Player Daemon. This is the probably the first time I am feeling truly satisfied about my music player.
The MPD runs as a service. It binds to a port on your computer (6600 by default). Once you have the MPD up and running (you need to edit mpd.conf for one thing) you need to install (or write yourself) additional client software which talks to the daemon. Once such program is mpc.
mpc is essentially a console program. You need to set the MPD_HOST and MPD_PORT environmental before you start using it (unless you’ve really left everything to the defaults). So to first scan the directory you’ve set in mpd.conf as the root of music you need to run mpc update. This fetches the file names and the id3 tags to create a media library. Then you can search by running mpc search ANY some_term (hint – read the man-pages) to get a list of the songs which have some_term in any field. You may specifically search in the author field, in the title field among other things.
You run mpc add to add music to the playlist, mpc play to start playing it, mpc next to move to the next song and so on …
I have not tried this but it seems that in case you are on a network anyone on the network may stream music from your MPD server. However you do have access control – you may set a password and not allow the users who do not authenticate themselves with the password to, say, change the song. It is also reportedly easy to hook this up with IceCast to broadcast over HTTP.