Friday, November 27, 2009

My summer of code journey [part4]

The final evaluation!

Assuming that i was done with my history plugin, i told my mentor to review it, and also mailed the kopete-devel community so that if there are any developers with some spare time can review it as well, and went to prepare for my exams. I tried to make sure that during my exams that i stay in touch with my mentor and and project doesn't suffer because of it.
I got a reply from Oliver Goffart(author of the history plugin of kopete) stating that, 1) i have used lots of kdebugs, 2) my error checking was not proper 3) and most of the jobs i had used were synchronous job->exec() and it would be a good idea to redesign the plugin and use asynchronous jobs where ever possible.
Later that day krake also told me about his experience that he had lots of crashes while he was writing a plugin because of job->exec() and it is always a good idea to use asynchronous jobs, So i added a new todo in my list which was to make all jobs asynchronous. This job turned out to me more than what i had imagined. The history plugin uses QDomDocument and every method in there had sequential execution so i had to split a method in two parts(some method like readMessage into 4-5 parts) and introduce new variable, make them member of class so that they can be used in other parts of methods as well, overall it was very hard for me to change all akonadi related things into asynchronous jobs. The toughest thing i faced in my Google summer of code. 
The design of the plugin is something like this. Kopete has a messageHandler chain, so whenever a new message arrives, the messages flows through the message handler chain, so when history plugins message handler method gets invoked, the history plugin object creates a historylogger object. Two important functions of historylogger are the appendMessages and readMessages. When a new message arrives and the appendmessage method is called which saves that chat into akonadi. In the constructor of the HistoryPlugin we also connect a slot to slotViewCreated so whenever a new windows is created the readMessage method is called which reads a specified number of lines from the chat history and appends it to your chat windows.
So basically all the tough work was about making the readMessages and appendMessages asynchronous.

That took me some 20 days! :-( I was almost like doing everything again. 
But i got it working somehow! :) and trust me it was a nightmare. But the good thing was that I had my holidays and i was able to devote all time to it! :-)
After doing with my history plugin, I started with my telepathyWatcher application. The telepathy watcher is an Telepathy client application(basically an telepathy observer) that logs all the text chats that you do using the Telepahy Protocol into Akonadi, using the same collections that are used by kopete.
I cleared my final evaluation, but I am not satisfied with the history plugin. I want to make the kopete history plugin better in terms of searching through logs, and give it a better UI and looks.

If you are interested in knowing more about telepathy you can find a good tutorial about telepathy here
I will blog about the Telepathy-Watcher later, let me first put forward some of my confusions.
1)When kopete starts, I need to fetch collections from the akonadi, so that they can be made available to plugin.
At the moment when the plugins starts, i do a fetch job that fetches all the collections from Akonadi server. 
--> what pings me is that, I am fetching collection everytime kopete starts. No doubt it works but Is this the right approach??
2)When the plugin initializes, a good idea is to fetchItem with headers, so that in order to get information about a particular contact, we dont need to fetch items from akonadi. This looks like a good approach to me. 
But my doubt is, i have some 150 people in my contact list(with just 1 email id) and i dont talk to all of them everytime i start kopete, and I assume many all around the globe at one point of time, use more than one Account to log into kopete, so suppose they have 4 accounts, then i will be fetching some 500(approximated) item Headers from Akonadi. Will that be okay ???
Or a better idea can be something like, as soon as they come online i fetch their item headers?

3) Will it be better that kopete and the kopete-akonadi-history resource share a config, so that it improves performance?

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!

Monday, November 23, 2009

My summer of code Journey. [part 2]

Between application phase and Community bonding phase

There are bascically 4 phases in summer of code,
1) the application phase
2) the Community Bonding phase
3) coding before first evaluation
4) coding before final evaluation

