kvm / qemu simple command
建立一個新的 image : qemu-img create winxp.raw 8GB
啟動一個 guest os 用 VNC 連接 : kvm –hda winxp.raw –cdrom /dev/cdrom –vnc :2
[下午 02:21:04] _RTN gillight: 如果有 適合的 CPU 的話
[下午 02:21:11] _RTN gillight: KVM 會有些優勢
[下午 02:21:26] _RTN gillight: 1. 近似 native 的 CPU 利用
[下午 02:22:03] _RTN gillight: 2. 近似 native 的網路利用 (KVM的半虛擬化驅動程式)
[下午 02:22:23] _RTN gillight: 3. 近似 native 的硬碟利用 (也是KVM的半虛擬化驅動程式)
[下午 02:22:50] _RTN gillight: 4. 動態縮放guest主機的實體記憶體大小
[下午 02:23:56] _RTN gillight: 然後剛剛說的那個 library 叫做 libvirt
[下午 02:26:05] _RTN gillight: 剛剛應該可以參考這個網頁
[下午 02:26:06] _RTN gillight: https://help.ubuntu.com/10.04/serverguide/C/libvirt.html
[下午 02:26:58] _RTN gillight: virt-viewer 是官方推薦的 GUI
[下午 02:27:02] _RTN gillight: 但我沒用過
[下午 02:27:42] _RTN gillight: 我還是覺得要管一堆虛擬機器的話 webUI 還是最方便的
[下午 02:27:51] Rimmon 2.0: (y)
[下午 02:27:59] Rimmon 2.0: 有喵到
[下午 02:28:51] _RTN gillight: 我自己現在適用 VirtualBox
[下午 02:28:57] _RTN gillight: 本來是昇陽的產品
[下午 02:29:11] _RTN gillight: 現在變成萬惡甲骨文的了
[下午 02:37:52] Rimmon 2.0: 對呀, 一開 virtualbox 就看到 oracle ….
[下午 02:38:20] _RTN gillight: 更囧的事
[下午 02:38:29] _RTN gillight: 開 java 也會看到 oracle
[下午 02:38:38] Rimmon 2.0: 有點嚇一跳
[下午 02:39:03] Rimmon 2.0: 不是, 還有更囧的事
開 mysql 也會看到 oracle Orz
[下午 02:39:05] _RTN gillight: 還導致 Eclipse 死當
[下午 02:39:53] _RTN gillight: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6969236
[下午 02:40:44] _RTN gillight: 因為急著改名導致程式死當的案例…..
[下午 02:40:56] Rimmon 2.0: 這就是 hardcode 的結果呀
[下午 02:41:22] _RTN gillight: 😛 的確是
[memo] iPhone display images sample code
FROM URL : http://www.iphoneexamples.com/
CGRect myImageRect = CGRectMake(0.0f, 0.0f, 320.0f, 109.0f); UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect]; [myImage setImage:[UIImage imageNamed:@"myImage.png"]]; myImage.opaque = YES; [self.view addSubview:myImage]; [myImage release]; // or UIImage *imagesource = [UIImage imageNamed:@"userbutton.gif"]; myphoto.image = imagesource; //
Firewire 800 speed test!
[2010/9/3 下午6:05:46] _RTN Jason Chen: Firewire 800 外接盒效能還不錯,TimeMachine的差異備份很快。
[2010/9/3 下午6:22:44] _RTN Jason Chen:
1GB 檔案複製速度:
SATA -> SATA : 12sec
SATA -> FW800 : 21sec
SATA -> USB2.0 : 30sec
[2010/9/3 下午6:24:33] _RTN Jason Chen:
Xbench Disk Test:Sequential Uncached Read
500G SATA 7200轉:106MB/sec
USB 160G 5400轉:36MB/sec
FW800 250G 5400轉:80MB/sec
把 wordpress blog 立即變成 mobile friendly 的套件
阿毛介紹的: http://mobilepress.co.za/
裝好後它會偵測 user 的 user agent 若是 mobile 就會把頁面換成 ‘手機’ 版.
[MEMO/TIPS] iPhone class / method / instance naming convention
class : 大寫開頭
method / instance : 小寫
Property List / SQLite 寫法 sample
類似 printf 的寫法
NSString *debugMsg = [NSString stringWithFormat:@"Process %d", 1];
取亂數
定義: #define RANDOM_SEED() srandom(time(NULL)) #define RANDOM_INT(__MIN__, __MAX__) ((__MIN__) + random() % ((__MAX__+1) - (__MIN__))) // --- 這樣用 NSLog(@"%d" , RANDOM_INT(0,9) );
取 unixtime :
NSDate *past = [NSDate date]; NSTimeInterval oldTime = [past timeIntervalSinceDate:[NSDate dateWithNaturalLanguageString:@"01/01/1970"]]; NSString *unixTime = [[NSString alloc] initWithFormat:@"%0.0f", oldTime]; NSLog(@"%@" , unixTime);
印出 debug message / popup alert 的寫法:
// --- -(void) printdebug:(id)msg { NSLog(@"%@", msg); } // --- -(void) displayAlertMessage:(id)msg { // Display AlertView UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"___Alert___" message:msg delegate:self cancelButtonTitle:@"Close" otherButtonTitles: nil]; [alert show]; [alert release]; }
Objective-C 奇怪的 null detect!
if ( (NSNull *)[item objectForKey:@"nick"]==[NSNull null] ) { // FOR GUEST DATA cell.textLabel.text = @"Guest"; } else { // FOR MEMBER DATA cell.textLabel.text = [item objectForKey:@"nick"]; }
ASYNC network 寫法:
http://mobile.tutsplus.com/tutorials/iphone/iphone-json-twitter-api/
—-
[書上沒教的] iPhone / xcode 出現這種 error : Check dependencies …error: There is no SDK with the name or path ‘iphoneosx.x’
想抓別人的 iphone project 來試玩看看, 在 build 時會有這種 message 的解決方法
Check dependencies
error: There is no SDK with the name or path ‘iphoneos2.2’
重選 “Base SDK for All Configurations” , 如圖: