detecting iphone/ipad in rubymotion
I just found this post in my drafts pile; might be a little old by now, but here goes. Most standard texts on iOS programming say to use the following code to detect whether you’re running on an iPhone or an iPad: BOOL iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad); Well, that won’t work in RubyMotion because UI_USER_INTERFACE_IDIOM is a C macro - meaning that it...
AVAudioPlayer and you
I’ve changed direction from Rails into iOS programming now… And ran into a big frustration point. The app I’m working on needs to record and play back audio. So into AVFoundation I go! The API annoys me. There are a few methods on AVAudioPlayer which can return false in case of error - but there’s no way to tell what the error is. So you have to jerk around...
Since we last spoke, my good friend Karen Suhaka convinced me to come on a bit of a mad dash with her… The idea is called MyFairElection, and the “X for Y” version of the description is “Yelp for polling places”. So to be successful - we need to build a site that’s usable and robust, than can deal with a number of weird corner cases in how states and...
RubyMotion added a debugger today. Hooray!
Grr ruby local variables shadow setters!
Time for a Ruby setter/getter pair! def bar @bar end def bar=(b) @bar = b end Seems workable enough, right? 1.9.3p194 :008 > bar => nil 1.9.3p194 :009 > bar=100 => 100 1.9.3p194 :010 > bar => 100 1.9.3p194 :011 > self.bar => nil Uh. Huh? 1.9.3p194 :014 > self.bar=200 => 200 1.9.3p194 :015 > self.bar => 200 1.9.3p194 :016 > bar =>...
Mac OS X users, upgrade your ruby!
If you are running: Mac OS X Lion 10.7.4 Xcode 4.3.3 installed via the App Store ruby 1.9.3 …and you’ve removed previous versions of the Xcode environment, when you build gems with native extensions, you may see this: /Users/dpassage/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb creating Makefile make compiling autolink.c make: /usr/bin/gcc-4.2: No such file or directory make:...
Rails and Referential Integrity
So in the course of working on that new Rails-based web site for our silly obsessive games nights, I ran into a problem: In an effort to maintain the data from the old, PHP-based app, I’m starting with the original database schema and using Rails migrations to bash it into shape, adapting it to the Rails conventions and the like. Anyway, things are going along well, but I ran into a...
Bayou Grand Prix: A Ruby on Rails project
The Rails app I’ve been poking at for a while is pretty frivolous. A fried of mine started a regular playing night for Formula De, a car racing game based on Formula 1 (and shame on them for racing in Bahrain). He wanted it done as a league, complete with teams, driver names, scoring, etc. So in 2001, the Bayou Grand Prix was born. I coded the first version of the web site - and as you can...
I’m a recovering product manager, trying to get back to my coding roots by fiddling with things like Rails and iOS. Every once in a while I’ll run across something I feel I need to write about. Tumblr seems to be the flavor of the month, so I’ll do that here.