網頁

2012年6月20日 星期三

iOS開發筆記 ﹣NSIndexPath indexPathForRow: inSection: 的注意事項

使用[NSIndexPath indexPathForRow:(NSInteger) inSection:(NSInteger)]這個function,若使用在整個object的範圍下,要注意是會隨時被autorelease,不在自己的控制下,所以若要在整個object的使用範圍,最好assign給此object的member時寫成以下方式,如:

_curIndex = [[NSIndexPath indexPathForRow:_curIndex.row+1 inSection:0] copy]

2012年6月13日 星期三

CentOS筆記-安裝svn


yum install mod_dav_svn subversion

利用上述的指令已安裝好subversion了。


參考網頁
http://wiki.centos.org/HowTos/Subversion

2012年6月10日 星期日

CentOS筆記-start ssh server及root不可登入設定

/etc/init.d/sshd start or /etc/init.d/sshd restart

看是否有start起來
netstat -tlnp | grep ssh

//刪除所有確認的金鑰
rm /etc/ssh/ssh_host*

//列出剛建立確認的金鑰
date; ll /etc/ssh/ssh_host*

//取消root用ssh遠端登入的權限
vim /etc/ssh/sshd_config
PermitRootLogin yes --> no

CentOS筆記-設定linux系統上網

公司放了新的server使用,記錄一下設定上網的流程

1. 設定網卡的ip
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
HWADDR=XXXX
IPADDR=192.168.X.X
NETMASK=255.255.255.0
BROADCAST=192.168.X.X
ONBOOT=yes

2. 設定Gateway
vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=XXX
GATEWAY=192.168.x.x

3. 設定DNS server
vim /etc/resolv.conf
search
nameserver 8.8.8.8 //google DNS server

4. 啟動網卡
ifup eth0
ifdown eth0 //關閉網卡

2012年6月7日 星期四

iOS開發筆記 - MutableCopy


今天一直發生底下的exception:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object'

仔細查了之後才知道,是在讀取file時,用了以下這樣的code
NSMutableDictionary *fileContent = [[[NSMutableDictionary alloc] initWithContentsOfFile:_filePath] autorelease];
_list       = @"list";
_content    = @"content";
_objects        = [[fileContent objectForKey:_list] copy];
_qaDescriptions = [[fileContent objectForKey:_content] copy];

copy改成mutableCopy即可