Monthly Archive for March, 2010

Tra-la-la-laa

On my way back from work this evening, I was stuck in traffic on the Inner Ring Road. It was then that I heard a humming and distinct singing. Looking around for the source, I realised that it was the guy riding on a bike beside me singing some gult songs. And he made no efforts to keep the volume down.

I might have initially scoffed at the guy. But once the traffic got moving, I gave singing a try. Anyone who has heard me sing, with some background music, will testify that it’s a torture. Caring little for anyone listening to me, I started to sing loudly while riding the bike.

And I must accept, it was quite a pleasant feeling. It felt good. I am going to do this every day from now on. :D

Popularity: 7% [?]

Ubuntu Lucid: Upgrading To Lynx In Virtualbox

I have Virtualbox 3.1.4 r57640 installed on Windows XP as the host, Ubuntu 9.10 as the guest. And since the ubuntu is not being used as an active development currently, I decided to upgrade it to Ubuntu 10.04 Beta 1. Having read a lot of positive reviews for Lucid Lynx, I wanted to try it out as soon as possible.

The upgrade took more than a couple of hours. It downloaded a GB of package data from repositories, and then took 90 minutes to setup the new system. Usually my ubuntu upgrades have been quite a painful process, having to manually configure a few things and set another few right. But then these things are to be expected if you always jump the ship in the Beta mode.

Immediately upon restart I was faced with my first problem. The xserver failed to load and instead threw a dialog box saying it was switching to low graphics mode for the session. I let it do so. Logging in into the system, as usual, my VirtualBox addons needed re-installation. But even that did not solve the problem. The same error popped up again upon restart. Also, my mouse integration did not work.

The first problem was occurring due to the new kernal 2.6.32-16-generic. Looking up in the forums, I found that virtualbox will incorporated the fix in their next maintenance release. However, one could apply the patch manually. It required modifying the file:

/usr/src/vboxvideo-3.1.4/vboxvideo_drm.c

The fix is r27248. You can read up about the ticket here.

To get the cursor integration working, we need to create xorg.conf. Ubuntu has done away with xorg and are using hal now. I could not clearly understand the reason behind the problem, but re-creating the xorg.conf file does the trick. Here is the forum where this issue has been discussed:

Cursor Control in Ubuntu 10.04

I do not seem to be having any more issues. I’ll keep consolidating any issues I run into and how to fix them so that I don’t have to google them up every time.

Popularity: 42% [?]

Amarok 2.3.0 “Clear Light” Is Beautiful

The latest edition of Amarok is too good. I was using 2.2.0 prior to this one. The new amarok has a couple of features which makes the experience even more enriching.

The 2.3.0 sees a new toolbar. The left edge has pause or play button, the right end has a sound control and the remaining width is made up of the progress bar. Above the progress bar in the middle is shown the details of the song being played currently. To either side of it are songs before/after this one, serving the purpose of jumping to next/previous song. The beauty of this design is that if you unlock your layout, remove the media sources, playlist and context panels, then you are only left with the toolbar. Resize the window to cover just the space needed for the toolbar. Now you have got an ipod like player. Flick above the progress bar to go to the next/previous song. This is one cool feature. You can have a look at it from this video:

Amarok New Toolbar In Action

Another feature I liked was the bookmarking of timeline for a given song. If there is an awesome guitar solo that you like in a particular song, you can bookmark that point and play it from there whenever you want to. This feature has been in Amarok for quite a while now.

But installing Amarok 2.3.0 in Ubuntu needed more than just apt-get install amarok. The default amarok package available in the Ubuntu 9.10 repositories is that of 2.2.0. To install 2.3.0 you need to follow the steps mentioned here:

Installing Amarok 2.3.0 in Ubuntu

But there was a problem with the installation on my computer. The application would crash every time I opened it. The application would just not start up. A few searches and I found that the info applet was causing the application to crash because of some fault with qt [read this comment]. The simplest solution is to remove the info applet. To do that, open the ~/.kde/share/config/amarok_homerc file and remove the info applet from plugins. The application should start now.

Another problem I encountered was that my local collections was not being displayed or stored. It would scan the files alright, but then it would not add them to the collections list. And if you do not have the collection added to amarok, it takes away half the fun. You need them for dynamic playlist and all.

Again googling around and I found the solution. Here is the link to the forum where this topic has been discussed:

Amarok Not Recognizing Media

For me just installing the below mentioned packages did the trick:

libhtml-template-perl (2.9-1)
mysql-server (5.1.41-3ubuntu6)
mysql-server-5.1 (5.1.41-3ubuntu6)
mysql-server-core-5.1 (5.1.41-3ubuntu6)

