Tuesday, November 1, 2011

Siri on the Bus

I have a fairly long bus ride to work, it typically takes around an hour. Sometimes I like to sleep on the bus, but I'm always scared of missing my stop. With the introduction of iOS 5, Apple added location-based reminders that can be activated with Siri, or manually if you're on an iPhone 4. Location-based reminders don't work on the iPhone 3GS.

My solution is to create a contact just before my bus stop and set a reminder to alert me when I've reached that spot. It's a 2-step process, but it's fairly easy:

Step 1: Create a contact a mile or so before your stop

  1. Open the Maps app and drop a pin by touching and holding in one spot until the pin drops.
  2. Touch the right arrow and select "Add to Contacts"
  3. Name your new contact something easy. I called mine "Mills and 50"


Step 2: Tell Siri to wake you up

When you get on the bus, simply tell Siri to wake you up when you reach your contact. I just have to say "Remind me to wake up when I reach Mills and 50". If you're on an iPhone 4, just open the Reminders app and add a reminder manually.


That's it! Get some rest without worrying about missing your stop!



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!