27
Jan
2010

Installing PIL on Mac OS X Snow Leopard for use in Google App Engine

Tags: , ,     Categories: Software

Python users who use Django or Google App Engine on the Mac, will likely benefit from the python imaging library (PIL).

However, installing on Mac OS X (Snow Leopard) can be tricky. There are many blog posts on the issue. The most common problem is that PIL and libjpeg (a dependency) seem to install OK, but when you go to use it in your Python code, you get “_jpeg_resync_to_restart” errors.

A further complication is the fact that Google App Engine uses Python version 2.5 (and not the default 2.6 that comes with Snow Leopard). If you just need PIL for Django, you can ignore the 2.5 references (i.e. python2.5 becomes python).

Here’s how I got it working on my machine (the steps are a combination of others’ blog posts, but main credit goes to Michael Richardson’s post):

  1. Download libjpeg (the latest .tar.gz version): http://www.ijg.org/files/.
  2. Download PIL (the latest version for Python 2.5): http://www.pythonware.com/products/pil/
  3. Extract libjpeg and do the standard install affair:
    export CC="gcc -arch i386"
    ./configure
    make
    sudo make install
    from within the directory. The first line is the gem that many other blog posts leave out (and it assumes you’re using BASH)
  4. Extract the PIL and change in to that directory.
  5. [optional] libjpeg will have been installed in /usr/local/lib/, by default, above. Normally this directory will be picked up automatically by the PIL install below, but just for good measure (or if you have problems later in the PIL install), edit the setup.py, look for the line
    JPEG_ROOT = None
    . Change that line to
    JPEG_ROOT=libinclude( "/usr/local" )
    and save it.
  6. Install PIL by running
    sudo python2.5 setup.py install

That was enough to get it running for me. I can start App Engine (I use the Google-provided launcher), and use the Image API.

 

2
Nov
2009

Running dotMobi Wordpress Mobile Pack on PHP 4

Tags: , ,     Categories: Software

If you, like me, are installing the dotMobi Wordpress Mobile Pack on a server with PHP4 installed, and you enable the “Shrink images” feature under “Mobile Theme”, you will likely see just the header of a blog post being out put for mobile devices (and not the full content).

This feature reduces the image size (of any images in your Wordpress post/page) to make it more bandwidth and screen friendly for mobile users. The problem is that it uses a PHP5-only call of file_put_contents(..), which fails without error, or logging, on my Wordpress install.

To remedy the problem, I substituted the call, in 2 places, with the PHP4 equivalent calls. file_put_contents(..) is a shortcut convenience method which is the same as calling fopen(..), fwrite(..) and fclose(..).

As of version 1.1.3 of the plugin the code is under wp-content/plugins/wordpress-mobile-pack/plugins/wpmp_transcoder/ in your WordPress install directory. The 2 occurrences are in the file wpmp_transcoder.php on lines 431 and 448 respectively.

I changed

@file_put_contents($full_location, $data);

.. to ..

$fhout = @fopen($full_location, "w" );
@fwrite($fhout, $data);
@fclose( $fhout );

.. and ..


@file_put_contents("$full_location.meta", "< ?php $"."width='$width';$"."height='$height';$"."type='$type'; ?>");

.. to ..

$fhmeta = @fopen( "$full_location.meta", "w" );
@fwrite( $fhmeta, "< ?php $"."width='$width';$"."height='$height';$"."type='$type'; ?>");
@fclose( $fhmeta );

.. and all was well again.

You could also just not use the “Shrink images” feature to avoid having to mess with any code!

 

22
Sep
2009

Getting SMS delivery reports on your o2 Ireland iPhone

Tags: , , ,     Categories: Software

If you need SMS delivery reports on your iPhone, you might have read that the iPhone doesn’t suport them. It doesn’t, unfortunately!

iPhone screenshot

The good news is that there is a workaround! Add *R* and a space to the start of the SMS message (not the number; the message body). While this code will appear in the conversation window, the recipient won’t see it. o2 will strip it out before sending.

When your SMS is delivered, you’ll get a message back which is the raw delivery report. It’ll appear as an SMS in your conversation window.

It’s not an ideal solution, but you do get notification of delivery, at least.

This code also works on Meteor and Tesco Mobile. For a list of codes for networks other than o2 Ireland, see url.ie/2hgg.

 

10
Aug
2009

My App School experience

Tags: ,     Categories: General, Software
5/5

I attended the first App School some weeks back and, as a staunch critic of week-long training courses, I’ve come to be convinced of the opposite.

If you’re a developer, no matter how experienced, interested in iPhone development, read on!

Read the rest of this entry

Rated 5/5 on Aug 10 2009
Vote on cgarvey’s reviews at LouderVoice
LouderVoice review tags: , , , ,

 

22
May
2009

Lightning review of LouderVoice for Android

Tags: ,     Categories: Software
4/5

Below is a very brief review of the new Google Android application, by LouderVoice.com, which allows you to browse, search and write reviews, much like on the main site. They’ve included some basic location-based features, such as the ability to automatically set the location of a given review from your phone’s GPS, and to search for reviews in your current location.

Here’s a quick video tour:

Rated 4/5 on May 22 2009
Vote on cgarvey’s reviews at LouderVoice
LouderVoice review tags: , , ,