A traditional tour

What do you do when you are jobless for three months? Go wherever your mom takes you of course. So did I. I went to a remote village called ‘Pothunuru’, which is around 150 KM from Kakinada, the place where my maternal grand parents live. The occassion was the marriage of a distant cousin. Primarily, I wanted to roam around in the farms and perhaps drive a tractor (I have had this penchant from the time I was born. There was a tractor in front of our house in Bangalore when I was 1-2 years old). However, neither of this was possible due to the extremely busy schedule. We stayed for a total of 24 hours and it was quite an experience. It was not just joy that was contained in this experience, but a lot of pain.

Before I discuss the traditions, I would like to state that hospitality extended by my uncles was top notch. I was touched by their kindness and their happiness on seeing me around. My uncles are four brothers. The marriage was the first uncle’s daughter’s, who had completed her B.Sc and was in the first year of MBA. The second uncle, perhaps knowing I liked working, decided to make me run a few small errands. On the other hand, the third uncle was not ready to give me any work, since I was their guest and guests don’t work. The fourth uncle, the most active and the busiest, made sure I was getting to roam here and there. What impressed me was their collective working. While the marriage was in the first house only, it hardly felt like that. It was like four elders toiling a lot for their child, something I wouldn’t see very often in cities. Further, the aunts were also extremely hospitable. What more, all the people were quite kind. This made me wonder, does a cosmopolitan atmosphere lose a sense of down to earth attitude and kindness? Perhaps yes. Anyways, I can’t really argue much, since the districts of East and West Godavari are very famous for their hospitality.

Since I was a boy and boys don’t directly participate in the marriage process, I was roaming here and there, running errands, trying to keep myself busy. However, as evening approached, I was totally free and decided to look at some of the events of the day. Quite mundane and archaic. That is how I understood the events. The first one was what is called in English as ‘Nail Cutting’, where, after a long period, the bridegroom’s nails are cut in the public, perhaps telling the whole world that she is going to get married soon. Isn’t it enough to see the thread around the neck? Or that she is roaming around with her husband? Part of the same event involved making her sit between four wooden cart logs. When I asked my aunt why it was done, she did not have an answer. I guessed that the first time this was done, it was because they wanted some form of boundary to assert the importance of the bridegroom and that these cart logs were all they found immediately. You see, this is now mundance and archaic. Why do we follow it? Is it blind faith? More than that, I see it as a fear of the unknown. That doing something against the ‘tradition’ might have very bad repurcussions. Similarly, the follow up event was bathing her. This involved, bringing five pots of pond water with great pomp and show. Once again, perhaps this was how it was done long ago, when that was the only method to get water for bathing.

A small detour here. I will tell a little about my aunt, about whom I mentioned above. She is my mother’s sister and in all terms, opposite to her character. While my mom is bubbly and has a tendency to follow the society, my aunt is quite reserved and believes in education. She is quite patient when it comes to answering my weird questions and I think she is quite knowledgeable about our tradition, and hence, she is my target at most of the times. She was married when she passed 10th class, thirty years ago. I guess she was lucky that she got a very supporting husband. She pursued law and even attempted civils but she was not successful, due to medical reasons. But she is a good lawyer and takes up a civil cases. All her three daughters, who are quite close to me, are highly qualified engineers and doctors. I can give the credit to my aunt, who is very supportive of education, as well as my uncle, who is perhaps one of the best fathers. Not just that, my aunt has helped a lot of her maids to pass Bachelor of Arts examinations. She also appreciates me when I question our traditions, our religious books and law in general. But is telling about my aunt in this article relevant? Yes it is. She is one reason I can still have some faith in our system. She is one person I can turn to and tell that there is bad in this society and that education (please don’t confuse education with mere literacy) can help reduce this problem. You will also realize at the end of this article that she is in stark contrast to another case study I am going to present in the coming section.

Coming back to our discussion, does this notion of tradition hurt? On the surface, it might not seem like. Following a bunch of not so harmful traditions does not really seem to hurt. Perhaps not and perhaps yes. I might not be able to see the immediate effect of these traditions, so I won’t comment on them much.

