Thursday, December 30, 2010

[Book] Butterfly Effect

No, we are not talking about the movie by Ashton Kutcher. We are going to talk about the Butterfly Effect which is a concept in chaos theory, which says

A flap of butterfly's wings in Brazil can set out a tornado in Texas. 

More generally, few insignificant random events can cause a big impact. This phenomena occur a lot in our daily life. But perhaps, it is referred to as fate, rather than the Butterfly Effect. For example, had Bruce Willis not gone to at attend an Olympic event in 1984, he might have not been a star today, or had you not gone to study abroad, you might have not found the love of your life.



Source: The Drunkard's Walk: How Randomness Rules Our Lives by Leonard Mlodinow, Chapter 10 [Read the Book Review] [Read the Previous Part] [Read the Next Part].

Sunday, November 21, 2010

[Book] Hot hand fallacy


 Hot hand fallacy states that if performing well in last consecutive trials, a person might perform well in the next trials. In fact, the streak (of well-performance) may just be because of pure chance. If this is the case, the results in the few consecutive trials infer nothing about the next trials.


Hot hand fallacy is perceived in various fields such as sport or business. We usually judge people (e.g., basketball players or companies) by statistics. But we usually misled by a hot hand fallacy. When a good player makes several baskets consecutively, we tend to think that his hand is “hot”, and that his teammates should give him the ball. So if an average player makes several baskets consecutively, does is mean that his is better than a good player? No, because if he is better, his statistics would have been better. The fact that he makes a lot of baskets consecutively implies that he might miss a lot of baskets too. We just don’t know when it will happen.

Saturday, November 13, 2010

[Book] People, Perception, Perfection, and Randomness


 Perfection requires perfect perception. It is hard to achieve perfection, since the data we perceives is rarely perfect. So how do we determine whether what we perceive is true. In a more technical term, how do we accept or reject the hypothesis based on what we perceived? In this respect, statisticians resort to "Significant Testing" in order to make decision based on observations.

"Human perception is very narrow. There is only about 1 degree of visual angle around the retina center which has high resolution. Outside this region, the resolution drops off sharply. Therefore, we tend to move our eyes a lot to compensate for the narrow visual area."

Thursday, October 21, 2010

[Book] The Dawn of Statistics



Statistics began as early as 1066, when William the conqueror, the Duke of Normandy, conquered and became the King of England. He would like to find out what exactly he did conquer and how much tax he can collect. So he sent out two groups of inspectors to men to do some survey on land and livestock. At that time, people believed that it is the God’s will to let people live or die. So, a survey of people as well as how they born and die were forbidden. As time changes, people changes. In later time, people began to believe that study of population is not against the God’s will, but is the way to understand him better. In the 16th century, the London Bill of Mortality was drafted. It was the first attempts to record people’s birth and death.
"Statistics can provide insights into the system from which the statistics are derived."

Source: The Drunkard's Walk: How Randomness Rules Our Lives by Leonard Mlodinow, Chapter 8 [Read the Book Review] [Read the Previous Part] [Read the Next Part].


Saturday, October 2, 2010

[Book] Measurement and the Law of Errors


Ancient Experiment: Science or Art
In the old time, scientists perform experiment, and make the best intuitive guess of what the result should be. And, if they were to repeat the experiment, they could get totally different results. They just lacked a standard for measurement.
In other words, they use feeling rather than scientific method. Is this science? Or, is it art? “Any variation within a margin of error should be ignored.”

Tuesday, September 28, 2010

[Book] False Positives and Positive Fallacies



Conditional Probability

We learned earlier that more details can lead to more restriction and reduce the corresponding probability. More specifically, the probability of event A is always greater than the probability of events A and B.

But details do not always reduce the probability. It can increase the probability by shrinking the sample space. We can be more sure that a specific outcome will occur if we can cross off some of the sample space. This is known as “Bayes’ Theorem”.


Sunday, September 19, 2010

Probability, Ratio, and the Law of Large Numbers

Probability and Ratio

You probably know about probability and ratio. Suppose I put 70 of black balls and 30 of white balls in an urn. General statements would be
  • The Ratio of black balls (when comparing to all the balls in the urn) is 7:10
  • If I draw a ball from the urn, the Probability that I would draw a black ball would be 7 in 10

Thursday, September 16, 2010

Gods and Expectation

Blaise Pascal

Blaise Pascal is known as the person who invented the Pascal's Triangle, whose elements are the number of ways to arrange N objects in M places.

But, the story that drew my interest is that he is also the inventor of expectation. And, even more interesting is how he came up with the concept of expectation. Here we go....

Wednesday, September 15, 2010

Update on NS 2.35 Installation: Command not Found

During the last week, I have got few email about my previous NS2 installation.

The Error Message

After the installation some one type "ns" and get the following error
>>nsbash: ns: command not found
This could be because you have not set the $PATH variable. Therefore, the OS does not know where to look for the command "ns".



Friday, September 10, 2010

The Birthday Problem



Given that everyone’s birthday is absolutely random, how many people
must be in the room such that there is more than even chance (at least
50%) that
  • Another person would have the same birthday as you (ANS: 365/2 =
    183 persons)
  • Two persons would have the same birthday (ANS: 23 persons)
The difference is that you fix the date in the former. But you let the date vary in the latter. It is obvious that you would need less people in the latter than in the former. But the surprising result is that it is a lot less.


Monday, September 6, 2010

C++ and OTcl Linkage: Result — Passing Values between C++ and OTcl domains

ote: The content in this series is extracted from the book, Introduction to Network Simulator NS2. You may have to read chapter 3 of the book for better understanding.

Introduction
This post is the second post in the series on C++ and OTcl Linkage:

   1. Why Two Languages?
   2. Binding C++ and OTcl classes [Main steps, The mechanism].
   3. Variable binding
   4. OTcl command: Invoking C++ statements from the OTcl domain [ Getting Started, Invocation process, Binding OTcl and C++ ]
   5. Eval: Invoking OTcl statements from the C++ domain
   6. Result: Passing Values between C++ and OTcl domains
   7. Object binding and object construction process.
