Wednesday 20 July 2011

燕子呢喃之烧鸡公 (Chongqing Spicy Chicken)


材料:
鸡块,烧鸡公调料


步骤:
1. 热锅中倒入200克油,旺火加热到7成熟后,倒入鸡块2斤左右,翻炒加热到皮紧。

2. 倒入160克调料,翻炒至调料均匀。
3. 倒入水至盖过鸡块,旺火烧10分钟,小火焖20分钟,至烧烂为止。

Ingredients:
Chicken (cut into pieces), Chongqing spicy chicken sauce.

Steps:
1. Add 200g oil to the wok. Heat under high heat until 70% cooked. Add the chicken and stir until the skin is tight.
2. Add the sauce and stir until well-mixed.
3. Add water until it covers the chicken. Heat under high heat for 10 mins and low heat for 20 min until the chicken is tender.

Friday 8 July 2011

燕子呢喃之酒糟木耳猪蹄 (Fungus and pork feet)


材料:
猪蹄, 木耳,葱姜,料酒,酒糟。




步骤:
1. 猪蹄洗净焯水。取出后将猪蹄冲洗干净。

2. 再将猪蹄、葱姜放入水中,大火煮沸7-8分钟,加料酒。
3. 将洗净的木耳去根,稍切小。
4. 加入木耳,转至小火焖煮1小时。当肉煮烂后,加入盐和鸡精适量。
5. 再略煮片刻后取出,冷却2个小时左右后加酒糟。

Ingredients:
Pork feet, fungus, onion, ginger, cooking wine, distiller's grains.

Steps:
1. Wash the pork feet and put them into boiling water. Take them out when it boils again and wash again.
2. Put pork feet, onion, ginger into water, boil for 7-8 mins under high heat. Then add cooking wine.
3. Remove the root of the fungus and cut it into smaller pieces.
4. Add the fungus and turn to low heat and cook for 1 hour. When the meat becomes tender, add some salt.
5. Take out the feet after a few minutes. Add the distiller's grains after cooling for 2 hours.

燕子呢喃之茄汁鳝筒 (Eel with tomato sauce)

这道菜荤素搭配,营养丰富。黄鳝鲜嫩,酸中带甜。热量低,是理想的减肥菜肴。

材料:
主料:黄鳝500克,番茄2个。
配料:蒜头1个,红椒3个,葱姜若干。

步骤:
1. 黄鳝焯水,去腥味和粘液。取出后切断。
        


2. 煸炒配料,煸出香味后,加入黄鳝,再煸炒一下。放冷水大火烧滚2-3分钟,然后调小火焖烧10分钟。然后放入盐、鸡精和料酒少许。


3. 把去皮的番茄切丁,放入油锅中煸炒成番茄酱。

4. 将炒好的番茄酱放入黄鳝中翻炒几下即可上盆。

Ingredients:
Main: 500g eels, 2 tomatoes.
Side: 1 garlic, 3 chili peppers, ginger and scallion

Steps:
1. Put eels in the boiling water and take out when it boils again to remove smell. Chop the eels.
2. Fry the side ingredients, and then add the eels and fry again. Add cold water and boil for 2-3mins under high heat. Turn to low heat and cook for 10mins. Then add salt and cooking wine.
3. Remove the skin of the tomatoes. Chop the tomatoes into small pieces. Fry the tomatoes in a pan with some oil to make tomato sauce.
4. Add tomato sauce to the eels. Stir for a bit and it's done.

Thursday 7 July 2011

OpenCV naming convensions


  • Matrix data types:
    CV_[bit_depth](S|U|F)C[number_of_channels]
    S = Signed integer
    U = Unsigned integer
    F = Float 
    
    E.g.: CV_8UC1 means an 8-bit unsigned single-channel matrix,
            CV_32FC2 means a 32-bit float matrix with two channels.

  • Image data types:
    IPL_DEPTH_[bit_depth](S|U|F)
    E.g.: IPL_DEPTH_8U means an 8-bit unsigned image.
            IPL_DEPTH_32F means a 32-bit float image.
Note that in the image data types, the depth and number of channels are specified separately.

Meat ball soup(肉丸汤)