However, there is another tradition which I want to comment on in the context of Indian marriages, in particular, in our clan. The marriage as an institution itself! During this whole process, I got to know that another of my cousin, who just cleared her 10th standard, was looking forward to work as a civil servant. I thought it would be a good social experiment to brain wash her and find out what she was actually thinking. I found out that she is quite naive (of course, for her age, I can’t expect anything more. At that age, all I wanted was a new bike!), and that she had some altruistic views. She wanted to start an orphanage sometime down the line. She wanted to bring drastic changes in low level administration by being a collector. Noble thoughts. I showed her the dark side also. I told her that she might get bumped off in the process, or that her most loved one’s might get bumped off. She was undeterred. Strong personality. She was ready to resign if she had to choose between that and getting corrupted. Confused little child? I was impressed. I was almost going to congratulate her on her ambition, since I don’t know any girl in my family who wanted to work in the administrative wing. Then came the jerk. Her mother wanted to get her married as soon as her 12th grade got over. That, in my view is a crime. Can’t she have the liberty to choose when to get married? Actually not. The society is constructed in such a way that, if a girl does not get married early, her chances keep reducing exponentially, not something the parents would want. Let us, for the time being, tolerate this ‘tradition’. Now, this in itself should not be a roadblock for her ambition. Contrary to this, this is the greatest roadblock. The husband will not(statistically high chances. 9/10 husbands) allow her to study, since she might start commanding him! Bleh, that is not true you might say. One of her own uncle prevented his wife from continuing her education! This is not a one in million case but one less than a million in a million case! I had to agree with her. I could see that a child who has a noble ambition with a strong personality is being denied her right, because the society does not agree.

Now tell me. Is our tradition correct? What are we trying to safeguard? Whom are we trying to control and why? What are we trying to prove? Are we in a position for bringing change, or are we helpless?

Our tradition is not correct. It is archaic and does not apply in this age. Any tradition that prevents education is wrong. We are trying to safeguard our ego, our old notions, our head in the public. We are trying to control the helpless for this purpose, as we have been taught that the bread winner is always the supreme of the house and that the woman should be multiple levels below him. Education is seen as a threat to his power. Can’t they see that it will only help the family? Unfortunately, we can’t change this construct. It is so deep in the society that trying to mend it will only make you bleed. It is a viscious cycle and it has no exit. For the first time, I am apologetic of my clan. Nope, no one in my clan, except a few, share these views and I will get rebuked, if not beaten for saying this. So what do I do? I write an article, pouring out all my frustration and shut up. Welcome to my society. Where giving Rs. 1.5 crores of dowry is seen as a prestige well earnt but spending more than a few thousands on education is seen as an investment wasted.

Small things

Is your day made up of big achievements or small happy moments? Quite a mix right? But if you see on an average, it is the latter. I will be putting some of my thoughts in this post and expect it to be quite fragmented.

Many a times, I found that the shop helpers or the errand boys in our college messes tend to be alone, working and being shouted at by irritated students. We cannot always hold the students at fault, since the heat does take a toll. However, it is not fair to treat them that way. What more, they do find themselves quite lonely at times. Unconsciously, I have a quick conversation with them on a very light vein. Talking about bland mess food, or the heat in the city, or perhaps that the day is quite windy. I have seen them go happy for some time.

The guy at the lime soda stall, a Bihari is an awesome guy. I talk to him a lot about his city, my home town and how the heat is at our places(Yes you observed right, heat is the discussion most of the time, thanks to Chennai). I always compliment him for the excellent soda he makes, or let it just pass when the soda is hardly cold.

Our hostel zone has a cycle repair person who is almost mute. He is considered arrogant by a lot, since he outright rejects requests for repairing cycles when his shed is full.  For some reason, he does not do that with me. We have a good rapport. I quite easily understand what he means by his sign language. We say hi to each other when we meet at some other place.

The much talked about barber talks? Of course I do that too. The barber shop I go in Hyderabad is an M.Sc pursuing student, who talks a lot to me about life in Chennai, studies in general, latest movies (and my inability to comment on them as I hardly watch movies) and the politics.

It is not the costliest dinner you have one day that makes you happy. It is these small socializing events that make our day. A parting message by our close friend. A warm hug from our friends when we achieve something. Cousins calling up when you feel that you always wanted an elder sister. A small talk with a shop keeper. It is these small things that make my day. Perhaps this is a trait I have inherited from my father, who has enemies at his official level, but is revered in the driver and the helper circle (and the barbers too).

So if you want to make your day, go ahead and have a small chat with the coffee shop person. Perhaps buy a coffee for him and ask him to savor it along with you. Or buy a bunch of books for a driver who wishes to learn. Make your day with these small things.

A kind gesture

