Logo 61e73bc61c0e1780102320e879dc3cac0e29303ea8894dd8f10c942f3ba8120f


An adorable little blog

Dell UltraSharp

Thursday — April 6th, 2017

Dell ultrasharp display I've been enjoying Dell's 25" UltraSharp U2515H display for the past few months. It has excellent color accuracy, a bright backlight, and great resolution for the price.

I’ve noticed one oddity though, the display produces a strange dithering effect on shadows and blurs in macOS Sierra.

Dithering More of the dithering

The issue seems to be in the display's presentation of the image, and not the image itself. Screenshots captured from the OS, like the one below, don't show the dithering.

Screenshot without dithering

It took me a week before I could pin down the issue. It appears to be a bug with either the display or my old Mac mini's handling of DisplayPort 1.2. The fix is simple enough, disable DisplayPort 1.2 in the monitor's settings menu and the blurs and shadows show as expected.

To disable this setting, tap on the menu button (third from the left) to bring up the display’s configuration menu.

Menu button

Next, navigate down to the Display section on the left hand side using the down-arrow (second button from the right). Then use the right-arrow (third-button from the right) to navigate to the right panel. Select the DP 1.2 setting using the right-arrow and set it to Disable and confirm.

Display menu
Confirm display settings change

Now blurs and shadows render as you would expect. No more weird dithering.

Display dithering fixed

I can't remember if this is something I turned on out of stupidity or if the display comes from the factory with this setting.

Either way, I hope this can save someone else the headache.

Watching Files Live

Sunday — April 2nd, 2017

Terminal app icon OS X

If you’re like me, when it’s time to deploy an app or service you’re frantically refreshing log files waiting for something to go horribly awry. Constantly opening and closing the same files to see if anything has changed. Luckily, there is a better way that works whether you’re on macOS, Linux, or BSD!

Normally, if we want to view a file in a Unix-y terminal we could use the less or more command. (Fun fact: On many systems, calls to more are actually just calls to less in disguise!) If we want to view a file with live updates there’s a flag for that.

If we wanted to watch a file called my_log_file in the /var/log directory, we could use the +F flag like so:

less +F /var/log/my_log_file

When you're ready to leave, you can press Ctrl-c to exit the live mode and then you can press q to leave less. Easy as that! Now you can sit, settle down, and have another cup of coffee the next time deployment goes up in smoke. ☕️

Getting Started with CoreLocation in Swift

Tuesday — May 24th, 2016


You want to get a user’s location in your app but aren’t sure where to find it. You’ve heard of CoreLocation but aren’t sure where to start and old StackOverflow answers have you tinkering with plists all day.

Don’t fret though! Working with CoreLocation in Swift is simple once you get set up. In case you missed the memo, CoreLocation is Apple’s framework for accessing a user’s location and heading (with their permission of course!).

Before we get rolling, there are a few disclaimers I need to get out of the way. I’ll be using iOS 9 and this code won’t work with iOS 7 or lower and it won’t work in Playgrounds. There is a way to get CoreLocation in Swift on iOS 7 but it requires using respondsToSelector and I’m far too snobby to do that if it isn’t required.

With that out of the way, let’s get started with a new Single View Application in Xcode. Before we write any code we’ll have to fiddle with our Info.plist file.

Corelocation info plist

To the right of the Information Property List heading, we’ll need to click the “➕” to add a new key and manually enter the name NSLocationAlwaysUsageDescription and then another named NSLocationWhenInUseUsageDescription both of type String. The values for these keys should be a short description for why your app needs the user’s location.

Location permission dialog box

You may have seen dialog boxes in other apps with a tiny message that asks for your location and that’s what we’re setting here.

That’s all the more meddling we need to do in the Info.plist file. Now we can actually start using CoreLocation in our app!

In the ViewController.swift file that Xcode so graciously provided for you, we’ll import CoreLocation, create a location manager property, and make our View Controller the location manager’s delegate.

That looks something like this in your ViewController:

import UIKit
import CoreLocation

class ViewController: UIViewController, CLLocationManagerDelegate {
  let manager = CLLocationManager()

  override func viewDidLoad() {
    manager.delegate = self

Before we can read the user’s location we need to ask permission politely. So we’ll check if the user has given us permission yet, and if not, we’ll ask for it. In our case, we’ll ask for permission to use the user’s location when our app is in use, but you could also use the location manager's requestAlwaysAuthorization method to request access when the app is in the background. We can update the viewDidLoad method to include this:

override func viewDidLoad() {
  manager.delegate = self

  if CLLocationManager.authorizationStatus() == .NotDetermined {

Finally, we need to implement the locationManagerDidChangeAuthorizationStatus and locationManagerDidUpdateLocations delegate methods so we know when the user has given us the go-ahead and when the location manager has information for us. So we’ll add the following methods to our view controller:

func locationManager(manager: CLLocationManager,
  didChangeAuthorizationStatus status: CLAuthorizationStatus) {


func locationManager(manager: CLLocationManager,
  didUpdateToLocation newLocation: CLLocation,
  fromLocation oldLocation: CLLocation) {


And that’s it! When you build and run the app, you should be prompted for permission to access your location. If you allow it, the app will start printing your location as CoreLocation gets new information. The next step might be moving the location manager and delegate out of the View Controller but this example works for getting started.

You can see the full view controller code here.