, , ,

Picup iPhone App

Picup is my latest iPhone App that facilitates photo uploads to the web. Since file-upload form fields don't work in Mobile Safari, a webapp can instruct Picup to choose and upload a photo. Once the upload is complete, Picup returns control to the webapp with information about the upload.

Read more information and view a demo at picupapp.com

Permalink    Show Comments


, , , ,

HTML5 Todo List app for the iPhone

I've been playing around with HTML5 and client side storage on the iPhone. Mobile Safari is a really impressive piece of software, and it's been a pleasure not having to concern myself with cross-browser compatibility. My sense is that more and more mobile apps will ignore native implementations and instead opt for a browser-based solution, since it has so much to offer and all of the major mobile players have adopted WebKit.

To demo client-side storage to some of my coworkers at RGA, I created a simple Todo list. It stores the data in the browsers SQLite database and takes advantage of some CSS3 tricks (there isn't a single graphic used in the app). I've decided to publish the app for anyone else who thinks its useful or would like to take a look under the hood. I ended up creating a lightweight javascript ORM to manage the database interactions.

Some Usage Notes

  • To edit an item, press and hold on the item's description. This will load the item into a form.

  • To sort the items, click "Edit" and drag them with the tab on the right hand side.

Point your iPhone at http://wdlindmeier.com/todo to try it out.

iPhone todo list

Permalink    Show Comments


, , ,

The Classics Presents: Le Petit Dummy

Robert and I have released our first iPhone app under the banner The Classics Presents. The app is called Le Petit Dummy and it allows you to do marvelous things like make your hotdogs talk! You can read more about it on our blog and it's available for free in the App Store. Credit for the awesome name goes to Maureen Massey.

Permalink    Show Comments


, , ,

Customizing Rails Serialization

I wanted to customize the ActiveRecord attributes which were being serialized by to_json. This is easy enough if you're serializing one record; add the attribute names as arguments of the to_json method. For demonstration purposes, lets use the following ActiveRecord models:

Survey(id: integer, name: string, created_at: datetime)
	has_many :questions

Question(id: integer, body: string, survey_id: integer, position: string, created_at: datetime)
	belongs_to :survey	

And serialize a survey without the timestamp:

@survey.to_json(:only => [:id, :name])

=> {"survey": {"name": "Favorite Foods", "id": 1}}

But to_json also allows you to serialize associated records with the :include option. So if we want to include the Survey questions, it would look like this:

@survey.to_json(:only => [:id, :name], :include => {:questions => {:except => [:id]}})

=> {"survey": {"name": "Favorite Foods", "id": 1, "questions": [{"id": 1}, {"id":2}]}}

But this isn't the output we wanted. You'll see that the survey's :only option overrode the question's :except option. In other words, the parent's options trickle down unless the association options override them. With to_json, :only overrides :except. So, to have full control over the JSON output, I need to pass in a list of approved attrs and methods for every association, which can be a little verbose.

Since I have a list of attributes and methods that I know I want to expose in my JSON by default, I don't want to pass those into to_json every time. So, I made a plugin that lets you define the attributes and methods that are serialized by to_json and to_xml in the class.

class Question < ActiveRecord::Base

  inheritable_attributes[:public_serialization_attrs] = ['id', 'name']

end

class Question < ActiveRecord::Base

  inheritable_attributes[:public_serialization_attrs] = ['body', 'survey_id']
  inheritable_attributes[:public_serialization_methods] << "thumbnail_path"

end

Furthermore, I don't want the parent's serialization options to trickle down to its associations. This plugin also overrides that behavior so every :include tier has it's own options and doesn't inherit the parents' options.

Sample output using the plugin with the above configurations:

@survey.to_json(:include => :questions)

=> {"survey": {"id": 1, "name": "Favorite Foods", "questions": [{"body": "What's your favorite pizza topping?", "survey_id": 1, "thumbnail_path": "/images/question_1.png"}, {"body": "What's your favorite ice cream flavor?", "survey_id": 1, "thumbnail_path": "/images/question_2.png"}]}}

The plugin is available at GitHub: wdlindmeier/Rails-Custom-Include-Serialization-.
This plugin has been tested on Rails version 2.2.2 and 2.3.4.

Permalink    Show Comments


, ,

Here's to the crazy ones

I was looking for some FPO icons online and I found a nice, large TextEdit icon. Interesting that the sample text written in the icon is from Apple's "Think Different" campaign.

Permalink    Show Comments


, , , , , , ,

Compressing directory contents on the iPhone with zlib

I am preparing version 1.1 of Wine Notes which allows users to export their data from their iPhone. I decided to use JSON and flat image files for maximum portability, which left me with a directory of data to export. So, I needed to find a way to compress that directory into a .zip file while preserving the file hierarchy. This seemed like an easy enough task, but it took me a while to track it down, so I've decided to post the solution here.

Follow these steps:

Link libz.dylib to your target in XCode:
http://stackoverflow.com/questions/289274/error-when-import-zlib-in-iphone-sdk/289301#289301

Download ZipArchive

Drag ZipArchive into your XCode project.

Change the following lines at the top of ZipArchive.h:

  #include "../minizip/zip.h"
  #include "../minizip/unzip.h"

to

  #include "zip.h"
  #include "unzip.h"

Delete the following files:

  1. minizip.c
  2. miniunz.c
  3. iowin32.c
  4. iowin32.h

And here is a sample of the code I used in Wine Notes:


BOOL isDir=NO;	
NSArray *subpaths;	
NSString *exportPath = pathForDocumentFileNamed(@"exportData");
NSFileManager *fileManager = [NSFileManager defaultManager];	
if ([fileManager fileExistsAtPath:exportPath isDirectory:&isDir] && isDir){
  subpaths = [fileManager subpathsAtPath:exportPath];
}

NSString *archivePath = pathForDocumentFileNamed(@"exportData.zip");
		
ZipArchive *archiver = [[ZipArchive alloc] init];
[archiver CreateZipFile2:archivePath];
for(NSString *path in subpaths){		
  // Only add it if it's not a directory. ZipArchive will take care of those.
  NSString *longPath = [exportPath stringByAppendingPathComponent:path];
  if([fileManager fileExistsAtPath:longPath isDirectory:&isDir] && !isDir){
    [archiver addFileToZip:longPath newname:path];		
  }
}

BOOL successCompressing = [archiver CloseZipFile2];

Permalink    Show Comments


, , ,

Wine Notes: An iPhone Application for Wine Drinkers

Today my first iPhone application was accepted into the iTunes AppStore. It’s called Wine Notes and it’s an application for wine drinkers to organize and review wines that you've tasted.

Wine Notes

I am in particular need of this app, because remembering wine is usually sheer guesswork for me. Partly because the labels tend to blend together and partly because I’m usually a little buzzed when I start getting into it.

From a development standpoint, I’ve been really into coding for the iPhone (if not XCode). I think Apple has done a great job creating comprehensive and consistent documentation for developers. UIKit almost acts as a sandbox into Cocoa development, which I’m guessing can be a little overwhelming to n00bs like me. I’m also greatly indebted to Stackoverflow.com because they seem to have answers for most of the Objective-C hurtles that I’ve run into so far.

Hopefully this will be the first of many apps that make it into the AppStore. Robert and I are already hard at work on a new (and completely unrelated) project. If you’re looking for an iPhone developer, or feel like collaborating, give me a holler! bill@wdlindmeier.com

Permalink    Show Comments

The Worlds Best Lute Music

theworldsbestlutemusic.com is available at the time of this writing.

Permalink    Show Comments


, ,

More emoji goodness: Emoji Tales

Thanks to the creative direction of Robert Hodgin, the emoji script I mentioned below has grown up into it's own mini-webapp. It has been re-launched as "Emoji Tales" at emojitales.com.

The emojis are now bigger and you can give your stories titles. As an added bonus, if you use twitter to link to your Emoji Tale, add the hashtag #emojitales, and your link will be re-tweeted by @emojitales. Anything else that's in your tweet is presumed to be the title.

Permalink    Show Comments


,

Emoji Message Creator

I created a web script that lets you create iPhone emoji messages, and send links to friends.

iphone emoji

Let the good times roll!

Permalink    Show Comments

  1 2 3 ... 16   >