Some of the popular events in my campus comes under the umbrella of Literature and Social activities, or Lit-Soc in our institute lingo. One of the events, which I happened to see in my last year ( I was lazy the other years) was mono acting. A particular event in this acting was so spectacular that I felt a blog article would be the right justice on my part.

A total of 14 students participated in the event. While I was sitting at the back and judging the acting skill without being an expert in it, I was completely aware of the guts we needed to go on the stage in front of a huge crowd of students and act. I don’t think I have that courage. But let us not digress too much. One of the participants was a junior from my hostel, whom I like for his jovial and never say never attitude. He also happens to be our Literary affairs secretary. The 7th or the 8th person on the stage was a sophomore. He was going to enact a play on television interview of a famous person in India. Now the play included enacting two people, so the fete was not an easy one. The start was good, though I did feel it was sloppy. But not something to worry about, as he seemed a new comer to this art.

After 30 seconds of play, he walked out of the stage saying that he had cold and that he could not carry forward the play. clearly, his stage fear had got the better of him. I felt no pity or anger. Just simple apathy. The judge, who was an amazing guy with a good diction tried encouraging him but his efforts were in vain.

After all the participants were done with their acts, the judge gave him another chance, asking him to do it as it was now or never. He still could not gather enough courage. Then the judge offered him to play for one minute instead of five to get rid of his stage fear. So he went to the stage and started his act again. However, in 30 seconds again, he was mentally out cold. I was of the view that he did not prepare, but that was just my view. Then something amazing happened. My junior went up to the stage and acted as the other guy in the play. The combo of the two was amazing and the play went hilarious. I am sure the post graduate student was very comfortable, as was evident from his confident voice and body language. The play pulled off well and the judge congratulated them both.

There were two things that I had seen that day. The support garnered by the judge was truly amazing and added to this was the cheering by all the students. But what took the cake was the gesture by my junior, whose act was commendable. I believe going to the stage and standing up for the post graduate student was the best thing anyone could do. While it needs guts to enact a mono acting scene on the stage, it requires true courage and selflessness to be the support for another student. It gave me great happiness seeing this act. I would like to quote a popular phrase from the meme world, ‘Faith in humanity restored’.

Thoughts

It has been a long while since I spent even fifteen minutes writing a post on my blog. The last time I wanted to write a post was around 4 months back, when I was extremely angry with the posts on Quora questioning the IITians and their contribution to the society. I wrote and article, but immediately found out from the same set of posts that there are people who think similar to me. They answered back and that made me pull back my post(Added to this was my laziness to post). So today morning, inspired by my sudden surge in enthusiasm, I decided to write a post on what has been going in my mind for the past six or so months.

I have been to Germany in the summer, for an internship at Maschinenfabrik Reinhausen, a company which manufactures transformers and high voltage regulators. The internship was one of the most memorable experiences I ever had. Apart from an unforgettable trip of European countries, I got to learn a lot culturally. Before that, check the details of my European trip at reiseneurope.wordpress.com. Coming back to my experiences, I never expected that I would ever see a country like Germany( I haven’t seen any other non-European country as such). The discipline there astonished me. People were amazingly friendly and my work place was a joy. I was in the Bavarian state, known for their hospitality and beer :).

During my internship period, I happened to get a lot of free time during and after my work hours. I have pondered on a lot of things. First one was religion. I happened to read God delusion by Richard Dawkins. I will not be presenting any of my views here, since it may raise a heated argument. However, the book made me think a lot. Secondly, I have been wondering about what I wanted to do in the future. I got no definite answer. There were multiple reasons which were simultaneously attacking me. A job, I considered was lucrative, since there won’t be much of a load after work hours and it was a safe path. But life stops in the company. I am not sure how much of an impact I can bring. Perhaps if I rise to the position of a CEO, I could make an impact. And then there was this idea of getting into teaching. Teaching in India is financially not a exciting option. But I think teaching will give that solace I have looked for many times. Further, excluding the times when I have to correct exam papers( Which I may very well get rid of by removing the exams) I think there will be ample time to think for myself and tinker with some research work. Why would I love to teach? For a simple reason that two things have always delighted me, innovating on my own( Even if it meant reinventing the wheel) and teaching what I know. I am very notorious for giving analogies, but that is the way I like teaching. I like to express my intuition of the subject and involve the opposite person in an awe inspiring session, appreciating the intricacies of the subject. Perhaps that is the reason I write a few technical articles on my blog.

