Saturday, December 27, 2008

First flight

I went paragliding again last week, to finish my Elementary Pilot course. I had my first solo flight from a height of 45m on 24th Dec 2008. It was an exhilarating feeling, although short. After 3 days of solo top to bottoms, I now have 15 min of total air time. I'll put up the pictures soon. The sight is Shinde Wadi, around 125km from Mumbai.






I also had great fun at the Native Place, home to Nirvana Adventures. Hoping to go back in May and make progress towards Club Pilot.

Monday, December 01, 2008

Filtering QTreeView

While working on my newest project, I had a miserable time figuring out how to filter sub-items in QTreeView and its associated models (like in kopete/pidgin). The first thing to do is to use QSortFilterProxy as a middleman. The problem is that QSortFilterProxy will only search top level tree nodes.
The way to implement custom filters is to subclass QSortFilterProxy and reimplement filterAcceptsRow(). But I couldn't figure out any way to quickly access sub elements using QModelIndex, nor could I find anything on the 'net. So after quite a lot of fiddling around, I managed to get this, which works. So to save someone else some time, here is the code



bool MemberFilter::filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const
{
if( sourceParent.isValid() && sourceModel()->data(sourceParent).toString().contains(filterRegExp()) ) return true;

QString data = sourceModel()->data(sourceModel()->index(sourceRow, 0, sourceParent)).toString();

bool ret = data.contains(filterRegExp());

QModelIndex subIndex = sourceModel()->index(sourceRow, 0, sourceParent);
if( subIndex.isValid() )
{
for(int i = 0; i < sourceModel()->rowCount(subIndex); ++i)
{
ret = ret || filterAcceptsRow(i, subIndex);
}
}
return ret;
}



On a side note, this has been a post after a long long time. This is because I've decided only to post important things or code related stuff. Right now I finished one semester of college, and will be home for a month.

Monday, October 27, 2008

Installing Arch linux on the HP DV6910TX

This is a record of my attempt to put Arch (2008.06 Core Dump) on the HP DV6910TX.
Here is my system configuration
  • Intel Core 2 Duo T5750 @ 2.00GHz
  • Ram : 3GB
  • Nvidia GeForce 8400M GS with 256Mb dedicated memory
  • 320Gb harddisk

Partitioning



Here was my original partitioning scheme:
  • C: 308Gb
  • D: (Recovery) ~10Gb
Make sure you create your HP Recovery Discs first!

Since the arch install CD doesn't have ntfsprogs ( it has the packages, but not as part of the setup boot ), I booted from dreamlinux (you can use any liveCD) and used ntfsresize to shrink the C: (/dev/sda1) to 35Gb.

Then I used gparted to create a proper partition layout. Here is how it goes
  • /dev/sda1 - ntfs - 35Gb (C:)
  • /dev/sda2 - ntfs - 10Gb (D:)
  • /dev/sda3 - swap - 4Gb ( to hibernate, you need atleast as much swap as your RAM )
  • /dev/sda4 - extended
  • --- /dev/sda5 - ext3 - 20Gb (/)
  • --- /dev/sda6 - ext3 - 50Gb (/home)
  • --- /dev/sda7 - ntfs - 180Gb (/shared)
After committing these changes I began the installation.

The rest of the settings were normal Arch installation procedures, which can be found elsewhere.

Hardware



Display


The dv6910tx has an nVidia 8400M GS with 256Mb of dedicated memory. Installing the nvidia drivers ( pacman -S nvidia nvidia-utils ) and running nvidia-xconfig generated the required xorg.conf, and the card worked perfectly.

Touchpad


Installing the synaptics package and merging the required changes into xorg.conf ensured that the touchpad worked too, including scroll areas and locking.

CD/DVD drive


Works perfectly without any configuration.

Ethernet


Arch correctly used the r8169 driver

Wifi


Arch was able to identify the card, but there is no hotspot here to test the connection.

Card reader


The 6910 has a 5-in-1 reader from Ricoh. But I could test only for SD cards.

Firewire


Detected fine,, but no device to test.

Power management


Installing Guidance (pacman -S guidance-power-manager) will allow you to quickly view battery performance and perform suspend or hibernate ( I'm using pm-utils ).
To enable different power modes ( governors ), install cpufreq and follow the Arch Wiki Page on CPUfreq.

A special entry has to be made to mount/unmount NTFS partitions. Put the following in /etc/pm/sleep.d/66ntfs:


#!/bin/bash

MOUNTS="/windows/C /shared"

function 66ntfsmount() {
for i in $MOUNTS
do
mount $i
done
}

function 66ntfsumount() {
for i in $MOUNTS
do
umount $i
done
}

case $1 in
hibernate)
66ntfsumount
;;
suspend)
66ntfsumount
;;

