Saturday, December 20, 2008

My iPhone Initiation

Santa came early this year for me. On Tuesday (16th Dec) my girlfriend came home from work and presented me with a brand new iPhone. After some messing around with sim cards and pixels I've had a good two days of use with this slick device and thought I would capture my impressions.

The phone came home without a 3G sim card. Apparently the sales chick forgot to give us one. I didn't mind too much and postponed opening the packaging of the phone until the following day. On the Wednesday night I released the phone from its cardboard and cellophane prison and slapped the new sim in. Two more problems, the sim didn't work (my number didn't transfer nor was the sim activated on the network) and the phone itself had two dodgy pixels. I googled dead pixels and came to the conclusion that they were likely 'hot' or 'stuck' (brighter than the rest of the screen under all conditions), and tried various methods of flashing colors to wake them up, getting nowhere.

I stormed back to the phone store on the third day, got a new (and this time working) sim card and was bounced to the Apple store at Chadstone to get the replacement handset. I'd never been to the one and only apple store in my city and was surprised when I was told I needed an appointment (WTF?). I spent my 15 minute wait chatting to some other random worker about his iPhone. I interrogated him about cases and cool applications and he eventually sold me a Power Support Air Jacket for iPhone 3G for $40AUD. He had apparently been through three different cases, arriving on the clear version of this case with the crystal rather than glare resistant film. I chose the black backing for the more grippy feel, the clear and naked iPhone felt way too slippery to me. Anyway, I saw the 'genius' tech support guy who immediately switched out my phone leaving me a fully functional iPhone 3G, finally.

I was pretty ignorant about the device when I got it, so naturally I did some research reading iPhone on Wikipedia, the Apple propaganda page and videos, the PDF user guides some of which came with the phone, and the technical support page with some general information on specifications, resetting, and battery management.

Some details of this pocket computer: It is a black 16GB model (contrasted to the 8GB model) with a 9cm liquid crystal display with a resolution of 320x240. It runs a 620MHz CPU supposedly underclocked to 412MHz and has 128MB of RAM. The touchscreen is capacitive meaning it is requires human skin to operate (no glove or stylus). It has a 16GB flash drive (not a HDD), runs an iPhone OS (a derivative of OS X), use a powerVR 3D graphics chipset and has a 2 mega pixel camera. The Chadstone store gave me a 3 month warranty on the device, and Apple has a one year limited warranty.

Compared to the first generation iPhone, this second generation device has the addition of a plastic backing for improved reception, support for 3G connectivity for voice and broadband, and has built in assisted GPS. Some common criticisms of the device include: the lack of flash and Java in the web browser, crippled bluetooth, no video, no MMS, no cut/copy/paste functionality, and the low resolution camera with no flash, zoom, or autofocus.

The carrier is Optus who have good 3G coverage in major cities. The handset is apparently sim locked to the carrier, although Optus will remove this lock for free if requested. I'm on a 12 month contract with 100MB data and $50 of calls per month with a minimum of $19 of calls and a $65 contribution to the cost of the phone per month. Specifically: $0 up front, phone cost (12*$65=$780), min call costs (12*$19=$228), totalling ($780+$228=$1008) over the next 12 months. Call costs are step at 47c per 30 seconds, 35c flag fall, and 25c per text all in AUD.

Physically the phone is big. It fills my jeans pocket and is too big for my jacket pocket. I feel like a dick in public clumsily retrieving it from my pocket to change songs or answer a call because it is so big. I presume I'll get over this. The battery has been fine so far, giving me about a day of goofing around installing applications, listening to music, calling people, and playing games. About what I'd expect given heavy usage.

The interface is slick. I love the flick gestures for lists, and I love touching buttons and controls rather than using a disjoint keyboard and mouse. Mail hooked into my GMail account just fine, and AppStore is simple and intuitive to use. I've had applications crash on me a few times making me think a lot about how the OS is managing application serialization when I press the home key and later reinitialization. I had a situation where no third party application would open no matter what I did. I tried resetting, force restarting, and clearing settings all with no luck. I eventually restored the phone (basically a format) which initially pissed me off, although iTunes is set up to cache all the data I care about on the phone meaning after the restore and the subsequent transfer the phone was back to the way I had set it up - now with working third party apps. I had installed a lot of apps in 2 days (about 2 1/2 screens or about 40) and i suspect one of the apps wrote some data where it shouldn't have, stuffing things up for all the other apps.

I went to a dinner party the other night and an interesting situation occurred where almost everyone there had an iPhone. Almost all second generation, although there was one first generation phone. We all sat around playing on our phones, chatting about what cool applications we had tried or heard of recently, and playing games. Anti-social yet social. I got a lot of suggestions for cool apps and use cases for when device had proven useful in life situations (time tables and guides mostly). I was interested in the first gen phone. It was jail broken, meaning it had a modified firmware installed that allowed unsigned applications to be installed, much like modded xbox's (a domain I'm familiar with). He had a lot more flexibility with the phone, still accessing standard applications, as well as home brew apps like emulators and the array of games they provide.