Apart from the above two ideas, there is another mammoth task I was considering. A company to change the economy of my country. Don’t laugh and my childishness. With the recent degradation of the Indian economy, I have wondered( and for a very short sporadic times) what would drastically change the Indian market. I ( being an electrical engineer and a fan of gadgets) could think of two such commodities. Mobiles and personal computers. The country needs a defacto brand for these two devices. And what I wish to target is not a low price solution but an solution which defines perfection. A solution which will set the standards. A solution, which one day will make people say, “There is no competition to xyz company’s products. Their reliability is unquestionable. They always work on the cutting edge products”. One thing is clear though, I don’t yet know my path.

After giving a little time to introspecting myself, I have pondered about the political scenario in my country. Every small solution I have thought could bring about some change seemed to back fire. This is a vicious cycle. I realized that we, and not the politicians have to change. I trust only one way, education. I believe that education will change the way people think. Further, I feel that the word politics should get back it’s original meaning. The educated should not shun politics. They should be a part of it. My opinion is that politicians themselves should be educated. May be M.A in administration to say the least. In fact, someone like a health minister should have a degree in any field related to health. This will help making informed decisions easier. Apart from this, we need a sense of pride. We need to create a brand called India. I remember reading an article long ago which was talking about why the person likes Indian tradition but hates Indian culture. In an attempt to make ourselves feel better, we have created an unnecessary shield around us, preventing us from making rational decisions. Don’t mistake me for a western culture harbinger. I have always been fascinated by the Indian tradition. What I would like is to respect this and at the same time, always look ahead to rational changes. For example, the very concept of dowry frustrates me. How does a man gain the right to demand money from a woman? When I had presented this fact to my German friends, they first mistook my statement thinking that the boy pays the girl and thought that it was a fair deal. However, when I corrected them, they were astonished. I don’t blame them. This needs to change. But yet again, this is a vicious cycle. The man sees it as his right to demand dowry. The woman’s parents consider it prestige to give it. And the value only increases with the increase in woman’s education. Which means this is a positive feedback, with nothing positive about it. The parents of both the man and the woman need to realize that marriage is a two sided activity and not an auction. I believe that generation after me at least will completely get rid of dowry system.

Added to these, I ponder over elementary education in my country. Apart from the fact that many schools( especially in my home state) encourage rote education, a vast majority don’t even have the privilege of education, forget good education. What is the problem? Money. Ignorance. Parents don’t have money, parents are ignorant about education. How do you deal with the first one? I wish to do the following in the future when I start earning for myself. I will completely fund the education of one child an year. And if necessary, every year for the same child. I will fund only one child( He could be studying anything between 1st standard to Medical 4th year). Don’t ask me what is my selection criteria, I have no clue. All my co-IITians who may be reading this, perhaps we all could do this. Considering what we may earn, paying around 50-60k per year for a student may not be a large amount, if not paltry. Coming back to ignorance, this is a more serious issue. I have done no ground work whatsoever but I am sure many NGOs work on this.

I have come to not believe in charity. If you wish to do something, do it on your own, but do it to empower them, not to satisfy their hunger or sleep. Make them an asset if you wish to. Don’t make them a parasite on the society. Empowering them, in my view is not charity. It is a selfish motive to see perfection in the society. To see a society where a vast majority work everyday diligently with sense of satisfaction and pride in their work.

I think I have been a little dramatic in my post this time :). This post is not for motivating anyone. It is just a small summary of what I have been thinking over the past six months. And trust me, I have been thinking a way too much :).

Nostalgia

The time I am writing this post is a little abnormal. 11:30 PM at night is surely strange, but had to write this down, lest my mind changes. I have been thinking of writing many articles in the past few months but was just lazy to do so. Hence, this time, I decided to take action immediately and write on my thoughts.
I was coming back from a play by our institute guys and was in the bus, way back to the campus. Suddenly, I was reminded of Batman series in cartoon network, long ago and that was how it started. Nostalgia. The old Cartoon Network. Boy, such lovely days. This article is just to collate all the cartoons I have seen when I was a child (Argument: Did I grow up?).