thaw)
66ntfsmount
;;
resume)
66ntfsmount
;;
*)
echo "BAD!"
;;
esac



Now make it executable ( chmod +x /etc/pm/sleep.d/66ntfs ).

Webcam


Not tested yet.

NTFS partitions


I installed ntfsprogs and used the fuse.ntfs system to mount ntfs in userspace as read and write. Here are the additions to /etc/fstab


UUID=... /windows/D fuse.ntfs defaults 0 0
UUID=... /windows/C fuse.ntfs defaults 0 0
UUID=... /shared fuse.ntfs defaults 0 0

NOTE: The arch shutdown scripts kill the fuse ntfs system rather than unmounting the drives. To fix this issue edit /etc/rc.local.shutdown and insert the following:



. /etc/rc.conf
. /etc/rc.d/functions

# Unmount NTFS partitions
stat_busy "Unmounting NTFS partitions"
umount /shared
umount /windows/C
umount /windows/D
stat_done

Bluetooth


Device detected. I could scan for my cell phone, but I've yet to figure out how to exchange files.

Hotkeys


If you use KDE4, go to System Settings -> Regional and Language -> Keyboard Layout. Enable keyboard layouts and change the keyboard model to Hewlett-Packard Pavilion ZT11xx. All the keys EXCEPT Quickplay and DVD work after that. The mute key does not turn red, but it does work. Of course it is your job to actually configure application shortcuts to use the keys.

Remote


The volume keys respond. Other keys should be configured to work with the respective applications using application specific settings.

Tuesday, September 30, 2008

Random Ramblings

Sorry for not blogging in a long time. This has been a very busy week, and so I'm just going to drop some snippets.

First RMS and Larry Ellison both commented against cloud computing.

Graffiti is uploaded and ready to use ( but not necessarily stable ).

I read Snow Crash and >loved it.

I'm confused between getting a Dell Studio 15 and HP Pavilion dv6767tx.

Meanwhile I'll be leaving for Pune tomorrow for SUMMIT '08 at MIT Pune. This is a sports fest, and I'm proud to be the only first year in the football team. This is the first time I'll be playing football as part of an official team with jerseys ( no. 2 ) and all, so it will be fun.

I'll be back on the 5th after which I will probably start with a new project. Right now I'm thinking of something like hyperlink visualizations, though I've no idea how to accomplish this.

Sunday, September 14, 2008

Graffiti is almost released


Aside from some code cleanup, testing, and writing architecture documentation, Graffiti is good to go. You can Download it

Wednesday, August 27, 2008

Reworked Graffiti's first render


After quite a few weeks of work, Graffiti has (again) reached the stage where it can render it's first words. It's now at 488 lines of code, of which the CSS related stuff itself comes in at 288 lines! There is no word wrapping yet, or any layout logic. I've been busy fixing quite a few bugs in the CSS overlays and so on.

This is how you would use it.



import pygame
from pygame.locals import *

import graffiti as g # 1

pygame.init()

g.init() # 2

pygame.display.set_caption('Graffiti Render Test')

screen = pygame.display.set_mode((800, 600))
screen.fill((0, 0, 0))

page = g.page.Page('<body><p>Testing Graffiti</p></body>') # 3

page.render.on(screen) # 4

while True:
for event in pygame.event.get():
if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
pygame.quit()
sys.exit(0)

pygame.display.update()


Sunday, August 17, 2008

Nikhil meet Archlinux and KDE4



I've been home (Mumbai) this weekend and have been hacking away for the last two days to get Arch running on my external HDD, since I can't stand Mandriva anymore. The cool thing about Arch and Pacman is their flexibility. Following this guide I was able to install Arch from within my internal hdd arch, and have all the latest packages (including KDE 4.1).

There was only one problem which wasn't mentioned. External HDDs require usb support in the initrd which is not done in Arch by default. So before rebooting just edit /etc/mkinitcpio.conf and add "usb" to the line HOOKS="base udev …". Then remake the initrd using "mkinitcpio -g /boot/kernel26.img".

I must say I'm pretty impressed with KDE 4.1. There are still a few rough edges like the khotkeys keyboard shortcuts not working and some KWin effects not exactly doing anything. But overall a great effort.