So this happened... First Liquid Image test. by Paulo Fierro

First test taking the Liquid Image Scuba Series HD 1080p out for a swim off Eden Rock to get used to it.

After a short swim, ran into the fourth shark I have ever seen in Cayman waters and the first while snorkelling. Just a baby nurse shark, but still counts :)

A bit cloudy so not super clear but a good start. Currently awaiting a set of filters and a couple of strobes to improve the lighting conditions. Look forward to testing this out on a proper dive next week.

Thank you Niqui!

Moving to Squarespace by Paulo Fierro

Back in 2003-2004 when I was still studying in Oslo I decided to write my own blogging "platform" as a way of getting of practicing my then-newfound Perl hacking skills. I wrote the admin interface in Flash, they talked to each other using this library called AMF::Perl which, though awesome, never made it passed version 0.15.

Fast forward to a week and a half ago when my host media temple upgraded the PHP install. Unannounced and unbeknownst to me they also upgraded their Perl installation which broke my site. The code is 8 years old, I'm not surprised - if you're interested it was the library that talks to the database that does something which has since been deprecated. I haven't written any Perl in at least 5 years so I'm not sure how to fix it. My interest in digging down and fixing a third party library is zero.

So after hearing so much about Squarespace on nearly every podcast I listen to I decided to give it a shot and here we are. Hopefully I'll be able to transfer over the old posts (at least some of them) but we'll see.

In any case, so far Squarespace seems great. And the best part is I no longer have to maintain it.

Win.

Getting data to work with an iPhone with an AT&T GoPhone SIM by Paulo Fierro

So we are in San Francisco for WWDC and want to avoid roaming costs. Our inital plan of using HolidayPhone failed as they forgot to add credit to our SIMs.