Let us start of with Batman itself. Though the memories are a little vague, but still I can remember the series. It was incredible. I felt it a little eerie, but nevertheless, it was an amazing serial. I remember watching the series in the morning, sometime around 10 AM(Two notes here. All the times are Indian Standard Time. I could be wrong about the timings. I would be glad if someone comments about the same). And then, swat cats at around 4 PM. I think Swat cats was the best cartoon ever in terms of the coolness. T-Bone and Razor, the aircraft, past master and other characters. I am a fan of Razor. He seems cooler and more swift. My favorite cartoon till today has been Ninja Robots. It is a little sad that none of my friends know about it. Man, it is just an amazing show. Cybertron, Golden lion, Purple dragon, Red falcon. I should say that this was true hardcore cartoon show. I would greatly appreciate if someone reading this article could give me the link for getting all the episodes.
        Jonny Quest. A really weird cartoon. Though I did watch, I could not follow it completely. Perhaps I always watched it unconsciously. Yet another cartoon was Adams family. I still remember the hand, perhaps the most famous character in the show. And then, the all time golder, Scooby do. Scooby do was totally involving show. Comedy and mystery were perfectly blended. Couldn’t ask for anything better. Yes, I did not forget Tom and Jerry. I believe, everyone will know that. One cartoon which you can watch anytime anyplace, any age. I am pretty sure parents of every child who was born in 1990s will surely know tom and jerry. I should say, ‘The deadly duo.’
        Tiny TV was another awesome time pass in the afternoon. Bob the builder, Koala brothers, Pingu, Oswald, Noddy etc. Once in a while, Bob the builder song does ring in my head. I was such a fan of Bob the builder that time that I had also started making clay models of Scoop, Mug and Dizzy . And Pingu’s gibberish language was also fun.
And then the real action cartoons. These cartoons were totally worth following. Starting off with Transformers Armada. Till date, I am a hardcore fan of the transformers. I used to collect action toys, I used to make the convertibles, and yes, they used to convert from vehicles to robots and back to vehicles again(Boy, I just realize how creative and patient I was those days. I wish I go back to those days). I did start following Energon but left it in the middle due to the odd timings. And then, Beyblade. The first season was amazing show. I left the show after the first season. I used to collect the cheaper ones and used to have a battle with my brother. Though they were cheap, they were astonishingly powerful. Digimon was yet another amazing show. Followed the whole of the first season. I guess I remember some names. Garurumon, Greymon, Metal Greymon etc. I even made some of the action figures of these digimons with clay. No, they don’t exist today. They all were lost or were broken when we moved into a new house. Dragon ball Z. A recent cartoon but was very good. The annoying part was the repeating of chunk of episodes. Left it after Cell takes over.
A few more of the Cartoon Network cartoons include Powerpuff girls, G I Joe (I still adore the action figures, though left collecting them), Teen Titans, Scooby Do the laffa-lympics(spelling could be totally wrong), Batman of the future, and perhaps other cartoons I am unable to recollect while writing this article.
Nickelodian was nothing less. Spongebob square pants was an awesome cartoon. My all time favorite in Nickelodian was The legends of the hidden temple. I suppose that it was the first of its kind. It used to come around 4 PM in the evening. A sure time pass after school hours. Pogo too had its share of awesome cartoons. Many of the cartoon network cartoons were transferred to pogo, which were considered as cartoons for small children.
Today, the whole treasure seems to be lost. I don’t see any of these amazing cartoons in Cartoon network today. I write this passage with a very sad tone. It is very disheartening that these cartoons are just a fragment of memory, a piece of past. I can only call it nostalgia. I wish they repeated all these cartoons. The generation born in 2000 will not be knowing any of these awesome cartoons. I wish I don’t have the reason to sit infront of the computer instead of the TV because there is nothing worthwhile. I wish I need not search torrents and our institute network for these amazing cartoons because I can’t find them on TV. I WISH CARTOON NETWORK(And not CN) was back. I can only wish.
If anyone reading this article has the same feelings as me, share your thoughts. Perhaps one day, we can ask Cartoon Network to replay all of them. However, if you feel that present cartoon are also better, please do go ahead and sit in front of the TV and enjoy your cartoons, don’t comment here.

Using flash memory in MSP430

This article is about using the flash memory in MSP430. This will not teach you C programming, using MSP430 or flash memory basics. They are well documented on the internet. This article will help all of us who are struggling to use the flash memory.

I started off a project on MSP430G2553(Now on, I will refer it as micro). Soon I realised that I needed to store a large amount of data. I needed to store 4096 bytes. However, there was only 256 bytes of EEPROM space but 16KB flash memory. Initially, I was reluctant to use the flash but had no other option. So I started off. The trouble is that flash memory is not easy to handle. But not that difficult either. Reading is straight forward. There will be a pointer to the flash space and you just need to reference that pointer. However, the trouble starts with writing data.

