Sunday, August 31, 2008

Awesome music 24/7

Got the iTune Apps installed on my iTouch . I have got a number of free apps installed but my favourite one is the stitcher streaming radio app which lets me stream internet music to my itouch, which I can connected to my music system. So I now have some awesome music 24/7, 7 days a week.

Saturday, August 30, 2008

Rock On!!!

Watched Rock On yesterday with Tanu and Mom. Really liked it. Farhan Aktar simply kicks ass.

Also have started reading The Soul of a New Machine and I am simply hooked on it. It is one of the best books I have ever read. I think the reason I am enjoying reading it so much is that it directly relates to my profession. Also the story line very much reflects the events that occur in my life everyday. Also my favourite charachter in the book is Ed Rasala, the hardware guy for building the "Eagle".

Tuesday, August 19, 2008

Difference between __cdecl and __stdcall

The Microsoft compiler offers two calling coventions one __cdecl (Standard C calling convention) and the other __stdcall. All of the windows system calls are implemented using the __stdcall calling convention.

In case of __cdecl
1) It is possible to pass a variable argument (parameter) list (Standard C requirement)
2) As a result the calling function is suppose to clean up the arguments (parameters) of the stack. Since it is just the calling function which knows the exact number of argument bytes.

In case of __stdcall
1) It is not possible to pass a variable argument (parameter) list
2) As the number of arguments are known at compile time, it is possible to pass the information regarding the number of parameters on the stack to the called function. The called function can then itself perform the stack cleanup before returning.

As a result the __stdcall results in a more compact code since the called function performs the stack cleanup instead of each calling function doing it, there by saving few bytes per calling function. There by making the code tiny bit faster as well.

Labels:

Unixwiz

A Unix Wiz

Labels: ,

Sunday, August 17, 2008

Systems programming

A good basic Systems Programming course.

Labels:

No more mess

I have finished reading first six chapters of the book "a perfect mess" and the book doesn't seem perfect anymore. I see the same message being repeated again and again through various chapters. The basic summary is that it is ok to have a little disorganization in every aspect of your life and not to get anxious over it. Yeah, a good lesson for me since I do get anxious when things don't go as they are planned.

But I think I am going to stop reading the book since I don't see anything new since the past few chapters. I have reserved another book "The soul of a new machine" at the library and I am really waiting when will I get my hands over it.

Good weekend

Past few months have been really gruesome as far as work goes. I am working on one of the most complex projects in my life which has made be realize that I still need to improve on a couple of thinks like a) Cleaner C programming b) Code reading c) Better understanding of Multiprocessing and multithreaded kernels. Currently every day is a new lesson learned. I m learning a lot but sometimes do feel like I am getting burnt out.

Anyway this weekend was really a good break from all of the hectic life and work. We did not do much on Friday as it was raining heavily. So we basically watched a movie "Sweeney Todd", was an ok movie as compared to other Tim Burton flicks.

Saturday was really good with we going to a plant nursery to find new plants for our new garden. This was followed by a visit to a stone shop, to buy tiles for our garden pathway. We did not buy anything though since we still haven't made our minds about what we want. In the evening we then met our friends and went for a hike to Umstead park. This was followed by a heavy Indian dinner. We then got together with some of our old friends and played poker until 2 am. It was great playing poker after a while.

We woke up really late on Sunday morning and headed directly (after a shower) to a Gurudwara with our friends. It was a unique experience for me since I had never been to a Gurudwara before. We then had some really good food (langar) at the Gurudwara and after that headed to the Hindu temple for 15th August (Indian Independence Day) celebrations. Met couple of office folks there. The celebration was so so though.

Then came back home watched a movie and am writing this blog now. Damn, the weekend is over again and the busy life starts once more.

Tuesday, August 12, 2008

C Programming FAQ

A good C Programming FAQ

Labels:

Sunday, August 10, 2008

Being messy is good

I have finished reading the first three chapters of "A Perfect Mess" by Abrahamson and Freedman and I m really glad that I have started reading the book. The book has given several real life examples which illustrate how being messy (upto a limited extent) can actually be useful. The book basically tries to reason out that the cost associated with being neat and tiddy most of the times exceeds the costs associated with being messy. The book also states that messiness can also lead to creativity at times and I could not have agreed more with it.

Tuesday, August 05, 2008

A perfect mess

I recently completed reading the book "Common sense economics" and I really liked it. I think I will buy that book. Today I bought the book "A perfect mess" from the library and seems very interesting. I am hoping I will get time to read since I have been really busy for past few months.

Saturday, August 02, 2008

Avoid macros in C

Macros in C are problematic. This explained via example as follows

#define CHECK_INT(x) (x != 10 && x >= 20 && x <= 100)
while (CHECK_INT(val = get_value_from_void() )) {
....
}

Now the problem occurs when x inside the problem fails a check. Each time a check fails, get_value_from_void is called again to get a new value of x.

Hence be careful while using macros in C. Follow the rules given below to avoid problems
1) Make sure the argument to the macros are evaluated before passing them to the macro
2) Make sure to parenthise the macro body and it's arguments.
3) DO NOT use macro definitions to define constants in C, use enum instead

Labels:

Friday, August 01, 2008

Practice of Programming

Some nice pointers from this book

1) Use active verbs for defining functions
2) When writing an expression for an if statement, spell it out loud (in your mind) and check if you can grasp the meaning of it.
3) Negations are hard to understand and hence avoid them.

Labels: ,

Programming revisted

Computer science departments in universities offer courses pertaining to discreet math, data structures, operating systems, networking etc. However most of these schools fail to teach the students the basic principles of writing a clear, consise and maintainable code. I have felt the need of this as I am currently working on a very complex project which involves changing a major functionality in the OS which has been implemented in C.

Hence to educate myself I have bought the following three books
1) Practice of Programming, Kernighan & Pike
2) Code Reading: The Open Source Perspective, Diomidis Spinellis
3) Programming Pearls, Jon Bentley

I plan to complete reading these in the above mentioned order. I think every serious software developer especially using C/C++ should read these books to improve their software engineering skills. I just wish someone had told me about these books earlier.

Labels: ,