Thursday, May 31, 2007

Linux is too cute for business

I just read an article suggesting an explanation of why Linux/Unix has problem dominating the computing world. It is not a technical one, but rather, its culture and tool naming is not serious and therefore businesses do not consider it seriously.
In other words, the names are too cute.

And I agree.

For example, much of the free software of Linux comes from GNU, where it is a recursive acronym, which is "GNU is not Unix". I can call it FNU if I like, the G (and F) is never defined. Cute isn't it. Business users who don't know anything about the programs will just scratch their head.

Another example, the configuration tool is called YaST, "Yet Another Setup Tool". So the business people will ask is it a working tool or a toy? Microsoft would have called this intuitively as something like Configuration Tool.

I know some other strange names:
YACC is yet another "yet another" type of name, known as "yet another compiler compiler".
AWK is an awkwardly named little programming language named after the initials of the authors. AWKward indeed.

Modern programmers must know the modern MAKE tool known as ANT - Another Neat Tool. What sort of name is that?

Yet the cute names are the very culture of Unix.

The names perhaps explains why Linux never quite go to "mainstream". It is not likely the program names will ever change so that it can enter the business world more. Linux's very culture makes it unique. It also tends to be less crash prone than Microsoft OSes.

It used to take a lot of setup to get a Linux machine up and running: partition drive, LILO, and all that. However, it is getting easier now, depending on the setup programs that come with your distribution. And yes, it comes with a price tag too, much less than Microsoft though.

Wednesday, May 30, 2007

Decline with time

A while ago I read some commentary on Chinese history. Some dynasties started out well, just overthrown some bad emperor and established a stable government. People were happy for a brief period of time. However, much of history usually only records the bad times. Soon the good emperor is replaced by spoiled kid who inherited the throne and chaos occured. Good times just don't last too long. Corruption is internal evil of people. This is not just a Chinese thing.

So is the World Bank. The original intent was to help developing countries and maintain world peace. But look, we have a chief who allegedly steal money and give to his girlfriend. Outrageous.
The World Bank and UN have declined to a point where they have forgotten their purpose. BTW, How old is Wolfowitz? girlfriend? Ok that's another discussion.

That is probably tip of iceberg discovery. (Folks, with global warming, the phrase 'tip-of-iceberg' may need to go.) Just how many corrupted individuals are damaging the world's security with his/her own greed?

Throne inheritance is characteristic of dynasties. After all, parents want to give the best to their own kid, including the emperors. This proves to be problematic as good emperor does not necessarily have good heir.

Democracy whacked that. Now most countries elect their own presidents to ensure leaders with at least some public support. But after a few generations, a couple hundred years, do the present leaders inherit the leadership qualities that they should have? Or they go into cluelessness and corruptions that lead the country to doom and require restart with bloodshed and revolutions?

Tuesday, May 22, 2007

Teaching kids terror

Oh my, a Mickey Mouse look-alike known as Farfur are teaching Palestinian children violence.

Quote from news:
"We, tomorrow’s pioneers, will restore to this nation its glory, and we will liberate Al-Aqsa, with Allah’s will, and we will liberate Iraq, with Allah’s will, and we will liberate the Muslim countries, invaded by murderers," Farfur says in one episode that aired in April.

We naively seem to think the number of terrorists (insurgents) are just a fixed-number bunch of radicals. If we kill one we subtract one, and eventually all of them dead. Then we can extract all their oils. Look, both objectives are failing, both sides suffer casualties (and still on the rise) and oil price soared above $3.50.

The surviving, innocent kids who see nothing but destruction and perhaps lost their loved ones are trained to hate Americans.

There is no peace in sight.

What are Americans going to do next, bomb the little kindergartens or bomb the TV network?

Monday, May 21, 2007

Lessons from Grandpa (1)

When I was a kid, grandpa is the person to go to when I have questions. One time I went to him while watching some kungfu series.

"Why do they fight for the secret kung fu book? Can they get their own copies?"

A typical "design pattern" of kungfu genre series has story like this: there is this master who keeps a manual of the ultimate powerful set of kungfu and will not teach the bad student but will teach the protagonist student. The bad kid, once a brother of the protagonist got jealous and drug the master and killed him somehow AND stole the manual, and the rest of story is revenge and unleashing the power of the secret manual. A battle of good vs evil. Of course, there needs to be a protagonist's beautiful gf as side story.

Now that's a movie script that will work even today. Heck, what story is not good vs evil? Ok I am digressing here.