Well, I have my Amarok 2.3.0 running now, and am liking it already. Yay !!

But a couple of things are not working for me. They are:

  • I am not getting the mood toolbar even though I have enabled it from the options.
  • I have enabled the display tooltip for songs options, but do not see the tooltip song description.

Popularity: 42% [?]

F1 2010: Bahrain GP – The Most Soporific Race Ever

For all its pre-season hype, the excitement of having 4 champions on track, the eagerness to get a competitive Ferrari back on tract, the season opener couldn’t be a more boring car procession.The front runners, the ones having the fastest cars, just followed each other around the track completing the mandatory 49 laps without trying any overtaking maneuver. And the new regulation of fueling ban ensured that the nothing exciting could even happen during the pit stops.

The qualifying was the first to signal that something is not right. Until the last year, Q2 used to see the cars go zoom-broom at top speeds. Then the Masters of Strategy would work out a fuel strategy to give their drivers the best shot at glory. This did mean that slower cars could end up in front of faster ones, but at least it did mix the grid up a bit, and then the pit stops would become interesting. The new format of having no fuel strategy for Q2 and Q3 somehow reduced the charm of Q3. And when Vettel set the fastest Q2 lap, it was only a matter of wait and watch to see Vettel do it again in Q3. After all, there is no change in the car from Q2 to Q3. So the result of Q2 and Q3 should be the same, unless of course one of our drivers gets nervous and commits a mistake, something we saw Webber do. Or else if you were foolish enough like Adrian Sutil to be the only driver running on Hard than the Super Softs which the remaining 9 had chosen.

After qualifying we knew who the fastest guy was – Vettel. We also knew that Alonso and Massa were strong. But when everybody starts the race with the same amount of fuel, and when you expect everybody to come into the pits at almost the same time, and when you already know that to overtake the car in front you need to be 2-3 seconds faster which you are not, then where the hell did FIA see an opportunity for the drivers to overtake one another?

Another impact of removing refueling was that drivers chose to dive into pits only once, and play it safe on the track to conserve their tires.

For all the talk about reducing cost associated with getting a team ready for a race, and lessening the impact of machinery on race result, FIA has made the race day boring. Perhaps it were the slow corners of Bahrain which wasn’t the ideal place to judge the new regulations, or perhaps I was expecting just too much, but I wasn’t impressed with the show. If the same repeats for a few more races, F1 might face an even greater scare than all the scams, match-fixing and recession of the past couple of years. With a dwindling fan base, they need to do a quick rethinking.

Congrats to Alonso and Schumacher. Is this the beginning of the end of Schumacher – Ferrari legacy? Will Alonso become the next Schumacher of Ferrari? I certainly hope so. And I think the next season will once again be Schumacher vs. Alonso – one last time, and I will put my bet on Schumacher to walk away with the title. That would most certainly be a fairy tale end to a great illustrious career.

Popularity: 6% [?]

My First Bike Accident – Claustrophobia

This occurred a long long time ago. It was before Dussera of 2009. Yet I still remember that moment quite vividly. We were riding from Bangalore to Ooty, almost 300kms long stretch. Having started in morning at around 9, it had become evening when we entered the Madhumalai forest. Immediately after the forest we would get to the steep hairpin bends and reach Ooty.

The accident occurred in the Madhumalai forest. To go to Ooty you need to take a left at a point inside the Bandipur National Park. Immediately after taking the left turn, the road narrowed. I was driving and my brother was the pillion rider. He immediately pointed out that perhaps I was going fast for such a narrow road which had low visibility at corners and turns. I ignored his opinion – something I rue till this day.

It was at a blind turn. The road turned sharply right and I had no way of knowing what was coming towards me from the other side. I turned right to see a Sumo come right towards me. I panicked and tried to steer my bike away from the Sumo’s path. But being a narrow I ran out of road width and skid at the edge where the ground was at a lower level to the road. Instantly the bike tilted to my right and I could not control it. Both of us skid along with the bike.

My first reaction was to check if my brother was harmed. Bike mattered the least to me then.  And how glad was I to know that he was unharmed. Luckily, both of us had escaped with minor bruises. Had it been any major accident, help would have been tough to get.

The more I think of that day, the more I become sure of the reason I think caused the accident. Ridiculous or stupid it might sound, but the reason is that I am claustrophobic. I panicked because I ran out of space, and it scared me. This was the only reason why I lost control of my bike while driving at a modest speed of 40 kmph. All my analysis and logic interpretation of the situation points to that only one possible answer.