The device is a computer in my eyes, and phone and mp3 features are secondary. I'm interested in applications, and more specifically applications that can exploit the features of the device such as multi-touch interface, 3-axis accelerometer, camera, GPS, and 2G/3G/wifi/bluetooth communication. Two days of app sampling is not long, but a few standouts so far include:

  • Google Mobile App - for the voice search where you hold the device to your ear and mouth like a phone and vocalize a search query. It just works.
  • Midomi - where you hum or sing a tune and it guesses what song and/or artist it is.
  • Topple - simple block game. I like it for the cool graphics, music, and use of multi-touch for block rotation. It was the first game I came across that gave me an impression of what this device could do. In fact, the few games I've tried by ngmoco:) have been impressive.
  • Aurora Feint - An RPG/puzzle game with great graphics, music and gameplay. Really quite immerse for such a simple game.
I use Fring for IM and skype, Twinkle for twitter, and the built in Mail for my GMail. I'm not too interested in reading my RSS feeds on the device yet, I'm guessing it may be too small. Photo's are geocoded by default, and so are my twitter messages. Besides those two cases, I haven't seen many good uses of the GPS or the mobility/portability of the device. A 'help me find Apple in Chadstone' app would have been useful. I can never interpret shopping center maps accurately - I think it's the scale.

I'm on the lookout for a public transport trip planner like Metlink Melbourne, a local TV guide application (don't watch all that much TV really), and a good movie trailers app (youtube is good, but there is lots of crap on there). The following are some applications that have been recommended to me from more than one source that I'm contemplating buying, mostly games to test the limits of the device:
  • Spore Origins - graphics, music, and game play are meant to be great, although it looks expensive.
  • Moto Chaser - this is the motorbike game advertised on the TV where the accelerometer is used to control the bike.
  • Iron Man: Aerial Assault - looks ok to me, but this 'guy flying around' game was recommended as being lots of fun
  • Cro-Mag Rally - cave man driving game, I think it was on the iPhone TV add as well.
  • Enigmo - similar in nature to The Incredible Machine although with water
  • Metro Melbourne - public transport timetables in Melbourne with time/location filtering for convenience
  • App Sniper - monitor free applications and changes in price, great for finding app store bargains (the apple store guy loved this app!)
  • Ocarina - blow into the microphone and use the device like a musical instrument - seems interesting
  • Oz Weather - for useful weather information (yahoo is crap) from the Australian BOM
I am trying to postpone app purchases until I understand more about the scope of the free applications out there. As a computer it is about as powerful as something I had 6-8 or so years ago, and I'd expect the apps to reflect that. Where is doom or quake? Where is the old classics like lemmings or the original incredible machine? Where is the Optus usage monitor application so I can see how many calls and how much data I have left for the month (I have to infer from general statistics in the phone).

Apparently there are about 13 million of these devices out there (both generations), and the development platform has been available for about a year now. I suspect the applications will only get better and better, and hopefully more innovative. Going forward I'm going to try lots more apps. I'm also going to further investigate jail breaking the phone and the home brew scene. Finally, I'm interested in getting into some iPhone development. I have a few ideas, although my old PPC iBook G4 and Tiger OS X are not immediately compatible with the iPhone development platform. I'm looking into some workarounds.

Thursday, December 11, 2008

Evolutionary computation is popular in the holidays