In the previous post, I blogged about an approach to invoke OTcl statements from the C++ domain using function evalc(...) and evalf(...). This post discusses the way to pass results between C++ and OTcl domains using function result(...).

Passing Values Between C++ and OTcl

View more presentations from Teerawat Issariyakul.
======================================================
T. Issaraiyakul and E. Hossain, “Introduction to Network Simulator NS2”, Springer 2009.


You may also find lecture notes and other resource at the following website: http://www.ece.ubc.ca/~teerawat/NS2.htm

Wednesday, September 1, 2010

Sample Space and Gambling



The Dawn of Sample Sapce

Gerolamo Cardano was an physician, a gambler, and a mathematician. Early in his career, he discovered the concept of sample space, and tried to publish the concept in a book named “The book on Games of Chance”. The manuscript was rejected.

He did not try to published it again. Instead, he used the concept to make a fortune out of gambling. The book was published after his death in 1663. Here is the quote from the book.

“The possible outcomes of a random process can be thought of as a point in the space.”

This space of all possible outcomes is later known to as “sample space”.


Monday, August 30, 2010

C++ and OTcl Linkage: Eval — Invoking OTcl statements from the C++ domain

Note: The content in this series is extracted from the book, Introduction to Network Simulator NS2. You may have to read chapter 3 of the book for better understanding.

Introduction

This post is the second post in the series on C++ and OTcl Linkage:

   1. Why Two Languages?
   2. Binding C++ and OTcl classes [Main steps, The mechanism].
   3. Variable binding
   4. OTcl command: Invoking C++ statements from the OTcl domain [ Getting Started, Invocation process, Binding OTcl and C++ ]
   5. Eval and result: Invoking OTcl statements from the C++ domain
   6. Object binding and object construction process.
In the previous post, I blogged about an approach to invoke C++ statements from the OTcl domain. This post discuss the reverse: Invoking OTcl statements from the C++ domain.


 

View more presentations from Teerawat Issariyakul.
======================================================
T. Issaraiyakul and E. Hossain, “Introduction to Network Simulator NS2”, Springer 2009. Buy it now from

You may also find lecture notes and other resource at the following website: http://www.ece.ubc.ca/~teerawat/NS2.htm

Friday, August 27, 2010

The Interpretation of Randomness


How much do you know about randomness? What does it mean by a random process? Well, a lot of people would say that a random process is a process whose outcomes cannot be predicted. Clean and simple, and nice for a lot of people.

But this definition is quite vague to mathematician. Mathematicians have something for preciseness. When you say a circle is round, they would ask how round, and you would not know how to reply to them. But if you ask a mathematician how round is a circle, the answer would be 3.14 x R x R where R is the radius.

Likewise, the above definition for a random process is not precise enough. For mathematician, there are at least two interpretation for a random process:

(i) Frequency interpretation: A process is said to be able to generate random numbers when the observed outcome conform to the underlying probability.

(ii) Subjective interpretation: Observed outcomes are said to be random if they cannot be predicted.



Sunday, August 22, 2010

[NS2] Error message: Invalid command

Last week, I've got few messages asking me similar questions. The question was why do I see the following error message when running NS2 and how do I fix it?

invalid command name

Wednesday, August 18, 2010

The Greek, the Roman, and the Mathematics


The Greek and Their Mathematics

Most greek Mathematics are mainly about geometry. They do not believe in probability since
  • They believe that chance is governed purely by Gods.
  • Their number system is very difficult to work with. Algebra and arithematics had not existed in their time. They don’t even have the number zero nor fraction.

Monday, August 16, 2010

C++ and OTcl Linkage: OTcl Commands — Binding OTcl and C++

Note: The content in this series is extracted from the book, Introduction to Network Simulator NS2. You may have to read chapter 3 of the book for better understanding.

Introduction
This post is the second post in the series on C++ and OTcl Linkage:

   1. Why Two Languages?
   2. Binding C++ and OTcl classes [Main steps, The mechanism].
   3. Variable binding
   4. OTcl command: Invoking C++ statements from the OTcl domain [ Getting Started, Invocation process, Binding OTcl and C++ ]
   5. Eval and result: Invoking OTcl statements from the C++ domain
   6. Object binding and object construction process.
In the previous post, I blogged about the key steps in the OTcl domain when instproc or OTcl command is invoked. In this post, I will explain how NS2 moves from OTcl to C++.

Saturday, August 14, 2010

Availability Bias

A Trick Question You Might Want To Try With Your Friends

Let me ask you a question. Among English 6-letter words, which of the following is more probable?
  • Find a word whose fifth letter is ‘n’.
  • Find a word ending with ‘ing’.

Tuesday, August 10, 2010

Regression towards the Mean

A result which falls far from the mean tends to be closer to the mean during the next attempt. Failing something consecutively does not mean that the next attempt will not succeed. Attempts and successes are not linearly related.

Future is unpredictable, but there is one good news. If you are good (i.e., the mean is good enough), you will finally succeed (i.e., reach the mean). Do not give in, even if you have failed (i.e., fall off the mean) consecutively.

“Genius does not guarantee success, but it is seductive to assume that success must come from genius.”

The logic behind the “regression towards the mean” theorem is as follows. Suppose your average test score is 50. Now, let’s take a test. Suppose that you’ve got 40. If your next test scores less than 40, which is further away from the mean, your average won’t be 50. It has to be lower than 50 which contradicts to what we assume at the beginning.


Source: The Drunkard's Walk: How Randomness Rules Our Lives by Leonard Mlodinow, Chapter 1 [Read the Book Review] [Read the Previous Part] [Read the Next Part].

Sunday, August 8, 2010

C++ and OTcl Linkage: OTcl Commands -- Invocation process

Note: The content in this series is extracted from the book, Introduction to Network Simulator NS2. You may have to read chapter 3 of the book for better understanding.

Introduction
This post is the second post in the series on C++ and OTcl Linkage:

   1. Why Two Languages?
   2. Binding C++ and OTcl classes [Main steps, The mechanism].
   3. Variable binding
   4. OTcl command: Invoking C++ statements from the OTcl domain [ Getting Started, Invocation process ]
   5. Eval and result: Invoking OTcl statements from the C++ domain
   6. Object binding and object construction process.