My being claustrophobic was pointed out by Rohit Mahapatra. I have tested this theory for correctness.   And I am sad to accept that I am actually claustrophobic. I am always reluctant of squeezing my way through two SUV’s or larger vehicles. I feel uncomfortable when I enter the lift of small apartments, the ones having very little space inside the lift. I sleep with my head towards the corridor when traveling in a train.

But now that I have accepted that I am claustrophobic, I try to be more careful while driving. However, I would like to solve this problem from root. I would like to get rid of my claustrophobia. I know it’s just psychological. And if it is something wrong with my brain, I would like to train to think it otherwise. So here’s a realistic mission for myself – get rid of my claustrophobia.

Popularity: 13% [?]

F1 2010: New Season, New Expectations

I have been watching F1 regularly since 2006 and this is the first time that 4 world champions will be on the grid at the same time! No wonder I am so excited and eager to get the season started. My ears have tired of waiting to hear the commentator say – “And the Bahrain GP is GO“. And just like the millions of fans across the globe, I too have lots of expectations from this season after the boring last one.

What makes the 2010 season fantastic is the return of God of Racing – Michael Schumacher. The seven time world champion is desperate to get started again. His enthusiasm shows his want for F1 racing again after a break of 3 years. And who better to have as team principal than Ross Brawn. The duo have won seven championships. I don’t care if it is not Ferrari they represent now. Schumacher is great at developing the car, and I am sure that if not this season then the next one will definitely be his.

The pre season testing for Brawn has not been as awesome as last years. The last year they had the fastest car and it showed right from the first lap of testing. This year though Brawn has accepted that they might be slightly off the pace. In the longer runs Mercedes car has managed to show consistency and speed, but it is with the lower levels of fuels that they are not sure about. The other cars seems to be quicker than Mercedes when running on fumes.

Speculations and rumors though refuse to die down around Brawn and Schumacher. Apparently Brawn has declared that they have a piece of technology which did not require testing and to design it they went till the limit of rules. Obviously reporters have been buzzing about the possibility of a new design of diffuser which would boost the performance of their car by a second or two per lap. And if this turns out to be true, then the championship is already Michael’s.

The testing though showed Ferrari to be the pick of the lot. They have got the pace to challenge for the championship. And Alonso is a shrewd driver. He is just as good in developing his car and extracting that last bit of performance. People have already tipped him to be clear favorite for drivers title. I just want to see Alonso and Michael battle it all out just the way they used to earlier. I just cannot make up my mind who to support – Michael or the team I have always liked, Ferrari. Michael was the reason I started watching F1, and Ferrari the reason I continued watching it after Michael left. Picking one is tough.

The return of Massa after the tragic accident is being highlighted too. He was quick during the practice sessions. But how competitive he will be compared to Alonso is doubtful. Alonso might perhaps carve out a place for himself just like Schumacher did. Alonso has already declared that he would like Ferrari to be his team when he retires. Also Luca Montezemolo has declared that all great drivers ultimately end up at Ferrari. I think if it comes to choosing between Alonso and Massa, Ferrari might prefer Alonso.

A lot of focus is being put on Hamilton and Button. I am given to understand that the Hamilton-Alonso saga, which nearly destroyed the McLaren team a couple of years ago, has been a valuable lesson for the team in management of resources. However the Hamilton-Kovaleinen partnership suggests otherwise. McLaren has been Hamiltons’ team and I think it will continue to be his. A few measure like shuffling of staff has been made to make Button happy regarding equality of driver, but pretty soon Button will realise that perhaps it was not for nothing that Alonso cribbed so much while at McLaren. How soon will trouble emerge could be an interesting bet.

But the most promising rising star on the grid has been Seb Vettel. The German has won lots of accolades for his driving in the wet. The last season with Red Bull, he did mount a serious challenge to the championship despite his car not having the double diffuser. Horner is a great designer of car, and it was mostly his ability that pushed RBR to the front. This year they have gone a step forward. With refuelling banned for the races, pit stops shall only have a change of tires, adjustments to the wing and a few minor changes if required. RBR has gone on record saying their pit crew has worked hard the whole winter and they have come up with a modified methodology which enables them to complete the pit stop in less than 2 seconds. Less than 2 seconds !!! You got to be kidding me. Thats lightening quick.

Last but not the least, with Max Mosely gone, politics should see a drastic reduction. Jean Todt is more than able person to be replacing him. A joke I read somewhere -

What could be the worst thing that Jean Todt does in the first year of his office?