Grandpa says "Well if everyone has a own copy, it isn't so secret kungfu anymore. See Chinese culture is greedy. We'd like to keep our own little secrets and won't teach others to keep ourselves special. This is not a good approach. Western education doesn't do that. They encourage opening schools and sharing knowledge. Just when have you seen western guys fighting for books?"

Grandpa is right somewhat. Even to this day I have not seen Americans fighting for secret kung fu manuals or any knowledge manual. I never read people fighting to read Principia Mathematica or Theory of Relativity. I see ...For Dummies book that want to present you knowledge as easy as possible.

Well grandpa didn't know that I would come to "the western world". Yes, education is accessible. But most people's knowledge sharing stops here.

If you are a computer programmer, when do you see nicely documented codes?

When do you see procedures nicely documented to help others ramp up asap?

Does anyone get rewarded for nicely documented stuff? If I run a IT department I'll give you a raise for good code, a bonus for good docs.

Guys with no knowledge of anything else but maintaining old code write ultimate sloppy stuff to stay employed.

I agree with grandpa that's not a good approach. Oh that sloppy code is their ultimate set of secret kungfu.

Thursday, May 17, 2007

Book Review: Euler's fabulous formula.

I recent bought a hardcover book titled "Dr. Euler's Famous formula - cures many mathematical ills". Sorry Borders, I found this book at your store but bought it at Amazon to save some money.

As you can see from the title it demonstrates the witty side of (some) mathematicians. Math is not all boring abstract discussions and calculations. In fact, it takes a lot of writing/communication skills to communicate math. Your heavy accent professor that you've had just isn't sophisicated enough to do that. The author is very articulate and this is a very well written book: packed with enthusiasm and applications of the Euler's formula eix=cos x + i sin x. It is jammed packed with clever derivations of many gems from all over mathematics and engineering.

Most of us were told π is irrational but were told not to worry about the proof. Maybe you have heard the "prince of mathematics" Gauss showed a 17-gon can be constructed when he was 18. This book tells you the glorious details which involves the Euler's formula. And you will know why you weren't told the details because it is gosh, quite involved. You will have some idea what sort of genius was Gauss and Euler after reading a couple chapters.

The prerequisite of this book is a couple years of calculus and differential equations. Ok I had that, and so do most college students. We are talking the very motivated 'A' or 'B+' math students here and not those who barely passed. I am not sure if I will ever understand all of this book. But it will be proudly displayed in my bookshelf after I understand all that I can.

I think this book can gain broader audience if author can start with an introduction of each of the important constants involved in the Euler's formula: e, i, π, derive this formula from the Taylor series. Ok, he actually did that by showing a page in Feyman's teenage notebook in the introduction.

Monday, May 14, 2007

Postage hike

Unbelievable gas prices have passed beyond $3.50 a gallon. Another hike taking place: postage is no longer 39 cents. Plus now it is not just the weight matters, but the size matters.

Inflation, and perhaps the unbelievable gas prices have driven up the cost of postage stamp. But when you think of it, it is STILL a bargain. Look, I can send a letter all the way to California for merely 41 cents. Imagine trying to send something without mail. Quite unthinkable isn't it?

But waita minute. Do we still communicate via the art of letters anymore? 99% if not 100% of all my mail wants money from me: bills, shameless advertisements, and all that. When was the last time you send or get a personal letter? Email has virtually replaced all personal mails.

Go online is now the way to beat the postage hike. Pay as many things as you can online.

Ah, I need to get a shredder to prevent as much fraud as I can. Criminals can pick up the shameless credit card application in my garbage and apply a card for themselves.

Saturday, May 12, 2007

Small Programming Assignments (part 2)

When I first saw this BASIC program in eighth grade I already think programming is quite interesting:

10 PRINT "ENTER A:";
20 INPUT A
30 PRINT "ENTER B:";
40 INPUT B
50 PRINT "THE SUM IS :";
60 PRINT A+B

Ooh it is a calculator of some sort! The computer is doing what I tell it to do!
I can even make it run conditional code (IF-THEN-ELSE), and loops and stuff. The computer is my slave to follow my orders! I felt somewhat empowered by that.

BASIC is not very fast, but easy. Also, it only has GOTO and GOSUB statements for blocks of code. I felt more empowered when I can write self-contained functions and procedures in Pascal. Oh and in those days I only program in DOS.

Besides your perhaps boring homework exercises, do you write your own programs for fun?

I did.

Some programs I did, most has to do with math.

