Tuesday, August 30, 2005
Monday, August 29, 2005
Learning(s) from a different land - I
The hall had three phones (two cordless), a laptop for each person, one wireless and one wired router with a broadband connection. The engineers had all the stationary and used an oscilloscope for debugging. They also had soldering capability.
In the time to follow I began to love the work environment, no meeting, no interruptions, everyone has lunch together, the atmosphere was very informal almost like working from home. The kitchen had everything we needed to eat, we could walk around freely or rest on the sofa set. The environment made us feel so agile, we could solder up any hardware changes we needed, discuss any changes we wanted. I was glad to see that the Phone was not ringing, I had no chat interruptions, I did not have to wait for people for lunch. I had no fixed process to follow, no timesheet to fill, no status report to update, no meeting to attend.
I felt empowered to work the way things work for me. I got to define any workflow I wanted to follow to reach success. I realized that I was treated as per my capability and could decide what I needed to do. I was treated on Merit. We did not have any manager, just a stake holder.
I learnt that the ideal team size is probably 3 to 4 with no managers, just stake holders in the success of the team. This is probably what Agile Programming is all about, but to see it work is something else. I think organizations should ensure that like software, people should also have high cohesion and low coupling. I understand how the open source community works now.
Saturday, August 27, 2005
I'm back
Friday, August 19, 2005
Off for a while
If you find the blog is not updated for a while, you know the reason. I will try to keep the blog up to date depending on the time I am able to find.
Wednesday, August 17, 2005
Late Night Help for a desperate photographer
Linux came in very handy, I was able to read my photographs using Digikam. See the screen shot below
I guess this is just one of the many good things about open source.
Check out digikam. Also check out the screen shots at Digikam ScreenShots
Tuesday, August 16, 2005
Searching with A9
One can dynamically select the source and select preferences. Books can be searched as well!
The screen shots below show the main page and a sample search for Discrete Cosine Transform. I found the search interesting. Many links were common between google and A9, but I think I am going to use A9 more often.
Monday, August 15, 2005
Real Time Preemption changes being planned for 2.6
These changes obsolete many things that have been said about Locking in Linux. As they say in the open source world
I would highly recommend reading this article
Friday, August 12, 2005
Opera 8 now
- Mouse Gestures
- Unix Like Browsing
- Voice Support
- Many more
but what I found very useful for my blogging is image scaling. Scaling down of images is much much better than IE or Firefox.
Image rendered by Opera 8
Image rendered by Firefox
Image rendered by Internet Explorer
Thursday, August 11, 2005
Compile Time Assertions
This array would then be malloc'ed to store the string.
There are obvious deficiencies in this code
It is slow (due to the log10 calculation and malloc)
on the other hand
This code would scale better than any other code, for example if the integer size of the platform changed.
I suggested that the author do the following
1. Calculate the maximum array size for an int of 4 bytes (remember to include space for a possible "-"). Currently (11+1(possible "-")+1 ('\0' character)) bytes for a 4 byte integer.
2. Use compile time assertion to assert the size of the integer being converted.
If you are wondering what compile time assertions do, look at the code below
1 #define CT_ASSERT(cond, msg) \
2 typedef char msg[(cond) ? 1 : -1]
3
4 int
5 main(void)
6 {
7 int i = 10;
8
9 CT_ASSERT(sizeof(i) == 4, size_must_be_4);
10
11 }
Compile time assertions try to use the preprocessor and create situations that are illegal. The "C" compiler cannot compile the preprocessed code, if the assertion fails. See the example above.
On a platform where this condition fails, the output would be
cassert.c: In function `main':
cassert.c:9: size of array `size_must_be_4' is negative
This ensures that there is no runtime overhead of catching assertions and yet the code is fast and will break if the size of the integer changes.
Other sources of information
Monday, August 08, 2005
Netscape 8 is such a joy
In the screen shots below look at the icon at the bottom left of the screen, they show the icon with which the page has been rendered. I think this a giant step for web developers and a good move by Netscape.
Netscape rendering using Firefox
Netscape rendering using IE
Netscape used to be the only browser for Linux, but unfortunately they have decided not to release Netscape 8 for Linux. I would be happy even if they released with a firefox engine, atleast I would use the same browser across platforms.
Sunday, August 07, 2005
Celebopedia
I still love imdb and I think its much ahead of celebopedia.
Friday, August 05, 2005
An unexpected visit
Well, to be fair, I visited their web site from home and found out something about them. Blog's are multi-dimensional (people might not be willing to show all aspects of themselves completely). Some blogs are personal, some are political, some are technical, etc. Some blogs have mixed content.
I use the blog's I read column to link to my friends, but I might start indicating what kind of blogs I would like my blog to be linked with. The blogosphere is similar to a biological system. Wikipedia's definition of Blogosphere is very interesting.
Wikipedia states
Blogosphere (alternate: blogsphere) is the collective term encompassing all weblogs or blogs as a community or social network. Many weblogs are densely interconnected; bloggers read others' blogs, link to them, reference them in their own writing, and post comments on each others' blogs. Because of this, the interconnected blogs have grown their own culture.
Blogosphere is an essential concept for blogs. Blogs themselves are just web formats, whereas the blogosphere is a social phenomenon. What really differentiates blogs from webpages, forums, or chatrooms is that blogs can be part of that shifting Internet-wide social network.
Like biological systems, the blogosphere demonstrates all the classic ecological patterns: predators and prey, evolution and emergence, natural selection and adaptation. The number of links obtained by a blog, is frequently related to the quality and quantity of information presented by that blog. That means, the most popular blogs have the highest link level, the worst blogs have the lowest link level. The blog ecosystem has its own selection and adaptation mechanism. The good tends to become better, the bad tends to disappear.
Through links and commentaries, the blogosphere with its self-perfecting mechanism, converts itself from a personal publishing system into a collaborative publishing system.
I don't want to disappear, please help me survive :-)
Thursday, August 04, 2005
Can you recognize this person? -- Answered
Here is the answer to Can you recognize this person?. The name of the person is Lena.
See this expert from an email response
Subject: Lena (parting words) (longish)
Date: 21 Feb 1996 13:33:20 GMT
From: dobelman@dfw.dfw.net (John Dobelman)
Organization: DFW Internet Services - DFWNet: 800-2-DFWNet
Newsgroups: sci.image.processing
If Dr. Munson and the Transactions can forgive the copyright infringment, the departing Editor-in-chief's comments on the Lena deal are too good not to share with the group.
IEEE TRANSACTIONS ON IMAGE PROCESSING. VOL. 5. NO. 1. JANUARY 1996
A Note on Lena
During my term as Editor-in-Chief, I was approached a number of times with the suggestion that the IEEE TRANSACTIONS ON IMAGE PROCESSING should consider banning the use of the image of Lena. For those of you who are uninitiated in this brouhaha, let me provide a few facts. The original Lena image was a photograph of a Swedish woman named Lena Sjooblom, which appeared in the November 1972 issue of Playboy Magazine. (In English, Lena is sometimes spelled Lenna, to encourage proper pronunciation.) The image was later digitized at the University of Southern California as one of many possible images for use by the research community. I think it is safe to assume that the Lena image became a standard in our "industry" for two reasons. First, the image contains a nice mixture of detail, flat regions, shading, and texture that do a good job of testing various image processing algorithms. It is a good test image! Second, the Lena image is a picture of an attractive woman. It is not surprising that the (mostly male) image processing research community gravitated toward an image that they found attractive
An interesting link is http://www.lenna.org/
Wednesday, August 03, 2005
Rock star INXS
I love Jessica's attitude and singing. But my picks for the top three are
What to Lock (Locking Design part IV)
- Semaphore
A semaphore is used to denote a locking primitive in which we relinquish the CPU if we do not get the lock. In the examples used in the previous article, down, down_write and down_interruptible are semaphores. The pseudo code for a typical semaphore implementation is given below.
- Spinlock
A spinlock is used in a multiprocessor environment. There might be cases when one cannot go to sleep waiting for a lock. Consider for example an interrupt handler in a Symmetric Multi Processing environment (here after referred to as SMP). All the CPUs may receive an interrupt from any device. If a device interrupted the system twice, lets say one interrupt goes to CPU 1 and the other to CPU 2. Both of them execute the same interrupt handler for the device. They will need mutual exclusion to avoid the kind of races or unexpected results. It would be very bad for a CPU to go to sleep in an interrupt handler, because an interrupt handler is running at a very high priority, preempting everything else, we should deal with it quickly or the system will perform very badly. So what do we do, we spin on the lock being held by the other CPU (assuming that the other CPU will not hold the lock for long). Once we get it, we finish with the interrupt handler and continue (NOTE: The assumption here is that interrupt handlers run fast, otherwise the spinlock will spin for a long time).
Now that we have looked at kinds of locking primitives, let us discuss when we need to lock data. First of all remember that we need to lock only global variables and structures, since only they are prone to races. Local variables reside on the stack and since each process on each processor has its own stack, there are no race conditions with local variables. We will consider the following cases
Rules Of Locking (locking design part III)
- Lock only data, not code.
- Lock only what you want to protect, not everything around it. Use locking optimally.
Surprisingly enough, there are only two small rules for locking. These rules are definitely not exhaustive, they are rules of thumb and form the basis of this article. From these rules we will draw more and try to use real world examples to illustrate the various rules. Lets now see what each rule means.
/* Find the cache in the chain of caches. */
down(&cache_chain_sem);
/* the chain is never empty, cache_cache
is never destroyed */
if (clock_searchp == cachep)
clock_searchp =
list_entry(cachep->next.next,
kmem_cache_t, next);
list_del(&cachep->next);
up(&cache_chain_sem);
if (__kmem_cache_shrink(cachep)) {
printk(KERN_ERR "kmem_cache_destroy:
Can't free all objects %p\n", cachep);
down(&cache_chain_sem);
list_add(&cachep->next,&cache_chain);
up(&cache_chain_sem);
return 1;
}
In the example above, we grab the cache_chain_sem lock twice. We release the lock before calling __kmem_cache_shrink() and grab it again if necessary i.e, if __kmem_cache_shrink() returns a value greater than zero. We could have held the lock for the entire duration and freed it at the end, but it would conflict with the rules we stated above.
We would be protecting code and not data, we need to protect the cachep list, so we use the lock only to protect the contents of that list from changing. What if we held the lock and __kmem_cache_shrink() turned out to be an extremely long function? Other routines waiting for that lock would really starve, especially if __kmem_cache_shrink() does not change the cachep list. It would even be unfair to hold the lock and make merry while others are waiting for the lock.
This brings us to some important questions
- When do I need to implement locking into my code?
- How do I design my code to in corporate locking into it?
These questions are answered in the articles to follow.
Monday, August 01, 2005
Pages related to OSX86
They are all unofficial, but they are fun to read. I can't wait for my own copy of MAC-OS-X on Intel or to buy one of those cool boxes. I hope they use a processor with 64 bit extensions and hyper-threading support
Ranking and Unranking permutations
I've been a big fan of Skiena's Algorithm Design Manual , I recently found my first edition of the book (although I own the third ed...
-
(Photo from http://content-usa.cricinfo.com/indvaus2008/content/current/player/28114.html) Dravid's dismal form continues in test crick...
-
I've been reading up on Fast Fourier Transform (FFT) from several books on algorithms that I have, TCLR, Tamassia, Sahni, Numerical Rec...
-
The book is almost out there . There is code and selected solutions as well. The book is supposed to be in full colour from what I heard....