Friday, October 21, 2011

Use Siri to Update Facebook and Twitter

I got my iPhone 4S on launch day and I absolutely love Siri! Unfortunately there is no Twitter or Facebook integration for Siri out of the box. There are some fairly straight forward workarounds, though.

Facebook
To update your Facebook status:
  1. Create a new contact in your address book and name it something other than "Facebook". "Facebook" is a reserved word and Siri will tell you it can't interact with it. I named mine "Face".
  2. Find your Facebook email address on the Facebook Mobile site and set that as the email address.
  3. Now you can just email status updates to Facebook using Siri. Facebook uses the Subject line as the status update.



Twitter
Twitter doesn't have native email updating capability so, instead, use SMS to send Twitter updates:
  1. Link your phone to Twitter on the Devices page.
  2. Create a new contact in your address book and name it something other than "Twitter" or "Tweet". These are both reserved words for Siri. I named mine "Toot"
  3. Set the phone number to 40404.
  4. Send a text message to your contact.

Wednesday, October 19, 2011

Python, Virtual Environments, and cx_Oracle on Lion

As of this writing, the 64-bit Oracle Instant Client segfaults under Lion. There is a fairly lengthy discussion thread on the Oracle support forums and the only solution currently is to use the 32-bit version.

While the problem is fairly easy to overcome if you use the system python, it presents a problem when using virtual environments. For the system Python, simply install the 32-bit Instant Client and tell the system to use the 32-bit python install:

defaults write com.apple.versioner.python Prefer-32-Bit -bool yes

or

export VERSIONER_PYTHON_PREFER_32_BIT=yes

Python in a virtual environment, on the other hand, bypasses the Prefer-32-bit flag and will always run in 64-bit mode. As suggested by Ned Deily on StackOverflow, you can remove the 64-bit binary from the virtual environment python to force it to use 32-bit.

To remove the 64-bit binary, use lipo:

$ which python
/path/to/virtualenv/bin/python
$ file /path/to/virtualenv/bin/python
python: Mach-O universal binary with 2 architectures
python (for architecture x86_64): Mach-O 64-bit executable x86_64
python (for architecture i386): Mach-O executable i386
$ cp /path/to/virtualenv/bin/python /path/to/virtualenv/bin/python-universal
$ lipo /path/to/virtualenv/bin/python-universal -thin i386 -output /path/to/virtualenv/bin/python
$ file /path/to/virtualenv/bin/python
/path/to/virtualenv/bin/python: Mach-O executable i386

If you take this approach, you will probably need to reinstall any python libraries like mysql-python with their 32-bit versions. To install mysql-python 32-bit, make sure you are running the 32-bit MySQL server.

Good luck!