Archive for the ‘English’ Category

The Genus Homo

Monday, April 28th, 2008

If any part of this earth belongs to some one, it belongs to every one.

If any part of this earth belongs to only some one, it belongs to no one.

John Lennon - Imagine

Friday, April 18th, 2008

http://youtube.com/watch?v=jEOkxRLzBf0

Imagine there’s no heaven
It’s easy if you try
No hell below us
Above us only sky
Imagine all the people
Living for today…

Imagine there’s no countries
It isn’t hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace…

You may say I’m a dreamer
But I’m not the only one
I hope someday you’ll join us
And the world will be as one

Imagine no possessions
I wonder if you can
No need for greed or hunger
A brotherhood of man
Imagine all the people
Sharing all the world…

You may say I’m a dreamer
But I’m not the only one
I hope someday you’ll join us
And the world will live as one

by John Lennon

My New Toy

Tuesday, April 8th, 2008

img023 img025

img024 img026

It’s much better than what I thought. Both the look and the features. Zune! Zune! Zune! (Sorry, Mazda.)

Dinosaur Eggs

Sunday, March 16th, 2008

dinosaur-egg.jpg

Picture was taken in AFC on March 15, 2008

A Fortune Fish In My Office

Tuesday, February 12th, 2008

001.jpg

The picture was taken in my office. In Chinese we say “Nian Nian You Yu (年年有余)”, which means “Every year there is money in the saving account”. The last word “Yu (余)” stands for “saving” and it has the same pronunciation as “Yu (鱼)” which stands for “fish”. This makes it sounds like “Every year there is a fish”. Therefore every time Chinese New Year comes, we hang a poster or an ornament of one or more fishes indoor and outdoor, to express the wish.

Predators in Shenzhen

Wednesday, January 30th, 2008

I came across following two statues at the front door of some store at Eastdoor (东门 Dong Men) in Shenzhen. The first one is a predator made from some metal parts. The second one is a predator in 1:1 size. Pretty cool!

predator2.jpgpredator.jpg

I am your Elvis

Tuesday, December 18th, 2007

I’ve got an e-card yesterday from her and I am so happy! Thank you! Love you too…

happy_birthday.jpg

Video: Introduction to Functional Programming and F#

Thursday, November 29th, 2007

When I was in undergrad school, we used to have a course on functional language taught by Dr. Kahl. We learned the concept of functional programming and got to get assignments done in Haskell. Until the end of the course, I wasn’t sure enough if I’ve learned what it is.

It’s been a while since I graduated in 2005 and this new concept of programming wasn’t getting my attention until recently, I saw the coming of F#. Then today, I found a good video talking about the basic concept of this new form of coding, as well as F#. Take a look. :)

Use base class iterator in a derived class with a template

Thursday, October 18th, 2007

To tell the truth, I am still a newbie in C++. So I decided to take a evening and do a quick exercise. What I am trying to do is to write a class which uses the iterator from its ‘parent’ class:

 1: #include <vector>
 2: #include <iostream>
 3:  
 4: template <typename T>
 5: class myVector : public std::vector<T>
 6: {
 7: public:
 8:  void Test();
 9: };
 10:  
 11: template <typename T>
 12: void myVector<T>::Test()
 13: {
 14:  typename std::vector<T>::iterator i;
 15:  
 16:  for (i = this->begin(); i != this->end(); i++)
 17:  std::cout << *i << std::endl;
 18:  
 19:  return;
 20: }
 21:  
 22: int main()
 23: {
 24:  myVector<int> v;
 25:  v.push_back(1);
 26:  v.push_back(2);
 27:  v.push_back(3);
 28:  v.push_back(4);
 29:  v.Test();
 30:  return 0;
 31: }
 

The whole point here is the typename in line 14. That is the tricky part which took me a while to figure out. Without it the code won’t even compile. Now I can add all different kinds of sorting methods to myVector. Yes, I know it’s a bad idea. Just code for fun.

Don’t write multiple statements in one line

Saturday, October 13th, 2007

… for several reasons:

  1. It doesn’t boost the performance.
  2. It doesn’t reduce the memory usage.
  3. It is hard to set a breakpoint while debugging.
  4. It reduces the readability.
  5. It is nothing to show off.

Counter example:

Don’t write multiple statements in one line for that, it doesn’t boost the performance and reduce the memory usage, but hard to set a breakpoint while debugging as well as reducing the readability, plus it is nothing to show off.


Chat with me. =)