## Saturday, December 31, 2005

### Happy New Year in Advance!

As the earth rotates and as time (as we understand and define it) advances, our calendars will reach/have reached the year 2006 AD. I hope this year has been quite fruitful for all of you and the new year will bring more progress, peace and happiness for all of you, compared to this year.

For me, the next year will be very challenging both personally and professionally and I look forward to it. I hope to be a little more active in my social life and otherwise.

Well, as for 2005 "That's another year archived in memory and on the blog's sidebar".

## Thursday, December 29, 2005

### Data Structure Patterns - II

In Data Structure Patterns, I referred to embedding data structures in other concrete data types to as a pattern. Linux Device Drivers, third edition talks about embedding kobjects, which I quote here

If you are used to thinking of things in object-oriented terms,kobjects can be seen as a top-level,abstract class from which other classes are derived. A kobject implements a set of capabilities that are not particularly useful by themselves but that are nice to have in other objects. The C language does not allow for the direct expression of inheritance,so other techniques —such as embedding one structure in another —must be used.

I realized that what I originally called a data structure pattern is really a means of achieving inheritance. I would like to refine what I said and call it a "Data Structure mechanism to implemeninheritancece in C". What is interesting to note is that this is not a design pattern, but rather a code pattern to achieve a design goal inheritance.

I would like to thank Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman for their book and seeing things so clearly.

## Wednesday, December 28, 2005

### Tragedy at IISc

As I returned home today night, I was informed that there has been a shoot-out at IISc Scientists Killed, 3 injured in IISc terror strike . I usually go to Tata Book House and had planned a visit, but could not go because I had to meet a friend.

Lets all gather together and condemn the attack. The people hurt are eminent scientists and our gurus. Such attacks always impact innocent people who want to live their live in peace. My prayers go out to the family members of the people hurt and their families.

We in Bangalore have been reading reports of terror reaching Bangalore, could this be the beginning of it? I sincerely hope not.

## Saturday, December 24, 2005

### A visit to doddamakali

We recently visited doddamakali. There are good number of pictures in the previous blog postings.

I am going to keep the trip report small and readable.

The day of the trip did not start well. I was supposed to be picked at 6:15 AM, I was picked up by 7:00 AM and then our vehicle ran out of fuel. After having a great breakfast at Kamat (on the highway), we set of for doddamakali. We arrived at the camp at 11:15 AM, after having driven down the hill to the mighty river Cauvery. The path requires that a 4x4 be used to drive down.

Trek1

Our first trek took us along the bank of the river. The path has a combination of sand and rock. Finding your way down and up the rocks can get difficult, especially when the rocks get hot. It is difficult to grip on to anything. To make matters worse for me, I carried a bag, a camera and a stick.

I did not rest enough and drink enough water, the result -- I felt like I was de-hydrating on the way back. It is one of the worst feelings I have had in a long time. I could not stop losing water, I could not rest at a place and I could not stop using the rest-room. I gathered enough energy to reach back the camp and had a lot of lemonade, it took a lot of lemonade and some good rest (for about an hour) before I could stand up again.

Lunch

The camp people served lunch. The lunch was well cooked, but I avoided lunch and only took curd-rice and some sweet. Of-course with a lot of lemonade.

Boat Ride

Initially we were refused the boat-ride, the folks at the jungle mentioned something about crocodiles. After lunch, we were adamant on the ride. The result, of came two boats and 10 life jackets. The forest people insist that we were life jackets (which is a good thing). One of the boats was leaking, so they use a metallic stool in it to avoid getting wet.

You will see in the pictures that one boat has people seated on the boat and the other boat seated on a platform. The boat ride lasted about 15 minutes, the fun part of the ride is when the boatmen turns the boat in circles to everybody's cheer and joy.

Fishing and Trek2

One group decided to stay back and fish, the other (including myself) decided that it was time for trek2. The fun part about trek2 was that there is no trek path. There are thorns and bushes and the trek is steep. The view from the top is amazing, some pictures of the view are available in previous posts. On the way back, the grass helped us from falling, everyone gripped on to it. But no-one reached the camp without a fall. I had a big thorn that entered my thumb and broke inside. The forest official used his pin to get it out of my hand and offered a band-aid

Coming back

We stopped at Maddur for some maddur wada (which is very delicious) and reached home by around 10:30 PM.

## Sunday, December 11, 2005

### Making people believe - Logic lost?

Most humans are very logical by nature, some more than others. Yet all of us have illogical beliefs - we believe in the impossible. Let me illustrate the point with some examples

Remember Spiderman? Spiderman (the movie) was one of the biggest chartbusters (both I and II). Spiderman is bitten by a radio active Spider and develops the abilities of a Spider himself. Have you noticed the following flaws in Spiderman?

1. He crawls up buildings wearing shoes - how? What holds him to the wall?
2. He spins a web using his hand, where as the Spider does it using its mouth (saliva), why the difference?
How do logical human beings cope with this ambiguity?

The loss of logic at certain times is not necessarily a bad thing. Science fiction writers have tried to create fictional elements and back them up with logic - remember HAL-9000 from 2001 the Space Odyssey? It has lead to the creation of many new ideas, which scientists have found useful.

Sometimes, our logic limits our thinking. In fact, many people criticize education as something that provides too much logic and narrows our thinking. We start ignoring ideas that are not logical.

Researchers and creative thinkers suggest that we build a fantasy island in which we can override logic. Such an environment promotes creativity. For me cartoons and movies are a good way to enter the fantasy island. But then, in the scientific world, we need logic. Logic proves to others that we are sane and our ideas are not some thing from this fantasy world which is absurd and rubbish.