Cry his tears out when Schumacher wins his first race.

Popularity: 9% [?]

Svn Repository Backup

Ever since I started using svn I have found it an indispensable tool. I have created a local repository on my hard disk and all my personal projects are using this repository. And having had lots of hard disk crashes last year, I fear for the loss of my code files. So, I thought about a regular backup system.

I also have Ubuntu installed as a virtual machine. And Ubuntu has this Ubuntu One feature, which gives you a 2gb space online. So I went ahead to backup my repository to this space.

I have my repository mounted in Ubuntu at /mnt/WinRepository. The following script takes a dump of the repository:

svnadmin dump /mnt/WinRepository --incremental > ~/Ubuntu\ One/WinRepo.bak

The advantage of using incremental option is that I can specify revision range to be backed up into different files.

svnadmin dump /mnt/WinRepository --revision 0:100 > ~/Ubuntu\ One/WinRepo1.bak
svnadmin dump /mnt/WinRepository --revision 101:200 --incremental > ~/Ubuntu\ One/WinRepo2.bak
svnadmin dump /mnt/WinRepository --revision 201:HEAD --incremental > ~/Ubuntu\ One/WinRepo3.bak

And since the files are being saved in Ubuntu One folder, they get automatically backed up to the Ubuntu One online space.

This does not compress the files. But since I have 2 gb of space available, I am not really concerned about space.

Popularity: 9% [?]

Parsing XML With Castor XML

After lot of trying I finally managed to get Castor tools working to parse XML files. And now that I have it working for me, I am always going to use it for XML parsing. It makes things so much simpler and easier.

Castor takes in a xml file and unmarshals it into Java objects. There are three ways to associate Java Classes with XML elements.

  • The first one is introspection. Given the class to the Unmarshelar, Castor populates the instance fields from XML.
  • The second is to use bindings defined by user.
  • The third is to use the XML Code Generator tool and have it generate Java Classes.

Of course, I used the third option, and that is the one I am going to mention here.

Castor jars can be downloaded from the Castor Project.It has a few dependencies. So I decided top use Maven. And I am already using Eclipse.

I imported the castor-code-generation jar. Then created a pom.xml file. I added a plugin to it:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>castor-maven-plugin</artifactId>
        <version>2.0</version>
        <configuration>
          <schema>config.xsd</schema>
          <packaging>pba.plgen.xml.binding</packaging>
          <properties>generation.properties</properties>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

Where the properties file is:

# Specifies whether the sources generated should be source compatible with
# Java 1.4 or Java 5.0. Legal values are "1.4" and "5.0".  When "5.0" is
# selected, generated source will use Java 5 features such as generics and
# annotations.
# Defaults to "5.0".
#
org.exolab.castor.builder.javaVersion=5.0

# Set to true if you want to have an equals() and
# hashCode() method generated for each generated class;
# false by default
org.exolab.castor.builder.equalsmethod=true

# Specifies whether automatic class name conflict resolution
# should be used or not; defaults to false.
org.exolab.castor.builder.automaticConflictResolution=true

# Property specifying whether extra members/methods for extracting XML schema
# documentation should be made available; defaults to false
org.exolab.castor.builder.extraDocumentationMethods=false

Right Click -> Run As -> Maven generate-sources

And all the source code is generated.

Suppose that the root element is plgen. Then a class Plgen is generated. All the child nodes of plgen become instance variables of Plgen. To unmarshal the xml file,

        public void parse() {
		try {
			m_plgen = Plgen.unmarshal(new FileReader(m_configFilePath));
		} catch (MarshalException e) {
			e.printStackTrace();
		} catch (ValidationException e) {
			e.printStackTrace();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

Well, I haven’t written this properly. But, its enough to make me remember how to get castor working again. My mission accomplished.

Popularity: 10% [?]

I Hate XMLs

XMLs have never been my favourite. Attributes, Elements, Values, Child nodes … aargh, they are so confusing. And yet, configuring an application using an xml file seems so simple.

I have written my own XML parsers using the DOM. The whole document gets mapped to a tree structure which you can iterate over and get any value you want. But I find it to be very restrictive, and most of my code depends on the structure of my xml file. I would like to make my xml parser independent of the xml file structure.

I came across Castor XML. It has tools to read the schema and generate Java Classes out of it. Then the xml file is parsed and objects are created. Now this is good. I think this should be much easier than iterating a tree. But !! I have spent a lot of time trying to get Castor working. Its dependencies !!! Damn.

Time to get back to xml parsing again.

Popularity: 11% [?]