Sunday, December 30, 2007

Nostalgia and the movie next day

Date: 29th December 2007

Since few days, because of some unknown reason, I constantly wished to be back in my 3rd year of engineering with all my friends at hostel, specifically the L4x series of rooms along with the 3 CSI seniors. That was probably the best part of my engineering life. The amount of learning and amount of fun was highest during this time. I guess, if given again, I would enjoy that part of my life at any moment and any number of times. Now as part of the co-incidence series of posts, this one will also present another instance of co-incidence.

Yesterday when I was going to office, I saw a boy with a bag running to catch a bus. He reminded me of Harish Bhai and an incident when me and him had raced casually after lunch. I once again wished to be in one of those CSI meetings under the chairmanship of the Harish Bhai. After this when I reach office and logon to Gmail, I see Harish Bhai online after so many days and I talked to him for a few minutes.

Today being weekend I got up late, only to find two Kannada movie CDs on the table in front of my bed. My Doddamma (Aunt) got it from a neighbor here. As I was absolutely jobless (in one sense) I decided to watch one of the movies as it was a long time since I watched any of the new-age Kannada movies. Of the two I picked up one and seeing that Sudeep (A well known Kannada actor with a commanding voice) is the protagonist I started watching it. The movie was really good and I enjoyed it like anything. Now the co-incidence part is that the movie was about the protagonist recollecting the past – his school days, college days and initial days of his work, at a time when he was deciding on the list of people whom he wanted to invite for his wedding. He wanted to see all these three spheres of his life together once again for one last time. Every scene was beautifully portrayed (of course except for the songs) and each instance in those scenes reminded me of some instance that had happened in my life. I too have three sets of friends, in fact four including the colleagues at office. I could correlate several parts of my life with quite a few scenes of the movie. The only outstanding difference was that the protagonist has “FOUR” girls in his life where as there are typically none in mine. But nevertheless I have much bigger group of friends and above all a lot of them are still in contact with me and we talk frequently enough.

I suggest any person who has lived a hostel life to watch this movie. By the way, the movie is “My Autograph”. A really good movie (would have been much better without songs). I wish science was advanced enough for me to afford a minimal time machine, without any accessories, at least.

Sunday, December 16, 2007

Need of Exposure To Open Source Community

Ever since I have been associated with Mozilla community I have been interacting with a lot of people involved in the development of the Mozilla products, mainly Firefox web browser. I have learnt so many things from the community and have interacted with several extremely modest people who despite being extremely knowledgable and busy too, often helped me with my stupid questions. And in several occasions I see people younger than me who are so bright and have contributed much more than what I have done. All these situations just keep reminding me that no matter how much of Computer Science I know, how much of coding and design I have done there is still so much to learn and there are a lot of people who are simply better than me. The second part especially motivates me and always keeps ringing in my head in case I start thinking big of myself. Not that I am boasting about myself, but it’s true that I was a pretty good programmer back in the college. I was one guy who did a few things others did not do or others did not consider doing, though there were several who were way ahead of me in knowledge and intelligence and had much more capacity than me. Basically I am trying to say that I was somewhat good amongst the guys in the college. And this had given me a feeling of satisfaction (to some extent) that I have indeed learnt something and achieved something. I knew that a lot of real good punters lurked around in the open source community through my frequent visits to IRC. That to some extent kept me glued to earth and prevented me from being complacent. But I always carried around a thought that I am some good.


That was clearly a crappy thought. And it became more and more clear when I was formally involved with an open source community and interacted with the folks there more and more. I, like any beginner in the community (Mozilla community), had several things to learn during the initial stages and always had a lot of questions. Probably in my case it was a little more than any other beginner. Luckily I had several people in the community helping me out and always ready to answer my questions. Whenever I came across a new nickname in any channel I am observing I would just try and find out more about the person. That way I got to know about different people pretty well. I came across people who have been there right from the time Mozilla originated or even before when it was still NetScape. But none of them carried any air of pride and were very modest all the time. The credentials of the person answering my question used to be so high that I often feared asking anything thinking that I would just get some scolding for putting in a silly question. But such a thing never happened. Be it a regular developer or QA guy, employed or a volunteer, young or old, they all helped me. It’s not just the modesty, but their technical knowledge also is worth speaking. They were so precise, they considered situations that never occurred to me, they thought of performance, usability and several such things simultaneously and every word of theirs carried weight, every bit of it was informative. Sometimes things went way above my head and I had to ask them to explain the same things again and again and in simpler words. They did that almost every time. If I was not ready to understand what they were talking about someone would point me to a nice document which would clearly explain me the basics, after reading which I could understand the discussion easily.


All these things always told me one thing: World is really big and it has some really big people, so be modest and be ever receptive. This means that there are a lot of heights yet to be scaled by anyone and hence one should never stop learning because there is always something new to learn. It is in this OPEN SOURCE COMMUNITY that I realized what computer science and programming is. It is because of the PEOPLE IN THIS COMMUNITY I realized that there is so much to learn. If not for this community I would probably have been a complacent guy who would have shut his doors for new knowledge and considered himself a "GOOD PROGRAMMER". Thank you OSS.


