Wednesday, February 28, 2007
A day by the SEAside
Scene 1
Mr. T: Hey you do know that we are good friends right?
Mr. S: A-huh.
Mr. T: In fact I think that we should be more than good friends, we should be best friends, after all we're neighbors.
Mr. S: Um.. Okay.
Mr. T: Remember that nice tv you bought from me, I bought a new refrigerator from what you paid me!
Mr. S: That's really nice.
Mr. T: Since we're best friends you'll sell me that tv at half-price?
Mr. S: w00t?
Mr. T: Thanks for the free offer, I'll come by to collect it in 48 hours.
Scene 2
Mr. I: Hey Mr. S! I'm sorry, I can't sell you more soil from my garden. I think it is harming my grass.
Mr. S: But Mr. I you have a garden a 1000 times larger than mine!
Mr. I: Yeah, I can't help it, my grass is important you know. Maybe if you will give me the fruits that grew from the seeds dispersed from my plants...
Mr. S: What a bother!
Mr. I: But we're still good friends right? Best neighbors! You can come over and party in my big garden anytime, as long as you pay the cover charge of course.
Mr. S: Party? Won't that spoil your grass?
Mr. I: You must be joking. What grass?
Mr. T: Hey you do know that we are good friends right?
Mr. S: A-huh.
Mr. T: In fact I think that we should be more than good friends, we should be best friends, after all we're neighbors.
Mr. S: Um.. Okay.
Mr. T: Remember that nice tv you bought from me, I bought a new refrigerator from what you paid me!
Mr. S: That's really nice.
Mr. T: Since we're best friends you'll sell me that tv at half-price?
Mr. S: w00t?
Mr. T: Thanks for the free offer, I'll come by to collect it in 48 hours.
Scene 2
Mr. I: Hey Mr. S! I'm sorry, I can't sell you more soil from my garden. I think it is harming my grass.
Mr. S: But Mr. I you have a garden a 1000 times larger than mine!
Mr. I: Yeah, I can't help it, my grass is important you know. Maybe if you will give me the fruits that grew from the seeds dispersed from my plants...
Mr. S: What a bother!
Mr. I: But we're still good friends right? Best neighbors! You can come over and party in my big garden anytime, as long as you pay the cover charge of course.
Mr. S: Party? Won't that spoil your grass?
Mr. I: You must be joking. What grass?
Monday, February 26, 2007
Humans and Computers
While having a quick lunch today, I happen to be thinking about an old topic.
Humans and computers are each good at different tasks. Humans are very good at finding associations. For example, we might realize that ice is related to cold, cold (temperature) is related to cold (disease), cold is related to a runny nose. Identifying these simple relations seems simple for us. Yet, for computers, this is a major task with no fast solution. This is one of the main reasons for computers not being able to plan as well as humans under changing circumstances. Almost all forms of computer planning, must be done on very well defined problem domains or, with naive assumptions.
On the other hand, computers score well in accuracy (i.e. perfect memory), repetition, calculation speed, and large amounts of perfectly retrievable data. Humans "store" large amount of information too, albeit imperfectly due to memory loss. Furthermore, it has been hypothesized that our memory is not absolute, but approximated (i.e. it is reconstructed when needed from associations and belief). Worse, belief can actually shape this reconstruction and we end up thinking that we remember, often inaccurately. Following this, my hunch is that the more one tries to remember, the more the recollection is inaccurate. Kind of like the movie Big Fish.
Humans are always trying to perfect computers to be like themselves. After all, since they are already so good at doing those previously mentioned tasks, if they can think like us, they will be perfect! Hence, the many Sci-Fi movies and novels, depicting computers as being superior to humans. However the myriad of variables uncertainty brings makes this a daunting task (even calculating conditional probabilities of an event given 10 other events is already a ridiculous amount of computation). Maybe if computers sacrifice their accuracy they can become like us, but hey! Then humans will be back at square one, making babies will probably be more fun.
From my limited reading experience, only one series of novels presents an interesting alternative - humans learning to do what computers can do, hence becoming superior. This series is Frank Herbert's Dune novels and subsequently the prequels written by his son. I did not have time to read every book so I just browsed the summaries on Wikipedia. These are what I gathered.
In the Dune universe, there are powerful machines but AI is tabooed. This is due to some eons ago, humans were enslaved by intelligent machines that they created. So how did they free themselves from their machines? Apparently, one day the machine Overload (i.e. big boss) made a wager with his adviser. The Overload believed humans were inferior but its adviser believed that humans can be trained to do what computers can do. Hence to prove its (damn everything is it, I mean the adviser) point, it created a human computer, a human capable of blindingly fast computation and can accurately store and retrieve vast amounts of information at the same time retaining the traditional abilities of humans. This was called the first Mentat (i.e. a human computer).
The result was revolution, the humans took over again and AI is outlawed. Humans began to augment their abilities through genetic manipulation and a form of drug abuse of something called spice to allow heightened awareness. Mentats were advisors to empires and were basically all knowing super planners. Space guild navigators were so warped they had brains so large they swam in tanks. Their job was to perform immeasurable amount of computation at unimaginable speeds for spacecraft to navigate folded space. All rather interesting but also rather gross.
So which will it be first? Computers like us or us like Computers? Thus begins the battle between the Computer Science and Life Science disciplines with Psychologists sitting on the fence. It is amazing the amount of thoughts that can arise from a quick lunch...
Humans and computers are each good at different tasks. Humans are very good at finding associations. For example, we might realize that ice is related to cold, cold (temperature) is related to cold (disease), cold is related to a runny nose. Identifying these simple relations seems simple for us. Yet, for computers, this is a major task with no fast solution. This is one of the main reasons for computers not being able to plan as well as humans under changing circumstances. Almost all forms of computer planning, must be done on very well defined problem domains or, with naive assumptions.
On the other hand, computers score well in accuracy (i.e. perfect memory), repetition, calculation speed, and large amounts of perfectly retrievable data. Humans "store" large amount of information too, albeit imperfectly due to memory loss. Furthermore, it has been hypothesized that our memory is not absolute, but approximated (i.e. it is reconstructed when needed from associations and belief). Worse, belief can actually shape this reconstruction and we end up thinking that we remember, often inaccurately. Following this, my hunch is that the more one tries to remember, the more the recollection is inaccurate. Kind of like the movie Big Fish.
Humans are always trying to perfect computers to be like themselves. After all, since they are already so good at doing those previously mentioned tasks, if they can think like us, they will be perfect! Hence, the many Sci-Fi movies and novels, depicting computers as being superior to humans. However the myriad of variables uncertainty brings makes this a daunting task (even calculating conditional probabilities of an event given 10 other events is already a ridiculous amount of computation). Maybe if computers sacrifice their accuracy they can become like us, but hey! Then humans will be back at square one, making babies will probably be more fun.
From my limited reading experience, only one series of novels presents an interesting alternative - humans learning to do what computers can do, hence becoming superior. This series is Frank Herbert's Dune novels and subsequently the prequels written by his son. I did not have time to read every book so I just browsed the summaries on Wikipedia. These are what I gathered.
In the Dune universe, there are powerful machines but AI is tabooed. This is due to some eons ago, humans were enslaved by intelligent machines that they created. So how did they free themselves from their machines? Apparently, one day the machine Overload (i.e. big boss) made a wager with his adviser. The Overload believed humans were inferior but its adviser believed that humans can be trained to do what computers can do. Hence to prove its (damn everything is it, I mean the adviser) point, it created a human computer, a human capable of blindingly fast computation and can accurately store and retrieve vast amounts of information at the same time retaining the traditional abilities of humans. This was called the first Mentat (i.e. a human computer).
The result was revolution, the humans took over again and AI is outlawed. Humans began to augment their abilities through genetic manipulation and a form of drug abuse of something called spice to allow heightened awareness. Mentats were advisors to empires and were basically all knowing super planners. Space guild navigators were so warped they had brains so large they swam in tanks. Their job was to perform immeasurable amount of computation at unimaginable speeds for spacecraft to navigate folded space. All rather interesting but also rather gross.
So which will it be first? Computers like us or us like Computers? Thus begins the battle between the Computer Science and Life Science disciplines with Psychologists sitting on the fence. It is amazing the amount of thoughts that can arise from a quick lunch...
Saturday, February 24, 2007
Branded 红包
Friday, February 23, 2007
Totally Bad Movie
Wednesday, February 21, 2007
Financial Noob's Discoveries Part 2
Problem: Given a loan with an interest rate compounded daily, a target duration to completely repay the loan, and the fixed interval to make payments, how much should one pay per interval to completely repay the loan by the target duration?
Solution:
Solution:
Financial Noob's Discoveries
Recently I have been thinking about the following problem:
Given a loan with an annual interest rate that is compounded daily, and given a payment to be made at fixed intervals, how much money is actually paid to recover the loan and over how long?
Hence I came up with the simple calculator below (thanks to jw for pointing out the function to use; this should run slightly faster if the log operation in javascript is implemented in less than O(n), otherwise no speed gain):
Now, the harder question is finding the converse: given a loan with an interest rate compounded daily, a target duration to completely repay the loan, and the fixed interval to make payments, how much should one pay per interval to completely repay the loan by the target duration?
Saturday, February 17, 2007
ABC Extra Stout with Ginseng
恭喜发财
Transport Tycoon
One of my favorite games of all time that I have been playing since 10 years ago is Chris Sawyer's Transport Tycoon Deluxe (TTD). In fact I still play a semi-open source remake (it still uses the original game graphics) of the original classic called Open TTD. Basically it is a simulation type of game where the player is in charge of a transport company. There is just something very addictive about building transport networks all over the map and watch the vehicles move around. This open remake further allows multi-player, adds an extra load of features, smarter routing algorithms, and can run on almost any OS available today. Some images shown below, click for a clearer view.
Friday, February 16, 2007
Water Logic Gates
Someone has built logic gates using water instead of electrons. Rather interesting. Read here.
New Version of Slide Show Widget
Finally completed a new version of the Slide Show widget here. As previously mentioned, this widget is fully cut and paste with minimal changes necessary. There are two control parameters at the near the end of the code:
picObject.slideit();
}) (1000, 1);
/*]]>*/
The green parameter indicates the duration in milliseconds that each picture will display before the next. A value of zero means the picture will only swap when the mouse is moved over it, i.e. like the banner above. The red parameter indicates if clicking on the picture will open a link to the picture. A value of 1 means yes (i.e. the slide show on the right) and a value of zero means no (i.e. the banner).
Somehow I cannot get the blogger API to share the widget properly using a form, it keeps scrambling up the code and displaying it as a Text/HTML/JavaScript widget when it should be a TextList widget =(.
Strawberry Balsamic Cake
Thursday, February 15, 2007
JavaScript Total Re-discovery
After trying out JavaScript and reading this, I made a shocking discovery for myself. All along my impression of JavaScript was this language used to write some hasty gimmicks for web pages. After all it is just a scripting language, how advanced can it be?
I have been totally debunked. JavaScript is actually more like Scheme and Lisp than JAVA itself! And the even more amazing thing is that every modern web browser is an interpreter almost as powerful as the Scheme interpreter. JavaScript is a functional programming language extended with records and imperative constructs.
Now for the less technical folks, what does all these jibberish mean? It basically means that I can now create widgets that contain JavaScript without fear of clashing declarations with another widget (written by someone else) on the same HTML page. In other words keeping true to the idea of a widget being an independent GUI component that is not affected by and does not affect other widgets.
Finally becoming less noob. Look out for cut and paste widgets, almost no configurations necessary, from me soon.
I have been totally debunked. JavaScript is actually more like Scheme and Lisp than JAVA itself! And the even more amazing thing is that every modern web browser is an interpreter almost as powerful as the Scheme interpreter. JavaScript is a functional programming language extended with records and imperative constructs.
Now for the less technical folks, what does all these jibberish mean? It basically means that I can now create widgets that contain JavaScript without fear of clashing declarations with another widget (written by someone else) on the same HTML page. In other words keeping true to the idea of a widget being an independent GUI component that is not affected by and does not affect other widgets.
Finally becoming less noob. Look out for cut and paste widgets, almost no configurations necessary, from me soon.
New SlideShow Widget
I have finally created my first widget and I must say it was a horrendous experience. The code is available at my code testing blog here. The main trouble with the code was declaring objects in JavaScript. For some reason, over the past two years, numerous sites sprang up each claiming different techniques for declaring objects and their members/methods. After trying out numerous, I finally found one that works.
To understand what it does, move your mouse over my banner on top. That is the default behavior. Modifying this.slideshowspeed=0; to a value greater than zero will set the pictures to swap at different durations, i.e. 2000 for 2 seconds.
The widget is actually a hack of a TextList widget. This is to make use of the same interface provided by blogger to add URLs of pictures to display. This can be seen on the code testing blog mentioned earlier. One drawback of this hack is that for now it does not resize pictures to fit.
The reason behind creating a JavaScript Object, PicObject(), is to encapsulate the variables used in the script. This will allow multiple instances of this widget in a single blog. However two modifications have to be made to allow that:
1. The variable holding the object, "pickSwap" must be renamed throughout the code.
2. The image tag's name attribute, "slide", must be renamed throughout the code.
An example of two of these widgets operating is shown for the time being with some DotA icons on the right.
The widget is actually a hack of a TextList widget. This is to make use of the same interface provided by blogger to add URLs of pictures to display. This can be seen on the code testing blog mentioned earlier. One drawback of this hack is that for now it does not resize pictures to fit.
The reason behind creating a JavaScript Object, PicObject(), is to encapsulate the variables used in the script. This will allow multiple instances of this widget in a single blog. However two modifications have to be made to allow that:
1. The variable holding the object, "pickSwap" must be renamed throughout the code.
2. The image tag's name attribute, "slide", must be renamed throughout the code.
An example of two of these widgets operating is shown for the time being with some DotA icons on the right.
Wednesday, February 14, 2007
Valentine's Day
Some of my friends love to comment that I like to spend a lot compared to them. Well to me I think the best comparison will be V-day. Being rather busy, my partner and I decided on dinner at a local restaurant.
..
.
TADAA!
Somewhere between dinner, my partner surprised me with a V-day present!
*Drum-roll*
.
.
.
CHANG!
年
With the impending advent of the Lunar New Year, I cannot help but wonder how the custom seems to be devolving over the years. There is just less hype -- likely the signs of aging.
Rants aside, I always believed that ancient traditional customs and folk lore encode a practical meaning. Legend has it that 年 is a beast that comes and devour people, only to be chased away one day by loud noise and the color red by an angry mob of villagers. Since then they liven up the village every year with noise and red banners so that 年 would not return. Coincidentally, 年 is supposed to strike in Spring.
So what would 年 the beast encode? Here is my hypothesis:
The Seasons in ancient times will be the most accurate clock available to man. The coming of Spring signals the passing of a year, reminding everyone that they are a year older and likely to be closer to death soon. Furthermore, Winter is a time of depression, with many dying from communal diseases as they huddle together in the cold. However Spring is an important season on the agricultural calendar. It just would not be right for everyone to be sulking instead of planning for future survival. The wise man and women of the village or some smarty decided that the depression must go and the joy of life must be instilled in the people before they are all wiped out. Thus, the loud noise and bright color red (do they have brighter colors then?) to drive away 年 the beast -- that is actually depression.
END
To everyone, have a Happy Lunar New Year and may you be ever more prosperous!
Rants aside, I always believed that ancient traditional customs and folk lore encode a practical meaning. Legend has it that 年 is a beast that comes and devour people, only to be chased away one day by loud noise and the color red by an angry mob of villagers. Since then they liven up the village every year with noise and red banners so that 年 would not return. Coincidentally, 年 is supposed to strike in Spring.
So what would 年 the beast encode? Here is my hypothesis:
The Seasons in ancient times will be the most accurate clock available to man. The coming of Spring signals the passing of a year, reminding everyone that they are a year older and likely to be closer to death soon. Furthermore, Winter is a time of depression, with many dying from communal diseases as they huddle together in the cold. However Spring is an important season on the agricultural calendar. It just would not be right for everyone to be sulking instead of planning for future survival. The wise man and women of the village or some smarty decided that the depression must go and the joy of life must be instilled in the people before they are all wiped out. Thus, the loud noise and bright color red (do they have brighter colors then?) to drive away 年 the beast -- that is actually depression.
END
To everyone, have a Happy Lunar New Year and may you be ever more prosperous!
In the making
I have always wondered what is the big hoohaa about web logs. After all, personalized homepages have been around since the dawn of the Internet. I guess it all boils down to automation. The free tools provided are really good for those without web know how. Sadly, I find them rather restrictive -- nothing like the good old hacking away at open source stuff and ftp. Finding webspace to locate flash files, audio, picture, etc, is just so troublesome with different services scattered all over. Probably that is the reason people get their own domains.
A long time ago I tried to keep a diary in an attempt to improve my Chinese. But could never pen anything beyond: "The day was as it is". Hopefully the increasing desire to rant will change that. Everyone is just too busy for synchronous communication nowadays. Here is something to end off this entry with.
A long time ago I tried to keep a diary in an attempt to improve my Chinese. But could never pen anything beyond: "The day was as it is". Hopefully the increasing desire to rant will change that. Everyone is just too busy for synchronous communication nowadays. Here is something to end off this entry with.
Subscribe to:
Posts (Atom)