Tuesday, June 1, 2010

Surprise! C++ version

// Could you explain why this happens:

#include <iostream>

int surprise()
{
    int j = 0;
    if (true) int j = 7;
    return j;
}

int main()
{
    std::cout << "surprise = " << surprise() << std::endl;
    return 0;
}

Monday, March 29, 2010

Financial Chaos

John M. Templeton
Lyford Cay, Nassau, Bahamas

June 15, 2005

MEMORANDUM

Financial Chaos - probably in many nations in the next five years. The word chaos is chosen to express likelihood of reduced profit margin at the same time as acceleration in cost of living.

Increasingly often, people ask my opinion on what is likely to happen financially. I am now thinking that the dangers are more numerous and larger than ever before in my lifetime. Quite likely, in the early months of 2005, the peak of prosperity is behind us.

In the past century, protection could be obtained by keeping your net worth in cash or government bonds. Now, the surplus capacities are so great that most currencies and bonds are likely to continue losing their purchasing power.

Mortgages and other forms of debts are over tenfold greater now than ever before 1970, which can cause manifold increases in bankruptcy auctions.

Surplus capacity, which leads to intense competition, has already shown devastating effects on companies who operate airlines and is now beginning to show in companies in ocean shipping and other activities. Also, the present surpluses of cash and liquid assets have pushed yields on bonds and mortgages almost to zero when adjusted for higher cost of living. Clearly, major corrections are likely in the next few years.

Most of the methods of universities and other schools which require residence have become hopelessly obsolete. Probably over half of the universities in the world will disappear quickly over the next thirty years.

Obsolescence is likely to have a devastating effect in a wide variety of human activities, especially in those where advancement is hindered by labor unions or other bureaucracies or by government regulations.

Increasing freedom of competition is likely to cause most established institutions to disappear with the next fifty years, especially in nations where there are limits on free competition.

Accelerating competition is likely to cause profit margins to continue to decrease and even become negative in various industries. Over tenfold more persons hopelessly indebted leads to multiplying bankruptcies not only for them but for many businesses that extend credit without collateral. Voters are likely to enact rescue subsidies, which transfer the debts to governments, such as Fannie May and Freddie Mac.

Research and discoveries and efficiency are likely to continue to accelerate. Probably, as quickly as fifty years, as much as ninety percent of education will be done by electronics.

Now, with almost one hundred independent nations on earth and rapid advancements in communication, the top one percent of people are likely to progress more rapidly than the others. Such top one percent may consist of those who are multi-millionaires and also, those who are innovators and also, those with top intellectual abilities. Comparisons show that prosperity flows toward those nations having most freedom of competition.

Especially, electronic computers are likely to become helpful in all human activities including even persons who have not yet learned to read.

Hopefully, many of you can help us to find published journals and websites and electronic search engines to help us benefit from accelerating research and discoveries.

Not yet have I found any better method to prosper during the future financial chaos, which is likely to last many years, than to keep your net worth in shares of those corporations that have proven to have the widest profit margins and the most rapidly increasing profits. Earning power is likely to continue to be valuable, especially if diversified among many nations.

Thursday, July 30, 2009

Ram Shift

A programmer started to cuss
Because getting to sleep was a fuss
As he lay there in bed
Looping 'round in his head
was: while( !asleep() ) sheep++;

Saturday, April 18, 2009

The Voca People

Thursday, March 12, 2009

Innovative methodology: Rubber Duck method of debugging

> There is an entire development methodology (whose name escapes me at the
> moment) that makes use of that very phenomenon.


We called it the Rubber Duck method of debugging. It goes like this:
  1. Beg, borrow, steal, buy, fabricate or otherwise obtain a rubber duck (bathtub variety)
  2. Place rubber duck on desk and inform it you are just going to go over some code with it, if that's all right.
  3. Explain to the duck what you code is supposed to do, and then go into detail and explain things line by line
  4. At some point you will tell the duck what you are doing next and then realise that that is not in fact what you are actually doing. The duck will sit there serenely, happy in the knowledge that it has helped you on your way.

Works every time. Actually, if you don't have a rubber duck you could at
a pinch ask a fellow programmer or engineer to sit in.

Wednesday, March 4, 2009

Systems thinking, Passion, and Clear communication

There are three traits that will serve anyone wanting any role at any company: systems thinking, passion, and clear communication.

Systems thinking is a way of looking at the world that allows you to see how many small pieces come together to make a more complex whole. System thinkers see the hidden interconnections that bind together the parts and know how to make the best use of ambiguity and uncertainty as a result.

Passion isn't just about liking what you do. It's also about focus, determination, and obsessing over quality. Yes, you want a job, but do you want a mission? Having this sort of enthusiasm is essential because it will get you through difficult challenges more than almost any other trait.

Clear communication brings everything together. If systems thinking is about the higher-level patterns, and passion is about the details, then clear communication is the means by which the first two traits come into alignment. You need to be a clear communicator as an individual contributor, an executive, and everything in between.

(Gary Flake)

Tuesday, February 24, 2009

I will buy your monkeys

Once upon a time in a village a man appeared who announced to the villagers that he would buy monkeys for $10. The villagers knew that the jungle held countless monkeys, easily caught. The man bought 2 thousand.

As the supply diminished, they become difficult to catch, and villagers returned to their farms. The man announced that he would pay $20. The villagers renewed their efforts and caught 1,000 more monkeys.

The supply quickly diminished, but before they returned to their farms the man increased his offer to $40 each. Monkeys became so rare that it was difficult to even see a monkey let alone catch it. But they caught 500.

The man now announced that he would buy monkeys at $100! However, since he had to go to the city on some business his assistant would now buy for the man. The man departed.

Then the assistant told the villagers, “Look at all these monkeys the man has in that big cage. I will sell them to you at $50 each. When the man comes back you can sell the monkey’s back to him for $100.” The villagers queued up with all their saving to buy the monkeys. The assistant took their money. They never say either the man or his assistant again.

They now owned 3,500 monkeys. They were paid $60,000 to catch them, and bought them back for $175,000.