图片来源:心食谱

Ingredients:
Ground meat, 1 tomato, 1 egg, water 1L, salt 2 1/2 teaspoons, starch powder 2 tablespoons, soy sauce 2 1/2 teaspoons, ginger (small amount, optional).

Steps:
1. Defrost the ground meat in the microwave for 4 mins (choose defrost on the microwave).
2. Cut the tomato into pieces. Optional: cut the ginger into very small pieces.
3. Add 1 teaspoon of salt, ginger pieces (optional), egg and 1 teaspoon of soy sauce to the ground meat. Stir in one direction. Add the starch powder and stir further.
4. Boil the water under high heat. When the water boils, turn to low heat. Use the green measuring spoon to scoop the meat, making it approximately ball shape. Put the meat balls into the water.
5. When the meat balls float on the water (almost cooked), add tomato, salt and soy sauce.
6. When the water boils again, it's done.

Original recipe:

材料:
猪肥瘦肉250克(可选猪绞肉,但是自己剁的肉要筋斗些),大番茄1个,黄豆芽100克,鸡蛋1个,鲜汤或清水1升,精盐21/2茶匙,生姜5克,姜末11/2茶匙,水豆粉2汤匙,味精21/2茶匙(可选),酱油21/2茶匙


做法:
1.将葱切成葱花,番茄切成厚片,生姜拍破,黄豆芽洗净待用。
2.猪肉剁茸,加1茶匙精盐、姜末、鸡蛋、1茶匙酱油及少量清水向一个方向搅拌均匀,再加水豆粉搅拌均匀待用。
3.汤锅置旺火上,加入鲜汤或清水、破姜烧沸,将火关至小火,将肉馅用小汤勺舀成圆形,每个约呈2厘米的直径,逐一放入锅中煮熟至肉丸浮出汤面时,加黄豆芽,番茄片、精盐、酱油、味精烧沸后,捡去破姜,盛入汤碗中即成。

Wednesday 6 July 2011

Wireless adapter on Compaq Presario V2000

Today, I was trying to use wireless network connection on the Compaq Presario V2030US laptop. It didn't work initially. The wireless button didn't light up when I pressed it.

In device manager, the network adapter Intel (R) PRO/Wireless 2200BG Network Connection is listed with a red cross on the icon. I tried to update the driver automatically and it appears to install some files from the system folder. In the end, it says the driver is not compatible with the platform. I'm guessing it's because the driver comes with the original installation is for XP Home and now the OS is XP Professional. Maybe there's some incompatibility.

So I went to find the driver for the wireless adapter online and installed it. It works now. :)

Monday 4 July 2011

Ants climbing the hill(蚂蚁上树)

照片来源:心食谱


Ingredients:
Rice noodle (1 bundle), ground meat, hot chili sauce

Steps:
1. Boil the rice noodle in a pot with water. Take out the noodle when it's soft. Run the noodle through cold water in a sieve (the orange one in the kitchen drawer) to cool the noodle and get rid of the water.

2. While boiling the noodle, defrost the ground meat in the microwave (choose defrost, for about 4min).

3. In a pan, heat up 2 teaspoons of oil under high heat. When the oil is warm, turn to low heat. Add ground meat and stir. Add hot chili sauce and stir more until the meat is almost cooked.

4. Add the noodle to the pan and stir for about 3 to 5 min. Add some salt and soy sauce, and it's done.

Optional:
Can add some vegetables, like green peppers, tomatoes, carrots if you like. Add them after the meat, but before the noodle.

Original recipe: 

材料:

粉条,肉末50克,蒜蓉

步骤:
1.粉丝先在开水中煮至八成熟后,捞出;过冷水,沥干水份,备用。
2.油锅烧热,下蒜蓉,爆香;加入肉末,炒至肉粒呈金黄颜色。
3.倒入已煮过,沥干水份的粉丝,与肉末一齐翻炒三至五分钟;此时加适量精盐,以及生抽,上色并调味;即可出锅。

Saturday 2 July 2011

If by life you were deceived...

If by life you were deceived... - Alexander Pushkin

