Author Archives: Dog Father

And The Race Is On!

The 41st running of the Iditarod kicked off this morning in Anchoage, Alaska and this year they went mobile!

The Race

Iditarod Ceremonial start in Anchorage, Alaska

The Iditarod, the Last Great Race on Earth, is a 1,049* mile sled dog race that starts the first Saturday in March. The first race was held in 1973. An average of 65 teams start the race in Anchorage and each team of 12 to 16 dogs & its musher cover the route to Nome in 9 to 17 days.

iditarod_route*The route is not a exactly 1,049 miles because there are two routes and the trail is not permanent. Since it was originally a little over 1,000 miles and Alaska is the 49th state, it’s symbolically stated as 1,049 miles.

Mobile Video Access

Unless you attended the race or were in Alaska at the time, you probably saw little to no coverage of the race.

Several years ago, they offered video-on-demand (streaming) during the race to Iditarod Insiders ($20 annual subscription). These are short, 2-minute video news clips uploaded during the race. Two to three years ago, they streamed the race start and finish, but it wasn’t available to Apple’s mobile devices.

This year, the website supports mobile devices and both the ceremonial start and the restart worked perfect on an iPad-to-AppleTV setup.  Kudos to the Iditarod Trail Committee for supporting mobile.  I’m very happy with what I’ve seen so far.

Moving Day – SquareSpace to WordPress

Canispater has moved to blog.canispater.com

I made a blog move to WordPress from SquareSpace because the price was right (included free with my domain purchase through 1&1 Web Hosting) plus a couple of posts got away prematurely due to the quirky web interface. Don’t get me wrong, SquareSpace is a great platform for quick setup and ease of use, but I wanted a little more control over the platform and like I said, the price was hard to beat.

WordPress’ web-based editor works well for creating simple text or media rich posts. You upload media to your “media library,” then add it to your post.  It’s really handy if you need to upload a lot of media.  I was also pleasantly surprised with the WordPress iPad app.  You have full site management capability and the post editor gives you access to the raw HTML if you want to make changes.  Oh, and for you developers out there, it’s open-source!

While a WordPress blog will require more up-front configuration, there are thousands of plug-ins available for adding the functionality you need.  I do recommend getting the JetPack plugin though it requires a login at WordPress.com for web stats.  JetPack includes a basket of features most blogs will use.

WordPress Hosting Options

You can get WordPress running in one of three ways:

  1. a free blog on WordPress.com (minimal configuration options, easy setup, least flexible)
  2. download the software and host it yourself (the most complicated setup yet most flexible) or
  3. find a hosting service (easy setup, some configuration required, very flexible)

Migration was easy

SquareSpace has an export to WordPress function which worked flawlessly except for a few images (it got most, but not all).  I copied the missing images over manually.

Setup was easy with the 1&1 admin panel.  I used the Click & Build website feature to create the WordPress instance.  A subdomain is required to host the software (eg: blog.canispater.com).  After a couple of minutes, I received an email saying my blog was ready so I configured it like I wanted (user accounts, theme, plugins, extra pages, etc.) then chose import from the tools menu.  The entire process took seconds, but I didn’t have a lot of content to move.

Once I was happy with the new blog, I repointed the domain destination to the new blog.  This change propagated within a couple of minutes.

Lessons Learned

Setting up the WordPress instance was a little tricky for me because my domain was not registered at 1&1.  I had to first set up an external DNS for the domain which basically means using the 1&1 DNS servers for the domain instead of the existing domain registrars’ servers.  Performing this operation caused an outage while the DNS changes propagated, but everything converted over within a few minutes.  Once everything worked on the new DNS, I proceeded with the install.  If possible, have the domain registered with your provider to make things easier.

I had two issues to solve once everything settled.  First, the RSS feed URL for the old blog was canispater.com/blog?format=rss but the new feed URL is blog.canispater.com/feed/.  In order for the spiders to maintain the old feed, I had to create an .htaccess file to do a 301 redirect.  Second, I wanted people to be able to type canispater.com into their browsers and have that redirect to the blog.  There are a couple of ways to accomplish this depending on your environment, but these two lines seem to work.

