Manipulate a plist from the command line

Since OS X 10.5 a command called PlistBuddy has been available.

It's useful for things like extracting the version number out of your Info.plist during a Run Script Build Phase.

PlistBuddy wasn't in my existing path, I found it at /usr/libexec/PlistBuddy

Example Usage

/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" Info.plist

Outputs: 0.14, or whatever the value of the CFBundleVersion key in Info.plist is.

Fix PHP 5.3 hang on Windows

I just upgraded to PHP 5.3 on my Windows development box, and ran into an issue making any database connection with the MySQL and MySQLi drivers. Pages not making any database connections worked fine, but any page with a database connection would sit and hang for about a minute, and then throw an error.

PHP Warning: mysqli::mysqli(): [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in xxx.php on line 2
PHP Warning: mysqli::mysqli(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
in xxx.php on line 2

PHP bug #45150 suggests that this is due to issues resolving localhost on Windows. This is partially correct, more specifically it's an issue with localhost resolving to ::1 when IPv6 is enabled.

While it feels like Windows has shoehorned in IPv6 support, the blame seems to lie with MySQL, which won't support IPv6 until version 6.0.

I'm not sure why the timeout isn't instant, the port is closed, so it could be partially a problem with PHP or Windows.

> nmap -sT -p 80,3306,3389 -6 ::1
 
Starting Nmap 5.00 ( http://nmap.org ) at 2009-11-20 15:48 Mountain Standard Time
Interesting ports on cfg64 (::1):
PORT     STATE  SERVICE
80/tcp   closed http
3306/tcp closed mysql
3389/tcp open   ms-term-serv
 
Nmap done: 1 IP address (1 host up) scanned in 3.14 seconds

The Fix

Open up %windir%\system32\drivers\etc\hosts with a text editor and comment out the line that looks like:

::1             localhost

Prefix it with a #, like so:

#::1             localhost

Save it and your PHP/MySQL connections will immediately begin working. You could also use 127.0.0.1 in your connection string instead of localhost, but I didn't want to change code in innumerable files.

Helper Application to View the Event Log on a BlackBerry Storm

When Verizon shocked the world by releasing OS 5.0 for the 9530 Storm, the OS unfortunately shipped with a bug that prevents users from viewing the event log.

To view the Event Log on a Storm you need to switch to the Home screen, show the keyboard, and activate alt/num lock by holding down the '123' button. Once alt is 'locked', press ", /, ", /. That's double-quote, forward-slash, double-quote, forward-slash. On all the QWERTY devices you can type ALT+LGLG.

The OS released approved for release by Verizon (application version 5.0.0.328, bundle 508) doesn't have a Show Keyboard menu item on the home screen, leaving users with no way to view the event log or configure any event log filters.

I thew together a quick little application that does one thing, and one thing only, launch the Event Log Viewer.

OTA install: http://coreygilmore.com/ota/eventviewer/EventViewer.jad
Desktop Manager install: http://coreygilmore.com/ota/eventviewer/EventViewer.zip

Apple treats all iPhone developers equally – like crap

Today Google released Google Latitude for the iPhone, something BlackBerry and Android users have been enjoying for quite some time.

One paragraph in particular jumped out at me, emphasis mine:

We worked closely with Apple to bring Latitude to the iPhone in a way Apple thought would be best for iPhone users. After we developed a Latitude application for the iPhone, Apple requested we release Latitude as a web application in order to avoid confusion with Maps on the iPhone, which uses Google to serve maps tiles.

So Google was working "closely" with Apple, built a native iPhone application1 for Latitude, and then Apple essentially rejected it and told them to build a web application. Isn't building an entire application only to have it wholly rejected one of the leading complaints about the nightmarish App Store approval process?

  1. I'd love to see a build of this leaked out so jailbreak users could run it [back]

© 2007-2012, Corey Gilmore | Posts RSS Feed | Comments RSS Feed | Contact

 

The views expressed on these pages are mine alone and not those of any past or present employer. All information presented on this site was obtained lawfully and not through disclosure under the terms of an NDA.