「一代不如一代」,這是句我們常常聽到的老話。做學問,一代不如一代,民國大師之後再無大師。寫文章,一代不如一代,周氏兄弟始終是白話文寫作的高峯。當官亦是一代不如一代,早輩的政治人物潔身自愛高瞻遠矚勤政愛民,別說去「天上人間」買醉了,他們根本忙得連廁所都沒功夫上。我最近發現,原來連打工階層也是一代不如一代。他們老說以前出來打工的刻苦耐勞,你叫他怎麼幹,他就怎麼幹;如今可好,個個貪圖逸樂,有錢不存下來交首期,先拿去買新款手機再說;而且抗壓能力特別低,動不動就鬧事。
Continue reading 梁文道 – 這也叫一代不如一代?
iPhone – AVAudioRecorder mono playback problem
Before initializing the AVAudioRecorder, we need to configure the record setting such as the sampling rate and the audio format.
Most of the AVAudioRecorder examples in web have similar record setting as follow: Continue reading iPhone – AVAudioRecorder mono playback problem
iPhone – Reading File in Resource Folder
Sometime you may need to bundle your files with the resource folder of the Xcode project such that u can manipulate those files on the fly.
If you have a resource file named as readme.txt, you can get the file path by
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"readme" ofType:@"txt"];
Objective-C – Convert NSString File Path to NSURL and Vice Versa
Convert NSString to NSURL
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath]; /* OR */ NSURL *fileURL = [NSURL fileURLWithPath:filePath];
Convert NSURL to NSString
// The output string will have the file:// prefix NSString *filePath= [fileURL absoluteString]; // The output string will have the file path only NSString *filePath= [fileURL path];
Updated @ 2011-01-10: Thanks for the comments of Brandon and Antal.
iPhone – Configuring the AVAudioSession and Output Audio to iPhone Speaker
I am working on the AVAudioRecorder and AVAudioPlayer. By default, the output audio is routed to the receiver instead of the iPhone speaker. In order to fulfill my requirement, i have to configure the AVAudioSession in the AppDelegate.
There are 2 ways to route the audio output to speaker.
- Overriding the output audio route
- Changing the default output audio route (iPhone OS 3.1 or above)
Continue reading iPhone – Configuring the AVAudioSession and Output Audio to iPhone Speaker
名言十四
Many people dream of success. Success can only be achieved through repeated failure and introspection. Success represents the 1% of your work that results from the 99% that is called failure.
Soichiro Honda
iPhone – Aligning UIToolbar Items on Code Level
In Xcode, If you want to add items to the UIToolbar, you need to create an NSArray which stores all the items and put them to the UIToolbar using the setItems method.
If you want to align one items on the left and the another one on the right. you need to create a space item in between the two button in the array. That’s just like adding a Flexible Space Bar Button Item in Interface Builder.
Continue reading iPhone – Aligning UIToolbar Items on Code Level
CakePHP – Open an xml Formatted .xls in OpenOffice
About a half year ago, i posted an article about exporting data to an .xls file in CakePHP.
CakePHP – Export data to a .xls file
It is found that the exported .xls cannot be opened in OpenOffice. Today, Stebu finds the solution. Here is the modified helper class.
Continue reading CakePHP – Open an xml Formatted .xls in OpenOffice
貨幣戰爭
作者: 宋鴻兵
繼 Rich Dad, Poor Dad 之後,我想推薦這本書給將要進入社會工作的年青人,做好準備面對真實的世界。
作者搜集了大量史料與數據,再加上的自己的聯想,合成了一本故事書,重現人類係工業革命後到現代的經濟過程。沒錯,係故事書,因為我不能印證作者所描述的人類行為,但我個人相信有部份內容與真相相差不遠,雖然只有上帝才知道真相,但無所謂啦,歷史從來沒有真相,只有接近真相。是不是真相都無傷大雅,因為最重要係書本的啟發性,能夠刺激讀者思考,就係好書。我自己就覺得獲益良多。
有冇想過銀行係怎樣運作? 貨幣係點創造? 點解會有咁多投資產品? 仲有好多經濟上的知識,你都可以從此書見識到。如果你不想做一隻羔羊,就要做好準備,這書會幫到你。

.htaccess – Setting Password For Your Web Folder
You can add a .htaccess file to secure your web folder with password protection. Let’s assume the location web folder is /home/ykyuen/public_html
Continue reading .htaccess – Setting Password For Your Web Folder