Can’t debug iOS 4.2 with iPodTouch 3G in Xcode 4.3

Posted on

This is regards to debug by Xcode 4.3 and attempting to run on an earlier device (e.g. iPhone 3G, 2G, iPod 1st gen, etc)
Solution: Remove ‘Required Device Capabilities’ in XXXX-info.plist if wanting to support devices that run armv6 (e.g. the iPhone 3G).

廣告

instruments remote exception encountered

Posted on

solution:
make sure your Xcode set the Profile scheme as Debug than Release.

Grab Screen from Mac OS X Lion(10.7)

Posted on

Mac OS X Lion seams disable OpenGL screen. So, glReadPixel can’t get screen shot.
The solution to grab the screen:
CGImageRef image = CGDisplayCreateImage(kCGDirectMainDisplay);

TCP 常見問題 1 : 如何知道對方不正常斷線?

Posted on Updated on

問題: Peer A & Peer B 已經建立連線。但是Peer B突然電源線被拉掉,也沒電池撐著,或是突然B端的網路線被拉掉。這時候Peer A 的應用程式也沒有對B進行資料的收送。等到下次要搜送資料的時候,卻卡在send recv or read/write 當中。怎辦?
解法;利用 tcp keep alive.在socket 建立的時候 加上
int optval = 1 ;
setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, (const S8 *)&optval, sizeof(optval))
optval = 10 ; // seconds
setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE, (const S8 *)&optval, sizeof(optval))
optval 設定成 timeout 的時間。這個timeout發生的時候, tcp 會送一個 SYN 給對方。

http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/programming.html#setsockopt

windows mysql reset root

Posted on Updated on

http://dev.mysql.com/doc/mysql-windows-excerpt/5.0/en/resetting-permissions-windows.html

1. stop mysql service.
2. edit a file abcd.sql
UPDATE mysql.user SET Password=PASSWORD(‘MyNewPass’) WHERE User=’root’;
FLUSH PRIVILEGES;
3. mysqld.exe –console –init-file=abcd.sql
4. new root password = MyNewPass