As I have already blogged something about my application phase, lets start with the time in between the application phase and the community bonding phase. As mentioned earlier, I at first started with 3 ideas for Gsoc, but as the responce i got from Kde communiuty and my mentoer was very quick, i started to pay more attention to it. 
I come from a place in India, where the use of linux is not that wide spread. Here linux is like "Linux! What Linux??!!" Dont ask me, recently what happened , i was part of a infosys compus connect program, where we had to execute some program online (just like codechef and topcoder) wasen't opening in firefox(as i was using linux) so i took online help and asked them why isnt it working, and they told me try it on "IE" or switch to another system. Anyway Lets come back on track.

Being new to linux, not that very new as i had been using it(because i liked kde :P) from quite some time. I was new in terms of internals of linux. I was not an expert :-P Same was the case with Qt, though i knew about it, i knew c++, but I had never actually used Qt as the way it is used in Kde, so in short "I was a total newbie" ;-)

/* So the moral of the story is for New Guys who are willing to take part in Google summer of code, dont loose hope just because you are an not an expert. Here we will make you an expert if you are willing to put your efforts in. :) */

Lets get back to track again! :-P
I was new, I was not very experienced, so i was not very confident either. Now that communication had already started between me and my mentor, i got involved in it. When i say i got involved i mean, initially Akonadi, Telepathy were just names for me but now i started to read about them and collect information on them and started taking look at their APi's. I emphasised on the fact  *new* because at the start it is not easy to grasp what exactly things are and how they are actually working.

If somebody else who was a little more experienced then me would have taken a look at it, he might have understood it in a little less time than what i took. I knew this fact so i also knew that, the only thing that can beat my drawback of not being an experienced programmer is that - 'I put in more and more effort!'

So I started to read through documentations, look at the videos of tutorials available, in another words gather as much info as i can before i talk with my mentor on that topic on IRC. This made me tremendously busy and as a result i got completely involved and was not left with any time for other topics i had chosen initially, and so the end result was that I could prepare only one proposal for Google summer of code 2009. I had read at some developer blogs and in some old mail archives that it is always advisable to put in more that one proposal for Gsoc but somehow i was unable to find time for my other ideas and also because This present idea of Akonadi and Telepathy got me interested and everytime i think about it, it produces enegy inside me to work on it.

I am not a kind of guy who will run away from putting an effort into something that i love, and indeed, i am still putting in everything i have! :P

For example when are totally new out from school where you have programmed only simple programs( which max to few 50-100 lines) taking a look at source code of open source applications at one glance will make you nervous. It made me nervous too! First of all there were so many files that I was unable to make out from which file is the execution starting.( i figured that out finally, and so will you! :P)
But my advice is dont quit just by looking at long source code, make and effort and once you get a grasp of it, it will be a piece of cake! Or ask the developers who wrote it, Dont hesitate in asking but at least make sure that you just dont ask anything. We are there to help!

Once the application phase was over, communication had dropped a bit as we were all waiting for the results but as correctly i was advised, "Dont wait for Google summer of code, If you are interested, start working/coding".

Wednesday, October 28, 2009

Why do i love to hack Kde ? Google Summer of code journey[part1]

It wasn't a very long time back that a friend of mine asked me "Kaushik, Why are you still hacking kde?" At first I frowned(at myself obviously :P), and my instantaneous thought was, why I shoudn't be hacking kde, but then, as the normal assumption of my friends around me was that I was hacking kde just for the sake of Google summer of code and as the summer of code was over, they were expecting me to move on, so I did some digging of my soul and tried to figure out "Why Kde?"

Because my Gsoc proposal was selected? Because of its excellent community support? I like to code for fun ? I love kde?
YES!! Honestly all these reasons contribute equally! :)
But i feel a kind of sense of attachment with Kde( honest and biggest reason of all :P).

Kde && Summer-of-code was my first introduction to Open Source Culture. Saying it another way would be like, Google summer of code was my first step towards contribution to Open Source s/w development.