4 function calculator. Harder than you may think. When you hit a +,-,*,/ key, I must turn the argument from a string to a number, and keep track is this first argument or second argument?
I also have to make sure you don't enter wacky things other than digits and the decimal point.

RPN calculator. I forever praise the reverse-polish-notation in hand held calculators. Though anti-intuitive at first, it lets you evaluate complex expressions with ease, without all that parentheses. It is also easier to implement. I have a stack, when an operation is selected, just drop two arguments, calculate the result and push it right back. This can handle operations for a typical scientific calculator. I implemented exponents with exponential function and natural logarithm... Now how do you evaluate 00? Then I found out it is undefined. When I know how to program in Delphi, I ported that over to modern Windows GUI.

Function Plotter At first I must recompile for different functions. Later I learned the rather difficult grammar things that I implemented a parser to evaluate a general function. Another hurdle to overcome: coordinates. In math we start (0,0) at center but my graphics library starts (0,0) at the upper left. I also have to scale it. Computer graphics lessons are handy to implement this. It should have the zooming and good stuff like that, but I never bothered to implement it.

Graph 3D. I can't afford Mathematica, but I like to see z=f(x,y) graphs! I did it on my own. But how do you put a 3D graph on 2D? Wow, a ton of matrix calculations are needed to turn 3D coordinates into 2D. Then I discovered an OpenGL library. Wow, it can draw real fast.

I also implemented simple board games.

Connect 4 Easy to implement, just an array. check horizontal, vertical and diagonal. When a friend played it he discovered a bug. It won't announce a win when a connect 5 occurs. Ok I changed that to >= 4 instead of =4.

Mastermind a few secret pegs are selected and you supposed to guess it, and the guy holding the secret pegs may tell you how many you got exactly right and how many you get right color but wrong position. I first used colorful DOS 16 color to implement. Later I turned it into graphics version, that is my first Visual Basic program.

I also use programming to solve puzzle games.

Game of 24 A game played by drawing 4 cards from a deck, and J=11, Q=12, K=13. You are supposed to write an equation so that the cards equal 24. For example, if you have 1,2,3,4. The solution is 1x2x3x4. How do you have your computer solve it? Brute force trial and error works. But it is not very trivial to program it to try all cases. An elegant and faster (almost) solution is to break down the problem into several smaller problems. Take away 1 card, let's say the 4. If you can make 28, 20, 6, 96 out of the 3 remaining cards you get 24. We keep breaking the problem down recursively.

My most recent (still a while ago) fun program is Sudoku. Folks on the train play this game tirelessly. This can be solved by trial and error and backtracking. Just try any legal numbers , if no more possible numbers, then retract back. Easy to describe, a bit involved to implement. Hardcore computer scientists will tell you this is not the quickest approach. But heck it is pretty quick to solve a 9x9 grid.

Oh I also did a ton of little applets for my book, including a demo of Archimedes' π approximation and Reimann sum illustration...

Awaiting the next fun (doable) programming assignment for myself.

Thursday, May 10, 2007

Response to "Pain"

I recently read a column in a magazine, titled "Pain", written by a renowned author Lam Yin Nei. The pain she is referring to is not physical pain, but rather, feeling a pain for Chinese history.

So the article says it is painful to see Chinese has good inventions like the compass and the fireworks, but there wasn't much technical development. It is painful to see that the ancient education curriculum only push the students to read classics and ancient poetry, and recite "Confucious says..." and "Mencius says...", rather than encourage students to think for themselves. The most pain is the constant military conflicts among each other.

Chinese love to brag about their glorious ancient history (the good times), such as the Tang and Song dynasty. After all, there isn't much other things to brag about. Not many of them bring up the dark days of the opium wars and the Japanese invasion of WWII. Not many dare to mention the corruptions at all levels of government. Fewer dares to bring up Cultural Revolution and the Tianenmen square in 198...

About the classics and poetry that ancient Chinese education system requires: these may actually be good things. After all, Confucious and Mencius have some good things to say. But rather than have them recite this stuff, make them think about pros and cons. Anyone can be the next Confucious.

What ancient Chinese lacked was willingness to breakthrough and even challenge accepted ideas. They needed much more in their curriculum.

The old poetry have some great beauty within the languages. They describe scenes, thoughts of leaving buddies in compact phrases. But what do we do with them? These poetry lack application. Ok, one application is to impress well educated ladies, that's it.

