#26: GSoC with KDE Now – 4

Hey ! I’m making KDE Now, an application for the Plasma Desktop. It would help the user see important stuff from his email, on a plasmoid. It’s similar to what Google Now does on Android. To know more, click here


In the past week, I worked on the code reviews I got. Hence, I changed the classes’ design all over. The way it works now, is that there is a central dispatcher, the daemon, that handles all the jobs. I chose this design, since it was how originally KIMAP jobs, was supposed to be managed. My mentor and Daniel Vratil helped me in deciding this.

I previously said, that I’d change the update to a new thread. That might not have been entirely true 😉 . From what I know, IDLE is an async process, so there might be some actual lag there. I’ll add this in my TODO during the time I test everything and just move to other things on my list.

The IMAP client was looking good, so I started to implement a parser. Now I must say, this took more time than I expected. I was adamant at using Qt JSON library which is pretty good for parsing JSON. But to parse that JSON, the first thing is that I need JSON data. I looked through the docs. Nothing seemed good enough. QtWebKit seemed overkill. Of course, me and my mentor were against using it. There’s no GUI in our application, and using it would have been a waste of precious resources. I checked some other 3’rd party C++ libraries like SGML for Qt, Gumbo Parser by Google but nothing seemed appropriate. SGML was a bit (well more) on the slower side. Gumbo seemed good at first, but since it was 3rd party, I was worried. Maybe some things about license too. I didn’t feel like adding a dependency. Finally I settled for regex (No Wait. Whattt ? I know ? Before you all charge at me, I didn’t use it). Yeah, so I settled for regex. I contacted my mentor and Dan, and they were against it (Well me too, but what choice did I have ?). To those of you, who still think, it would have been okay to use regexes, read this. Dan told me to use QXmlStreamReader. My initial reaction was whattt ? How can I parse HTML with an XML parser ? Hence I never even googled about it. On a second thought though, HTML if formatted nicely, is just plain XML. (Now do you get it ? Just the tags !). I tested it with my IMAP client. Everything seemed good. It’s fast and reliable. It’s also in the QtCore module. So, Speed; check. Reliability; check. No added dependencies;check. What else could I have asked for (A tank ?). So, now I had data between those script tags in HTML, after I parsed it through QXmlStreamReader. Next I parsed this data using Qt JSON Library (QJsonDocument, QJsonArrayQJsonObject). I store the required data in Maps. With the power and consistency of QVariant(Map) things became quite easy.

I got code reviews from my mentor. We discussed some stuff for the next stages.In the next part, I’ll perfect the extractors I have written. Implement them as plugins and load these plugins in the client. This will make writing extractors for other schemas and hence adding support very easy. I’ll also be working with a database (SQLite) to cache the fetched emails. One of the things, I noticed just now, is that I’m using the Incremental methodology of Software Engineering. I am adding new features one by one. Building and testing at each step. Never thought, I’d see the impact of the course classes this early 😉

See you later.


#25: Summers !

I had my last exam on the 27th of May. And with that, I bid adieu to my sophomore year. Now when I look back, things seem to have flown past. Just the other day, I was excited about starting another year at college, and here I am writing about it’s end. Life sure moves fast, mate.

Last year (or academic session) was a mix bag. We had some good courses, and some not so good ones. (Yes, Microprocessors and Computer Arch, I’m referring to you). Well, in my opinion at least.

I’m happy that finally my exams came to an end. It goes on for a fucking month. Well roughly. We have our Minors – 2, that takes about  a week. Then practicals for another week. Then about 14-15 days for the University exams. I meant every word of it, when I posted the following on my Facebook wall when my exams ended.

Walk into your house like, when the semester ends!


My University exams went fine. No that I expect something like a 9 CGPA, but anything close to 8 will do.

I haven’t had much time to blog about anything except my updates with the Google Summer of Code this year. It has been keeping me busy lately. I wonder how things are gonna roll, when the next semester starts. Which reminds me, the last two semesters were awful in terms of schedules. All week, our classes used to end at 5 pm. That makes it kind of a 9-5 job 😛 . Last semester, our labs were 3 hours long. I mean, can you even believe it ? And all we had to do in those 3 hours, was perform just a single experiment. Terrible waste of time. An hour would have been more than enough. As a result, we were exhausted when finally reached hostel at about 6 pm. Then the assignments, lab work, etc took another couple of hours. No wonder, things seemed to have moved very fast ! I kind of cringe at the thought, that even now if it’s getting difficult to take out time for hobbies, what will happen when we’ll be working ?

