Mike Clark http://en.oreilly.com/rails2010/public/schedule/detail/14136 This is going to be mostly an iPhone application development session, not Rails. Demo app is performs CRUD operations on a Rails 3 site from an iPhone app http://github.com/clarkware/iphone-rails-tutorial Basic Railsy JSON controller methods Standard iPhone callback methods: applicationWillTerminate, didFinishLaunchingWithOptions in .h file - create instance variables in the @interface and add: @property(nonatomic, retain) NSMutableArray *goals; in .m use: @synthesize goals (initializes instance variable), also release in dealloc() viewDidLoad - called when the view is loaded reference “goals” with “self.goals” to access variable through property “Do not fear the square brackets” cellForRowAtIndexPath - don’t delete what’s there (that’s what makes scrolling through large list fast), just add your own logic to the end of the method, before “return cell”; commitEditingStyle - delete from our array - allows deletion in app. Restart app to get data back (since it’s in memory) StringWithContentsOfURL - fetch URL synchronously (blocks main UI thread) json-framework is a strict JSON parser and generator return NSDictionary or NSArray of NSDictionaries refreshButton - “action:@selector(refresh)” – is like using “send” in ruby. target:self” means that self.refresh will be called on click networkActivityIndicatorVisible - network spinner NSURLRequest, NSURLConnection, sendSynchronousRequest Shift - Apple - R brings up debug console in Xcode After break - Asynchronous Networking, Authentication, Error handling …. Async Networking - done with the Delegate pattern - http://en.wikipedia.org/wiki/Delegation_pattern Use an OperationQueue to background work - NSOperationQueue, NSInvocationOperation - don’t use NSThread Always update the UI on the main thread - performSelectorMainThread HTTPRiot is a simple REST library that makes it easy to interact with RESTful resources (inspired by httparty) - responses converted to NSDictionary and NSArray objects. http://allseeing-i.com/ASIHTTPRequest/ - flexible, low-level library with tons of features - File uploads, post form-encoded data, basic authentication, progress indictors, etc. Not REST specific, doesn’t handle json/xml by default, but very useful for low-level stuff ObjectiveResource is an Objective-C port of ActiveResource - Automatically serializes/deserializes objects (to/from JSON or XML) - Assumes Rails RESTful conventions - adds methods to NSObject didFinishLaunchWithOptions - only gets called once - when app starts up ObjectiveResource needs the following to give json a default root object: ActiveRecord::Base.include_root_in_json =
true
RailsConf - Day 1 - Git Immersion
Jim Weirich - @jimweirich If for some crazy reason you don’t already have git installed, go download it from here - http://git-scm.com/download Source Control Made Easy - Pragmatic Bookshelf Screen Cast git config –global user.name “Brian Olore” git config –global user.email “brian@olore.net“ git config –global core.autocrlf input git init - creates a new, empty repository Git is about changes, not files. Always additive - Information is never destroyed - makes it really really hard to screw up your repository SHA1 used for preventing duplication - all files referenced using their hash - Is there additional meta-data that has things like executable flag, etc ?? Tags point to snapshots & never move Branches point to snapshots and move with commits Can branch after committing changes Cheap, local branches git clone gitx
(for Macs) and gitk
(any platform) are useful in exploring log history. git reset - changes a branch pointer git reset –hard - changes the branch pointer and checks out into your working directory. git rebase master - replays branch changes (rewrites commits) as if they happened on master DO NOT rebase shared branches - only reset/rebase on local repositories http:/nvie.com/git-model - “A successful Git branching model”