Thursday, 7 July 2011

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.

Friday, 24 June 2011

Working with PrimeSense's Nite Middleware

Today when I tried to run the sample program in the Nite package, I got an error saying "One or more of the following nodes could not be enumerated:" It worked before, so I wondered why. Eventually I solved the problem by reinstalling the Nite package.

1) Go to the downloaded Nite package directory.
2) Use the following commands to reinstall:
$ sudo ./uninstall.sh
$ sudo ./install.sh
When prompted, enter the licence key: 0KOIk2JeIBYClPWVnMoRKn5cdY4=

Wednesday, 22 June 2011

Adding printers at CSAIL on Ubuntu

1. Go to Printing and click "Add".
2. Under Network Printer, choose LPD/LPR Host or Printer.
Host: cups.csail.mit.edu
Queue: [Printer Queue Name] (i.e. xerox2)
3. Choose the option to provide the driver yourself. You can download the driver here.