It seems to me that so-called exotic computer science topics become popular each holiday season, at least in the context of the news sources I consume. I eluded to this in a recent post, in particular computational intelligence. Now it seems the trend is evolutionary computation. Some highlights that have cropped up recently include:

  • Genetic algorithm for building a car: A flash program that begins execution on page load toward evolving a two-wheeled car in a two-dimensional landscape. The objective function appears to based on keeping the red circles from touching the ground, time, and perhaps distance travelled.
  • Genetic Programming: Evolution of Mona Lisa: Example by Roger Alsing of using genetic programming to evolve a set of 50 polygons to represent a source image, specifically the Mona Lisa. A FAQ is provided that comments that the objective function is the sum error between the generated image and the source image, meaning the result is an approximation of the source.
  • Image Evolution: A web application that uses simulated annealing to optimize the color, number of vertices, and orientation of a set of 50 polygons on an HTML canvas element to represent a given image, the default of which is Mona Lisa. Inspired by the popularity of the above approach.
  • Statistics vs. Machine Learning, fight! A great overview comparing and contrasting machine learning and statistics. This argument crops up every year or so, some good points though.
  • Application of Genetic Programming to the "Snake Game": The resurgence of this 2000 tutorial on using genetic programming to evolve a controller to successfully play snake.
Give the theme, there have been a number of recent requests for good tutorials, frameworks, and resources for learning about evolutionary computation and machine learning. Most are pretty crap, I'm sure this represents an opportunity, now that sites like ai-depot and generation5 are defunct.

Wednesday, December 10, 2008

Rationalizing the choice of ruby for code examples

I am writing copy for a technical book that will present concepts predominately as example code in the Ruby Programming Language.

I recently explained the concept to some old colleagues which resulted in a discussion on the rationale for selecting ruby over math, pseudo code, or no examples at all. I'm not even going to try to justify the choice objectively (perhaps parsimony, prominence, popularity, etc.), rather I'm going to discuss some factors that influenced the decision.

It is a book by a programmer for programmers, that is people used to thinking about systems from a computational perspective. It is a natural fit therefore to communicate computation notions programmaticly. Further, to do so with small, sharp, and executable code examples ultimately makes the end product more engaging (at least it does when I project myself as a consumer).

Firstly I chose code examples over mathematical expressions. Equations can present concepts very compactly although generally at the cost of time and readability, at least for the types of things I'm interested in (systems and procedures). I made the same decision to use code snippets to express concepts in my dissertation, primarily because I felt a snippet was faster to write, faster to verify, and easier to read.

Secondly, I chose code over diagrams because I find most diagrams for conveying computation to be wasteful with regard to space and time. They have their place in design, but when communicating a programming concept I prefer short and sharp code snippets of conditional execution paths or an object and its use, over flow charts and class diagrams.

Given that I decided upon code examples, I chose to write snippets in a real language over a fictitious one (pseudo code) because I want code that can be executed. This is a no brainer, executable code adds substance to examples for the reader and provides an important verification step into the production of copy. The important decision here is the choice of language for general readability by programmer types.

I chose Ruby primarily because it is concise and reads well, two features it shares with pseudo code. The ruby syntax is quite general for modern languages, and procedures almost read like conversations between entities. The conciseness and readability come in part from the mixture of procedural, object-oriented, and functional features it supports, the blurred line between expressions and statements, and the fact that it is dynamically typed. Further, programming in Ruby "is fun", which is not surprising given that it was principled to be productive and enjoyable for programmers to work with.

To recap: code over mathematics for readability of computation, code over diagrams for conciseness, real over fictitious code for executability, ruby over other languages for its power and generality of syntax.

Ruby is a moderately popular language, although more readers will be unfamiliar than familiar with the specifics of its syntax. This can be addressed by providing a primer of 'Ruby for programmers' in the book, and limiting the use of features that do not align to the average C/C++/C#/Java programmers world view. It seems that a fine balance must to be negotiated here because constructs like closure's can significantly simplify examples in some cases. This is an important caveat to acknowledge because examples in a non-milk language (C or Java) may have been a deal breaker for the younger less experienced me of ten years ago.

Ruby does have some criticisms over other languages, the most relevant of which is execution speed. Some ruby interpreters are faster than others (checkout this great shootout), although ultimately the executable ruby examples are intended for education, not production. Speed of execution is happily sacrificed given that the intended readability of examples means code can be realized on demand for a problem and language of choice.

