Sep 09

How I “earned” a Google Summer of Code project…!

It’s not a sin to try, the real sin is not trying at all should have been the thought that was working on my head in the months of March and April 2011, in the time that I was working hard to find a project in Google Summer of Code 2011, as a 2nd year student in the department of Computer Science and Engineering, University of Moratuwa. So after spending lot’s of time, I found a project that matched my novice knowledge. It was a project by a company called Digital Mars. The project idea in which I had interest (rather, I had the capability to work on) was “adding more containers to D”. In simple terms, what I had to do was to write new data structures to the programming language named D. I had never before heard about D or the data structures that they wanted to be implemented. But that didn’t stop me from trying. Countless hours were spent on learning D and learning about the data structures that they suggested. 

Unfortunately, being an organization which was in it’s debut GSoC, Digital Mars didn’t get many slots for their projects and they could only select the most critical projects to their product. So my project was not among the projects they selected for GsoC. But I felt really satisfied because I knew that if my project was selected, I had a very high chance of getting that project. Also my bond towards the internals of the Programming Languages kept growing because of the efforts I put for GsoC 2011 and that lead me to study more about Programming Languages in the university also (which showed me a total new path for my future carrier). So ultimately, my failure at GsoC 2011 was not a failure, but an achievement.

Time flew and came the time for the 3rd year Software Engineering Project (SEP) in the university. The visionary lecturers at our department wanted all 100 of the batch to find a way to contribute to a FOSS product (which would ultimately be the 3rd year SEP). The only exception they allowed other than contributing to a FOSS product is developing a mobile application. So in that sense, SEP is also like a mini-GSoC!.

The project idea that I came up with was writing a LibreOffice extension which allows the user to access their Google documents using the online accounts feature in Gnome 3. If you want more information about the product, please feel free to visit https://github.com/ishanthilina/Gnome-Online-Documents-Manager and view its documentation plus the crappy code it contains(yes, I admit, it contains crappy code!). Before starting the project, I had never written a single extension for LibreOffice nor even seen its API(or the Google API for Google Docs). It’s only after starting the project that I got to know the real pain of the trouble that I’ve put my self in to. There were only a handful of tutorials on writing LibreOffice extensions using Python (yes, I was going to code in Python, with no prior extensions knowledge!). And none of them described most of the essential parts that I needed to know about extensions developing under LibreOffice. And to make my matters worse, the documentation for the Google Docs API was not up to date with the Python Gdata library I used. Result..? 3 months of pure suffering!. At the end of the SEP evaluations, I knew that I am never going to write a LibreOffice extension again, I was simply had enough!.

In no time came GsoC 2012 and I was wandering through the ideas list again!. Seeing the number of Android projects available for this years GsoC, I blamed my self for not doing an Android related project. If I did so, my life would have been easier in the period of SEP and I could have easily found an Android project in GsoC. But hoping to find a project that suits me, I kept wandering through the GsoC 2012 ideas list, and BANG…!. I spotted a project on which the task was to write an extension to LibreOffice. The project was from the organization Creative Commons and the task was to port an existing LibreOffice extension to Python and add some more new features to it.

As you might have guessed, the first stream of thoughts that came up in to my mind were the bad memories of all the hardships which I had to undergo in SEP!. But I was not ready to give up that easily. So about a week before the deadline for the student application period I started communicating with the projects potential mentors on their mailing list. Finally I put an application for the proposal in Google Melange and when the selected students were announced, I was selected to that project!.

 It’s amazing how you can succeed when you keep trying even when you fail. You never fail until you abandon trying. Unlike in GsoC 2011,in GsoC 2012, I was able to get my hands on a project without trying much hard!.

But then came the most challenging days of the story. I knew that I had a lot to learn, and I knew that I had to learn fast!. I knew only a very little on extensions developing under LibreOffice. I didn’t know how to package an extension, I didn’t know how to write GUI stuff, I didn’t know how to debug in Python(yes, I was a complete novice to Python too!), and the list of I don’t knows seemed pretty endless!. Lot’s of time was spent on reading Java code (since most of the examples for LibreOffice extensions development was in Java) and another considerable amount of time was spent on porting that code to Python, lot’s of time was spent on learning new stuff.  