Redirect 301 /blog http://blog.canispater.com/feed/
Redirect 301 / http://blog.canispater.com/

The first line allows the spiders to find the new feed and the second redirects any request to the root of the domain to the blog.  Note: once the spiders crawled again, all of my previous entries (previously published and imported from the old blog) were sent to the feed again.

The domain redirect worked fine with Chrome and FireFox, but not Safari (initially).  Safari caches 301s and I had tried this earlier while the DNS was propagating so it cached the redirect to the generic “domain just set up” page.  Clearing the browser cache solved that problem.

This was basically a weekend exercise because I had to do a lot of reading to understand the new environment.  I really like what I’ve seen with the platform so far and recommend it if you want more control over your blog.

iOS/Mac Network Link Conditioner

Xcode Lets You Test Your Network-Based Apps

Who knew? Apparently just about everybody – except me! I recently discovered the Network Link Conditioner Apple provides for developers. The latest version I could find was Hardware IO Tools for Xcode 4.4 – Late July 2012 for the Mac, but I was pleasantly surprised it was already on my iPhone under Settings.

2013-02-16 21.30.55 2013-02-16 21.31.12

Simply turn it on, run your app, fix it. Note: this will affect all network communication on your device while it’s enabled so don’t forget to turn it off when you’re done testing your app.

XCode Environment Settings

Easily Print XCode Environment Settings to a File

If you need to get a list of environment settings running under Xcode, use a run script to print them out to a file when you run your app.

Go to the Build Phases section of your target and add a Run Script by clicking the Add Build Phase button in the lower right-hand corner and choose Add Run Script.

AddScript

This adds an empty Run Script section to your Build Phases for the selected target.

Empty

Add the line printenv | sort > $SRCROOT/environs.txt as the script.

RunScript

$SRCROOT is the main folder of your app. Each time you run your app, the Run Script will create or overwrite the file environs.txt in the main folder with a sorted list of all of your environment variables. This will help you figure out where everything is hidden behind the scenes.

Here is an excerpt of the file on my machine.

CACHE_ROOT=/var/folders/7v/4b2ghpfx4sd5bgn6y1lc1rs80000gn/C/com.apple.Xcode.501
CCHROOT=/var/folders/7v/4b2ghpfx4sd5bgn6y1lc1rs80000gn/C/com.apple.Xcode.501
CHMOD=/bin/chmod
CHOWN=/usr/sbin/chown
CLANG_CXX_LANGUAGE_STANDARD=gnu++0x
CLANG_CXX_LIBRARY=libc++
CLANG_ENABLE_OBJC_ARC=YES
CLANG_WARN_CONSTANT_CONVERSION=YES
CLANG_WARN_EMPTY_BODY=YES
CLANG_WARN_ENUM_CONVERSION=YES
CLANG_WARN_INT_CONVERSION=YES
CLANG_WARN__DUPLICATE_METHOD_MATCH=YES

Let me know if this helps.

iOS Rename Main Thread

Attention iOS DEVs! Rename your main thread!

If you are fortunate enough to have instrumentation built into your app using Hockey App or something similar, then you probably won’t need this tip, but for the rest…

Add this to your app delegate in didFinishLaunchingWithOptions:

Simulate a crash with
*(char*)0 = 0;

Debug Navigator

Validate your thread name using the XCode Debug Navigator.  The crash you added will halt the app and should automatically show you the thread name. If not, hit Command-5 on your keyboard.

If you run this on a device, you should generate a crash report. Notice the named thread in the report.

I can’t take full credit for the idea – we received a crash log via email today and didn’t know which version they were using. This idea was a result of our discussion.

Anyone else have helpful tips to share?

FusionDrive for Original Unibody MacBook Pro

