Friday, May 28, 2010

writing Bug free C code


The C language provides a minimal, efficient framework. A key to writing bug-free code is learning from your mistakes. Designing a module right the first time saves time. Programming without a goal is like a sailboat without a sail. You drift. Never reinvent the wheel. Always code what to do, not how to do it. As a general rule, try to keep functions under one page.


Always review changes before checking source code back in. An API must be designed right the first time because changes to an API are costly. Before you can write bug-free code, you must have a bug-free, rock-solid base. Provide a code wrapper around all system calls. Use macros as an aid to porting so that your code base does not change at all. Try to hide how something works to provide an abstraction that aids.

Macro names should be in uppercase. Macros beginning with an underscore are to be used only in other macros, not explicitly in source code. New data types should be in uppercase. New data types must be declared with a typedef statement, not a macro definition. Variables should be named using Hungarian notation. Hungarian notation allows you to know a variable's data type without seeing the data declaration. Functions should be named using the module/verb/noun convention. Think twice and do once.

    If I had eight hours to chop down a tree, 
    I'd spend six hours sharpening my axe.  -- AbrahamLincoln

    --
    Sam

    Wednesday, May 19, 2010

    A Leader Should Know How to Manage Failure


    Question: Could you give an example, from your own experience, of how leaders should manage failure?

    APJ Abdul Kalam: Let me tell you about my experience. In 1973 I became the project director of India 's satellite launch vehicle program, commonly called the SLV-3. Our goal was to put India 's "Rohini" satellite into orbit by 1980. I was given funds and human resources -- but was told clearly that by 1980 we had to launch the satellite into space. Thousands of people worked together in scientific and technical teams towards that goal.


    By 1979 -- I think the month was August -- we thought we were ready. As the project director, I went to the control center for the launch. At four minutes before the satellite launch, the computer began to go through the checklist of items that needed to be checked. One minute later, the computer program put the launch on hold; the display showed that some control components were not in order. My experts -- I had four or five of them with me -- told me not to worry; they had done their calculations and there was enough reserve fuel. So I bypassed the computer, switched to manual mode, and launched the rocket. In the first stage, everything worked fine. In the second stage, a problem developed. Instead of the satellite going into orbit, the whole rocket system plunged into the Bay of Bengal . It was a big failure.

    That day, the chairman of the Indian Space Research Organization, Prof. Satish Dhawan, had called a press conference. The launch was at 7:00 am, and the press conference -- where journalists from around the world were present -- was at 7:45 am at ISRO's satellite launch range in Sriharikota [in Andhra Pradesh in southern India ]. Prof. Dhawan, the leader of the organization, conducted the press conference himself. He took responsibility for the failure -- he said that the team had worked very hard, but that it needed more technological support. He assured the media that in another year, the team would definitely succeed. Now, I was the project director, and it was my failure, but instead, he took responsibility for the failure as chairman of the organization.

    The next year, in July 1980, we tried again to launch the satellite -- and this time we succeeded. The whole nation was jubilant. Again, there was a press conference. Prof. Dhawan called me aside and told me, "You conduct the press conference today."


    I learned a very important lesson that day. When failure occurred, the leader of the organization owned that failure. When success came, he gave it to his team. The best management lesson I have learned did not come to me from reading a book; it came from that experience.

    Source: This is from Former President of India APJ Abdul Kalam at Wharton India Economic forum, Philadelphia , March 22,2008

    --
    Sam

    Wednesday, January 20, 2010

    Free Fast Public DNS Servers List


    The Domain Name System (DNS) is a hierarchical naming system for computers, services, or any resource connected to the Internet or a private network. It associates various information with domain names assigned to each of the participants. Most importantly, it translates domain names meaningful to humans into the numerical (binary) identifiers associated with networking equipment for the purpose of locating and addressing these devices worldwide. An often used analogy to explain the Domain Name System is that it serves as the "phone book" for the Internet by translating human-friendly computer hostnames into IP addresses. For example hostnames such as google.com is translated to IP address 209.85.231.104.


    This is a list of better, fast public dns servers and free dns server (as compare to your ISP / DSL / ADSL / cable DNS service providers dns servers). These dns servers are free to all. I was able to improve my browsing speed with following DNS servers. Use any one of the following provider.

    Google [ 8.8.8.8 or 8.8.4.4 ]

    ScrubIt [ 67.138.54.100 or 207.225.209.66 ]

    dnsadvantage [ 156.154.70.1 or 156.154.71.1 ]

    OpenDNS [ 208.67.222.222 or 208.67.220.220 ]

    vnsc-pri.sys.gtei.net [ 4.2.2.1 or 4.2.2.2 ]



    --
    Sam

    Monday, December 14, 2009

    Earth's Atmosphere Came from Outer Space

    [click to view larger image]


    A new study finds the gases which formed the Earth's atmosphere as well as its oceans did not come from inside the Earth but from comets and meteorites hitting Earth during the Late Heavy Bombardment period. A research team tested volcanic gases to uncover the new evidence. They found a clear meteorite signature in volcanic gases which could not have contributed in any significant way to the Earth's atmosphere. Therefore the atmosphere and oceans must have come from somewhere else, possibly from a late bombardment of gas and water rich materials similar to comets.


    According to the theory of the Late Heavy Bombardment, the inner solar system was pounded by a sudden rain of solar system debris only 700 million years after it formed, which likely had monumental effects on the nascent Earth. So far, the evidence for this event comes primarily from the dating of lunar samples, which indicates that most impact melt rocks formed in this very narrow interval of time. But this new research on the origin of Earth's atmosphere may lend credence to this theory as well. Until now, no one has had instruments capable of looking for these subtle signatures in samples from inside the Earth.

    Source: universetoday

    --
    Sam

    Friday, October 30, 2009

    Curiosity - The Key to Discovery





















    [click to view larger image]

    Curiosity is an emotion related to natural behaviour such as exploration, investigation, and learning, evident by observation in human and many animal species. The term can also be used to denote the behavior itself being caused by the emotion of curiosity. As this emotion represents a drive to know new things, curiosity is the fuel of science and all other disciplines of human study.


    Curiosity is common to human beings at all ages from infancy to old age, and is easy to observe in many other animal species. These include apes, cats, fish, reptiles, and insects; as well as many others. Many aspects of exploration are shared among all beings, as all known terrestrial beings share similar aspects: limited size and a need to seek out food sources.

    Strong curiosity is the main motivation of many scientists. In fact, in its development as wonder or admiration, it is generally curiosity that makes a human being want to become an expert in a field of knowledge. Though humans are sometimes considered particularly curious, they sometimes seem to miss the obvious when compared to other animals. What seems to happen is that human curiosity about curiosity itself (i.e. meta-curiosity or meta-interest), combined with the ability to think in an abstract way, lead to mimesis, fantasy and imagination - eventually leading to an especially human way of thinking ("human reason"), which is abstract and self aware, or conscious. Some people have the feeling of curiosity to know what is after death.


    To be curious, all it takes to start is imagination and curiosity. If you've got these qualities, along with persistence, you've got what it takes to consider a career in science-perhaps an award winning career. That wonderful world of the future, now only in your imagination can become real. If you act on your curiosity, you can help make it happen!


    --
    Sam

    Wednesday, September 2, 2009

    Why Should We Hire You


    [click to view larger image]


    When it comes to job interviews, there are several questions that are not exactly related to the work, but are one of the major reasons why your job interview does not have the results that are in your best interests. One such question is the question “Why should we hire you?” Basically, this question is one of the master strokes during an interview.

    For one, the interview question “Give us reasons to hire you” or “What can you bring to our company” is something that differentiates the best candidates from the other, good candidates.


    This question is more often a surprise question to most individuals who are not as experienced in the process of the job interview. Also, this question works as a divider between the people who are looking for a job just casually and the people who are really seeking a job. While answering this question, remember that the answer should not come across to be egotistic or be completely unrealistic. You should focus on providing reasons to hire you over someone else in the best way you can.

    The following are some points to consider:

    1. One of the best ways to answer this question is to make a short list of all your advantages that would point out the positive aspects that you have for the new job position.

    2. One of the points that you can raise is the similarity of the job profile you are aiming in the company basis to the job profile you enjoyed in the previous job.

    3. You can also take the interviewer’s attention towards your key skills and strengths, name – quick learning, excellent communication skills, etc

    4. In addition, your professional ambitions should be made clear – the motivation and dedication that you have for the profession and the opening position.

    5. Make sure that your answers do not come out to be too much about yourself or even can be translated into bragging.

    6. The body language when you answer the question is important too. For example, your body language should make it clear that you have thought about the answer and given a carefully worded answer, instead of coming up with a made up, dummy answer.

    7. The last sentence, a phrase that can be used is, The job is tailored to my (or- I will bring my) experience, knowledge base and abilities and I believe I can maximize my skills for the benefit of the company.


    Source: job-interview-site

    --
    Sam

    Wednesday, August 12, 2009

    Rainbow at Night


    [click to view larger image]

    We have all seen rainbows during the day but what about rainbows at night? They are elusive, but powerful to see. Yes "Moonbows" are rainbows created by light from the Moon. Conditions have to be just right, and there are only a small number of places in the world where they regularly materialize, such as Victoria Falls on the border between Zambia and Zimbabwe as seen above, Cumberland Falls in Kentucky, Yosemite Falls in California, and Waimea on Hawaii. Because they are so faint, moonbows are difficult to see with the naked eye (they usually appear just white). But with long-exposure photography, all the colors of moonbows can be seen.


    Moonbows are rare because moonlight is not very bright. A bright moon near to full is needed, it must be raining opposite the moon, the sky must be dark and the moon must be less than 42ยบ high. Put all these together and you do not get to see a moonbow very often! To the unaided eye they usually appear, as in the small image, without color because their light is not bright enough to activate the cone color receptors in our eyes. Colors have been reported and might be seen when the moon is bright.

    --
    Sam

    How to Recover deleted sticky notes on windows

    Most of us take important notes and reminders on the "Sticky Notes" feature available in most of the windows operating syste...