Thursday, June 23, 2011

Installing Pylint for Python 2.5 on Mac

In a previous post I discussed how to set up Google App Engine (Python) development environment on Mac OS X 10.6. I'm liberally mining some of my own notes on setting up Google App Engine on Ubuntu 10.10.

In my previous Ubuntu environment I had a neat Ant script for building, testing and uploading my Google App Engine applications such as My Web Brain. One of tests the script performed was Python code style checks using Pylint, which I have also mentioned before in the context of Ubuntu. I've set this up again on my Mac, so I thought I thought I would post my notes here.

In this post I talk about:

  • Installing Setup Tools for Python 2.5,
  • Installing PyLint using SetupTools, and
  • Configuring Aptana/Pydev to use PyLint
Lets go!

Sunday, June 19, 2011

Getting Started with Google App Engine, Python 2.5 and PyDev on OS X 10.6

Last week my shiny new Apple iMac 27 inch arrived and I thought I would share my steps in getting my Google App Engine (Python) environment set up. I have previously written about setting up Ubuntu 10.10 for the same purpose and that post remains one of the most popular on this blog.

To set up our Google App Engine environment we will need the correct version of Python, the Google App Engine SDK and a Python/GAE friendly IDE.

Monday, June 6, 2011

A Better Prisoner's Dilemma Simulation?

In my previous post I had started work on a python program named generations to try to replicate the simulations of Robert Axelrod in comparing differing Prisoner's Dilemma strategies. At the time I was simulating single organisms ('Critters') with different strategies accumulating food over a number of iterations with the critter with highest food at the end of the iterations judged the winner.

The result of this simple simulation was that two strategies - Grudger and Tit-for-tat - were continually vying for the top spot, with Grudger taking the mantle more often than not. In Axelrod's tournament Tit-for-Tat was the unambiguous winner, so I knew my generations script needed some work.

(Read my previous post for an introduction to Prisoner's Dilemma, why it interests me and what the various strategies were.)

I've been developing the simulation since. Technically it is a bit of a mess, but when I next refactor I will be focusing on new parts of the model aside from PD and so I wanted to deliver this conclusion to Prisoner's Dilemma now.

In this post I want to talk about how I changed the simulation and what effect these changes had. For the impatient - yes I have managed to tweak the simulation such that Tit-for-tat is the unambigously best strategy. Many critters had to die to make it so...


Monday, May 23, 2011

My Generations Project and Prisoner's Dilemma

Apologies for the lack of recent posts. I have been 'learning technical stuff' mostly at work and mostly not in a form that can be easily shared. I have recently found the time to start a new project I call Generations - a python program I am developing to simulate some aspects of natural economy and natural selection.

Recently I re-read Richard Dawkins' The Selfish Gene and Robert Wright's The Moral Animal and was fascinated by the idea that computer simulations could tell us useful information about effective behavioral strategies, how those strategies prosper and in turn what effect these strategies may have on their own effectiveness and that of other strategies.

Currently this initial version of my program only simulates Prisoner's Dilemma. Wikipedia describes the Prisoner's Dilemma scenario, a classic game from the field of Game Theory, like this:
Two suspects are arrested by the police. The police have insufficient evidence for a conviction, and, having separated the prisoners, visit each of them to offer the same deal. If one testifies for the prosecution against the other (defects) and the other remains silent (cooperates), the defector goes free and the silent accomplice receives the full one-year sentence. If both remain silent, both prisoners are sentenced to only one month in jail for a minor charge. If each betrays the other, each receives a three-month sentence. Each prisoner must choose to betray the other or to remain silent. Each one is assured that the other would not know about the betrayal before the end of the investigation. How should the prisoners act?
Prisoner's Dilemma is an example of a non-zero-sum game, meaning that players are not attempting to beat other players, just achieve the best outcome for themselves. That is to say: winning doesn't automatically imply the other player or players have lost. When played repeatedly and scored (ie. 'Iterative Prisoner's Dilemma') the interesting question becomes which strategy, if any, is the most successful against the widest range of counter-strategies. Always cooperate? Always defect? Some mixture of the two?

Friday, February 18, 2011

PagedQuery not working on SQLite Google App Engine SDK..?

A recent interchange with a helpful user gave me a heads up that PagedQuery - my simple query wrapper for providing paging in Google App Engine - might not work when testing locally using the SDK with the optional SQLite backend (there are number of open issues about SQLite on the SDK project page).

I haven't used SQLite backend personally, so for the moment I can't confirm this. From my discussion with the user it seems the SQLite backend does not implement cursors properly. I'm slowly reviving my he3-appengine-lib development environment so hopefully I will be in a position to confirm this soon.

(Thanks Milo for bringing this to my attention!)

Monday, February 7, 2011

Naked Domains on Blogger

Google sometimes isn't great at updating its documentation. Or perhaps they need to improve their search. If you search for information about how to use a naked domain on Blogger, you will get the impression from results that this isn't possible.

The highest search result I found from Blogger seems to say the same thing:
To simplify custom domain configuration on your blog, Blogger only accepts non-naked domains in our sign-up process. If you try to enter a naked domain in the advanced settings of the Settings | Publishing tab, you will run into an error stating that Blogs may not be hosted at naked domains.

To fix this, simply enter the non-naked version of your domain and save your settings.
But you can use a naked domain! (sort of). No hosting, redirect pages or .htaccess files required. You can achieve the same result by configuring some A records on your naked domain to redirect to Google's server.

I knew I saw this somewhere while I was setting up Ferny Blog but it has taken me far too long to find the information in Google's documentation.

But found it I did - Look at the second half of this page

Monday, January 17, 2011

Eclipse-Based Wireframe and Mockup Designer: WireframeSketcher

If you are in need of a capable wireframe and mockup designer for Eclipse, this post will interest you. I was contacted by Peter Severin from WireframeSketcher last month. Peter asked if I was interested in trying out his Eclipse-based wireframe and mockup designer. He also provided a free license key. Thanks Peter!

In truth, I had been looking around for an easier solution to wireframes and mockups. I had been trying to use Adobe Fireworks CS5 in combination with a course from Lynda.com for this purpose but I found the solution and workflow overkill for a web application designer working on his own projects. I need something simpler.

And then there is the issue of platform support. As I have mentioned in previous posts,  I develop on Ubuntu and Mac OSX. My Windows license for CS5 would not help me on those platforms, and running additional virtual machines for the purpose simply complicated my workflow and source control.

Balsamiq looks like a great tool, and I have heard many good things about it, but it suffers from the same lack of platform support on Ubuntu and is otherwise just another tool to manage and integrate into workflow and source control.

WireframeSketcher, on the other hand, is built on Eclipse. It is available in a standalone application, but really comes into its own as a plugin into your existing Eclipse environment. WireframeSketcher, like Eclipse, is cross-platform, and works just as well on Ubuntu or Mac OSX as it does on Windows.