In Objective-C, you can use the sleepForTimeInterval class method of NSThread to sleep the program.
// Sleep the program for 10 second [NSThread sleepForTimeInterval:10.0];
Done =)
Reference: NSThread Class Reference
In Objective-C, you can use the sleepForTimeInterval class method of NSThread to sleep the program.
// Sleep the program for 10 second [NSThread sleepForTimeInterval:10.0];
Done =)
Reference: NSThread Class Reference
Selenium is a suite of tool to automate web application testing. Unlike the unit testing in backend application, it is hard to test user interface in frontend application. Thanks Selenium, it makes frontend testing much easier and fun.
Selenium are 3 sets of tools.
Continue reading Selenium – Automation Tools for Web Application Testing
Yesterday we talked about how to localize the iPhone Application. For more details, please refer to iPhone – Localization. So how about the localizing the application name?
Continue reading iPhone – Localizing iPhone Application Name
Localization is a must in mobile application development. The article will shows you how to localize your iPhone Application in just a few steps.
1. Whenever you need a localized string in your application, use the NSLocalizedString(NSString *key, NSString *comment).
[self.label1 setText:NSLocalizedString(@"label1.text", @"Label1 in MyViewController.m")]; [self.label2 setText:NSLocalizedString(@"label2.text", @"Label2 in MyViewController.m")]; [self.label3 setText:NSLocalizedString(@"label3.text", @"Label3 in MyViewController.m")];
With AVAudioRecorder, we can create different audio files in different format. So how could we determine which format we should use?
Continue reading iPhone – Best Audio Format
The AVAudioRecorder creates .caf format file in my next iPhone Application. so what is .caf file?
Core Audio Format (.caf) is a audio file container developed by Apple for audio files. A .caf file can contains different audio file formats just like .mov container for different video formats.
The post shows you how to convert the following file extensions to .caf using iTunes. Continue reading iTunes – Create .caf File
你係我第一個喜歡的足球員,係我心目中,你絕對係一個世界級的球員。希望你早日康服。
據澳洲《每日電訊報》報導,澳洲隊球星哈里-基維爾早在2002年就被查出患有罕見的血液病(自身免疫性肝炎),有生命危險。
其實一直以來關於基維爾患病的消息和謠言有很多,這次是澳洲隊醫首次對外証實了這一消息,據隊醫卡納加拿斯介紹,基維爾是在2002年隊內的一次例行檢查中查出患有這種罕見疾病的,「這種病如果不及時治療的話會在5-8年內致命的。」隊醫說。 Continue reading 我的偶像 – 基維爾
You can use the following piece of code to randomize/shuffle the objects inside a NSMutableArray.
/* anArray is a NSMutableArray with some objects */
srandom(time(NULL));
NSUInteger count = [anArray count];
for (NSUInteger i = 0; i < count; ++i) {
int nElements = count - i;
int n = (random() % nElements) + i;
[anArray exchangeObjectAtIndex:i withObjectAtIndex:n];
}
Update @ 2012-07-18: Suggestion from kimbebot
/* anArray is a NSMutableArray with some objects */
NSUInteger count = [anArray count];
for (NSUInteger i = 0; i < count; ++i) {
int nElements = count - i;
int n = (arc4random() % nElements) + i;
[anArray exchangeObjectAtIndex:i withObjectAtIndex:n];
}
Done =)
Reference: StackOverflow – What’s the Best Way to Shuffle an NSMutableArray?
二零一零年五月十六日,主持了《城市論壇》近十年的謝志峰,竟然出現第一 次心寒的感覺。
這天論壇,「曲線」討論類近補選的議題,「維園阿哥」號召數百「紅衫仔」逼爆會場,結果創出《城市論壇》市民出席人數紀錄,約450。「……當日我真係驚出事,係第一次驚!觀眾進場時,《Wall Street Journal》的記者正在訪問我,我看見那班年輕人進場時的狀態--嘩!那種急切、盼望、希冀,恐怕佔不到座位的惶恐心情。憑一個記者的直覺,我立時叫正在訪問我的《Wall Street Journal》記者先拍下這個千載難逢的Moving Shot,然後我問她:『你看到他們的神情嗎?』」
謝志峰說,當時他看到的,是數百對饑渴的眼神,他們在掠奪一個發言的機會、一個表達不滿的宣洩途徑、一種希望政府聽到他們聲音的欲望!「我做了那麼多年論壇主持,在『五一六』那天才是第一次看到這種眼神,才第一次感到可能出亂子。」幸而剛好三十周年《城市論壇》這天大步檻過,紅衫仔沒有變成紅衫軍,只有慷慨激昂沒有流血衝突,謝志峰謝天謝地!
Continue reading 維園良心 – 謝志峰
You can get the Date and Time in NSString using NSDateFormatter.
// Get current datetime NSDate *currentDateTime = [NSDate date]; // Instantiate a NSDateFormatter NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; // Set the dateFormatter format [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; // Get the date time in NSString NSString *dateInString = [dateFormatter stringFromDate:currentDateTime]; // Release the dateFormatter [dateFormatter release];
Continue reading Objective-C – Display Date and Time Using NSDateFormatter