That is why I would say that exposure to the open source community and affiliation with one of those is mandatory for any computer science student who aims at being a successful and worthy programmer. It is here people will get a look of the ocean named programming and the several software applications that are churned out continuously. I hope this becomes the order of the day very soon and every computer science student will learn programming real world applications right when he/she is in college. This would also lead several success stories coming from our Indian academic institutions and we will be leaders, intellectually, once again.

Jai Shree Yalaguresh Prasanna.
Hari Om.

Thursday, December 13, 2007

References issue with __fastcall calling conventions

I talked about calling conventions in an earlier post. There I mentioned that if the function is qualified with the __fastcall calling convention the system will try to push the parameters to the registers instead of the stack and there by tries to increase the speed of the function call. But this would just be an attempt. We are not assured that our parameters will always go to the registers. This is because of the availability of the registers.

Apart from this there is another issue associated with __fastcall. Since the parameters are put in the registers, those variables will not have any address location. So if we try to fetch/use the address of the parameters the system will be in a fix as it will not have any address to return. In such a case the params in the registers are copied to some temporary memory location and the address of that location is returned. This temporary location can be anything. It can be the regular stack itself.

Calling Conventions --- __cdecl V/s __stdcall

In an earlier post I mentioned that the __stdcall calling convention reduces the code size by putting the stack clear statement just before the return statement. If this is better than __cdecl then why do we need this "__cdecl" calling convention at all??

As we know, in "__cdecl" the caller will clear the stack. This would be the ideal behavior if the callee does not know how much of stack to clear. This is absolutely the situation in case of functions with variable number of arguments. The callee will not known how many arguments it is going to receive when compiling the code and hence will not be able to put a proper stack move statement. On the other hand this info will be available with the calling function and an appropriate stack move statement can be put right after the function call instruction. This is where the "__cdecl" convention comes to rescue.

Functions with variable arguments will be qualified with "__cdecl" calling convention.

Tuesday, December 11, 2007

Calling Conventions

This is the outcome of today's presentation by Anand - our tech lead.
There are four calling conventions, and the Microsoft terminologies for them are:
  1. __stdcall
  2. __cdecl
  3. __thiscall
  4. __fastcall
As its known, the calling conventions will tell who, amongst the caller and callee, will clear the parameters from the top of the stack when the function call completes.

__cdecl is the old 'C' way where the stack is cleared by the calling function. Clearing the stack is nothing but having a statement to move the stack pointer up by some number (which is generally the number of arguments). So when a call is placed, immediately after instruction to call, there will be an instruction to move the stack pointer. This way we have an extra instruction associated with every function call instruction. This leads to the increased size of the executable, because of one extra instruction for every function call.

__stdcall is the new way where every function is responsible for clearing the stack allocations made for its parameters. As in, the callee is the one who will rewind the stack and move the stack pointer. In this approach before the return statement of the function a statement to move the stack pointer is introduced. This way the number of instructions will not increase with the number of the function calls.

__thiscall is the object-oriented way of calling functions. Here the first parameter passed is always the "this" pointer. So any instance function member of a class will follow this calling convention. Unlike other parameters, which go to the stack top, the "this" parameter which is also passed is stored in "ECX" register. Now this is how the "this" pointer is implicitly available to all the instance member functions. No function can be explicitly qualified with this calling convention. Any instance member function will get this implicitly, but it can be over-ridden with any other calling convention.

__fastcall is an approach where in the system will try to push the parameters on to Registers instead of the stack just to get a performance boost. But as with the variable qualifier "register" , if the registers are not available then again stack is used for the parameters.

There are a couple of other posts regarding the specifics of the calling conventions and comparison. If this post made any sense then check out those also.

Monday, December 10, 2007

FOSS.IN/2007 – The most exquisite FOSS event

In an earlier post I mentioned how much Mozillians have influenced me and that will surely give an idea as to how much eager I would be to meet any of those people. Well it finally happened this year during the FOSS.IN/2007 as IISc in Bangalore. I was looking forward for this event even before Mozilla was a part of this. I had missed it in the last couple of years and this year I was very keen on attending it as I was in Bangalore itself and the venue was so close to my residence. I sometimes even thought of bunking office for all the five days and have some real good time with all the open source freaks from different parts of the world. As crazy the idea seems to be I was able to attend the event only for one full day and a part of another. That apart, my interest in the event doubled or increased by several times when I found out that Mozilla was one of the projects for Project Days and few of the folks that I had talked to over IRC were coming down to speak at this event. I was very much excited and followed the event very closely. I completed my online registration the day it was announced, I subscribed to the RSS feed of the FOSS.IN/2007 main page, looked at the schedule when it was posted, read about speakers and what they will be speaking when that was put up. Basically I made sure I did not miss out on any detail. Another thing that caught my attention was the Google summer of code BoF (Birds of Feather) that was proposed and also accepted. This was another chance to meet fellow countrymen involved in the development of FOSS. Altogether this was something really big and was close to one of my all time dream of being amidst full time geeks and computer science pundits.

