Monday, April 24, 2006

Errors & Bugs

Errors & Bugs

Absolutely all of us face errors in writing programs (Compilation and runtime and others). Some give up some make massive changes while others try to follow errors and never change code or idea.really I don't know what is the best choice but I think it depends on the project itself and on the programmer.

Well I will tell you about some errors I faced.

First error: When I compiled a project (signal flow graph) a nice error appeared.The error was multiple declaration for class List see earlier declaration actually they were more than one error. I compiled the program more than once but the same error List was a template class so I thought that was because of template errors or due to multiple inclusions from several files. All didn’t work. Finally I decided to trace the earlier declarations. I found that the earlier declaration was in other project (Sorting techniques) although the project file was not included. WOW! Yet I was very pleased that I closed the computer. Never work in 2 projects in the same time simply, delete one of them to be far from errors.
No comment.

Other error was in sorting techniques project the project compiled normally with 0 errors and some warnings but when I removed the checkbox of Build with runtime packages the following error appeared fatal linker error cannot find the file “perfgrap.obj”!! What is that file and who included it I don’t know? When I removed the checkbook the project compiled normally I made a new project added all files to that and compiled it with the same error so, what to do now?? I had a small idea I brought any object file from any project and copied it to the project directory then renamed it to “perfgrap.obj” then compiled the project. It compiled successfully and ran normally!
Past errors were all compilation errors what about run time errors?
One of the strangest errors I saw was privileged instruction error! I think it was the responsibility of the compiler to fix that error. other was Paging file error when I see this types of errors I do nothing more than compiling the project more than once.

What’s an error?

(Compilation) Not following the language rules.
(Runtime) The condition of preventing the program from continuing running normally.

What’s a bug?
A bug is a mistake or failure that prevents it from working normally or produces incorrect or false result.
Linus Travold "Given enough eyeballs, all bugs are shallow".
Advices for programmers:

1-Write smart compressed small code : e.g. to copy a string: while (*s++ = *t++) ;
2-Go back and enhance your old code.
3-Learn from your IDE.( Language features IDE features help…)
4-Development on a fast-super computer.
5-Write lots of comments.
6-Use accessors or properties rather than public data.
7-Be aware with input and organized with output.
8-All special cases must be handled immediately; you'll never go back and fix them.
9-Design first (on paper in mind) then code.

Monday, April 17, 2006

China president at Gates house, not White House

China president at Gates house, not White House


Where do you think the first dinner of the historic visit of China’s president Hu Jintao to United States?

The White House? No.

It won't be in Washington D.C., but Seattle,The capital of Microsoft, and the Tuesday dinner will be held at the $100 million lakeside mansion of Microsoft founder and the world's richest man, Bill Gates.

The approximately 100-person guest list is a who's who of the U.S. Pacific Northwest power elite, including Starbucks Chairman Howard Schultz and Washington State Gov. Christine Gregoire.

Gates and Gregoire are expected to introduce and welcome Hu, who will then offer a toast in front of the gathering.

Like any good dinner guest, President Hu will not come empty handed. The Chinese government issued a decree two weeks ago that all PCs will need to have licensed operating system software installed before leaving the factory gates in an effort to crack down on piracy.
As a result, three Chinese PC manufacturers announced plans to buy a total of over $400 million worth of Microsoft Windows operating system software over the next three years and Lenovo Group, China's largest PC maker, is expected to announce a similar deal on Monday, organizers said.

This event is not so good for Linux lovers as it closes the door for Linux poularity in China(one of the greatest hosts for Linux).

Gates' lodge-style, 66,000-square-foot home overlooking Lake Washington with a reported seven bedrooms, six kitchens, 24 bathrooms, a domed library, a reception hall and an artificial estuary stocked with salmon and trout.

Gates lodge

The dining room overlooks the river!

Friday, April 7, 2006

Why People Don’t Work Like Elevators?

Why People Don’t Work Like Elevators?

Your reaction to intensive signals is faster than less intensive ones.

Do you know why?
Do you understand?

Consider the following 2 examples:

You are in a hurry and waiting for the elevator what will you do?
You will push the elevator button strongly and repeatedly, but do you think that this will bring the elevator faster? In other words do you think that the elevator will respond to you faster in that way?
You may imagine that but absolutely that is never true.

Now if you shout at your friend then (s)he will respond to you faster than simply calling him so, why people don't work like elevators?

People respond to brighter light, louder sound faster than other this known as Pieron’s Law

Reaction Time is the time between the action and your response.

I is the physical intensity of the signal.
R0 is the minimum time for any response
K and b are constants that vary depending on the exact setup and the particular person involved.

A graphical representation showing last relation can be shown:

In fact, Pieron’s Law holds for the brightness of light, the loudness of sound, and even the strength of taste.

To see why, think of it like this: Pieron’s Law is a way of saying that the response time increases but at a decreasing rate, as the intensity.

Tom Stafford &
Matt Webb