In the previous post, I blogged about OTcl command. I took you to see how to create a OTcl command in C++ and invoke the command from the OTcl domain. how C++ and OTcl classes are bound together. In this post, I will explain the key steps for OTcl command invocation.

Saturday, July 17, 2010

Are we a better guesser than a mouse?

It is compelling to answer ‘yes’. Unfortunately, the answer is ‘not always’. To see why, let’s setup an experiment where red and green cards are shown to a test subject. The job of the subject is to observe a sequence of cards and to guess the color of the next cards. Suppose that we use a certain sequence where 75% of the cards are green and 25% are red cards. The subject might choose to use one of the following 2 strategies for guessing:

(i) Probability based guessing: Observe and compute probability of cards being green and red. Then always choose the color with higher probability. In the above example, the subject will always choose green. If we let the subject keeps guessing, the correct probability will approach 75%. But it can never be better than 75%. This is what most non-human animals such as mouses would do.

Monday, July 12, 2010

C++ and OTcl Linkage: OTcl Commands — Getting Started

Note: The content in this series is extracted from the book, Introduction to Network Simulator NS2. You may have to read chapter 3 of the book for better understanding.
OTcl Command -- Getting Started

View more presentations from Teerawat Issariyakul.

Introduction

This post is the second post in the series on C++ and OTcl Linkage:

   1. Why Two Languages?
   2. Binding C++ and OTcl classes [Main steps, The mechanism].
   3. Variable binding
   4. OTcl command: Invoking C++ statements from the OTcl domain [ Getting Started, Make it more Interesting ]
   5. Eval and result: Invoking OTcl statements from the C++ domain
   6. Object binding and object construction process.

In the previous post, I blogged about how C++ and OTcl classes are bound together. In this post, I will explain how to bind C++ and OTcl class variable together.
=======================================================
T. Issaraiyakul and E. Hossain, “Introduction to Network Simulator NS2”, Springer 2009. Buy it now from

You may also find lecture notes and other resource at the following website: http://www.ece.ubc.ca/~teerawat/NS2.htm

Thursday, July 8, 2010

Segmentation Fault: A Common Error in NS2

Introduction

One of the most common error you might have found when running NS2 is "Segmentation Fault". This is just a type of runtime error. If you run, the same program in Win32 console application, Windows will show a run-time error message and terminate the program. So don't be intimidated by it. 

Monday, July 5, 2010

C++ and OTcl Linkage: Binding variables

Note: The content in this series is extracted from the book, Introduction to Network Simulator NS2. You may have to read chapter 3 of the book for better understanding.

Introduction

This post is the second post in the series on C++ and OTcl Linkage:

   1. Why Two Languages?
   2. Binding C++ and OTcl classes [Main steps, The mechanism].
   3. Variable binding
   4. OTcl command: Invoking C++ statements from the OTcl domain
   5. Eval and result: Invoking OTcl statements from the C++ domain
   6. Object binding and object construction process.

In the previous post, I blogged about how C++ and OTcl classes are bound together. In this post, I will explain how to bind C++ and OTcl class variable together.
NS2: Binding C++ and OTcl variables


View more presentations from Teerawat Issariyakul.

=======================================================
T. Issaraiyakul and E. Hossain, “Introduction to Network Simulator NS2”, Springer 2009. 
You may also find lecture notes and other resource at the following website: http://www.ece.ubc.ca/~teerawat/NS2.htm

Wednesday, June 30, 2010

[ns2] C++ Command assert()

When delving into the C++ domain in NS2, you would be likely to find a C++ statement assert(<expr>). For example, in file ~ns/common/agent.cc,

assert(p!=NULL)

This function inspects its input argument <expr>. If the <expr> is
  • TRUE, it does nothing.
  • FALSE, it terminates the program.
For more information, please see [ this link ].

Sunday, June 20, 2010

C++ and OTcl Linkage: Binding C++ and OTcl classes — Part II

Note: The content in this series is extracted from the book, Introduction to Network Simulator NS2. You may have to read chapter 3 of the book for better understanding.

Introduction

This post is the second post in the series on C++ and OTcl Linkage:

   1. Why Two Languages?
   2. Binding C++ and OTcl classes [Main steps, The mechanism].
   3. Variable binding
   4. OTcl command: Invoking C++ statements from the OTcl domain
   5. Eval and result: Invoking OTcl statements from the C++ domain
   6. Object binding and object construction process.

In the previous post, I blogged about how C++ and OTcl classes are bound together. In this post, I will explain the internal mechanism of the binding process.



Wednesday, June 16, 2010

[BookReview] The Reader by Bernhard Schlink

Rating: 3/5
Genre: Novel

Book Review
I picked this book by the recommendation from one of my friends. She told me that it was a good story, only if you don’t know the story before I read it, and it was.

This story is translated from A Germany novel, “Der Vorleser”. It is the story during the Holocaust, told by the main character Michael Berg. Most of the storytelling is engaging, but some parts are not. The more exciting part is the place where the book surprises me. I won’t spoil you with what that is. You have to read the book.

Overall, I think this is a good book. It worthes my time reading this book.

Saturday, June 12, 2010

C++ and OTcl Linkage: Binding C++ and OTcl classes -- Part I

Note: The content in this series is extracted from the book, Introduction to Network Simulator NS2. You may have to read chapter 3 of the book for better understanding.

Introduction

This post is the second post in the series on C++ and OTcl Linkage:

   1. Why Two Languages?
   2. Binding C++ and OTcl classes [Main steps, The mechanism].
   3. Variable binding
   4. OTcl command: Invoking C++ statements from the OTcl domain
   5. Eval and result: Invoking OTcl statements from the C++ domain
   6. Object binding and object construction process.

In the previous post, I blogged about the motivation of having 2 languages. In this post, I will show you how to bind a C++ class to an OTcl class so that when an OTcl object is created, a shadowed C++ object is automatically crated.

Thursday, June 10, 2010

The Responsible Free Market Economy -- The Leader's Way, Chapter 9

Socialism and Capitalism