The flash is arranged as segments A, B, C, D and other segments. A, B, C, D are 64 byte segments and the others are 512 byte segments. A in particular is locked as it contains information about calibration. When you wish to write to a segment, you need to erase it first. Even if you want to store one single byte, you need to erase the whole segment.

Let us first look at the flash erase function


// __DINT() is in IAR workbench
void flash_erase(int *addr)
{
  _DINT();                             // Disable interrupts. This is important, otherwise,
                                       // a flash operation in progress while interrupt may
                                       // crash the system.
  while(BUSY & FCTL3);                 // Check if Flash being used
  FCTL2 = FWKEY + FSSEL_1 + FN3;       // Clk = SMCLK/4
  FCTL1 = FWKEY + ERASE;               // Set Erase bit
  FCTL3 = FWKEY;                       // Clear Lock bit
  *addr = 0;                           // Dummy write to erase Flash segment
  while(BUSY & FCTL3);                 // Check if Flash being used
  FCTL1 = FWKEY;                       // Clear WRT bit
  FCTL3 = FWKEY + LOCK;                // Set LOCK bit
  _EINT();
}

Initially, the interrupts need to be disabled. After that, the flash must be configured in erase mode. The information about the registers can be obtained from the datasheet. FWKEY is the password for the flash memory and should be included for every action. After configuring the registers, a dummy write must be done to the given address. This will erase the whole segment. Once the erase is complete, the memory should be locked and interrupts enabled again.
Once a segment is erased, data can be written to it. In the following example, I have used two global registers, data_buffer and data_dump which hold 64 16 bit integers each.


void flash_write(int *addr, char option)
{
  _DINT();                             // Disable interrupts(IAR workbench).
  int i = 0;
  FCTL2 = FWKEY + FSSEL_1 + FN0;       // Clk = SMCLK/4
  FCTL3 = FWKEY;                       // Clear Lock bit
  FCTL1 = FWKEY + WRT;                 // Set WRT bit for write operation
  
  if(option == WRITE_FROM_BUFFER)
    for (i=0; i<64; i++)
      *addr++ = data_buffer[i];         // copy value to flash
  
  else if(option == WRITE_FROM_DUMP)
    for (i=0; i<64; i++)
      *addr++ = data_dump[i];           // copy value to flash

  FCTL1 = FWKEY;                        // Clear WRT bit
  FCTL3 = FWKEY + LOCK;                 // Set LOCK bit
  _EINT();
}

The code is self explanatory. Though I have used data buffers, there shouldn’t be any problem writing single data. Note that each segment is 512 bytes and hence it can hold 256 integers(each integer in msp430 is 2 bytes). Hence, once a segment is erased, we can perform 4 buffer writes. Also note that addresses 0xfe00-0xffff hold interrupt vectors. Hence don’t use the segment which will overwrite these. This will result in the microcontroller malfunctioning after restart since the interrupt vector will get erased and the microcontroller will not know where to start from.
With the above two functions, let us look at a simple example where we save 256 integers


void main(){
	// Assume all initiations are done.
	// flash_erase erases a segment
	// flash_write writes 64 values
	// get_value() is any function which returns some value
	// print() is a generic function which prints the value given as input
	int *addr = (int *)0x0E000	// Address of the flash memory segment starting
	int *addr_cpy;				// A copy of the address
	int buffer[64];				// data buffer
	int i, j;
	flashs_erase(addr);
	for(j=0; j<4; j++){
		for(i=0; i<64; i++){
			buffer[i] = get_value();	// Save a value.
		}
		flash_write(addr + j*64, buffer, WRITE_FROM_BUFFER);	// Write the values to the flash
	}
	// Now print all the values
	for(i=0; i<256; i++)
		print(addr[i]);
}

That ends our article on using flash memory. Please feel free to comment. I would be more than happy to learn from you.
 

A reflection on 12/12/12

On December 11/2012, there was a lot of discussion about the next day, 12-12-12. I being a lazy person myself, did not care at all. But personally, I did not find anything wrong about celebrating 12-12-12, since this date will not come for another 800+ years(Lazy to google and find out the exact date!). People also started posting on Facebook about this date. Coincidence or not, this day also happened to be actor Rajnikant’s birthday. Though not a fan, I respect him for his simplicity and his down to earth attitude. All is well, people also posted that this was one of the most memorable day ever in their lives. Nothing wrong, though none of the present dates ever repeat for a 100 years, hence every day should be memorable.

