Thursday, November 26, 2009

My summer of code journey [part3]

The Communication Bonding period and phase before the first evaluation!

With the results out :-) and my proposal being selected, all i could do was be happy!! :P I was delighted, but i was also a bit nervous. As a newbie with an ambition to finish everything i have promised in my proposal, what lay ahead was a mountain of a task!

It took me some time start with the development as somewhere during the time the results got out, i was experimenting with my linux and i have absolutely no idea what i did that led to breaking of my hard drive. That meant getting a new hard drive, installing linux, then downloading and building kde from source. 
Initially i coudnt understand what i was doing with my .bashrc file, the environment variables etc etc, i was just doing everything advised, reading them again and again trying to understand. My efforts paid off finally, now i understand many things that are in there :P 

Being a student of VTU ( A university in Indian)  I realized that Google summer of code will not be easy, because of the vtu exam time table, and their instinctive ability that they can shift, postpone and exam anytime they wish, i knew that i will have need to have a good time schedule with proper deadlines. 
Consider this

Apr 20th – May 22rd --- Community Bonding period
May 23rd – July 6th  --- Coding begins
And the initial dates of my exams were on June 16th – June 26th which got postponed to 22 to 5th july i guess.
July 7th – July 13th [7days] --- Midterm evaluation.
July 14th – Aug 10th --- Second phase of coding.

As you can see, I had my exams right in between the coding period, That really sucks you know?!!
I was lucky to have a good mentor George Goldberg and Kevin Krammer(you can call as my co-mentor) to guide me through. If you havent taken a look at my proposal, and reading my blogs related to Gsoc! maybe its time you should see it.
The first thing in the project was to start with the I/O part and then start with telepathy watcher. But my mentor was quick to suggest me that instead of telepathy watcher i should start with the Kopete History plugin so that when i reach the telepathy watcher i will better understand things. True indeed!
I remember an interesting conversation i had with my mentor. These are the few lines that i know honestly that changed the way i work. Its not that i had never heard/read them before but this was certainly the first time that i really put it in execution and i am still doing it. At the first discussion about my project after the results were out, he asked me what my plans were and how was i going to do them, and i described some things to him(as at the beginning nothing was clear).
When i mentioned that these are the things that i am going to start with as soon as the coding period starts he said, " Why wait for the coding period to begin?, You have already done so much community boding lets start coding it". I was a little taken aback, and i said, "Right now??" and then he replied "Why not!?". 
The impact of this Why not is such that today when i hear a good idea from my friend or somebody, and i see the light in their eyes and the zeal to work on it, i try to encourage them to start working right now, and if by mistake they ask me back right now, then you know what i tell them! :P

So i started with the kopete's history plugin. I put in lots of kDebug() to find out how the control is flowing, and what functions are getting called in different scenario's to understand how the the history plugin was working, then i put it all in a flowchart( on a chart paper) to understand better how things were working.

In order to work in accordance with Akonadi, we need to have an akonadi resource and A serializer. 
When the Client application accesses akonadi, the Akonadi server then uses the resource to get that job done. for example If you need to create a collection, we will simple use the Akonadi::CollectionCreateJob, the cilents job is done. Now its the job of Akonadi to take care of the collection, where and how to create it. In order to handle that, Akonadi Server uses the resource. A resource is an akonadi agent that takes care of it.
I already had some sample codes which i had done for the proposal, so i started with the history class, finished that, then moved on to the resource. One problem i had was to figure out that, when you create collection, and want to create child collections for that, then the mime type of the parent collection should be inode/directory.

Some things that really gave me the trouble during writing the resource was the use of
changeRecorder()->fetchCollection( true );
I had not used them initially in the constructor and that gave me nightmares for some day, which was eventually solved then Vkrause told me to add the fetchCollection(true) aah!! :).
The first thing was to make the logger plugin save the chats in Akonadi instead of files. In order to make that possible i decided to use Akonadi jobs.
Akonadi works in terms of Collections and Items. A collection in akonadi can be thought same as a folder, and the Items as files.
So what i did was,i replaced the code which were saving the chats in fiiles with Akonadi::CollectionCreateJob, and Akonadi::ItemCreateJob and Akonadi::ItemModifyJob.

By this time, i remember it was time for me to start preparing for my exams, so it was around  13-14th june.
So in the time between April 25th - june 15 ( approximately 5+30+15=50 days, certainly took some time :P)
i was ready with
1) history class
2) I/O Api's (read history from xml file, write history to xml file)
3) the resource
4) the serializer
5) the edited history plugin. ( but i did make a mistake in this, i spent most of the time correcting it in the second phase of coding)

I asked my mentor to do a review of my work as, because As soon as my exams will end, i will be facing my first evaluation.
If you trust me, its tough doing Gsoc and being a vtu students( or having exams in between) *But its not impossible* 
As somebody once said
अगर लोहा हो तो गल जाओगे, अगर सोना हो तो तप कर निकल जाओगे!
So it will be basically a test of your character!

No comments:

Post a Comment