Since my internship in WSO2 had begun on those days, I was spending most of my time in WSO2. It was around 8.30-9pm everyday when I returned home . So I had only a little time to work on my GsoC project at night. But I didn’t give up. I managed to allocate at least an hour to the project everyday. And on weekdays, I spent lot’s of time on the project. They sure were hard days. Pretty hard indeed. But when the mid-term reviews were approaching, I truly was happy and progress seemed truly promising. I knew that I had learned a lot and I had done a pretty good job. My hard work had showed promising results. It was truly a satisfactory feeling.

And I should specially appreciate the support from my mentor,  Jonathan.Palecek. He always put faith on me, always motivated me to do my best, but at the same time didn’t expect me to be working like a slave, he was always this cool person who always put trust on me.

 Also I should give a special thank to Hanya. Without him, I won’t even make it to the mid-evaluations. He answered almost all of the questions I posted in OOoForum.org. I know at most of the times I was causing him lot’s of trouble and I really am thankful to him the way he tolerated all of them and how he always helped me in his full capacity.

 After the mid-term evaluations, life was much easier. I added some new features to the extension and ultimately I passed the final evaluation which resulted in a happy mentor, happy community and a happy student!. 

It’s amazing how the bitter experiences we undergo results in the sweetest memories in our lives. When the life puts challenges in front of us, we should make use of them, hence the same challenges will make our lives a comfortable place in the future. We should not be backing down in the face of difficulties hence the same difficulties will make our lives a luxurious place one day. All we need to master are patience and smart work!.

Always keep in mind, It’s not a sin to try, the real sin is not trying at all…!.

Share Button
Jun 10

Adding a template for new Python files in Emacs

I wanted my name and email address to appear in the top of the page every time I create a new python file in Emacs. So here’s what I did to achieve that.

First of all create a folder called templates in the .emacs.d directory (the .emacs.d directory is located in your home directory. If it does not exist, just create the directory ). Then create a file named template.py  in that directory. And add the text you want to be included when you create a new python file. An example can be shown as follows.

#Name: This Is My Name

#E-mail: someone@somewhere.lol

Then open the .emacs file in your home directory (if this doesn’t exist, simply create an empty file named .emacs). Then add the following content to the bottom of the .emcas.

;#############################################
;To load python templates

(add-hook 'find-file-hooks 'maybe-load-template)
(defun maybe-load-template ()
(interactive)
(when (and
(string-match "\\.py$" (buffer-file-name))
(eq 1 (point-max)))
(insert-file "~/.emacs.d/templates/template.py")))

That’s all…!. Now when ever you create a new python file using Emacs these header info will appear!.

More info:

As you might have observed this trick can be extended to other file types by changing the .py extension in the (insert-file “~/.emacs.d/templates/template.py”) line and creating a relevant template in the templates folder.

Also there are more advanced ways to achieve the same with more functionality in http://www.emacswiki.org/emacs/AutomaticFileHeaders

Share Button
Jan 19

A simple FAT32 bootloader written in assembly to boot from USB drives.

This is an assignment done by me for a second year project  in the university. The goal was to write a bootloader that can boot the given OS ( JOSH ) from a pen drive which is having FAT32 file system( We were supplied with a bootloader that could boot only from a FAT12 file system ). 

 

What this bootloader can do:

 

It can load the first file( which should be a file less than 4096 bytes) which is located in a USB drive with a FAT32 file system to the memory and hand over the execution to that program.

 

Download location:

 

https://github.com/ishanthilina/USB-FAT32-Bootloader

 

Steps to use the Bootloader:

 

Included in the README file in gitHub. 

 

 

More information can be found in the pdf in the doc folder. 

Share Button