I was getting ready for the event and unfortunately cold and soar throat struck me a couple of days before the event. Nevertheless I asked for a sick leave on the first day of the event and thanks to my manager who granted it immediately. I quickly got ready by noon after some extra resting in the morning and took my uncle’s laptop and moved to IISc to meet the OSS freaks from different parts of the country and the world.

As I was late I missed out on talks related to extension development and a couple of other dev stuff in the Mozilla project days schedule. When I went there it was close to lunch time and almost everyone was moving to the dining area. As I was not completely healthy I had restrain myself from enjoying the FOSS delicacies. I just roamed around the event area looking at the various corporate stalls that were put up there. A couple of days before the event I had met a friend’s brother, who was going to launch a product of his company in this event. I went and met him and looked at the various products that were out there for exhibit. This got over pretty quickly and I had to find something for me to spend time.

Fortunately the event area was Wi-Fi enabled. I utilized the lunch break to update my Mozilla repository on my uncle’s laptop and also to submit a patch which was waiting in my inbox. The wireless connectivity was really good and the speed was well worth mentioning. By the time my repo was up-to-date the afternoon session had started. Then I moved to Satish Dhawan auditorium where the Mozilla talks were being held and spent the rest of the day with the Mozillians. More about the time spent with Mozilla folks in a later post. But I must really thank Team FOSS.IN which made it possible for me to meet the Mozilla people and have some good time with them.

On the whole the FOSS.IN/2007 experience was awesome and memorable. It was very well organized and at the end of the day I saw Atul Chitnis (One of the main men behind the success of the event) hanging around with the volunteers. The sleeveless jackets that the volunteers were given always made me feel that I too should have been a volunteer. ;-)

Jai Shree Yalaguresh Prasanna

Hari Om.

Wednesday, December 5, 2007

My First Hangout with Mozillians

As I am involved in the development of the Mozilla Firefox web browser I have always thought of meeting the actual full time Mozilla developers and spending some time with them. As most of them are in US, in a normal scenario this would have happened sometime when I was in US. But luckily for me this happened in India, right here in Bangalore where I stay. It was today, the 4th of December 2007, during the FOSS.IN/2007 event at IISc.

On account of being sick during the event I was not able to attend all the talks. I missed out on all the morning talks as it was already lunch time when I went there. So I started with the afternoon session where Axel talked about localization, Chris Hoffman talked about Testing and Krishnakanth talked about accessibility. Though these were not the talks that I was looking forward to listen to, I just spent my time in the auditorium waiting for an opportunity to speak to Myk, who was the only developer guy amongst those who had come. All the talks got over at around 6:00pm and it was announced that interested people can talk to the Mozillians. Though Myk was already caught by a couple of Akamai guys, I went to him and introduced myself with the “Resumable Downloads” tag. Though he did not remember me he remembered the feature and that made it easy for me to talk to him. Moreover I was wearing my GSoC shirt, which luckily my father had got it from home just a day before. That carried some recognition too.

Then me, Myk, the Akamai guys and another person interested in XUL and Thunderbird talked at length about various things involved in Mozilla development. The Akamai guys asked me if I am interested in joining them when they realized that I knew Mozilla stuff, after they heard me speaking about debugging release builds of Firefox using remote symbol server. Then we exchanged contact info and they asked me to send them some info on that debugging thing. There were a couple more incidents like this where in I met different people from different companies, small and big, who were doing some work related to Mozilla.

Then we carried the banners and posters to the store room and that was when I got introduced to the other 3 Mozillians present there: Mary, Chris and Axel and also to other Indian developers, a couple of NIT-Jaipur students and a RV college lecturer. After we deposited the banners and stuff in the store room, I asked Mary about their plans for the rest of the day and she said, “We are going out for dinner to some place nice and you are coming with us.” I was like “Me???!!!” She said, “Yes you. Lets go, the cars are here.” I was so surprised and did not know what to say. Luckily the RV college lecturer and the NITJ students were also coming and that made things a little more comfortable. I and the lecturer agreed to go on his bike and the rest of them came in cars. We went to an Italian restaurant named “Sunnys”.

We spent nearly 3 hours there eating and talking. A few of them had some nice Italian wine and other drinks. I sat next to Myk, with Axel and Mary in front of me. We again talked about the various things happening at Mozilla. The OS conflicts, views of different people and who is working on what. It was during this discussion that Myk told me about Timeless’ secret project at Nokia, where he was involved in development of a Mozilla based browser for Nokia N810 tablet. I also got to know about several other such things. Mary told us about her driver running over a dog and several other things that they find so very surprising about India. For instance, traffic was one of them. They even took pictures and video recordings of the traffic to show it to people back in US.

Overall it was a nice time and I learnt that the employed folks are also as fun loving and easy going as us. I got to know a lot about the internals of the Mozilla and some of the current affairs. It was basically a start for me to get more known in the community so that people would identify me with my contributions when I talk in IRC. I guess this motto was achieved to some extent. At least of the 4 I am sure Myk remembers me. After that me and the NITJ students went home and it was the end of a memorable day. Hope I get more of such days.

Jai Shree Yalaguresh Prasanna

Hari Om.