In January when, Leslie Hawthorn shot a mail in the Soc mailing list that soc is on for this year, things got hot and I started to look for a good project idea which worthy enough to get selected.  Since the desire inside me to get a proposal selected was strong, i decided that i will go thorugh the entire list of participating organizations, see their ideas, look for ideas they proposed and ideas that got selected to get the touch and feel of summer of code.  In order to select a good organization I actually browsed through the idea-website of the entire 185(approx of 2008) + the organizations that took part in 2007+2006. A very tiring job indeed, but from a guy who didnt even know a single Open source Organization or who didnt even know clearly what open source was all about, got to know a lot of names of Open Source Communities, along with what language they use, and what kind of s/w they develop etc etc.
From the entire list I selected some 20-25 organizations, then finally after keeping in my mind some of my interests(mind you, at that time, i didnt even know about kde or how open source development works), I selected 3 project ideas, from Ns-3, Enlightenment, and Kde. I had spen a lot of time, in selecting these 3 ideas, so I now had very less time to prepare for proposals. Maybe somewhere around 20-25th feb I guess.

Keeping in mind the idea, I shot mails to the concerned mailing list of ns-3 and Kde. The reply i got from the Kde community was instaneous, and then i joined the #decibel and #kde-telepathy channel(to talk to my mentor) who had actually proposed the idea, George Goldberg ( irc - grundleborg ) on IRC.

While discussing about the idea, i came in interaction with Kevin Krammer( kde-pim , Akonadi Developer), and Tobias Hunger( decibel developer, haven seen him around from a long time). All four of us spent a lot of time, talking on this idea, with great contributions from all of them. Any one missing from this 4 and i woudn't have been able to write the proposal as i wrote.

U know, it was a totally different feeling. I was being helped by them; on my proposal and thats when i realized that, The community wants the Participants to suceed as much as the participants wants to succeed( and that kde is not only a community but a kind of family :P )

 KDE ROCKS!!! :-)
Not only this, but slowly i evolved to become a part of cummunity during the entire phase of summer of code. More to come soon :-)

Wednesday, April 29, 2009

Library ---"Kconversation"

Kconversation--Library to access your conversations.

I m trying to make a list of jobs i want my library to do.

Consider the hierarchy.

Logs folder->Protocol folders ->Local contact id folders -> chat files.

More to come soon. :)

Monday, April 27, 2009

Design of the Project ---

Day7 --April27th

On one side is the Application, Kopete history plugin, and Telepathy watcher,
in between lies Akonadi server and at the rightmost is the backend(logs).

If we divide the pic in 2 parts, left and right, then the rightmost part is actually or will be a framework for logging conversatons.

Two important functions identified for the library are
1. It consists of a Konversation class, which represents a conversation. This class consists of only the chat data.
A conversation has 3 important parts at the moment,

a) date/time
b) nick/contact name
c) your text chats

2.The second part of the library write/read of the chats, will be used extensively by the resource. An important function of the library can be identified as *assisting* the resource.
When a chat is initiated in kopete, the history plugin
will send chats to Akonadi. When this request is made,
the resource then passes chat object to the library, and lets the
library handle how/where it is going to save it.

When kopete(client) asks for old chats, the resource then uses the library to fetch the chats from the backend.

So Library becomes the framework, that manages the text chats(logs). The in depth details of how the library will assist still needs to be worked out by me!!

Friday, April 24, 2009

Progress till now.

Day4 - April 24nd -friday
Its been one and half hour since i hv come back from college, and i m sitting on on my lappy, tring to build kde. :)
That was the story till now.

Day3 - April 23nd -thursday

Coming back home after installation, i started to install Kde.
Wednesday night, whole of thursday. Complete time i had on thursday i spend my day, reading how to install kde from svn.
I spend my whole complete day, in trying to download and install kde.
Even the whole day was not enough, as kde also took some time, in downloading, and as the linux installation was new i had to install certain other dependencied of kde as well. I slept at 5am(can be considered friday) but the installation was still not complete.

