October 3, 2010 | Comments Off
One of the podcasts I listen to on a regular basis is called MacBreak. The hosts are Leo Leporte, Alex Lindsay, Andy Ihnatko and a rotating list of other Mac/Apple/iOS luminaries. If you aren’t familiar with it head over to http://twit.tv/mbw and have a listen. It is highly recommended for anyone interested in all things Macintosh (and iOS too).
A few episodes ago Alex Lindsay mentioned that his company was going to be hosting a one week Commuter iOS Class at their San Francisco offices so their team could come up to speed developing applications for iOS devices. The class would be taught by the folks from Big Nerd Ranch. Usually the BNR folks teach classes from their monastery at a secret location just outside Atlanta, Georgia. Having them venture out to San Francisco; wow, what an opportunity. Oh, did I mention that Alex Lindsay also announced that there were a limited number of spots open to the unwashed masses to attend and the class would be held from 2:00 p.m. until 10:00 p.m. each day so folks could continue to do at least part of their day jobs.
All in all this just sounded too good to pass up so I fired off an e-mail to the folks at BNR to let them know I wanted to attend. My fingers were crossed because I know how quickly their classes fill up. Needless to say I wouldn’t be writing this post if I didn’t get in.
So, I’m off to the Pixel Corps offices later this month to soak up some more iOS goodness. Hope to see a few of you there too.
BTW: Here is a link to the course description for anyone curious.
October 1, 2010 | 6 Comments
This article covers the steps I went through to setup my MacBook Pro for Google App Engine (GAE) development. I am using the Python runtime in GAE so the focus here is on a Python development environment.
Setting Python 2.5 as Default
My MacBook Pro is running Snow Leopard. I am planning to host my projects on Google App Engine and it requires Python 2.5. Snow Leopard ships with Python 2.6 as the default. You can switch to Python 2.5 using a few simple commands, as follows:
$ defaults write com.apple.versioner.python Version 2.5 $ sudo defaults write /Library/Preferences/com.apple.versioner.python Version 2.5
After issuing these commands you should logout and login, launch a Terminal window and issue the command
$ python --version
It should report Python 2.5.4 as the result. If it still says Python 2.6.1 then your change did not take effect. To troubleshoot the problem start with man python. It includes information on how to switch the default version of Python on your system.
Additional Python Modules
Google App Engine expects that the ssl module is installed. This is so it can verify the identity of the GAE servers when trying to deploy your projects. Install it like this:
$ curl http://pypi.python.org/packages/source/s/ssl/ssl-1.15.tar.gz --output ssl-1.15.tar.gz $ tar xvf ssl-1.15.tar.gz $ cd ssl-1.15 $ sudo python setup.py install
If you want to use the GAE image manipulation classes while running on the local development server you will need to install PIL using the following command.
$ sudo easy_install pil
The following will be necessary for building some other python libraries later in the process.
$ sudo easy_install docutils
The following modules are necessary if you choose to install IPython (see next section). If you are planning on skipping the IPython installation these can be skipped as well.
$ sudo easy_install readline $ sudo easy_install nose $ sudo easy_install pexpect
The IPython interactive interpreter is a good addition to your Python development environment. It does not come pre-installed on Snow Leopard. You can download the latest stable version using this command:
$ curl http://ipython.scipy.org/dist/0.10/ipython-0.10.tar.gz --output ipython-0.10.tar.gz $ tar -xzf ipython-0.10.tar.gz $ cd ipython $ sudo python setup.py install
Google App Engine SDK
The Google App Engine SDK for Python is available at http://code.google.com/appengine/downloads.html. As of this writing you can use the following command to grab the latest version:
$ curl http://googleappengine.googlecode.com/files/GoogleAppEngineLauncher-1.3.7.dmg --output GoogleAppEngineLauncher-1.3.7.dmg
Once you download the dmg file open it in Finder and run the installer. It will place all of the necessary files on your machine. Once complete locate the GoogleAppEngineLauncher.app icon in Finder and double-click on it. This application provides a nice UI for managing your GAE projects.
Source Code Management Tools
I am planning on managing the source code for my projects with git and will store my master repositories on http://github.com. Apple does not include a copy of git on the machine by default. An installer is available at http://help.github.com/mac-git-installation/. While you are at it also create an account on github if you don’t already have one. It is useful for social coding in the wider open-source community.
Some of the Django open source software I plan on using is maintained using a distributed source control management tool called Mercurial. An installer for this is available at http://mercurial.selenic.com. Download and install the software.
$ curl http://mercurial.selenic.com/release/mercurial-1.6.3.tar.gz --output mercurial-1.6.3.tar.gz $ tar xvf mercurial-1.6.3.tar.gz $ cd mercurial-1.6.3 $ make PREFIX=/System/Library/Frameworks/Python.framework/Versions/2.5 all $ sudo make PREFIX=/System/Library/Frameworks/Python.framework/Versions/2.5 install $ hg version
I plan on implementing my web applications on top of the Django framework. Some modifications are required in order for this framework to run properly on GAE since Google uses Big Table for data storage instead of a relational database. Everything necessary to get Django working in GAE is included as part of the Django-nonrel project. Specific instructions for GAE are available at http://www.allbuttonspressed.com/projects/djangoappengine.
Use the commands listed below to install copies of all the necessary components onto your machine. Everything will be stored in a folder called DjangoStuff under your home directory.
$ mkdir $HOME/DjangoStuff $ cd $HOME/DjangoStuff $ hg clone https://bitbucket.org/wkornewald/django-nonrel $ hg clone https://bitbucket.org/wkornewald/djangoappengine $ hg clone https://bitbucket.org/wkornewald/djangotoolbox $ hg clone https://bitbucket.org/wkornewald/django-dbindexer $ hg clone https://bitbucket.org/wkornewald/django-testapp
Now, pick another folder where you want to setup a practice application. I am calling mine cs-practice since this is also the name of my Google App Engine application.
Use the following commands to configure the practice application for Django-nonrel development.
$ mkdir $HOME/cs-practice $ cd $HOME/cs-practice $ ln -s $HOME/DjangoStuff/django-nonrel/django django $ ln -s $HOME/DjangoStuff/djangoappengine djangoappengine $ ln -s $HOME/DjangoStuff/djangotoolbox/djangotoolbox djangotoolbox $ ln -s $HOME/DjangoStuff/django-dbindexer/dbindexer dbindexer $ cp -r $HOME/DjangoStuff/django-testapp/* .
Once you have the practice folder setup you need to edit the app.yaml file and change the application name to reflect the Google App Engine application name you selected when registering on http://appengine.google.com.