Friday, October 23, 2009

How to display NSData contents in XCode debugger

Actually, this is more of a gdb language tip.
  1. Set and hit some breakpoint
  2. Click SHIFT+CMD+R or Run --> Console
  3. Type the following into the gdb window that comes up:
(gdb) p (char *)[self._xmlData bytes]
$11 = 0x2058200 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\""...
Obviously substitute self._xmlData with the expression that accesses your own NSData * object.

Okay, but how do you display more lines of the output you ask? Try this:
x/10s (char*)[self._xmlData bytes]
This will display the first 10 chunks of the data as strings.

Thursday, October 01, 2009

iphone simulator screen capture made easy

There are various ways to take a clean screenshot of an iphone application. Perhaps the easiest and most reliable using the standard tools is the following process:
  • Open XCode
  • Flash app to real device
  • In XCode, Windows -> Organizer
  • In Organizer navigate to Screenshots
  • On device navigate to desired screen
  • In Organizer click take screenshot
This process is somewhat painful however when many screens are needed for two reasons:
  1. Requires a real device in the loop (doesn't work for simulator)
  2. Screenshot includes information bar with carrier and time
Enter the iPhone-Simulator Cropper tool! This handy program out of Germany provides simple single-click screenshot capability straight out of the simulator, sizes everything perfectly, automatically names the images exactly how you want, and even strips the carrier information bar if you choose. Indispensable.

Sunday, August 23, 2009

Apple AppStore silently adjusting behind the scenes

The Apple AppStore provides a nice feature of letting the developer adjust meta-data about an application in the store in near real-time via itunesconnect. The 4000 word product description that shows up in the app store, specifically, is quite malleable and can be used for late breaking clarifications and communicating directly to customers. Other attributes that are adjustable are the price, icon, category, and application long name. Recently, Apple added a keywords field too. Then all of a sudden (perhaps a few days ago), the application long name field and keywords where locked out -- you can't change these anymore... It's strange really, as the motivation for this isn't clear. Why wouldn't Apple want application developers dynamically optimizing their marketing message to be more relevant to customers?

Saturday, August 15, 2009

Throwing your junk into the Cloud

Sometime soon, everyone will join an online remote backup service en mass. Hard drives just aren't reliable, and with all the digital music and video folks are generating, this data will need a home. Enter the 15 cent/month cloud GB, and the internet version of the pay-monthly self-storage depot. So with such a compelling market need defined, who are the players and what are their offerings?

Here's the breakdown:




ServicePromoBasicProLocation / Review
LiveDrive1 month free100GB
1PC
$5/month
unlimited GB
unlimited PC
$13/month
UK Win only...
SpiderOak2GB free$10 / 100GB
unlimited PC
$10 / 100GB
unlimited PC
Illinois Promo
Mozy2GB free
unlimited GB
1 PC
$5/month
?Utah
iDrive2GB free
150 GB
$5/month
500GB
$50/month
California

Friday, August 14, 2009

What happened to Memidex?

Memidex, one of the better online dictionaries with superior mobile formatting, has been down for the last few days. All word lookups result in "Access Denied". I sometimes wonder what people would do if all websites suddenly did that, for example, say the internet "went cognizant" and just decided to keep everything to itself. :D

Sunday, August 09, 2009

Cappuccino newbie guide

Smallest Cappuccino getting started guide ever.
Required: minimal ruby environment with rake command

mkdir ~/src/cappuccino
cd ~/src/cappuccino
git clone git://github.com/280north/cappuccino.git
mkdir ~/bin/cappuccino
export CAPP_BUILD=~/bin/cappuccino
rake install
rake install
capp gen TestProject -l


"Hello World" will display upon opening ~/TestProject/index.html

Now, download and try some more advanced Demos:

Requires: wget

mkdir -p Projects
cd Projects
wget http://cappuccino.org/learn/demos/LightsOff.zip
wget http://cappuccino.org/learn/demos/FlickrPhotoDemo.zip
wget http://cappuccino.org/learn/demos/FloorPlan.zip
wget http://cappuccino.org/learn/demos/Puzzle.zip
unzip LightsOff.zip
unzip FlickrPhotoDemo.zip
unzip FloorPlan.zip
unzip Puzzle.zip

# Build and try one
cd LightsOff
rake debug


Just click on the index.html in the directory of each project to see the result.

Friday, August 07, 2009

AppEngine Expando Essentials

Google AppEngine has this awesome and flexible datastore model call the db.Expando. It lets you dynamically add parameters to a data record, sort of like adding new columns to your schema on a row-by-row basis. Here is how you could write a RESTFUL API that takes all the parameters in your GET or POST request and just dumps them into the datastore:

class ExpandoSetRequestHandler(webapp.RequestHandler):
def post(self):
return self.get()

def get(self):
record = db.Expando() # Really, use a subclass of Expando

# Iterate through http params
for arg in self.request.arguments():
# Set as dynamic property in Expando - the real magic
record.__setattr__(arg, self.request.get(arg))

# Store the record
record.put()

#... Render template, return (left as exercise)


So if you map some URL to the above, all the parameters passed will get pushed into the datastore as fields:

http://example.appspot.com/api/expando/set?field=1&foo=2&bar=3


Such an API call would result in a record which you can subsequently .get() and then access the values passed via .field, .foo, and .bar fields.

Pretty cool!