About endless military conflicts, perhaps it is not just a Chinese thing, but a human thing. Corrupted government spurs revolts. Run the government well and no one will risk to overturn you. If we can eliminate the greed of the corrupted guys we can solve a lot of problems. All anicent government officials passed exams of Confucious, who focus on concept of "kindness". That should have ensured they will be kind to the people, right? It would be naive to think so.

Wednesday, May 9, 2007

Small Programming Assignments

In a typical programming 101 class we write stand alone easy apps. In real life, we generally maintain ugly big apps with libraries not written by us. How we all miss the days where we can take full control of small programs. I recall some small programming assignments that trains the computer programmer. No bells and whistles pretty interface needed, just pure programming. Oh and you don't need a powerful machine to do these. If you find a compiler in a still running 8086 you can write code to implement these.

Pat and Vanna's tool
I'm sure you have watched Wheel of Fortune. Pat is able to tell you "there are 4 T" or "there are no N" in each puzzle. He has been counting alphabets on the fly for all these years. You can help his job easier by writing a program to count how many letters given each phrase. This lets you practice counters.

Factorial and Fibonacci
Factorial is classic example for recursion. You can view it as n!=n×(n-1)!, and 0!=1, or n!=1×2×3...×n. It can be implemented in a few lines.

The Fibonacci sequence is 1,1,2,3,5,8... Start with first two terms with 1 and 1. Find the next term by adding sum of previous two terms. you may not know how the mathematicians love it and its relationship with the golden ratio, but you can write n-th term programmatically. Is it advisable to do Fibonacci recursively?

Reverse a string
Enter a string, output the reverse. For example, enter "hello", return "olleh". Quite useless but it is a small exercise of accessing elements in an array. An atheist student decided to use "god" as test case and see if it return "dog". You only need to reverse half the string. Remember to handle the case of odd length. This can also be done recursively.

Maintain a linked list
In the beginning there are no good standard libraries and free Collection classes and we have to implement our own. We use a struct, with a "next" field to host a pointer to the same struct, thereby implementing a dynamic list. We can make our list sort on the fly by inserting the data in the right place. We also implement plain menus like 1-Add element, 2-Remove element, 3-Show List. Although the output is not impressive but it is a lot of tricky pointer assignmentss to make this work. One mistake you have to reboot. This program weeds out programmers wannabes when they can't handle the frustration.

You'll be surprised how many so called professional programmers don't know how to do any of these. Many programming in real life do nothing more than entering data and saving data.

Tuesday, May 8, 2007

Passing away of a friend's husband

At a funeral years ago, my dad told me another phrase: "as you approach middle age, you will attend funerals more often" 人到中年多殯送. He said a fact of life. We welcome kids as we say good bye to folks from previous generation... Eventually we all must go someday. Fortunately I didn't actually go to many funeral services since that one.

We expect the real elderly people to go. Sometimes we don't remember we all have to go one day. However, we don't expect younger ones to go. We do not expect a young daddy of 2 girls to suddenly get unrecoverable diseases and go.

Yet it did happened.

It was just a few years ago I helped them in their wedding, wishing them happily ever after.
Their vow was something this: "No matter rich or poor, health or sick, happy or sad, we'll be together". They lived through the ultimate test of love for each other in the last days. If you've found the love of your life, it is a life worth living.

I won't bother asking the most basic question: "why?" I never get a satisfactory answer.

It's not over yet. "See you in heaven" is the final episode. Life time on earth is perhaps at most 100 years? Compared to eternity, even 100 years is short.

Monday, May 7, 2007

Acts of God and Insurance

When I was in college, one day I got bored as I read the fine print of an insurance policy of the dormitory and I discovered a phrase: "act of God". This is an acutal insurance term. The insurance policy I was reading did not cover major devastation from Mother Nature and acts of God. Fine prints get insurance companies out of trouble. They like to collect premium dollars for premiums, and have lawyers to avoid payouts as much as they can.

Now what does my insurance cover? Isn't anything an act of God? Can their lawyers play with terminology that I will never get any coverage?

Each year, the United States is battered with hurricanes and devastating storm. I don't know what kind of coverage the victims get. But it is scary that people may simply lost everything in a few minutes of severe storm...

Insurace companies flee and refuse to cover flood zones. Heck, my insurance company threaten to not cover me if I have any damage in my house within the first year.
But insurance is a must. We need mandatory insurance, in driving and in home ownership. It just gives the insured a pyschological sense of security and invisible money drain from your wallet as years go by accident free.