I think the most critical thing is to find the correct balance between creativity and the ability to back up new creations with logic.

So the next time somebody calls you illogical -- remember, you are just being creative, so smile and thank the person for the complement :-)

## Friday, December 09, 2005

### Passed my first semester MS

I passed my first semester in my MS exam, yeah! yeah! Well, I know - but passing is an achievement for me :-)

Guess which subject I did the best in ?

Now, I must register for the second one and get started soon this time.

### Foss.in - take away - II

Another take away has been the answer to the question

"what is the impact of open source in the enterprise, on the market?"

Well, my thoughts come from the talks of Atul Chitnis and Jim Zemlin of Linux Standard Base. Here is how they put it (usual disclaimers apply)

"Consider the history of the Internet Explorer. IE 6 was the last release that happened in 1999/2000 and after that only service packs have been delivered. The web on the other hand has been changing, there is RSS, tabbed browsing, advertisements, spam, viruses, etc. Then comes along a browser called Firefox, within a few days of release 1.0, there are a few million downloads; the *NIX community has a browser they can use well. What is the end-result of this? Well there is now a new team working on IE7, with ad-blocker, tabbed browsing, better standards compliance to CSS, etc.

Who benefits from all this?

Tell me who?

The customer, the consumer. In the end, the consumer with a choice always benefits, because he/she has a choice. In the end, when the consumer has a choice - it opens up the market, benefits the consumer and the market has healthy competition."

## Sunday, December 04, 2005

### Foss.in - Take away - I

I attended foss.in last week. I was very happy with the arrangement and the venue. We had Alan Cox, Jonathan Corbet and many other prominent people attending the event. The schedule of talks was interesting. I attended quite a few of the talks. I intend to share my understanding in parts, starting with my biggest take away from the event.

Let me summarize it here

1. Itch-Scratch Phenomena -- If you got an itch, you will scratch. In the open source world this means -- If you need something, do it yourself or help somebody do it, do not sit quite
2. Contributions do not have to be code -- You can contribute by translating code, documents, submitting bug reports, testing, helping with infrastructure and many other means. Code is also of-course considered as contribution, but it is not the only way to contribute
3. You build the community -- No one can say no to you, if you do something and the community needs it, they will take it. Do not be afraid of people saying "No!". People saying "No!" often too busy fighting somebody will implement feature in the background and submit it.
4. Work on it now -- If you need something, discuss it with the community and start on it right away
This is what I want to take away immediately from the conference. Well, ideally I should have started working on the ideas in my mind, so I will cut short the post and try to "work on it now!"

## Saturday, November 26, 2005

### Thoughts on Science and Engineering

I think of myself as a little bit of a researcher. Being a researcher requires me to read journal papers and to try and understand them the best I can. I have a degree in Computer Science and Engineering.

So, the question keeps popping up -- "What is the difference between Science and Engineering?"
Well, here is my understanding so far (not complete yet)

Science
1. It is very theoretical
2. It relies on abstraction and the ability to visualize things
3. Proofs (mathematical) are important for completeness

Engineering

1. Relies on Science for getting started and for establishing a base for understanding concepts
2. Is more practical in the sense that ideas should be feasible to implement. Science will allow you to get away with black holes and infinity, engineering will not
3. It is the art of observing and collecting data and using it to solve problems

To illustrate the difference further, consider the mathematical concept of infinity, mathematics has a notation for it ∞. In computing, we cannot get away without finding a practical representation for infinity, hence computer engineers had to develop the concept of NAN (Not A Number), but in science we can simply use the notation for ∞.

Collecting data also plays a critical role in keeping things practical, analyzing data to come up with solutions to problems is very important in engineering.

There are occasions when science and engineering work very well together. Consider for example the Huffman algorithm, science predicts that it the most optimal algorithm for finding codes and engineering allows us to implement it. On the other hand, in the case of traveling salesman problem, science suggests that there is no way to design the most optimal solution to the problem except to use brute force, but engineers try to find a solution that is close to optimal.

Get the point - science vs engineering?

## Thursday, November 17, 2005

### Data Structure Patterns

Teaching and books have a profound impact on how we think and solve problems.

In college when I learnt data structures, I was taught to embed the element in the data structure (list)

struct x { struct x *next, *prev; int element;};

But I soon realized that I did not always want "int" as the type of the element, so I learnt the magical type void *

Here is another way to achieve the same thing

struct list { struct list *next, *prev;};struct y { int element; struct list l;};

This way, I could embed the list in anything without building any type information in list. Cool right?

If tomorrow I decided to use a tree, I could simply change

struct y { int element; struct tree t;};

This way the impact on my code for "y" is minimal. In the traditional approach, I would have to use

struct tree xt { int element; struct tree *left, *right;};

and redo most of the code.

The moral of the story

Embed the data structure in the data type and not the other way around

Figure illustrating the differences b/w embedding the data type in the data structure versus embedding the data structure in the data type

## Tuesday, November 08, 2005

### First example of using scilab

I tried generating beat waves using scilab

-->Ts=0.0001;-->n=-1000:1000;-->tn=n*Ts;-->xn=2*cos(40*3.14159*tn).*cos(800*3.14159*tn);-->plot(tn, xn);

This program shows the Beat waves for the equations given below

Equations for the two signals

The individual plots and the resultant beat wave is shown below

Plot of frequency equal to 20

Plot of frequency equal to 400

Resultant Beat Wave

This should come as no surprise, that beating forms the basis for Amplitude modulation.

The equation has been mentioned in Signal Processing First (© 2003, James H. McClellan Ronald W. Schafer, and Mark A. Yoder)