However, on 12-12-12, I saw a serious and ridiculous discussion on TV about this date. Mothers were trying to conceive their children on 12-12-12 at 12:12 PM!! Numerology. Apparently, as per some numerologists, this is a very auspicious time for conceiving which is suppose to ensure bright(read 12000W) future of their children. To add to this, the doctors were supportive of this. However, the show was a reliever. Normally, when a scientist, a doctor, a numerologist and an astrologer congregate for discussion, it turns into a show of power of their own science. To my astonishment, all of them had a consensus that forcing child birth just for the sake of a number is completely wrong. The doctor argued saying that this would adversely affect the health of both child and mother and could also prove fatal. The numerologist had also made a very interesting point. In Hindu culture, every person has with him a document, called as Jathakam, which contains details about the child birth date, day and other details, which I cannot comprehend and hence can’t present them here. The whole point of believing numerology was to ‘create a good Jathakam’. However, the numerologist was of the view that the Jathakam is made once the child comes to earth, not any moment before that. Hence, forcing child birth is equivalent to defying laws of god. For our geeky readers, this is a non-causal action, trying to create Jathakam, even when the child does not exist. The other people in the discussion also made similar points.

On one side, I was very happy that people with starkly different ideologies can come to a consensus. At the same time, I was a little disturbed that people can be so dumb as to believe numbers can change the future. My argument is as follows. There is nothing sacred about any date. It is just to keep a record and maintain consistency for all the activities. We claim that it is 12th December 2012, but isn’t it true that it is our convention? In fact, the Hindu calendar is totally different and has nothing to do with the Gregorian calendar. Every day is as good as any other day. Winnie the Pooh asks piglet what day it is and piglet replies ‘today’. To this, Winnie the Pooh replies, ‘My favorite day’. Seems childish but perfectly encapsulates what I need to tell.

Disclaimer: The views presented in this article are solely of the author’s and in no way convey any general view. They don’t even convey his parent’s view.
The last saying by Winnie the Pooh is a facebook post.
‘There is nothing sacred about any day’: Derived from Dr.A N Rajagopalan’s view on inverse fourier transform: ‘There is nothing sacred about time or frequency.’

Bandar mere bhai

That translates into ‘Monkey my brother’ in hindi. I am not trying to prove the fact the monkeys are actually our brother, which was proved by Charles Darwin ages ago. What I will talk about are the musings of the monkeys here in our campus(IITM).

It will not be surprising that I call these monkeys the IITian monkeys. They seem to be very intelligent(No offence). They tend to be a nuisance, since they like playing with our clothes hung outside, especially the young ones. Also, they are very fond of our home made food(For that matter, they don’t mind eating Dominos cheese burst or choco lava cake). If anyone makes a mistake of keeping the food on the table and forgets to close the door, he can as well forget the food.

However, our monkey friends are very punctual. They have very tight timing. Morning 7 AM is their arrival time, just when we start getting up(Conditions apply). They leave around 7:30 AM, creating a mess in  our corridor. Once again, they come around 4 PM in the afternoon, but this time they go back a little empty mouthed. But the young ones have a gala time with our clothes, our foot wear etc. They seem to be synchronized with the habits of the students. They come 2 hours late on weekends, since we also wake up 2 hours late on weekends. But I think they have an off on the weekend afternoons. Also, they make their visit less frequent in the winter and summer holidays, since the students are also back home.

Our monkey friends are very playful, sober at times, fearful, ferocious, lazy, over enthusiastic etc. Most of the monkeys have stopped caring about the hostel inmates(Don’t get confused, they are the actual IITM students). They just don’t give a damn whether we give a damn about them or not. In fact, when my friend and I were brushing our teeth in the morning, they were just walking past us, something like 5cm away, not even looking at us. The fat and the big ones especially are too careless about us. There was one exception however. Once when my friend was talking on the phone, leaning on the parapet, the monkey was sitting near him, waiting for him to finish talking, so that it can go ahead. The young ones, who are yet to know that we are too lazy to bug them get scared of us, or sometimes try to scare us. The mothers are too protective about their young ones. They generally tend to stay away from the us, sitting at a place and keeping an eye on the young ones. Yet there are other monkeys, which are very sober. All they do is sit on the branches of the tree and keep looking at the sky. Sometimes in the middle, they may scratch their tail or leg. The naughty and the energetic ones do all kinds of random things. One of the monkeys was simply standing on the parapet wall. Then, a monkey jumps near it and shows it back side to the other monkey, as if challenging it to a duel. They also play(Don’t know exactly, but may be they fight over some serious issues also), by pulling their tails, catching their necks and so on.