Insurance is mathematicians*-turned-greedy-business. Let's see you are a teenager? You have x% dying in accident, yikes i won't cover you. I don't care if you are a noble teenager who won't drink and drive. You are non-smoker 30 year old? Ok, you are not as likely to die, we will cover you. Oh you are smoker? let's raise your premium. oh you turn old? well we won't cover you. You are on your own. Oh, x% will die in traffic accident, and y% of that will donate organ. Ok we will put the organ donar card on the back, oh it will save z lives a year.
However if insurance is not creepy like this, how does it get money to cover you when something really happened?

*Actually, statisticians. Mathematicians and statisticans usually live in different floors in their own departments.

Thursday, May 3, 2007

Religion debates

I like to browse news magazines at the local bookstores. Magazines tell me what's going on around the world in more details than 10 o'clock news can. News stories are dominated by politics or criminals. When we have a break from this, often we get religion talks.

One time I read Rick Warren (Purpose Driven Life author) vs Sam Harris (an atheist) debate in Newsweek. One time I read a scientist vs evolutionist debate.

In the most recent visit I read about the soldier's chaplain struggling to keep his faith in a weary war zone... Is religion a problem? The weary war zone seems to be a bigger problem.

It is an old and complex debate
Atheists insist there is no god. Monotheists like Christians insist there is one (and only one) God. Polytheologists insist there are many. In the world's religions, it is not just the number of gods in dispute. Even when your answer is 1. Is it "Allah" or is it "God"? or are they the same? Then the role of Jesus is often in dispute. Is he the son of God? a prophet? or a regular man? What about trinity or dual-ity or single-lity? (sorry don't know the official theological terms)

Oh and there is endless evolution vs Creation debate, and when we cannot say "creation", we use "intelligent design".
Schools should have an open mind: teach BOTH. Oh, don't show me again the are-you-really-sure probability of the universe come the way it is by chance. I am tired of reading that many 0's.

It gets nowhere
Just how many years people have been doing this type of debates?
This type of debate usually gets nowhere. You expect a well-known atheist to confess and "accept Jesus Christ as his personal savior" during an interview for a magazine? You expect a pastor to express doubt about what he preach and abandon his career? Often a "religious debate" goes nowhere, no side can fully convince the other. Let's just hope such debates don't turn into violence. Too many have died in the name of religion already.

Solution
There are two solutions to endless debate. Some use the "kill the infidels!" approach by slaughtering every non-conforming people. There has already been horribly many conflicts in the name of religion in the past. The better approach is tolerance: freedom of religion. Go ahead, worship all you want. You get less violence this way. Don't you wish there is some divine revlations which settle debates once and for all? Christians would point out that already happened 2000 years ago. I am feeling objection to this claim coming....

Wednesday, May 2, 2007

The Veto

The Democrats should know that Bush would veto the war bill with a deadline attached. Do they have a 2/3 majority to override the veto? Given just a small majority of Democrats in congress I think we won't have 2/3 needed for override. We just would go on with quagmire until Bush is out of office.

Democrats should anticipate the veto. If there isn't a override, all that work was useless. What else can they do if the override does not happen?

Look folks it has been more than 4 years since the "War on Terror" started, actually, more than 4 years since the pre-mature "Mission Accomplished" show. No it is not accomplished. It is still a mess. This conflict is longer than our past conflicts with WWi or WWII or the civil war, and there is no end in sight.
There should be an end, and the Democrats wanted an end which they can mark on a calendar.

I am no military strategist. But wars should not have a deadline attached. As Bush indicated, the deadline would be the enemies celebration of our defeat. If there is a withdrawal, it should be IMMEDIATE withdrawal. But we can't continuously wasting money and precious lives in fighting a war in vain indefinitely either. There isn't WMD, there is just the Iraqi endless Sunni vs Shittes violence.

This is a very difficult situation: we can't really just pack and go (we will face humiliation of defeat), and we can't stay indefinitely. We don't even have a clear enemy.

Military should avoid insurgents and invisible enemies. How many times have we seen insurgents winning a well-equipped military? You don't have to turn history book too far back. Just look at Vietnam. Perhaps you can flip further to see the American Revolution defeat the now best-friend British.

What's our mission objective now? maintain peace? You can't maintain peace when you go kill their people in their land. These guys want revenge. These guys don't have food, don't have jobs, all they have is a will to keep foreigners out, and they are willing to suicide bomb. Perhaps can we rebuild their villages, build schools and hospitals and do them some good instead? Waita minute, we aren't even doing that in New Orleans?