I’m about 12-13 days in my summer vacations. I have a shitload of things going on. About a month more remains. I need to pull my socks up. And not sit around random subreddits !!! As expected, I’ve been keenly following Game of Thrones. It’s already 7 episodes down. (What ? 7 weeks ? How ?) Yeah. Just the other day, I bunked a lecture to watch the first episode with my friend. I will watch it all, one day when this season ends. 10 hours straight.

With that I end my blog(rant ?)

See you later

#24: GSoC with KDE Now – 3

Hey ! I’m making KDE Now, an application for the Plasma Desktop. It would help the user see important stuff from his email, on a plasmoid. It’s similar to what Google Now does on Android. To know more, click here


It’s been some time since the coding period started for this year’s Summer of Code. I had exams till 27th of May, so I started from 28th. My mentor knew about it already, so things went buttery smooth.

As the first part of my project, I had to implement an IMAP client for fetching emails from an IMAP server. I used KIMAP library in the process. With the help of my mentor and Daniel Vratil and Luca Beltrame, I implemented a working IMAP client. Daniel and Luca helped me with the API details, since the one available was lacking some of the details. Still, most of the methods were fine. The only minor issue related to the API was a specific function overloading in KIMAP::FetchJob. The new Qt signal/slot mechanism is good and all, but since it does static checking, we need to specify the exact methods. In this particular case, to resolve ambiguity, we need to cast it. Which looks not very beautiful. Hence, Qt recommends not to use function overloading.

There are a lot of details based  on how the whole thing runs. One can look at the commits, I made which are a lot more detailed. But the basic idea is: Start a client session, fetch relevant emails, and go into a laid back state. When the server receives a new email, it notifies our client that a new email has arrived. Our client then fetches the new emails. For future plans, I might as well incorporate information from these commits into docs.

For the coming few weeks, I plan to move the update procedure of the client to a different thread, as when I was writing a processor today, to process the newly fetched emails, I noticed some lag. For this, I will use QThread. I’m kinda amused that I didn’t think of this happening before !

Testing the client took time more than I expected. Actually, I tested the whole thing.I exchanged some 60 emails for this purpose. I plan to write unit tests later (in the final stages, which is like 2 months away).

This is the first time, I’m making a project like this from scratch and it has been a great learning experience till now. I plan to get my current code reviewed by some more people, before I am finally satisfied with it. I’d like to get tips on how to better refactor it, and any general tips for the code/classes design are welcome. Find the repo here.

Things are in pretty good shape. I plan to write extractors in the coming weeks and getting code reviews 🙂 I’m actually a bit ahead from my proposed timeline which was altered due to some changes. That gives me even more time later to work on docs and testing.

Catch you in the next one !


#23: GSoC with KDE Now- 2

Hey ! I’m making KDE Now, an application for the Plasma Desktop. It would help the user see important stuff from his email, on a plasmoid. It’s similar to what Google Now does on Android. To know more, click here


Just an update on what I’ve planned for the coming weeks. Also, I don’t think I’ll be able to do anything else for the next two weeks, since my final semester exams start from 18th of this month, and last till 28th. So, this blog post seems to be the last one for this month.

About two weeks remain, until formal coding period begins. And my fingers are itching for it.

I got in touch with VDG, and Andy will be giving me mockups. I’m really really thankful to him for it. I don’t know how much my mockups would have sucked, had I made them. Hahaha

My proposal had some changes in between. Originally, I had proposed to use Akonadi for fetching the emails. After submitting the proposal, my mentor got in touch with me and said it would be better to use KImap library. What this means for me, is that I’m gonna have to implement an Imap client (not so trivial), but where’s the fun, if it were easy ;). KImap makes this task easier. Unfortunately, I won’t have any time, to write some test applications for getting familiar with it’s API. I think, I’ll just have to dive in.

Vishesh had written an early prototype for KDE Now. So, to start with, I’ll be working on his code. He had used KImap to fetch emails. However, it did not update the email cache. That’s what I’ll be doing first. I’ll store UID of the last fetched email in a file. And when I get the notification that a new email has arrived, I’ll fetch new emails based on the UID’s larger than the one I stored in the file. This should work, since in IMAP, UID’s are incremental in nature.

I also went through D-Bus concepts. I’ll be using it to tell the plasmoid, that “Hey, I have new mails. Check !”.

<< Off Topic >>

I download free cover music from Youtube, using youtube-dl. I was bored while I was studying for my semesters yesterday. So I wrote this script yesterday to download songs from youtube. It’s really a no brainer,  not a big deal, but have a look and let me know if there are some bugs. It can be found here.