My main machine is a 15-inch MacBook Pro, Late 2008 model with a stock 320GB, 5400rpm Hitachi hard drive. As is typical, the hard drive is running out of space and it takes forever to compile XCode projects. I added a 240GB SSD from OWC as a replacement for the SuperDrive so I’ve now got over a 1/2TB of storage on the old girl.

And now I have a new problem. The SSD is really snappy compared to the old drive, but I really don’t want to have to manage what goes where while taking advantage of both drives. One of those new-fangled FusionDrives for the new iMacs would be great, but I still want the portability of a MacBook.

What is a FusionDrive, Really?

As it turns out, FusionDrive is a marketing term, not a piece of special hardware. Apple added Core Storage to it’s bag of tricks which is their extension of LVM or logical volume management. LVM allows drive spanning and in the case of FusionDrive, they’ve apparently added some smarts so the most often used files are stored on the faster storage.

Kudos to Pioneers Who Have Gone Before Me

I found a blog post by Patrick Stein describing the process of creating a FusionDrive and running some tests to prove that it works as advertised. Since then, Tomasz Korwel , Cocoanetics and Thomas Einwaller all performed the operation on differing hardware so I’m adding my machine to the list.

What’s the Catch?

If either of the drives fails, you loose everything!

Also, creating a FusionDrive will destroy all existing data so make sure it’s backed up before proceeding.

I recommend a tool called Carbon Copy Cloner and a portable drive at least as big as the new FusionDrive. Get in the habit of backing up daily. You can configure CCC so that it automatically starts an incremental backup when you plug the portable drive in so it’s always an exact image of your drive. This is a good idea regardless of whether or not you use a FusionDrive.

If CCC is used, you can validate your backup by rebooting and holding down the Alt key when you hear the beep. The boot option menu will appear allowing you to boot from something other than your hard drive. Choose to boot from the backup and it should look exactly like your hard drive though there may be a performance hit because it’s external.

Steps to Create a FusionDrive

We have one mechanical, rotating hard drive we’ll affectionately call HDD and one super neato SSD drive we’ll call… wait for it… SSD.

Step One – Get Your Disk Labels

Make sure all the drives to be used as the FusionDrive are unmounted so reboot once again and hold down the Alt key when you hear the beep. This time, boot from the recovery partition on the HDD. When the Mac finishes booting into recovery, open Terminal from the Utilities menu and run:

mount (or use diskutil list for the same info)

This brings up a list of your existing drives. Look for the device names for HDD & SDD. They are probably disk0s2 and disk1s2 though they could be different on your machine if you have more drives.

Step Two – Create the Logical Volume Group

diskutil cs create FusionDrive disk0s2 disk1s2

You can use any name you want for the volume group, but I used FusionDrive. This is not the name you’ll see in the Finder.

You’ll see a progress indicator as this executes, but it happens rather quickly.

diskutil cs list

Step Three – Create a New Volume

Next we create the volume by using the GUID we got from creating the LVG and we want to use 100% of the available space. We can rename the drive from NewHD to something else in the Finder (eg: Macintosh HD) once we’re done. Format the drive with journaled HFS+.

diskutil cs createVolume 4E9F1ED6-20AD-4748-B682-B3131E557082 jhfs+ NewHD 100%

This is another quick operation.

Step Four – Restore Your Drive

So now you have a big, fat, empty FusionDrive that you need to load with OS X. If you’ve followed along, you can connect your backup drive and boot like before (holding the Alt key). This time, choose the backup drive to boot from. Now use CCC to clone your backup onto your FusionDrive. Go grab something to eat as this will take some time.

Once the restore operation is complete, reboot one final time with the Alt key and boot to the new FusionDrive. Mine wanted to go back to the recovery partition for some reason, but booting from the FusionDrive fixed that.

Once the machine finishes booting, open the Finder and rename the drive from NewHD to whatever you want.

Now, verify that CCC starts a backup when you connect the external drive and enjoy your new FusionDrive!