If by life you were deceived,
Don't be sad or mad at it!
On a gloomy day, submit:
Trust - fair day will come , why grieve you?

Heart lives in the future, so
What if gloom pervade the present?
All is fleeting, all will go;
What is gone will then be pleasant.

假如生活欺骗了你 - 普希金


假如生活欺骗了你,
不要忧郁,也不要愤慨!
不顺心时暂且克制自己,
相信吧,快乐之日就会到来。


我们的心儿憧憬着未来,
现今总是令人悲哀:
一切都是暂时的,转瞬即逝,
而那逝去的将变得可爱。

Александр Сергеевич Пушкин


Если жизнь тебя обманет,
Не печалься, не сердись!
В день уныния смирись:
День веселья, верь, настанет.


Сердце в будущем живет;
Настоящее уныло:
Все мгновенно, все пройдет;
Что пройдет, то будет мило.


I loved you - Pushkin

I loved you; and perhaps I love you still,
The flame, perhaps, is not extinguished; yet
It burns so quietly within my soul,
No longer should you feel distressed by it.
Silently and hopelessly I loved you,
At times too jealous and at times too shy.
God grant you find another who will love you
As tenderly and truthfully as I.


我曾经爱过你 普希金


爱情,也许
在我的心灵里还没有完全消亡,
但愿它不会再打扰你,
我也不想再使你难过悲伤。
我曾经默默无语、
毫无指望地爱过你,
我既忍受着羞怯,
又忍受着嫉妒的折磨,
我曾经那样真诚、
那样温柔地爱过你,
但愿上帝保佑你,
另一个人也会象我爱你一样。


Я вас любил...


Я вас любил: любовь еще, быть может
В душе моей угасла не совсем;
Но пусть она вас больше не тревожит;
Я не хочу печалить вас ничем.
Я вас любил безмолвно, безнадежно,
То робостью, то ревностью томим;
Я вас любил так искренно, так нежно,
Как дай вам бог любимой быть другим.

Friday 1 July 2011

Java int and short casting

Did some test on Java int and short casting. I'm interested to see how it behaves when the integer overflows short.

public class CastingTest {
  public static void test(int a) {
    System.out.println("a = " + a + " (" + getBits(a) + ")");
    short b = (short) a;
    System.out.println("b = " + b + " (" + getBits(b) + ")");
    int c = b;
    System.out.println("c = " + c + " (" + getBits(c) + ")");
    int d = b & 0xffff;
    System.out.println("d = " + d + " (" + getBits(d) + ")");
  }
  
  public static String getBits(int v) {
    StringBuffer sb = new StringBuffer(32 + 3);
    for (int i = 1; i <= 32; i++) {
      int mask = 1 << 31;
      int bit = (v & mask) == 0 ? 0 : 1; 
      sb.append(bit);
      if (i % 8 == 0 && i != 32)
        sb.append(' ');
      v <<= 1;
    }
    return sb.toString();
  }
  
  public static String getBits(short v) {
    StringBuffer sb = new StringBuffer(16 + 1);
    for (int i = 1; i <= 16; i++) {
      int mask = 1 << 15;
      int bit = (v & mask) == 0 ? 0 : 1; 
      sb.append(bit);
      if (i % 8 == 0 && i != 16)
        sb.append(' ');
      v <<= 1;
    }
    return sb.toString();
  }
  
  public static void main(String[] args) {
    test(65535);
    test(65536);
    test(-65535);
  }
}

Output:

a = 65535 (00000000 00000000 11111111 11111111)
b = -1 (11111111 11111111)
c = -1 (11111111 11111111 11111111 11111111)
d = 65535 (00000000 00000000 11111111 11111111)

a = 65536 (00000000 00000001 00000000 00000000)
b = 0 (00000000 00000000)
c = 0 (00000000 00000000 00000000 00000000)
d = 0 (00000000 00000000 00000000 00000000)

a = -65535 (11111111 11111111 00000000 00000001)
b = 1 (00000000 00000001)
c = 1 (00000000 00000000 00000000 00000001)
d = 1 (00000000 00000000 00000000 00000001)

This shows that, when converting int to short, jvm just takes the lower two bytes, even if the number overflows short.