More Robust Browser-Side Networking

What happens to your web application when used over a flaky network connection? Does it swallow errors and stop responding? Does it bounce users immediately to the browser’s built-in “no connection” page? Does it give you a way to continue using the application when network connectivity is restored?

It used to be acceptable to simply say that a web application could only be used when there was a consistent, reliable network connection. They are web applications, after all. But it’s time to stop using that excuse. Read more on More Robust Browser-Side Networking…

UIStackView Tricks: Proportional Custom UIViews with ‘Fill Proportionally’

In iOS 9, Apple introduced a very handy new UI concept: the UIStackView. Stack views help us quickly compose sequential “stacks” of views without Auto Layout. UIStackView offers a number of distribution and spacing options in Interface Builder. If you’re unfamiliar with UIStackView, I recommend reading “Exploring UIStackView Distribution Types” first.

In this post, I’ll describe how to use the Fill Proportionally option with any custom view while enjoying fine-grained control over the proportions themselves. Read more on UIStackView Tricks: Proportional Custom UIViews with ‘Fill Proportionally’…

Active Record Aggregate Fields via Sub-Selecting Scopes

I was recently working on a piece of code from a legacy Rails application. An unusually large number of queries being run on a particular page let me know there was an N+1 query lurking.

The application was an online assessment platform dealing with assessments, questions, and responses. The question listing page was simply asking each question if it’s locked—which happens if it has any responses. So what’s the best way to query for lots of questions and their locked status? Read more on Active Record Aggregate Fields via Sub-Selecting Scopes…

A Guide to Interacting with iBeacons in iOS using Swift

I’ve recently been working on an iOS project that uses iBeacons. In this post, I’ll provide a comprehensive guide for working with iBeacons in iOS using Swift. I’ll describe what iBeacons are, how you can use them, and what you should know about the programming model for interacting with them in iOS. I’ll also share some of the best practices that I learned.
Read more on A Guide to Interacting with iBeacons in iOS using Swift…

Amazon Lambda Auto-Deployment For Your Alexa Skill Using AWS CLI

My latest project includes integration with Amazon’s Alexa voice service. My coworker Jordan already wrote an excellent post on how to get started writing your own Alexa Custom Skill. Amazon’s API makes it relatively easy to develop a new Skill, and with a number of languages to choose from (Python, Node.js, Java, C#, etc), developers can create a simple Skill in a weekend.

Read more on Amazon Lambda Auto-Deployment For Your Alexa Skill Using AWS CLI…

3 Good Habits for Avoiding Memory Leaks in Objective-C

I have been developing software in Objective-C for quite some time now, but I continue to discover new ways to shoot myself in the foot, particularly in the way of memory management. A while back, I wrote a post about finding iOS memory leaks using Xcode’s Instruments. This is a great tool for discovering memory leaks and tracking them down. But ideally, we would not have to deal with Objective-C memory leaks in the first place! The best way to avoid these types of problems is to stop them before they start.
Read more on 3 Good Habits for Avoiding Memory Leaks in Objective-C…

Utility to Initiate the Rebuild of Indices for CouchDB Design Document Views

I recently worked on upgrading a CouchDB instance and migrating it to a new server. Because of the upgrade and migration path, I needed to dump all data from the existing CouchDB, and then load it into the new CouchDB.

Fortunately, the Python libraries for working with CouchDB provide a convenient set of utilities to snapshot a CouchDB instance to a MIME multipart file, and then load that MIME multipart file into a new CouchDB. Although the utility handles all documents, attachments, and design documents, it does not provide a way to initiate a rebuild of the indices for views associated with design documents. I wrote a simple utility to aid in this process.
Read more on Utility to Initiate the Rebuild of Indices for CouchDB Design Document Views…

Run a Local Rails Script on Heroku

Heroku provides a convenient command line interface for executing snippets of Ruby code remotely. One-liners can easily be piped into the heroku run console command. But what about much longer scripts that you write locally and want to execute in a remote Heroku environment? In this post, I’ll show you how to execute a long Ruby/Rails script in a remote Heroku environment.

Read more on Run a Local Rails Script on Heroku…

Use ES2017’s async/await in your Ember Project Today!

After recently spending some time with C#’s async/await, I found myself wishing for the same features in JavaScript. I knew such a language feature was in the works, but it had been quite a while since I’d mentally filed it under, “Won’t it be nice when,” so I thought I’d check to see if async/await is ready for use in an Ember app.
Read more on Use ES2017’s async/await in your Ember Project Today!…