Socialism is a great concept. Conceptual, it should bring benefits to all and eliminate poverty. But in practice, power in socialistic society tends to be in the hand of a group of few people. Most people work very hard, but gain very little. Lacking motivation, socialistic economy tends to be stagnant. Although socialism focuses on the distribution of wealth, there is no wealth to distribute.

Capitalism, on the other hand, promotes competition in a free market. Freedom breeds competition. Free and fair competition leads to creation and wealth. Capitalism focuses on creation of wealth, not the distribution of wealth. Therefore, rich people become richer, while the poor remains poor.


Tuesday, June 8, 2010

Error message: Undefined reference to vtable

Introduction
Another common error message when you compile NS2 would look like this

Book/otcl.o:otcl.cc:(.text+0x8c): undefined reference to `vtable for MyObject'
collect2: ld returned 1 exit status
make: *** [libns.dll] Error 1

Why?
This error is caused by declaring but not implementing one or more virtual function.

How to Fixed It?
Provide implementation to all virtual functions

Monday, May 31, 2010

C++ and OTcl Linkage: Why Two Languages?

Note: The content in this series is extracted from the book, Introduction to Network Simulator NS2. You may have to read chapter 3 of the book for better understanding.

Introduction

NS2 consists mainly of two languages: C++ and OTcl. Each of these two languages has its own strengths and weaknesses. NS2 beautifully integrates these two languages to draw out their strengths. For most of the time, you would not need to know the integration mechanism. But you need to know the strength and weaknesses of these two languages in order to apply them properly.

Saturday, May 29, 2010

Entrepreneurship and Poverty -- The Leader's Way, Chapter 8


"Poverty is a problem of the mind, not the lack of resources or the lack of intelligence of the people."
In order to improve poverty,
  • Government must be motivated to help.
  • Economy system must be a responsible one.
  • Regulation must stimulate entrepreneurship
  • Fair banking, property right, and family planning must be in place.
Poverty usually congregates around the poor. These people need to spend less, leading to stagnant economy and more unemployment. The government
needs to promote entrepreneurship among the poor. This will alleviate poverty
and increase liquidity.

Tuesday, May 25, 2010

C++ and OTcl Linkage

Note: The content in this series is extracted from the book, Introduction to Network Simulator NS2. You may have to read chapter 3 of the book for better understanding.

Introduction

NS2 consists of two languages: C++ and OTcl. For most of the time, you would configure (e.g., "$ns duplex-link ... ", "$ns attach-agent ...") a network in OTcl. But the real simulation is running in C++. If you are having troubles grasping the concepts of the linkage, stick around. I hope I can help enlighten you guys :)

Thursday, May 20, 2010

The Challenge of Globalization -- The Leader's Way, Chapter 7

Globalization business model

Globalization has led the business through 3 following stages
  1. Import/Export: Focus on trading on raw material and production
  2. Satellites: All the branches take the commands from the headquarter. Build branches on several countries to
    • Avoid importing/exporting raw material
    • Understand local people better
    • Avoid import/export regulation
  3. Globally integrated: This stage is similar to the satellite model. The difference is that the business initiative can come from any country (not just the headquarter country).


Saturday, May 15, 2010

Doing Business Right -- The Leader's Way, Chapter 6

Doing business right means doing business with warm hearts--meaning thinking of others' feeling. Although profit is essential, money can't buy happiness. Companies which do business right will attract consumers, investors, and employees. After all, people want to be a part of something they can be proud of.

Negative Factors


The following are negative factors which contribute to corporate bad reputation:
  • Leaders without humility (Flashy leaders tend to be self-interest and lead the company into great risks).
  • Creative or fraudulent accounting
  • Increasing disparity in compensation
  • Exploited practices
  • Marketing of harmful product
  • Human right and environment violation
  • Countries without good governance

Thursday, May 13, 2010

Creating Profit, Jobsor Happiness? -- The Leader's Way, Chapter 5

An organization is the place where people congregate. These people need common purposes and spontaneous leader.
"Any organization is both more and less than the sum of its members. It is less because the members of the group devote only a part of their time to the organization, and much more because the organization as a whole can accomplish tasks the individual members cannot succeed in carrying out on their own.''
A Living Entity

We can consider business as a living entity. If food is essential to life, profit is essential to business. Business can be motivated. It can thrives, withers, and renews itself. It can act responsibly or irresponsibly.

As people should not live to eat, business should not live to make profit only. Making less profit is similar to having less food to eat. But that's not necessarily a bad thing. Business has three important purposes: 1) Create profit, 2) serve the customers, 3) act responsibly.


Friday, May 7, 2010

The Leader’s Purpose -- The Leader's Way, Chapter 4


A leader needs to have wisdom (right view) and faith (support from followers). He must establish clear purposes for the company, and set the value that should be observed by all. He should act as an example to convince his follows to follow the principles.

Leaders' Roles
The leader's responsibilities include

  • Set the values and purposes of the organization,
  • Create faith, attract competent people, and encourage them to put great effort into the organization,
  • Provide communication systems for people inside the organization, and
  • Plan, organize, set priority, and make decisions.

A good leader should have technical knowledge and skill, determination, endeavor, and courage. The leader should understand the problem and know the solution. He or she should understand the organization and its people, culture and characteristics.


Wednesday, May 5, 2010

[ns2] Do you really need NAM?

NAM
Recently, I've got few people asking about installation NAM (network animator) in NS2. Usually it is quite straightforward to do it in Linux. But it's quite tricky in Windows (with Cygwin). To be honest, I have not tried to use NAM in Cygwin. If I have time, I might try and let you know.



Saturday, May 1, 2010

Doing the Right Thing -- The Leader's Way, Chapter 2



"A leader will only be respected, when he acts according to the principles in which he said he believes."

Leaders and Their Roles


If the leader does not follow the principles, his followers will not follow the principles, but will follow the leaders’ whimsical will.

The roles of leaders include making decision and taking actions for the organization and people working for them. Leader should practice right conduct, which is achieved when acting according to right view.

 "If the leader listens to you, it makes you feel valued and important."

Right conduct is an offspring of two following concepts: Right intention and wholesome actions.


Friday, April 23, 2010

Training the Mind -- The Leader's Way, Chapter 3


Why do we want to train our mind?

The purpose of training your mind is to
  1. Be clam, collected, and concentrated all the time (especially when making decision).
  2. Enable the mind to analyze things quickly.
Training your mind to the perfection is too difficult. So you should aim at steady progress.


Wednesday, April 21, 2010

Commonly Used Windows Shortcuts

Are you using Windows 7? Do you perfer keyboards to mouse? If you do, you might want to read on.

I am a Windows user, and I hate to take my hands off the keyboards. I love shortcuts. I am quite happy that Zia Munshi compiled and published 20 commonly used short-cut on Windows website. In fact, I learned it from Windows Weekly Show with Leo Laporte and Paul Thurrott. Feel free to check their websites out.


Tuesday, April 20, 2010

Assistance and Ethics

How much help is too much?

Recently, I've received and seen quite a bit of emails asking for help. I understand the frustration. I was there, frustrated of not knowing what to do. But some of the questions went a bit overboard.
While I am willing to help, you've gotta help yourself too. Here are the questions that I don't think I will be able to comment on
  • I want to implement this protocol. Please send me the code.
  • I don't know what's wrong with the code. Can you help debugging my codes?
If the help you needed is one of the above, I might not be your best resource.



Monday, April 12, 2010

Synaptics: Disabling touch page, gestures, and more


Are you using a laptop? Does your laptop has a TouchPad? Does the TouchPad messup with your typing rhythm? If so, read on.

Accidental Touch on a TouchPad: What's an annoyance

I've got a new Fujitsu S6420 few months ago. This is a nice laptop. The size is compact. It is easy to carry around. But because of its compactness, the touch pad is so close to keyboard. While typing my thumb would accidentally touch the touch pad. The cursor position would change and mess up my typing. I am kindda guy who don't like taking my hand off the keyboard. So, I get really annoyed when my hand accidentally touch the keypad.


Sunday, April 11, 2010

Classifiers: A Multi-Target Packet Forwarder

Note: This is a detailed note for the book, Introduction to Network Simulator NS2. You may have to read chapter 6 of the book for better understanding.

Introduction
This post is a sequel of the previous post, which demonstrated the relationship of classifiers, routing modules, and nodes:


Friday, April 9, 2010

Taking The Right View -- The Leader's Way, Chapter 1


"Right view relates to the intention behind the decision. Right conduct refers to the quality of actions."

Right View

Right view is based on three following facts:

  1. Having right intention
  2. Understanding cause-effect law
  3. Having right state of mind
Having right intention is to think about self and others: not self, not other, but both self and others.

Wednesday, April 7, 2010

How to Read My Book

At the beginning, there was frustration.

First of all, I would like to thanks everyone for purchasing the NS2 book. The book was motivated by my frustration when I learned NS2 a long time ago. I guess everyone would at one time share that frustration with me. NS2 is a great tool. It has numerous modules.
Unfortunately, it does not have enough good documentation. With that, I began writing the book in order to help you guys get started with NS2. I appreciate everyone coming to this website, and every comment that you have on the book. Again, thank you.



Sunday, April 4, 2010

Classifiers and Routing Modules: Putting a routing modules rtnotif_ and ptnotif_ in a node using "$ns node"

Note: This is a detailed note for the book, Introduction to Network Simulator NS2. You may have to read chapter 6 of the book for better understanding.

Introduction

This post is a sequel of the previous post, which demonstrated the relationship of classifiers, routing modules, and nodes:
What’s in This Post

So far, what we have looks like the figure below. In the previous post, I discussed how the blue block (classifier_) is inserted in to a node.



This post focuses on how two yellow blocks are placed into a node.


Saturday, April 3, 2010

[BookReview] THE Leader's Way: Business, Buddhism and happiness in an interconnected world by His Holyiness The Dalai Lama and Laurens Van Den Muyzenberg

At first glace, business and religion seem to live in different world. But, in fact, both share the common purpose. They both seek happiness.  

The main idea of this book is to apply right view and right conduct to the free market world. The book consists of three parts. Part one focuses on a personal level. It presents the meaning of right view and right conduct that a leader should have, and instructs how one can train his/her mind in busy daily life. Part two moves on to what role leaders should play in an organization. Finally, Part three discusses the right role of the organization in our society.

Thursday, April 1, 2010

Text-to-speech and Audiobook

Texts are in a book. Speech is a form of audio. When we convert text to speech, we should get an audiobook, right? Not quite!! In fact, text-to-speed and audiobook are quite different.

Sunday, March 28, 2010

Classifiers and Routing Modules: Putting a default classifier in a node using "$ns node"

Note: This is a detailed note for the book, Introduction to Network Simulator NS2. You may have to read chapter 6 of the book for better understanding.

Introduction

This post is a sequel of the previous post, which demonstrated the relationship of classifiers, routing modules, and nodes: What are they, their purposes, their relationship, and how to configure them conceptually.

What's in This Post

Now that you get the concept, let's look at how NS2 actually configure them. I will demonstrate the process by walking through a command $ns node, which creates a node.
This post focuses mainly on how a default classifier, namely classifier_, is create and inserted into a node. I will discuss about routing modules in subsequent posts.

Friday, March 26, 2010

My Question on the Security Now Show

Security Now!

I have been following a Security Now! show for a while. It is a weekly show where Steve Gibson and Leo Laporte talk about Security. You can find the show at GRC or TWIT. But usually, I subscribe to its podcast version on i-Tune.

Why do I like this show
Steve Gibson is not only a Security Guru, but also the one who know how to make things easy. The show is fun and insightful. I have learned a lot listening to this show during past few years.


Thursday, March 25, 2010

[BookReview] The Social Network Business Plan: 18 Strategies That Will Create Great Wealth by David Silver

Rating: 4/5

Summary


This book focuses on online recommender community, which is a platform (e.g., a website) where the members gather to rate, review, and recommend services and products. An online community will succeed since

Sunday, March 21, 2010

Classifiers and Routing Modules: Configuration

Note: This is a detailed note for the book, Introduction to Network Simulator NS2. You may have to read the book for better understanding.

Introduction
This post is a sequel of the previous post, which demonstrated the relationship of classifiers, routing modules, and nodes: What are they, their purposes, and their relationship.
Great! Now that you know the relationship of classifiers, routing modules, and nodes. Let see how NS2 actually do it in Tcl! 

Saturday, March 20, 2010

Entrepreneurial Principles: Eighteen Sustainable Revenue Channels (for an online community website)

When operating a website, the first revenue people can think of is advertisement. David Silver provides us with a lot more revenue channels below:

Wednesday, March 17, 2010

Including New Modules into NS2

Your New NS2 Modules
You are doing research. One day you come up with a great idea, and you want to show it to the world how great your idea is. So you decided to go for NS2. You start learning NS2, while developing your idea using C++ and Tcl.

The Coding Completes; Frustration Begins
Great! After a long work, you finish coding in C++ and Tcl. Now, you are asking yourself, "What do I do next?"

Of course you would like to incorporate you codes into NS2, you don't really know how. Frustrated, eh?

Including Your Modules into NS2
The following slide shows you how new modules are incorporated into NS2:
Including Your Modules into NS 2

View more presentations from Teerawat Issariyakul.

------------------------------------------------------------------------------------------------------------
For more information about incorporating new modules into NS2, see Chapter 2 in the following book from Springer:
T. Issaraiyakul and E. Hossain, “Introduction to Network Simulator NS2”, Springer 2009.

You may also find lecture notes and other resource at the following website: http://www.ece.ubc.ca/~teerawat/NS2.htm

Monday, March 15, 2010

My online platform

List of my choice of online platforms

Currently, I have several online platform. Even I am confused sometimes. So, I decided to list the online platform, and their purpose (specific to me):
  1. My Personal Blog (http://t-issariyakul.blogspot.com/): This is the place where I post most of the stuff including 1) audiobook summary and review, technology, interesting stuff I see in life, and things about NS2. I am planning to move NS2 contents to NS2Ultimate website, and will lightly maintain NS2 contents at this site. 
  2. NS2 Ultimate website (http://www.ns2ultimate.com/): This is the main page where I post tutorial and FAQ related NS2.
  3. Twitter: Everytime I create a new post. I will let people know by Twitter.
  4. Facebook: This is the place where I interact with my friends. Most of it would be personal things.
  5. Facebook fan page: All the above platform do not allow people I don't know to send me messages. Facebook fan page allows people I don't really know to communicate with me. The created content could be interesting to others.
Efficiently ways to interact with me

Sunday, March 14, 2010

Entrepreneurial Principles: Should you sell, or are you having too much fun?

6 Rules to Consider When planning to Sell Your Community

  1. Do not listen to free advice.
  2. Do not discuss your plan with your relatives.
  3. Do not develop an inflated idea of how much your community worths.
  4. Look for strategic buyers before selling to a financial buyer (see below).
  5. No one every lost money selling too soon: Do not rush selling your community. Wait for the right moment before selling. Your chance will finally come.
  6. Consider selling to the public: If you can't find anyone to sell, that's ok. Try the public.
Strategic Buyers v.s. Financial Buyer

Strategic buyers are the ones who would like to have your community as a part of their business. They see the real value in your community. Financial buyers, on the other hand, seeks short-term capital gain. Their main goal is to come in, restructure your community to increase its value, and resell it to the others. They do not see the real value of your community, and therefore tend to offer much less benefits.

Arbitrage Flip: What a financial buyer is looking for.

Arbitrage means something can be purchased inexpensively in one market, and can be sold in expensively in another market. Financial buyers may spot an arbitrage opportunity. They may spend little money buying your community, and sell it dearly to a company who is looking for an online community. So why don't you sell your community to one of those strategic buyers.


Checklist for Those Who Want to Sell an Online Community
  1. Positioning: Get to the best position to get the best offer
  2. Clean out the fat from your company: Make thing more efficient.
  3. The rate of increase in the number of members is important.
  4. High renewal rate of members
  5. Do not discuss about the plan to sell. Keep it secret.


------------------------------------------------------------------------------------------------
About the summary: It takes time to finish up a book. And, when you do, sometimes, you want to review what you learn from the book. If you do not make notes as you read, you might have to go through the book once again. This can be time-consuming when you are dealing with a book. But you can still flip through the book and locate what you are looking for

However, when the material is an audiobook, it is extremely hard to locate a specific part of content. Most likely you will have to listen to the entire audiobook once again.

This book summary will help solve the pain of having to go through the book all over again.

I am leaving out the details of the books. Most books have interesting examples and case studies, not included here. Reading the original book would be much more entertaining and enlightening. If you like the summary, you may want to get the original from the source below.


Source: Social Network Business Model by David Silver, Chapter 7.
For more details, get this book online @ books.google.com [Link]

Monday, March 8, 2010

For NS2 Newbies

Starting to Use NS2 is Easy

At first glance, learning NS2 is not very hard. You can go through the tutorial by Mark Greis' Tutorial, and learn NS2 in few hours.

Then you will feel like you are on the right track. NS2 is a very simple. The Tcl is a very simple and intuitive language. You can construct a complex network (e.g., TCP over wireless networks) very easily. Moreover, you can get a nice animation from nam (network animator) and plot graphs using Xgraph. What's more do you want?

Hit by Reality when Extending NS2 beyond its Scope

There is only one problem. One big problem. Things are simple as long as what you would like to work on is built-in to NS2. What's the odds? Very slim! If you are doing research, you would do something innovative. Something that no one has done before. And, that thing, my friends, is not very likely to be one of NS2 built-in modules.

From this point, everything goes downhill. A common question everyone ask is as follow. I have a great research idea. How can run NS2 to validate my idea.? Good question but the answer can be harsh.

Nothing in Life is Easy

I don't mean to discourage you. But learning NS2 beyond its scope is excruciatingly painful. You've got a lot of work to do. If you really want to know NS2, here is the step that I would suggest you should learn.

Quick Fix: An Easy Way in Doing Simulation in NS2 (not Recommended)

I started learning NS2 in a wrong way. I did not start from basic. So I chose a quick and easy way, trying to modified the NS2 codes to fit my needs and hoping that it'll work. Sometimes, it did. Sometimes, it did not. In the end, I had to abandon NS2, and wrote my own simulation code in C++. Do not follow my footstep!

Prerequisite

If you are reading upto this point, it means you do not want to follow my mistake, and you are commit yourself to seriously learn NS2. Here are few things that you need to do before proceed further:

1. Learn C++: Not just C. The OOP (object oriented programming) concept is the very core of NS2.
2. Learn Tcl: The scripting language by NS2. I find the following book quite useful. You only need to read chapters 3-7.

3. Learn OTcl: Objected Oriented version of OTcl. The most useful resource is [This website].
4. Install NS2. Go to [NS2 Webpage] for further instuction.
5. Go through Mark Greis' Tutorial.

    After you clear the above checklist, you can proceed to the key steps in learning NS2 below.

    Key Steps in Learning NS2

    Regardless of you research work, I believe you should get the basic first. And, here are the key steps.

    1. Learn how NS2 pass packets from one object to another (e.g., from a Node to a SimpleLink).
    2. Learn how to bind C++ and OTcl. This is a hard one. But, it will be easier when you understand the first step.
    3. Learn the module you are interested in. Really, it's quite hard if you don't have the basic in NS2, and want to jump start to do your own work. It's like a baby trying to jump before learning how to crawl!
    4. Modify, include, and build. This would be the final thing that you need to learn.
    -----------------------------------------------------------------------------------------
    The details of NS2 can be found in the following book from Springer:
    T. Issaraiyakul and E. Hossain, “Introduction to Network Simulator NS2”, Springer 2009. Buy it now from

    You may also find lecture notes and other resource at the following website: http://www.ece.ubc.ca/~teerawat/NS2.htm

    Sunday, March 7, 2010

    Entrepreneurial Principles: Disruption, The Sumptuous Impertinence

    Disruption

    Disruption refers to the act of breaking equilibrium. In the old time, people go out an hunt animal everyday. Their routine is in equilibrium. Then along come agriculture, which disrupt their routine. Just like agriculture, online recommender communities would disrupt the current business model called Antelope Hunt Business Model.

    Antelope Hunt Business Model

    Impala









    A picture of an antelope
    An antelope hunt business model is old business model which works like this 1) Hunting an antelope (i.e., find a customer), 2) Kill it, bring it home, and eat it (Sell things to customer), and 3) Find another one. It is wasteful and costly. While the antelope hunt business model shrinks the market with each sale, the online community business model expands the market with each sale.

    Members of an online community find the community by themselves, pay the monthly fee for the privilege of being in the community (possibly for a year or longer), share search and information with other members.

    By now, you might wonder who would want to pay for monthly fee, just to be in the community. Well, read along and you will see that the community is a platform where only the members earns money while solving their pain.

    Benefit Number 1: A Pain Solver

    A recommendation online community is borned from pain. Each member of the community share pain and would be delighted if the community can help them relieve the pain. The pain arises from, for example, time needed to look for what they need. If they are not able to find solution, they will have to put up with what the vendor offers in the market. The first benefit of an online recommender community is to help member solve pain.

    Benefit Number 2: A Transfer of Wealth

    An online recommender community can act as a revenue generating platform for the members. Again, this is the place where the member rate, review, and recommend products. There are 18 revenue channels, which are the result of the members' actions. The community should share a part of its revenue with members to motivate the member to create more valuable content.

    Cost of products consists of production cost and marketing cost. An online community can leverage the marketing cost by doing the marketing for product vendors. The conversation of members can be sliced, diced, and then sold anonymously to the vendor. The vendors will, in turn, benefit from market cost reduction.

    Apart from 18 revenue channels discussed earlier, product branding is another one. When a company wants to launch a product, it can hire the community to survey the market, draft a plan, and come up with a fair pricing. The community rates, votes, or even design new products for the company. A community can even sell its brand to the company. The consumers who appreciate the community are likely to purchase the product with community's brand.

    Privilege of Being in a Community: Viewing or Creating the Content

    Being in a community gives members two above benefits. The former one, pain solver is pretty obvious. Members benefit from truthful information from other members.

    But the interesting is the latter one: A revenue generating platform. Here, the privilege is not for viewing the content, but for creating the content. The member can use the community as a marketplace where they can offer their content for sale. The high-quality content will get picked and purchased by the community, product vendors, and/or other members.

    The Endowment Effect

    People often things they own more than things they do not own. The value of a house depreciated as time elapses. Yet, the owners often refuse to sell their house at the depreciated price.

    Similarly, when people become a member, they tend to stick around. It is easier to keep the member in the community, than to persuade people to become a member. But it is also important to give member a glue factor such as lockers, closets, watch us grow page. See [here] for the elaboration of glue factors.



    Source: Social Network Business Plan by David Silver, Chapter 6.
    About the summary: It takes time to finish up a book. And, when you do, how would you review what you learn from the book. Flip through the books? What if the book is audiobook? You might have to go over the book again. Not plesant.


    The summary here contains insights I grasped when I read the book. It will tell you what to expect of the book. Giving key insights and the organization of books, the summary makes it easier and more entertaining when reading the book.


    What the summary does not give you is the details (e.g., business cases, anecdotes) and entertainments. So if you think this book will entertain you, you may buy it online here. Also you might want to check out the review of the book which shall be up soon.

    Thursday, March 4, 2010

    Classifiers and Routing Modules

    Note: This is a detailed note for the book, Introduction to Network Simulator NS2. You may have to read the book for better understanding.

    Classifiers

    Typically residing in a Node, a classifier is an NS2 component responsible for classifying packets. A classifier has one input link and several output links. When packets enters a classifier (via an input link), they are classified based on predefined criteria. Packets of different categories are forwarded to the different corresponding output links. These output links refer to logical connections from a classifier to another NS2 object such as a physical link, a transport layer protocol, a prioritized queue, etc.
    A node can contains several classifiers. Configuring classifiers one by one is a laborious task. It would be more convenient to configure all the classifiers via a single point of management. In NS2, that single points is called Routing Module.

    Routing Modules

    Routing module is an NS2 component designed specifically for managing classifiers. Via routing module, all classifiers can be configured by using a single command (e.g., add-route).

    Relationship of Classifiers and Routing Modules
    By convention, NS2 uses one routing module to manage a classifier. When a node has multiple classifiers, NS2 creates multiple routing module and associated each routing module with each classifier. An example configuration is shown below:


    From the above figure, a routing module has a pointer "classifier_" which points to the associated classifier. Multiple routing modules are links together by using pointer "next_rtm_". When we need to add a routing entry to all classifiers (by calling the instproc add-route), we only need to send the command through the first routing module (RM1), and the chain of routing modules will automatically propagate the commend to all connecting classifiers.

    Great! Now, we understand the purpose of routing modules. But how do we create the structure like the above picture? Stay tune. I will blog about it soon!

    For more information about classifiers and routing module, see Chapter 6 in the following book from Springer:

    T. Issaraiyakul and E. Hossain, "Introduction to Network Simulator NS2", Springer 2009. Buy it now from

    You may also find lecture notes and other resource at the following website: http://www.ece.ubc.ca/~teerawat/NS2.htm

    Changing domain name of NS2 website

    I just change the domain name of the NS2 website. It's now http:// www . ns2ultimate . com.

    Wednesday, March 3, 2010

    NS2, Windows 7, and Cygwin 1.7: What a nightmare

    The rumor has it that this is the worst combination ever. The reason? It doesn't work. I try it myself. Well what I did is to build NS2 (2.33 and 2.34) over Cygwin 1.7. It creates error when the installation suite builds Tcl.

    Looking for the solution online, someone also experience similar problems. Here is the summary:

    - NS2 works well over Cygwin 1.5, but does not work over Cygwin 1.7.
    - Cygwin 1.5 does not work on Windows 7 see[].

    Unfortunately, Cygwin 1.5 can not be obtained easily.

    Potential solution:

    I am planning to try this. If you have comments, please let me know.

    1. Use NS version 2.35 which has not officially available yet.
    2. Install Cygwin 1.5.
    - Windows XP: You have to get setup-legacy.exe file from Cygwin (instead of setup.exe). It helps install version 1.5 rather than version 1.7
    - Windows 7: Again, Windows 7 does not support Cygwin version 1.5. So you have to run it on the compatibility (Windows 95) mode.

    What I will do next is to test these solutions. I will blog about it again soon.

    Sunday, February 28, 2010

    Tcl Error Message in NS2

    Tcl error messages in NS2 can be pretty scary. You can see an example at the end of the post. But it's not that hard to deal with it. Here is what you should do.

    1. Relax.... Breath....
    2. Go lines by lines following the error reporting structure:

    invoked from within
    "code"
    (location)

    From top to bottom, these three line blocks repeat themselves from the erroneous code to the file from which the error is initiated.

    invoked from within

    Error is usually caused by calling another procedure. NS2 provided a mechanism to drill down the error levels by levels until the real erroneous code is found. Each level is separated by the line with the phrase "invoked from within". This is to say that the upper line is "invoked from within" the lower line.

    "code"

    This is the quote on the exact NS2 codes, which cause the error. The location of this part is indicated in the next line.

    (location)

    Enclosed in (...) are the location where the error occurs. The format of location is

    category [argument] line number

    • category is the location category. It can be file, procedure, classname (e.g., SplitObject), etc.
    • argument (optional) specifies the scope of the location category. Examples are filename (e.g., "smcc.tcl"), instproc name (e.g., unknown).
    • line number shows the exact location within the above scope.

    ---------- Example Code -------------------------
    "_o3 cmd queue-parameter _o17 _o24 2 6"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o3" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "$ns queue-parameter $n3 $n4 2 6"
    (file "smcc.tcl" line 94)


    For more information about Tcl, see Chapter 3 and Appendix A in the following book from Springer.

    You may also find lecture notes and other resource at the following website: http://www.ece.ubc.ca/~teerawat/NS2.htm

    Book Summary: Why Am I Doing This?

    You guys might have seen plenty of websites for book reviews. But, book summary, there are not many of them. Why I am I doing this? It actually come out of my frustration. In fact, I want to do it for myself. So, I might as well share it with you guys. The followings are the reasons why I am doing book summary. BTW, my choice is audiobooks, not paper-based books.

    What I Learn from Reading the Book

    It takes time to finish up a book. And, when you do, sometimes, you want to review what you learn from the book. One of the best way is to make note as we read (how many of us would do that?) After you reach the end of the book, you can review your note and recall what you've read earlier.

    Looking for a Piece of Information

    After some time, you may recall that you came across something. But you don't remember it very clearly. The summary of the book will help a lot.

    More than Book Review

    There are 3 pieces of information you may want to know before reading a book. The first one is book review, where reviewers share their opinion on books. I think the reviews is the best place to talk about the writing style of authors. The second one is the table of contents, which, I think, is very useful. Table of contents gives you the overall structure of the book. It shows you what to expect of the book. Finally, the last piece is the summary. This is the deepest level of information. It contains the insight drawn from the book.

    What the summary does not give you is the details and entertainments. If you love reading, you would know what I mean. A good book keeps you engaged. You want to keep reading one page after another, and you cannot put it down. The summary does not give you that kind of sensation. No offense, but if you think reading the summary will save you time from having to read the book, you are obviously wrong.

    Even Greater with Audiobooks

    All of the above positive things get intensified, when you are dealing with audiobooks. Unlike paper-based books, audiobooks cannot flipped through page by page. The longest audiobook that I have listened lasts for more than 21 hours. If you don't know where, within the 12 hours, what you are looking for is located, you're going to end up listening for a very long time. Not pleasant, right?

    Summary and Spoiler

    The line is quite thin. Summary is something useful to know before and after the reading. However, spoiler destroys the moods and the funs of reading the book. To me, I think summaries of novels are spoiler. Therefore, the summary you will find in this blog are mostly of the non-fiction genre. Giving key insights and the organization of books, the summary makes it easier and more entertaining when reading the book. Summary or spoiler? I guess you guys would be the judge.