Day2 - April 22nd -wednesday
Trouble by the fact the my dvd was giving errors in installation, i went to the man i brought the dvd from. He gave me another dvd. Now it just so happend that i got the same error from that dvd also.
This time i took my lappy to his home, along with the dvd.
Now the war begins. Both of us, me and that man(who was the authorised Distributor of) linux flavours, together we spent some minimum 4 hours trying to install linux in it. In all the dvd's and in all possible combinations we got all kinds of errors we could.
Result was a failure.
Just when i was about to loose hope, i spotted a linux cd in his drawer. This was the same dvd i once got free with Magazine, Linux For you. I decided to give it a try, and Bingo!! :) is got installed in one shot. Ahhh. finally!

Day1 - April 21st - Tuesday
The Google summer of code result was out.
I saw my results at 6am in the morning, then went to college.
My hard disk had failed on sunday, and
as the results of Gsoc were out, i wanted to start early on my project, so i bought a new hard disk. (the old wil take min 7 days for replacement).

I had some trouble installing on my comp, because the Fedora dvd i was using to install fedora, was giving an error and as a result, on Tuesday I failed in booting my system up, inspite of all my efforts.

Thursday, April 23, 2009

Google Summer of Code Proposal Accepted. Yoo!!! :)

The results were out at late night on monday. I was so scared about my proposal!
But finally when the results came out, yooo!!! My proposal was accepted.
For some hours i was so euphoric that...( i dont know how to explain :) ).
It is a dream come true to me. No doubt i did work hard for the proposal, but there is a lot of difference in submitting the proposal and actually getting selected for it.

I will post more as soon as possible. :)
The proposal can be seen here

Thursday, April 16, 2009

Finally i m freee :)

Just after submitting my Gsoc proposal, i had my internals, and after internals, i started to work on my OpenGL project.
My intention was to finish the GL project before 20th april, so that just in case i get selected for Gsoc ,i would be able to concentrate more on it.
And INDEED i hv nearly finished it. :) yes!!!!

Now, This wait for 20th April, is nearly Killing me!! (results for Soc will be out on that day).

But yo, i hv got college fest on sat, sunday, this means fun time. :)
Just Chill!!! :)

Wednesday, April 1, 2009

Things have started to roll..

i dont know what i had been waiting for in my life, but now finally things have started to roll.
I m working towards what i want, and i m working full time, that is toward the google summer of code, and my classes.
These days i hv started to wish, "God, give me more than 24 hours in a day" :)
Certainly thats not gonna happen, and afterall success is about staying in your limits and still winning. :)

Internal exams from 6th april-9th april
gotta study :)

Sunday, March 29, 2009

Gsoc proposal finally ready. :)

This year has been really busy for me.
First in January i was busy with my project of character recognition, which is stll not complete, and then from mid February i got busy with Google's summer of code.
Really, i should have entered in FOSS world earlier. But honestly i never knew that its so big, vast and powerful. I only realised that after i had gone through the list of all the organizations that took part in Gsoc 2008, along with their ideas, really cool.
Finally i found KDE :) An organization i hv fallen in love with.

I selected the project of the telepathy watcher and i hv been really working hard for it. Finally after so many days of long effort i can say that my Proposal is finally ok enough to be submitted. :)

I have absolutely no idea, my proposal will be accepted or rejected, but all i know that it has been a great learning experince, and i will stick to hacking KDE. :)
My mentor for this proposal George Goldberg says that "the Proposal is very good", i hope i get this proposal, i m dying to work with kde :P

So? i m going to submit my proposal right now("wish me luck", :-) ), rest of the story will follow soon.
take care.

who am i? :)

Since this is the beginning of my blogs, i think i should write about who i m!
Born in Patna, currently in 3rd year of engineering,CS Department, PESIT Bangalore.
More to come soon ;)

Saturday, March 28, 2009

Hey its my first blog ;)

this is my first blog.
So this is more or less just a test.
I new to blogging :)