Monday, December 8, 2008

Thoughts on writing a book and self publishing

I have started preparing copy for a book idea I've been noodling on for a long time. I'll go into the premise soon enough (in some future random post), although at this stage I've been thinking about the method of distribution I want to use. Without going too deeply into it, my first pass lead me to the current crop of self-publishing services.

I am a big believer in the notion that "obscurity is a far greater threat to authors and creative artists than piracy" espoused by Tim O'Reilly in a post Piracy is Progressive Taxation (2002). I am motivated to write because I want people to read and comment on what I have to say. I want to capture attention, inspire, and shed light in facets I think are truly interesting.

My planed book is technical. As a consumer of technical material my typically use case these days involves a search on google (web, scholar, books), visiting a small set of sources that have the potential of addressing my needs, and reading the slices of the opened sources relevant to my needs. When I was an enthusiastic kid with an interest in technical subjects (mostly programming related) my typical use case was very similar to what it us now, although it more typically ended with my completing a small code tutorial to grasp the concept or principle I was interested in at the time (the target audience and premise of the proposed book).

The commonality between these two examples is that I typically only ever needed a slice of the source that addressed my need a the time, not the source in its entirety. Services like google book search and similar are wonderful tools towards this end. A critical elaboration to these ideas is that when I locate a source I keep revisiting and/or a source I or peers respect, I typically acquire it. I buy the PDF or the dead tree book because I expect possessing the source will be more efficient for addressing my future needs. This is typically the case, although in non-linear ways such as concept seeding and discovery during a cover-to-cover read.

These thoughts lead me to the decision that I want to release the entire book as a series of web pages. The book idea is modular, so would translate neatly into a series of articles or posts on a dedicated website. The posts would be index by search engines, and if any good (referenced by readers) will float up in the search results and naturally accrue a readership. The webpage approach is intended to addresses the specific needs of searchers, and is intended to provide a gateway to the book as a consumer product. The web content would be free, and at this stage the e-book and dead tree version would be have to be purchased.

Self publishing appears to be a good approach for fiction authors that are able to promote their own product. I think natural promotion through search engines and careful SEO falls under this category, especially for the niche technical domain and market for which I am writing.

There are many-many print on demand (POD) services out there, although some of the newer or more popular sites I have uncovered include:

  • LuLu: A range of self-publishing services not limited to hosting, printing, syndication, and transaction management. Lulu offer more advanced features like analysis, cover design, and a range of editing and page layout service starting around $350 USD.
  • CreateSpace: Apparently acquired by Amazon, offering integration into Amazon's listings. According to their prices, createspace's approach involves taking a small fixed cut as well as a percentage from the list price.
I hear a lot about LuLu, and their site and services look great! The website promotion and/or POD models really appeal to me as I have seen them in action and have participated as a consumer a number of times. For example:
  • Kevin Kelly's Out of Control (1995). A book basically about complexity science that can be purchased like a regular dead tree book or can be read online. What I like about the online version is that it has been broken up for piecewise consumption, although not necessarily suitable to read end-to-end making me want to buy it. Note that there is nothing stopping you from reading the whole thing online other than convenience.
  • Cory Doctorow's fiction. I've read many of Doctorow's books by downloading, printing, and binding the PDF's. The easy access to a spiral binder as a postgrad made this an attractive option, although now that I do not have such access I am more than happy to buy new books as they come out.
  • A Field Guide to Genetic Programming (2008). A technical book on a machine learning technique released for free as an ebook and print on demand. A truly progressive move by these academics, which as of the end of November 2008 has seen more that 20k downloads in 8 months with 1.3% as POD purchases at approximately $13USD per copy.
I intended to spend my southern hemisphere summer focusing on writing the bulk of the copy for the book. There are some unsolved technical issues coming up which I'm looking forward to addressing including selection of appropriate (read: "nice looking") latex packages for type setting the book and sample code, and effectively managing the editing process.

I really want to split test the book and article format online, but I'm concerned that it would take away from professionalism of the final site and product. I suspect I will exploit the fall back position of enlisting a large pool of technical editors to achieve the same ends.