What astonishes me is their handling of things. They know how to drink water from a tap, opening and closing it. They also know how to open a cool drink bottle and drink from it. They make the bathrooms very dirty, but they do close the taps, which they open. Once, in our math class, a monkey came and sat on professor’s table, opened his bottle and started drinking water. We just were amused, but the monkey, once again, did not even care about us.

Yet in another event, it pulled a chocolate wrapper from my friend. Then, when it found out that it was empty, it started shouting at me, as if saying “Couldn’t you say that the wrapper was empty?“.

Though it would seem that monkeys are a nuisance here, the truth is we have invaded their home(Our campus is a part of the Guindy national park. So, the next time you come, don’t be surprised if you spot a lot of monkeys, deer, black bucks and white black bucks). Our formed director used to say, ‘Apart from monkeys and deer, we have B.Tech and other students and faculty.‘. There was a proposal to move some of the monkeys out, since their population was increasing rapidly, but the director was warned against such actions by the wildlife protection guys.

Having said all these, I am sure that it is convincing to say that the monkeys here are actually our brothers, sharing the same land and food and water( Literally 😉 ).

Making a car in 3DS Max


I started off making the model of Audi R8 when I was in 10th class. Since it was a beginning in a big project, it wasn’t very good but better than what I had expected. I used box modelling, i.e, started off with a simple box with multiple edges and carved out the shape accordingly. The result is:

The rendering was done using Mental ray render engine. Simple material was used without any environment, except for those walls. I also used few omnis to illuminate it from all directions.

After one year, I started off with Lamborgini Gallardo. Since my enthusiasm keeps dropping and I have a hectic schedule at the college, it took me one long year to complete it.

The gallardo was designed using a completely different technique. It was designed using what I call panel modelling. The model was broken into panels, each was designed independently and finally everything was sewn together again. This gives more control over the flow of the model, and makes it less cumbersome. There are no cons of this method as far as I can tell. Here is the result:

 

This time, only skylight was used. HDRI map was used for environment. Mental Ray car paint was used for the body. Clearly, the car looks less cumbersome and more real compared to Audi R8.

The guide images for the car were obtained from Blueprints

Image registration using python

As per wikipedia, ‘Image registration is the process of transforming different sets of data into one coordinate system’. Simply put, image registration is comparing images with a base image and quantifying the changes. For example when a video is streamed, we would like to find out whether the camera is changing its position, and if so, how do you correct it.

We will look at a snippet written in python which compares two images and returns a homography matrix which relates both the images.

A homography matrix is a 3×3 matrix which decides the transformation between two set of coordinate systems.Mathematically, if A is a set of coordinates in one space and B is a set of corresponding coordinates in another space, then

A = HB

Wher H is our homography matrix.

To calculate our homography matrix,we need a set of corresponding points in the two spaces. For this, SIFT(Scale Invariant Feature Transform) is used. SIFT generates a set of ‘interest’ points which can be used for tracking an image.

Once we get the corresponding points, we can calculate the homography matrix. But we need a good algorithm which will pick the necessary points and discard the outliers. To implement this, we use the RANSAC algorithm. RANSAC(RANdom SAmple Consensus) algorithm picks a minimum number of points from a given set and estimates the model. It then takes into account more points from the set which closely fit the model and then calculates the error in the estimated model. This is done for a predefined number of times to get a good model. This model ensures that only inliers are included and outliers are not taken into account.

Using SIFT implementation in python and calculation of homography matrix in python, we apply a RANSAC algorithm to find the homography matrix and change the first image accordingly so that it matches the orientation of the second image.

You can find the source code here:

Python image registration

For further study:
1. Image registration
2. Scale Invariant Feature Transform
3. RANSAC

Note: SIFT is a patented technique by David Lowe. It is protected by the following patents:
Method and apparatus for identifying scale invariant features in an image and use of same for locating an object in an image
David G. Lowe, US Patent 6,711,293 (March 23, 2004). Provisional application filed March 8, 1999. Asignee: The University of British Columbia