See you later

Thanks for reading !

#22: GSoC with KDE Now – 1

Hey ! I’m making KDE Now, an application for the Plasma Desktop. It would help the user see important stuff from his email, on a plasmoid. It’s similar to what Google Now does on Android. To know more, click here


As I said, in my last post, I am one of the student developers for KDE this year during this Google Summer of Code. I’ll be working on a project related to Plasma. I’ll go through the details, as I progress with my project.

It’s currently community bonding period, and we are expected to bond with the community and get to know the people. I’ve been hanging around IRC as usual. I recently only joined the telegram group kde-soc, and it’s pretty helpful for those with University blocked ports.

Also, I’ve been working withe the KDE VDG Group for coming up with some cool UI’s for my project. I plan to have a plasmoid, which will have different cards. This plasmoid will be scrollable, so we can scroll cards on it. Each card will display some important information pertaining to a user’s Flight, Hotel, Event or Restaurant reservation. Few days back, I created some basic parts in Inkscape, and sent it to the good folks at VDG. Andres Betts was quick to respond with his views on it, and asked me, how would they would look on a proper desktop.

Here are the Inkscape mockups I came up with. (The flight one is actually Vishesh’s 😉  )


He told me to, make these in QML and see, exactly how would they look on a Plasma Desktop.


They seemed good, and he said, he would come up with some mockups for the same. Also, the typeface needs to be made good. Personally, I also think the cliparts could be better. I used these, since I couldn’t find anything better from Google Images.

Things that still need to be done, as for the UIs is to find a way, to make these different cards uniform and aligned. Also, I plan to show just a small abstract of the information on the Plasmoid Card. When the user clicks on it, then the card would expand.

I have set up a scratch repository here. Also, I maintain a github mirror, for those who prefer github. It’s good, that I set up everything and pushed some code beforehand, since I won’t be able to actually code until a week later, after the formal coding period begins. (Courtesy of final University Exams -_- ).

Your valuable opinions and suggestions are welcome.


#21: Google Summer of Code 2016

Hey all !

I am happy to let you know that I got into Google Summer of Code this year. I’ll be working with KDE to create an application, KDE Now. I’ll go more into details as I move forward with it.

KDE Now would be a desktop application similar to Google Now cards for Android. It would show relevant and useful information to the user from his Email. Stuff like, his Flight Reservation or Hotel details would be shown in the form of concise cards. Prior reservations for Events or Restaurants will also be shown. This was originally an idea of Vishesh Handa.

So at least I know, what to do in summers. Working on an awesome project, learning from the awesome KDE developers, and getting paid for it. It couldn’t get any better. I’m really thankful to my friend and mentor Ashish Bansal for all his guidance and reviews on my proposal.

In the months to come, I’ll probably blog about my project and it’s details. I’ll be tagging these with gsoc16 tags, so you can see them later.

For those interested in other details, here’s a link to my proposal.

#20: Holidays, Game of Thrones and more

Well, I am currently at my home. (Again !). Perks of living in a hostel 40 miles from your home, I guess. It’s holiday time. I have the same 9 days leave that I had during Holi. I still have a couple of days until college reopens.

All I did in this time was drool over the new Game of Thrones season, practice Data Structure and Algorithmic Questions from SPOJ and well, wake up at 12 in the day. I am really happy that I finally found my motivation again to solve those problems. I know they are important. And I enjoy solving those, but then I eventually moved to Open Source software after 1st year and that kept me busy enough that I slacked off. I must say, solving problems seems not that easy now, after almost a year I left it. I’ve become rusty. But hey, I have ample time. And I find joy in it. So who cares. Anyways, I have setup a github repository here. I push all my submissions there. My aim, to solve the first 300 classical problems by August end of this year. I already have solved some 70-75. Let’s see, if I can do it till then. After that, I’ll start competing in Codechef contests I guess. Let’s see where the wind blows.

Also, I’ve been drooling over Game of Thrones a lot. I read every little bit of information about it as soon as it comes out. I am just so pumped about it right now. Man, why is it not 24th yet. And already, we’ve been waiting for an extra month. Game of Thrones, is premiering a month late due to Vinyl (another HBO show). And now since, I’m talking about Game of Thrones, I wish (read in Tyrion Trial voice), I wish that, the Indian Censor Board didn’t suck this much. I wish that we could have original Game of Thrones for India too. I wish we had HBO Now for India too. Man, so many viewers want this to happen. Ending my rant here.

Cheers readers !

Thanks for reading.