After much back and forth I finally got data working on our AT&T GoPhone (Pay As You Go plan). The people at the store assured us this would not work and is not possible, but they're wrong. We paid $10 for the $2 per day unlimited plan SIM. Unfortunately this plan no longer supports a data add-on so you have to upgrade it. There's a $25 per month plan with minutes and texts and a $50 per month one with unlimited everything. I don't care about the minutes or texts, but you may want to compare the two.

  1. To upgrade it, first you have to add money to your account. You can do this in store or online, I went to myprepaidrefill.com.
  2. Click on Login
  3. You probably don't have a password, so click on the forgotten password link for Pay As You Go
  4. Enter in your phone number and you'll get a text with the password. Now login.
  5. Click on Add Features, select Refill and add $25. You can look at the Data Packages section but you'll see a warning triangle. Hovering over it will tell you that a data plan is not supported on the Unlimited $2 per day plan.
  6. Once you've added money to the account, log out. Unfortunately you can't upgrade your plan on the site (or I couldn't find it) but you can go through an automated voice system by calling 1-800-901-9878. You want to upgrade to the $25 plan and this happens instantly. Trying to do so without enough money in the account doesn't work which is why we added funds first.
  7. Once that's done, log back in and you should see that your plan's changed. Now you can go back to Add Features, select Data Packages and select one. I went with $5 for 50MB just to test that this works.
  8. On your iPhone, hop on a wifi network visit unlockit.co.nz, go to Custom APN and select United States and "AT&T PAYG". Don't select plan "AT&T" - it didn't work for me. Then click "Create Profile" and it will install itself on the phone.

Now disconnect from the wifi and hopefull you'll have data working. It does cost a little bit ($10 for the SIM, $25 for the upgrade and then $5 or more for data) but its worth it.

Note: On the AT&T site you'll notice oddities like not being able to paste in your credit card number, you can set the State to "Foreign" when entering in your address but the Country can't be changed from "United States". It doesn't support non-US postal codes either so in my case I had to enter "BN13W" instead of "BN1 3WB" but it still works.

If you want to avoid the hassle you can go with T-Mobile, but then you're stuck with Edge unless you're near the Moscone center where they are apparently testing out 4G.

Setting up a fresh Lion for Ruby development by Paulo Fierro

Update (July 30, 2012):

If you've upgraded to Mountain Lion the below instructions still work. Once complete you should check out this guide. It contains a tip on installing gcc via brew in order to avoid using CLANG which can result in occasional errors when installing/updating gems.

--- End of update ---

A few weeks back I decided to take the plunge and wipe my machine and set it up from scratch. The main reason being I was running out of space on my SSD and I just wanted to see what a fresh Lion install would be like.

Let me tell you, its FAST! Totally worth it. It did take me some time to find the right resources and shave some yaks so this is more of a guide for future-me to save some time. If you do carry on reading from this point I assume you know what you're doing :)

So now that everything is wiped and fresh and new (backed up of course) the main task is setting up ye old dev environment. Lets start at the beginning.

Xcode

Head over to the Mac App Store and download Xcode. Once you install it you'll find that it no longer lives in /Developer. Its been moved to /Applications and its command line tools are no longer in the $PATH on the command line.

We don't have to add them ourselves, simply start up Xcode, go to Preferences and then Downloads > Components. Click on the "Install" button next to "Command Line Tools".

Heroku

If you're deploying stuff on Heroku, grab the toolbelt here.

Homebrew

Previously I was using MacPorts, but after hearing so many great things about Homebrew I took the plunge. Its simply a great package manager and you can download it here. For example, OS X doesn't ship with wget, so to install it you can simply run the following on the command line:

brew install wget

Done. Moving on.

RVM

RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.

What it says on the tin. It allows you to easily install multiple versions of Ruby on your system. It also allows you create gem sets and swap between them. To install:

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

Then:

source ~/.rvm/scripts/rvm

Now we're ready to install Ruby! The only problem is that with Xcode 4 the provided compiler (gcc) is LLVM based and not yet fully supported by Ruby and gems. Now before you go hunting for an older gcc (which I did) its not necessary.

To install Ruby 1.9.2 (which is required for Heroku) enter:

rvm install 1.9.2 --with-gcc=clang

When that is done, lets check what version of Ruby we have set as the system default:

ruby --version

Mine said Ruby 1.8.7. Lets set 1.9.2 to be default:

rvm use 1.9.2 --default

If you run ruby --version it should now say 1.9.2. If you ever want to go back to the system default simply enter rvm system. So now we have an easy way of swapping Ruby versions and you can read more about it here.

Sublime Text

Sublime Text is my favourite editor of all time. Get it here. Read some great tips and tricks here.

MySQL

Previously I was using MAMP. However I had an issue installing the do_mysql gem which is required for dm-mysql-adapter I was using with Datamapper.

Long story short I found the easiest thing to do was install mysql via brew instead of using MAMP. So to start off:

brew install mysql

Next to configure the installation (all one line):

mysql_install_db --verbose --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

To get it to run on startup, first we have to create the directory if it doesn't exist:

mkdir -p ~/Library/LaunchAgents

Then we copy the mysql.plist over (the version number may have changed when you're reading this):

cp /usr/local/Cellar/mysql/5.5.20/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/

Then we tell launchctl to load it on startup:

launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

Now to set the password:

mysqladmin -u root password {new-password}

Phew! Ok, now mysql is installed and running on port 3306. To create your first database simply enter:

mysqladmin -u root -p create {your-database-name}

And some gem love...

Finally I recommend using bundler for gem management, foreman to run your app (especially if you're on Heroku), rerun to rerun your app when something changes, datamapper for ORM and sinatra for happiness.

Good luck!

Reflection + Keynote = iOS demoing awsm sauce by Paulo Fierro

I just bought Reflection about 20 minutes ago and its awesome. It allows you to AirPlay mirror your iPhone 4S or iPad 2 to any Mac running Snow Leopard or later over WiFi. This is fantastic because in the past we had three options:

  1. Use the Simulator, but there are certain features (gestures, accelerometer, etc) that are hard or impossible to demo. Yes there may be tools to help us with some of them, but its a pain
  2. Set up some sort of camera rig to film what it is we're demoing. The nicest one I've seen is Heiko Behrens' CamHolder. I saw one of his earlier prototypes at Beyond Tellerand last year and its a great idea, but it means extra stuff to carry.
  3. Bring an Apple TV with you, hope the projector supports HDMI or buy an HDMI to DVI/VGA converter and AirPlay mirror to that. But then there's the issue of swapping displays, the time lag while swapping and hoping the projector is up to task. And you have to bring it with you.

Those days are long gone! This is what I will be doing in the future:

Step 1: Set up Reflection

Download the app, install and run it. Now ensure your Mac and iOS device are on the same WiFi network. If there is no WiFi available, create a wireless network on your Mac or share the wired connection. Now connect your device to this newly created network.

airplay-1.jpg
airplay-2.jpg

On your iOS device, double tap the home button, scroll all the way to the left and tap the AirPlay button. Select your Mac from the list of available options and select the Mirroring option.

You should now see a mirror image of the iOS device on your Mac. Finally enter full screen mode (Device > Enter Full Screen) or press CMD+F. Reflection will go into its own full screen space thing.

Step 2: Set up Keynote

Open up Keynote and any presentation. Go to Preferences > Slideshow and enable "Allow Expose, Dashboard and others to use screen".

Step 3: Awesome

Now for the fun part. Enter full screen mode in Keynote and then hit Play to start the presentation. Three finger horizontal swipe on your trackpad to swap to the Reflection app, showing your iOS device in full screen. Three finger swipe back to go back to your presentation.

How freaking cool is that? No swapping displays, no lag, no lugging extra kit with you, just ultra-smooth swipy goodness.

Yeah, I like this a lot.

PS: I have only tested this on Mountain Lion. I assume it works on Lion, no idea about Snow Leopard.

Update: Mike confirms it works on Snow Leopard in the comments. Wicked!