Friday, October 14, 2011

Prevent SIGPIPE from crashing the program

To do so, add following code to your program.
   signal( SIGPIPE, SIG_IGN ) ;

If debugging with GDB, GDB captures it and paused the process. To avoid this, run following command in gdb. For detailed information about handle, type "handle help" in gdb.
   handle SIGPIPE nostop print pass

Thursday, October 13, 2011

How to convert p12 files to pem files for Push Notification

Example: Development certificate
1. Download the certificate from iOS Provisioning Portal. Double click to install it.
2. Once installed, it should get listed in Certificates of Keychain Access.
3. Locate "Apple Development IOS Push Services:" and right click on it, select "Export xxx" and name it  dev-cert.p12 (leave the password blank for exporting)
4. Expand "Apple Development IOS Push Services:" to find the private key. Right click on it, select "Export xxx" and name it dev-key.p12 (leave the password blank for exporting)
5. Convert certificate to pem file format
   openssl pkcs12 -clcerts -nokeys -out dev-cert.pem -in dev-cert.p12
6. Convert private key to pem file format (password cannot be left blank, so key in 1234 and we will remove it in next step)
   openssl pkcs12 -nocerts -out dev-key-password.pem -in dev-key.p12
7.  To remove the password of dev-key-password.pem, run following command. (password will be asked, enter 1234 as we set in step 6)
  openssl rsa -in dev-key-password.pem -out dev-key.pem
8. Now we have both the certificate and private key (no password) converted in pem format.
9. That's it!

Check clients which connect to Mac OS X Wi-Fi Internet Sharing

arp -i bridge100 -a bridge100 may be different on your Mac OSX