Skip to content


October 8, 2009

I am back after 2 months. This post is about the various coding events at Shaastra 2009. There were 6 of them, I took part in 5 out of 6 as I could not participate in Search 3.0.

First on the list is Frugal. A competition that was supposed to require minimal knowledge of coding and algorithms. The participants were expected to solve problems like finding square roots of a long long integer without using multiplication, division and bit shifting. Quite easy a n00b would say but all that 10000 times, in 1 second, no n00b can achieve that. After a whole day of coding I managed to submit 3 problems successfully. I did attempt 2 more problems but got small errors which I couldn’t fix in time. I finished at the 9th position, sadly no consolation prizes :(.

Here is some code that I wrote. No divisions or multiplications, calculates sqr root of a long int :-
The code is supposed to be as short as possible, have as few key words, semicolons, commas as required, should include only stdio.h and worst of all, should be written only in C.


I was one of the coordinators for HackFest. It was a non-competition hands on event. It was one of the biggest successes this Shaastra. It had two speeches, one by Atul Chitnis on FOSS and technology and the other by Shreyas Shrinivasan on FOSS Foundry on the first day of Shaastra. The two above speeches were targeted at a general audience with little knowledge on the open source world. It was supposed to kick start people who were ambitious to get into the world of FOSS.

In the evening were lighting talks by the pro-hackers at hackFest. The organizations that were invited included the linux kernel, firefox, KDE, GNOME, sugar and FFmpeg. In the night people hacked the software that they had chosen. The hacking nights were scheduled to start at 10:00 but we started it at 9:30 and taught people about xchat and the IRC. A lot of unregistered participants turned up and had to be allotted to the organizations that were free.

The three kernel hackers where the most enthusiastic people in hackfest. They taught the students from the basics and gave out free T-shirts for people who answered questions. They retained their enthusiasm till 5:00 in the morning consuming just 1 expresso shot somewhere in the midnight.

Firefox hacking was done by sid0 from IITK, he used jet-pack to help people create their own add-on which checks for unread messages in gmail. Gnome and KDE hacking brought up some potential contributors. Around 5 patches were submitted in Gnome and KDE. Vimzard took care of GNOME hacking and KDE was taken care by kstar, praaksh and yours truly. I made people create basic Qt applications, the other two took care of building KDE and hacking KStars a desktop planetorium software. Other organisations like FFmpeg and Sugar were also hacked.

The next event, the OPC was what I felt was one of the most challenging programming contests I have ever seen. It was tougher than google code jam round 1 or the ACM ICPC and the questions were tougher than most problems in spoj, Euler, uva and usaco. I teamed up with friends Garimella and RajKishan. We got the algorithms for a couple of problems. We actually solved one of them. The problem called power. At the end we stood at position 25. Sadly again, no consolation prizes.


The next contest was polyglot. We had to write a single file program that would get compiled by different compilers successfully. There were a lot of languages which we could use. We solved 7 out of 8. Unfortunately we had trailing white-spaces in a few of our solutions so only 3 were considered to be correct. We won the 3rd prize at the end (team rocket Kashyap R Puranik and RajKishan G).

Here is a program I wrote that prints POLYGLOT in C++, python, perl, brainf**k and ruby.


Here is a program we wrote that reverses a string in 3 languages. python, brainf**k and C++


As I said, I couldn’t participate in search 3.0 which was the most generous among the events, gaving out 25K to 3 people.

Simulation Championship was a great contest where the coordinators had selected 16 teams for the finals. 6 teams for Ant colony simulation, 5 each for Rescue bot and Viral marketing. Me an Rajoo decided to attempt both the ant simulation and the rescue bot problem statements.

We used Qt and C++ for both the problem statements, we did not have time to finish the rescue bot program. Our entry won the first prize for the ant simulation problem statement. Here are some screen shots of the same.


Here you can see the trails left behind by ants, and you can see some ants following the food source.


Here is a picture of the rescue bots UI we made.



July 1, 2009

Hi everyone,

I am updating my blog again. This time I have added the molecular mass Calculator. I have merged my work in the kalzium branch back to the trunk. I have changed a few files from libkdeedu/libscience for this.
After attempting to use the Gnome Chemical utils in vain, I used the calculator already present in Kalzium and improvised it.
Here are a few screenshots of the molecular mass calculator.


The calculator displays molecular mass and composition of the compound you input.

I have entered the formula CaSO4 (Calcuim Sulfate) here. I get the molecular mass as 136. I get the percentages of the elements too.


I have also used the idea of aliases for example Me ( Methyl group ) = CH3 and Et ( Ethyl group ) = C2H5 and so on.

In the following case, I have entered the compound toluene, which is Me-Ph which expands to ( CH3 ) ( C6H5 ).


We can also add our own aliases. Use the aliases tab of the molecular mass calculator widget, add a valid alias.
The picture shows default aliases that are available. I haven’t added many though.



June 22, 2009

I am making this post after 1.5 months after beginning my GSoC project and exactly 1 month after its official commencement.  I have basically completed most of the work that I had planned. I have finished 3 calculator widgets and added them to the calculator widget along with the mass Calculator and the equation balancer which were already present.

Here are some screenshots where I have used the various calculators to solve a simple chemistry problem. (The problem is intentionally made very simple to attract a larger audience.)

Consider the following question :-

(Sodium Carbonate)Na2 CO3 on reacting with (HydroChloric acid) HCl gives

(Common Salt) NaCl and (Carbon Dioxide) CO2 and (water)H20.

If 1 mole of Sodium Carbonate is consumed, find the volume of Carbon Dioxide that is released at 1 atmosphere and 273 K. ( Assume CO2 is ideal.)

If a solution of common salt occupies 1 liter. What is its concentration of common salt if 117 grams are added..

The first step would be to balance the equation using the equation balancer in kalzium. ( The usage of this widget involves typing the equation in the form


! mole of Sodium Carbonate produces 1 mole of Carbon Dioxide and 1 mole of Salt.

Next step would be to calculate the molecular mass of Carbon Dioxide. (The usage of this widget is trivial, just enter the formula get the results)


Next we use the gas Calculator to find out the volume occupied by CO2 at the given conditions.


( Usage of the widget : seleect what you want to calculate using the radio button eg. volume, then enter required and relevant data. Not everything is compulsary. Select among the many units that are present)

Vand der Vaals constants have been set to zero because the gas is considered ideal. We get the volume of Carbon Dioxide.

We now use the concentration Calculator to calculate the concentration of the solution. First calculate its molecular mass.


Now for the concentration.


(Usage: specify all the data you have, not all are compulsary, eg density is unnecessary. You can select the way in which you specify amount (mass / volume / moles) You can specify a number of relevant units.)

There is also a nuclear Calculator that can answer questions simillar to the following one.

If initially 4 grams of Uranium-235 are present, after what amount of time will it reduce to 2 grams. ( Again the question is too simple but the calculator can do better problems.)


( Usage: select time from the radio buttons to calculate time. enter other data (initial and final amounts), selecting Uranium 235 automatically gets the halfLife from kalzium data. Thus we get the time required.)

You can also calculate final / initial amounts. You can specify time in halfLives using the slider which can vary from 0 to 10 half-lives.

I have gone through the plasma API FAQ and I have after some difficulty created plasmoid widgets for the same. These widgets are more difficult compared to the Qt ones because there is no equivalent of the awesome “Qt designer” for Plasma although it will be out soon.

The following is a plasmoid for the nuclear Calculator mentioned above. Looks cool doesn’t it?


Apart from that, I tried to use the Gnome Chemistry Utils library and create a new library called freeChem but it failed because, it wasn’t very easy to eliminate GTK from the code and put Qt instead. Now I plan to use the files in Kalzium itself to complete the molecular mass calculator.

Please feel free to ask any questions regarding the functioning / layout / ease of use of these widgets. Any suggestions are welcome. I have time for more Chemical calculators. If you have any ideas so comment.

20 days into SoC

June 1, 2009

21th April 2009 00:40, that was when my SoC results were announced. Because of the net cuts in my hostel after 11:59 PM, we are forced to turn off our computers and go to sleep. (Well they are trying) I had to go all the way to my Department Computing Facilities to find out my results. In the darkness of the night I slowly cycled and went to the DCF.  People like Akarsh Simha (kstar) felt I would obviously get in, but for me it was butterflies in the stomach as usual. It felt more like frogs in my stomach because what was about to be announced was a really big thing in my life. At 12:45 I some how managed to get into the site despite all its internal server errors and finally got to see a new link that wasn’t there before saying ‘student projects’. I quickly clicked on it to find out what it was about, and there came another 500. My friend Virus ( SuryaKiran ) messaged me and congratulated me, only then I felt relieved. I waited there for another 15 minutes patiently and found out that it was my application for the molecular calculator project that had been accepted. And now 22 days after the unofficial start of my project ( 9 days after the official start ), I am making this post to brief about my progress.

Now to get technical, I started off with the design of the user interface of the various calculator widgets. The current user interface file can be found in the kde branches at along with the other files that I have created. The user interface was done using the Qt designer / Qt creator. The design is simillar to the kstars calculator design which consists of a single calculator main widget that loads all the different calculators and shows them on selection. The design is not yet complete and can be further improved; please feel free to comment.

After that I started writing the classes for the various calculators. I have written the nuclear Calculator, gas Calculator and the concentration Calculators (sources in the above link ). I had to use the unit conversion library for the same. I found it really tough as an amateur noob to use a library without having any reference  / documentation about it. I gradually figured it out through some little help I received in the IRC. A person in the kde-devel channel showed me how to fix the problems I had with the CmakeLists.txt to include the library. I still did not know how to use the library.  Not a single page could I find after hours of search. I finally got the author’s name and started googling the name. I found his blog here but it was of no use as it had only descriptions of the unit conversion widget and not the library. Only this mail with just one line of info managed to teach me, how to use the library. I managed to finish of the calculators last week with unit conversion. Any new tabs that you would like to see in the calculator, please go ahead and make a request.

I have now begun my second phase, the plasma phase. I managed to create the hello world plasmoid widget using python, and now even as I write, am trying to make it work in C++. Not even in my worst night-mares had I realised it would take this long. Python hello world was like copying a couple of files from the tutorial, zipping them using plasmapkg and directly running that using plasmoid viewer.
Although C++ version is also easy, I have been facing a lot of difficulty. Firstly I faced an error during compilation saying “libphonon not found”. When I installed it ( sudo apt get ) everything worked, and now I have segmentation faults with no backtraces. After several hours of loafing around in the kde-devel/plasma channels disguised as n00b_max, I have found out the problems. I am now downloading the entire kdelibs / pimlibs / support etc, will build it and try to eliminate the segfault.


April 20, 2009

I have been selected for the Google Summer of code program under Kalzium under the molecular calculator project. Yippeeeee!!! 🙂 🙂 🙂 :D. I have started doing some ground work for the molecular calculator project. I have started designing the user-interface for the same. There was a user-interface for the Kstars calculator. It was really user friendly and cool. The same kind of interface could work out even in Kalzium. I have created a basic interface using the Qt designer. I have taken some screen shots of the same. Please comment. The calculator as of now looks kind of primitive, and I haven’t completed it yet. It will look great once completed. Please shower me with suggestions.


The above is the Calculator in Kstars.


There are tabs on the left which you can choose, on the right, you do the calculations.
The above software is kstars. The desktop planetorium of KDE.

The following are the screen shots of the molecular calculator interface design that I have tried to come up with for Kalzium.


The above is the layout of the molecular calculator, I plan to create. It has different tabs for different calculations.


After filling it up, it will look like the picture above. This is the introduction page. There are other tabs which include

  • Molecular mass calculator
  • Concentration calculator
  • Nuclear calculator
  • Gas densities
  • Equation Balancer
  • Scientific calculator

The picture you see below is the Concentration calculator, where the user enters the amount of substance along with the units and quantity ( which by default are according to the configurations.) The result is printed at the bottom.

The concentration calculator has 2 other parts which calculate the amount of solute and the amount of solvent respectively.


You can see the molecular calculator below. It has two parts, the molecular mass calculator and the molecule predictor.
The user can select the molecules from the list of commonly used compounds / history or he can enter the molecule in the text area. There is also a prediction for the molecule that pops out once the user starts typing the molecule. There is also a table of short-forms for compounds like amino acids. sugars, etc.
The molecule predictor will take in the molecular mass, some of the elements present in the molecule and predict all possible molecular formulae for the molecule.


Bottom: You can see the display of results, composition and other data.

Kalzium – Video play feature

April 3, 2009

This is a cool feature that I have added to Kalzium. It will be really attractive in schools. I call it the play feature. You can basically play the periodic table like a video where you can see the temperature increase from 0 K to 6000 K gradually and see all the elements melt and eventually boil.

This is an addition to the somwidget. I have added the same feature to the Time-widget. When the play button is clicked on, you start from some year in the 1600s. The periodic table displays only the elements that had been discovered then. The year gradually increases to 1994 and stops.

To make things convinient, there is a pause button and the speed slider with which you can select the speed. The navigation slider already exists.

Here are some cool screen-shots of the same.

This is the som-widget, the temperature is currently at absolute zero. Red elements are solid at this temperature.


I start playing the periodic-table video, gradually some elements melt and some even boil. The blue elements are liquid at this temperature and the green ones are gaseous.


As we proceed this is what it looks like. The text area in the widget indicates the elements that melt or boil around that temperature with a threshold of 25 K.


Most elements have boiled here. Note the Grey boxes are elements whose values are unknown.


This is at 6000 K. This shows no solid or even liquid element at that temperature.

This is the time widget, at each year between 1664 and 1994, it shows the elements which had been discovered in blue and the undiscovered ones in blue.


Once again I hit the play button and start the video and, also increase the speed.


Many elements have been discovered at around this year you see.


1994 – Almost all elements have been discovered.


These are the features that will be available in KDE 4.3 probably. I am sure students will like it.
If you have any suggestions about this feature or an earlier feature, please comment.
Also suggest any additional feature if you wish to see it in Kalzium in the next release of KDE ( 4.3).

Kalzium KDE 4.3

March 30, 2009

Please check out my GSoC proposal in this blog.
I have made two proposals

1 Kalzium Beautification.
2 Molecular Calculator for Kalzium.

These are the major changes of Kalzium in KDE 4.3

The nuclide board looks beautiful and user friendly.
I have added the legend at the side, also there is a tab which has a slider to zoom in and out.


This is a picture I have taken after zooming in.
The nuclide board widget shows the stability of compounds.


Kalzium ( Calcium )


Major bugs involved in the above widget have been fixed. This is the first of the changes for Kalzium in KDE 4.3.

The other changes include the Wikipedia integration feature for Kalzium.

This is the beginning of the feature that I have started adding. It gives a link to a particular article in wikipedia. The same feature will be extended to all places in Kalzium where further reference. Eg. kalzium help and Kalzium knowledge database.


You can choose the language of your choice. Right now there are 10 languages in which wiki has 100K + articles.


Here is the selective plotting feature. You can now choose to plot only metals or may be only d-block elements.

In the screen shot you can see that only the p block elements  have been plotted.


Changes to Kalzium in KDE 4.2.

I have fixed a bug in the plotting widget that used to plot unknown values and consider them as known values. The average and other statistics were affected because of those unknown values. Now the unknown values are plotted in red and the known values are plotted in green.


Please comment about the features that I have implemented and please feel free to comment on my contributions and if you have any ideas of your own. Please do comment.

Please check out my GSoC proposal in this blog.
I have made two proposals

1 Kalzium Beautification.
2 Molecular Calculator for Kalzium.