黃萬里 – 永遠講真話的人

黃萬里(1911—2001),清華大學水利系教授,著名水利工程專家。父親黃炎培是中國著名的教育家、政治家和詩人,中共建政後官至全國人大副委員長。黃萬里1934年赴美留學,1937年歸國,自此傾畢生心力於大江大河治理。半個多世紀以來,他以學識淵博、觀點獨到而蜚聲中外,更以敢講真話、仗義執言而在學界獨樹一幟。

  黃萬里去世時,他的女兒說他是一個永遠講真話的人,為講真話,他可以不顧時局變化、切身利害。而他的一個學生也說,在中國水利學界,黃萬里代表了科學家的良心。

  黃萬里兩次反對中國的重大水利工程:三門峽而三峽,前者已經得到驗證——證明他說的是對的,而後者還有待觀察。儘管黃萬里反對的聲音是尖銳的、刺耳的,但他的存在,代表了另一種聲音的存在,而這種聲音正是最缺乏的聲音。
Continue reading 黃萬里 – 永遠講真話的人

陳雲 – 保衛大粵語

我是客家人,憂心客家話失傳,但我熱愛粵語。保衞粵語,固可從政治平權、從文化權利去講,但保衞粵語、保育粵語,更應從中文保育來講。

粵語保存中華雅言,珍如拱璧,即使粵語不是有一億人講(實際數字),只有幾百人講,也要保育,也要在學校傳習,特別是香港的情況,正體字、粵語教中文的優良傳統,出於政治意外,由英國殖民政府保存下來,更是文化奇迹,香港人固然要珍惜,大陸人也要理解。北方人立場不同,珍惜不珍惜,由得他們,但不要橫加干預,不准吾人在公共領域和文教機構用粵語Continue reading 陳雲 – 保衛大粵語

iPhone – Create an iAd Application

Starting from iPhone OS4, you can add an advertisement banner to your iPhone Application using the iAd framework. I found a great article talking about adding iAd to the iPhone app. Here is an example of a empty view based application with iAd.

1. Open Xcode and create a new View-based Application (iAdProject)
2. Add iAd.framework to the project
3. Modify the iAdProjectViewController.h Continue reading iPhone – Create an iAd Application

陶傑 – 通識不承認

繼英國考試局後,英國的牛津華威兩大學,都悍然宣布:不承認香港特區的「通識」考試成績了。朋友看了新聞,大清早打電話來報喜。
 

「報什麼喜?」我睡眼惺忪:「英國的大學,往香港臉上吐一口沫,關我什麼事?」
「因為你閣下不久前,在有線電視,公開答過香港的通識會考卷,成績不合格。現在,英方給你平反了。」朋友在電話那一端笑嘻嘻。 Continue reading 陶傑 – 通識不承認

Objective-C – Rounding float numbers

In Objective-C, you can use the ceil(), floor() and lroundf() functions to round a float number.

// ceil()
NSLog(@"ceil(1.4f)   : %f", ceil(1.4f));
NSLog(@"ceil(1.5f)   : %f", ceil(1.5f));

// floor()
NSLog(@"floor(1.5f)  : %f", floor(1.5f));
NSLog(@"floor(1.5f)  : %f", floor(1.5f));

// lroundf()
NSLog(@"lroundf(1.4f): %d", lroundf(1.4f));
NSLog(@"lroundf(1.5f): %d", lroundf(1.5f));

Continue reading Objective-C – Rounding float numbers

Objective-C – NSDictionary Example

NSDictionary is a useful object to store key-pair values just like HashMap in Java.

You can create and iterate a NSDictionary as follow

// Create a NSDictionary
NSArray *keys = [NSArray arrayWithObjects:@"key1", @"key2", @"key3", nil];
NSArray *objs = [NSArray arrayWithObjects:@"obj1", @"obj2", @"obj3", nil];
NSDictionary *dict = [NSDictionary dictionaryWithObjects:objs forKeys:keys];
	
// Iterate it
for (id key in dict) {
	NSLog(@"key: %@   value:%@", key, [dict objectForKey:key]);
}

  Continue reading Objective-C – NSDictionary Example

PostgreSQL – Check Running SQLs

Recently, there is a performance issue on the application which i am supporting and i find that the bottleneck is related to the SQL query speed. Therefore, my SA suggests me to add an index on the table to increase the query speed.

But before i could add the index, i have to find out the SQL which runs slow. In PostgreSQL, you can query the recent SQLs by the pg_stat_get_backend_activity() function. Here shows you an example. Continue reading PostgreSQL – Check Running SQLs

Dream BIG and go for it =)