Archive for the ‘Programming/misc’ Category.
linux 開機時顯示 IP address script
有時需要用 vm 模擬一堆 server 的環境 , 開了 guest vm (linux) , 但是就是要進 console 後才能知道 IP address , 有些麻煩
這個 script 可以幫助一下, 把 該 server 取得的 IP address 顯示在 console 上, 把它寫成一個 bash 或加到 /etc/rc.local 去
IPADD=`/sbin/ifconfig | sed '/Bcast/!d' | awk '{print $2}'| awk '{print $2}' FS=":"`
echo " $IPADD" >> /etc/issue
Use subversion on Dropbox steps
這麼一來, 可以用 Dropbox 的地方就可以輕鬆的 check out code 了 (y)
ebay token usage
這邊有個圖, 跟 ebay API 串接時的 token / session id 等動作說明得很清楚
[URL] iPhone programming bookmarks / reference
★ Your First iOS Application
http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhone101/Articles/00_Introduction.html
中文 : http://icodeblog.com/category/iphone-programming-tutorials/
★★ iOS Reference Library : http://developer.apple.com/iphone/library/navigation/index.html
iPhone Dev Center : http://developer.apple.com/iphone/index.action
iPhone Human Interface Guidelines : http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/MobileHIG/Introduction/Introduction.html
objective-c 的基本認識 , 參考 URL : http://www.otierney.net/objective-c.html.zh-tw.big5
有趣的 iPad iPhone development video 教學 : http://www.rorylewis.com/docs/02_iPad_iPhone/05_iPhoneTutorials.htm
給初接觸 objective-c 的介紹 : http://maciku.blogspot.com/2009/12/iphone-objective-c.html
包裝好給 iPhone 用的 http 元件/framework – ASIHTTPRequest
http://allseeing-i.com/ASIHTTPRequest/
—-
7/31 iPhone dev 課程 outline :
iPhone spec. / Objective-c intro.
intro. xcode / iPhone 開發限制 / 應用軟體架構 / 記憶體管理
first App. – HelloWorld
程式語法 – simple
Interface Builder基本操作
字串與資料結構 / UI Catalog
second App. – Location base App.
upload to real iPhone – use Apple
★ init , copy , retain 要記得 release memory
★ didReceiveMemoryWarning , viewDidUnload 暫時釋放 memmory
★ IBOutlet 引用到的 InterfaceBuilder 元件建議作 release , 但要注意到不要重覆 release
★ InterfaceBuilder : 事件與程式碼配合 – IBAction , 物件關聯 – IBOutlet , Delegate 指定.
A simple Objective-C Method Declaration and Definition
定義
- (void) sayHello: (NSString*) name;
implementation :
- (void) sayHello: (NSString*) name {
NSMutableString *message = [[NSMutableString alloc] initWithString:@"Hello there "];
[message appendString:name];
NSLog(message);
[message release];
}
//
simple.m 宣告 sayHello method:
#import "Simple.h"
@implementation Simple
- (void) sayHello: (NSString *) name {
NSMutableString *message = [[NSMutableString alloc] initWithString:@"Hello there "];
[message appendString:name];
NSLog(message);
[message release];
}
@end
//
simple.h
#import@interface Simple : NSObject { } -(void) sayHello: (NSString *) name; @end //
main 呼叫 sayHello method:
#import#import "Simple.h" int main(int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; Simple * mySimple = [[Simple alloc] init]; [mySimple sayHello:@"James"]; [mySimple release]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; return retVal; } //

iphone / hello world 2 / single rows in the table view
// --
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
[cell.textLabel setText:@"Hello World!"];
return cell;
}
// --
// --
[導覽] 有趣的 iPad iPhone development video 教學
From : Rory Lewis, PhD, JD
URL : http://www.rorylewis.com/docs/02_iPad_iPhone/05_iPhoneTutorials.htm
另外給初接觸 objective-c 的介紹:
URL : http://maciku.blogspot.com/2009/12/iphone-objective-c.html
中文開發網站 : http://www.cocoachina.com/iphonedev/
// ——————
obj->method(argv);
[obj method: argv];
// ——————
@implementation HelloController
- (IBAction)sayHello:(id)sender {
[destinationTextField setStringValue:[sourceTextField stringValue]];
}
@end
(id)sender 是一個可以選擇性的用法,若您有需要取得發出 IBAction的元件時,可以用這個 sender變數來取得.但記得可能需要 cast一下.
UIButton *senderButton=(UIbutton*) sender;[senderButton setHidden: YES];
這樣就會把該button隱藏起來.
// ——————
[2010/7/9 下午 04:48:25] Rimmon 2.0: jason 有 mac os 的 sftp GUI 的 tools 嗎?
[2010/7/9 下午 04:48:40] Rimmon 2.0: 想要用 tools 傳 code 比較方便
[2010/7/9 下午 04:51:05] _RTN Jason Chen: http://www.versiontracker.com/dyn/moreinfo/macosx/15693
[2010/7/9 下午 04:51:08] _RTN Jason Chen: Fugu
[2010/7/9 下午 04:51:35] _RTN Jason Chen: www.versiontracker.com 有非常多的 OSX 軟體可下載
[2010/7/9 下午 04:53:59] _RTN Jason Chen: 還有 Microsoft Remote Desktop Connection 可遠端遙控 Windows
[2010/7/9 下午 04:55:13] _RTN Jason Chen: smb://172.30.0.29/Install 這樣 OSX 才看得懂網路分享目錄
[2010/7/9 下午 05:00:10] _RTN Jason Chen: Finder, 用 apple鍵 + K 再輸入 cifs://172.30.0.19/Install 即可連 server shared
programmer … 超好用的 online tools – URL Encode/URL Decode/base64 encode/base64 decode/UUencode/UUdecode
URL Encode/Decode : http://netzreport.googlepages.com/online_tool_for_url_en_decoding.html
base64 encode/decode : http://www.rbl.jp/base64.php
base64 encode/decode : http://www.motobit.com/util/base64-decoder-encoder.asp
UUencode/decode : http://www.webutils.pl/UUencode
Subversion 命令列用戶端 svn command
出處: http://i18n-zh.googlecode.com/svn/www/svnbook-1.4/index.html
checkout SVN_URL 的 1000 版號的 code command :
svn co SVN_URL -r 1000


