## Thursday, June 30, 2005

### Predicting the implementation by looking at the UI behaviour

I found some interesting things by looking at the UI of various applications, I hope you find them amusing too

1. On my Adobe Acrobat Reader in Linux, when I search for ",", it finds even ";" 's. That makes me wonder if internally, a semicolon is represented as a "." and a "," paired up horizontally?
2. In Windows, use your "Windows button" + D to see the desktop (Windows button gives you direct access to the "start" tab on pressing it). If you have any modal dialogs open, it fails to show the desktop. I suspect the implementation of "Windows button" + D is to send a minimize event to all windows. If some window has a dialog open, it cannot minimize.
3. In Windows XP, if your outlook email editor is set to "MS Word". Try the following, have a modal dialog open and try to send a new email. It will prompt you asking you to close the dialog before editing can begin. It goes to show that modal dialogs can be an irritant if applications are shared.

I will try to add more to this list.

You've got anything to share?

## Tuesday, June 28, 2005

### Prediction for the coming years

I have some thing to predict about the software industry in the coming years. Lets see how true they turn out

1. The usage of software tools will drop down.
2. The quality of software will temporarily dip (quite significantly), we will need a drastic changes to the software model at that point. Think of it as a pending software crisis.
3. Hardware will start eating into software, it will start doing what was done in software earlier.
4. There will be no new major programming language development.

This list will grow as and when I find/discover new things for myself.

### Java Language Specification, third edition

JLS, third edition is out and available online at The Java Language Specification Website.

Check it out

## Sunday, June 26, 2005

### Cheap Edition of Stallings Operating Systems (fifth edition)

The PHI edition is out, I reviewed a chapter for the book. You can find my name in the acknowledgements section. That's the trumpet blowing for the day, back to work now.

Thanks for visiting my blog, its now been visited at least a 1000 times since march 2005. Even if I do not post anything on my blog, look out for the sidebar, there is usually something new and interesting there - almost always!

## Friday, June 24, 2005

### Scope of typedefs in a class in C++

I found this in the latest C++ draft specification

Type names obey exactly the same scope rules as other names.In particular, type names defined within a class definition cannot be used outside their class without qualification.

Example:
class X {public :   typedef int I;   class Y { /  . . .  / };   I a;};I b;            // errorY c;            // errorX::Y d;         // OKX::I e;         // OK

## Thursday, June 23, 2005

### Hoare's Law

Inside every large program is a small program struggling to get out

C. A. R. Hoare

### Signs that a country is progressing

Here are some signs you notice when a country starts making its mark in the world

1. The economy improves
2. GDP and per capita incomes goes up
3. Manufacturing plants get setup because the labour is still cheap or it becomes an outsourcing hub
4. The Government starts opening up the economy
5. It becomes a market for goods, there is an influx of foreign brands
6. Consumer spending increases
7. Government announces more projects for infra-structure development
8. The automotive and airline industry starts booming
9. The country starts doing well in sports

Can you think of more? Please let me know and I will grow the list. Let me know if you disagree with these observations

## Sunday, June 19, 2005

### Problems with the Indian Software Industry

Please do not take this personally, but I have compiled a list of problems the Indian Software industry must address. Feel free to comment to get something removed or added

1. Attrition
2. Missing Work-Life balance
3. The nature of work
4. Un-empowered employees
5. Reactive Management and short-term management
6. disproportionate pay scales
7. Statistically qualified Quality Team but with no software experience

## Saturday, June 18, 2005

### When everybody knows

Have you come across a situation where some lies, but everyone knows the truth about that person not being honest. You have to tolerate the person more out of compulsion. The persons lie is still accepted as truth.

I have found several such examples in the political and business world.

Why to we tolerate such things? I think we expect things to improve in the future and the person to get better or excuse it as a once in a while thing.

## Friday, June 17, 2005

### Too technical

I have been recently told by a few friends that my blog is too technical and I agree.

I'll fix it, so watch out, because when I speak non-techy stuff, who knows what might come out?

## Thursday, June 16, 2005

### Mozilla Hacking

I have recently started reading Mozilla Hacking in a Nutshell. I highly recommend it

## Wednesday, June 15, 2005

### The Auto Rickshaw Rule

I have found that you have a better chance of the auto rickshaw agreeing to were you want to go, if you wait for him to stop completely before telling him your destination

has been around for a long time and is one of favourites.

## Tuesday, June 14, 2005

### C++'s One Definition Rule

The one definition rule of c++ is something I learnt and forgot several times, but it makes an interesting read every time!!

The One-Definition Rule

Also see Weaving a Way Past the C++ One Definition Rule

## Monday, June 13, 2005

### Blog Jockey

Well, to make Radios, Discos, Videos, etc interesting a RJ (Radio Jockey), DJ (Disco Jockey) or Video Jockey (VJ) is employed. I am thinking of coming up with a Blog Jockey (BJ - don't forget you heard it here for the first time!)

Any Ideas?

### Online Problem Set

There is a very interesting web site online judge. It is basically a problem set archive, where you can submit code to solve the problems submitted there and be judged. There is also a book Programming Challenges based on the web site. I am planning to get started sometime soon, interested in collaborating?

Drop me an email!

## Thursday, June 09, 2005

### GUI Question

This question was probably first asked by Jeff Duntemann. Why are most output devices asymmetrical?

Here is what I mean, look at your monitor, its likely to be either (in dimensions)
1. 1024x768
2. 800x60
3. something higher

But the point is that the "x" and "y" dimensions are not the same. Why is it that a pixel is not a 1x1 square? The impact of this is

1. I usually end up with a vertical scroll bar (rarely a horizontal one)
2. The scroll wheel on my mouse, scrolls vertically

I think most of us read information top->right->down, so it makes sense to scroll vertically top->down.

Even books seem to have similar kind of dimensions. On an A4 size paper, one of the dimensions is sqrt(2) bigger than the other dimension, but there either of sides can be used as horizontal or vertical.

I think in our natural vision, the horizontal vision is bigger than our vertical one. When we see from the corner of our eye, we usually refer to the horizontal vision

## Monday, June 06, 2005

### Big Powerful Processors

Intel and AMD seem to be flooding our markets with Dual Core/Hyperthreaded Processors. These processors are so quick that they hide away our programming inefficiencies. Even badly/poorly programmed code works good on them (not always, really really bad code will show). I realized that the same code which worked super fast on one of these processors was snail slow on another. By spending some time tuning up the code, it worked faster as expected.

The point being, on a fast processor, I would have left it as is "inefficient"

Revisit your code under harsher conditions like
1. Lesser memory
2. Slower processor

Well, I got my BSNL broadband today after registering a lot of complaints with BSNL. The people who came to install were nice, but not as knowledgeable as I expected. It was fun and this is my first post from broadband. I am still confused about the speed, I cannot make out the difference b/w dial up and broadband.

Hopefully, now you will see a lot many posts.

## Thursday, June 02, 2005

### Regular Expressions

Ever since college my favorite subject was regular expressions. What I really loved was Thompson's Construction, so powerful. Many tools gained from them and became popular due to their support of RE's, for example

1. SED
2. AWK
3. KSH/SH
4. VI

I implemented an RE engine with the capability to display its internal state as it does string matching.

Here is the output of the RE "a*b" matching the string "ab"

The first image is RE engine representation. In the subsequent images the red lines show the possible paths that can be taken after looking at the current character in the string being matched. All the photos are links, you can finder better sizes by browsing the links, if you so desire

Ever worked in a team where a couple of people are not good at coding or following any good standards for coding or commenting. Imagine if you have to share a source file with them. Seeing them not do so well can infect you as well and you fall to their level of coding and guidelines. After all in a mess, where does one stand in with a flag of hope?

I have seen this happen around me, any similar experiences?

## Wednesday, June 01, 2005

### Understanding Programs Written By Others

All programmers will at some point find themselves having to depend on other peoples programs for various things

1. Maintenance
2. To use as an extension
3. To use as a starting point

You could find yourself in a situation where somebody else is working on your code.

Believe me, code does not get thrown away that easily.

I have been thinking of ways and means of understanding third party code easily. Here are my first thoughts

If you are the author of new code

1. Comment it well (its obvious), but revisit your comments and documents you have written
2. Read the Practice of Programming before you write code
3. Learn about Literate Programming and try to use it if possible

If you are burdened with somebody else's code

1. Read the documentation that comes with the code, too bad if it does not come with any documentation. If you do not understand the document, read it several times
2. Read the test plan document first and see if you understand the test cases
3. Use a reverse engineering tool like
• cflow
• Any commercial tool available
• codeviz

4. Get the overall goals of the software - Don't dig into algorithms right away, just understand what the algorithm is trying to achieve
5. Search on google for understanding the technology and the jargon