My Weekend With Twilight Princess HD

I spent a good part of the weekend playing The Legend of Zelda: Twilight Princess HD that came out Friday for Wii U. I played the Wii version of Twilight Princess a bit, but bounced off of it because I found the motion controls tedious. This remastered version is based on the GameCube controls, and so it’s all buttons instead of waggling a Wii remote at the screen.

Besides Link glowing in one scene for no apparent reason, the updated graphics look fabulous. While I don’t find the art style quite as appealing as what they did with Wind Waker HD, and the graphical fidelity is nowhere near something like The Witcher 3, I haven’t ever felt like I’m looking at a ten year old game. If anything it’s exceeded my expectations graphically. Some of the controls have aged less well, but nothing that makes playing the game not fun. The two control issues I’ve noticed is that the camera will sometimes do strange things, and getting Epona to turn around is painful.

Anyway — I’m going to be playing more of it this week. If you have a Wii U and like Zelda games, definitely check it out.

Moving From Parse to OneSignal for Push Notifications

Parse is shutting down, and if you want your app to keep working, you’ll need to move to something else. I’d recommend doing it sooner than later. Thankfully our app isn’t out for another few weeks, and since the only thing we were using Parse for was push notifications, it wasn’t more than a couple hours of work to switch over to something new. The thing we found to handle our push notifications was One Signal.

Aside from Parse I’ve also used Urban Airship, Push IO, and a custom push server. Custom was definitely the worst. If I were writing the backend myself, custom might not have been so bad, but since I was always working with other developers, it was always a pain because it required involving someone else to test the thing and there was always something wrong with the certificate setup on the server. Out of all of those OneSignal has been the easiest, followed by Parse. I like OneSignal better than Parse though because it’s just push instead of one part of a larger thing that sort of expects me to be using their whole platform.

Email Validation String Extension

I’ve been using this extension on on String to make checking if a string is a valid email easy. If you know a better place this could live, let me know, but an extension on String felt as good a place as any. I didn’t write the original regex (although I did need to tweak it to make addresses with + in them work), but I’ve tested it and it works well as far as I can tell.

extension String {
    func isValidEmail() -> Bool  {
        if self.isEmpty {
            return false
        }

        guard let regex = try? NSRegularExpression(pattern: "^([a-zA-Z0-9_\\-\\.\\+]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$", options: []) else {
            return false
        }
        return regex.numberOfMatchesInString(self, options: [], range: NSMakeRange(0, self.characters.count)) == 1
    }
}

Less Gross Storyboard Segue to a Navigation Controller

This is a really ugly piece of code I’ve found myself writing in Swift whenever I’m preparing a storyboard segue where the destinationViewController is a UINavigationController whose root view controller is the thing I actually need to set properties on:

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    if let viewController = (segue as? UINavigationController)?.topViewController {
        // Set up the view controller
    }
}

And so I decided to make this slightly less terrible by adding this category to my app:

extension UIStoryboardSegue {
    var navigationController: UINavigationController? {
        get {
            return destinationViewController as? UINavigationController
        }
    }
}

So now that ugly line becomes this:

if let viewController = segue.navigationController?.topViewController {
        // Set up the view controller
}

In Praise of Non-Magical Pointing Devices

Last week I tried playing a game on my Mac for the first time in a long time. About a minute in I realized that a trackpad or Magic Mouse was not going to cut it. I needed something with actual separate buttons that click. The one I landed on, after reading a few positive reviews, was the Razer DeathAdder Chroma. Yes, I agree the name is ridiculous. I choose not to focus on that.

I like it for a few reasons:

  • It’s the number one gaming mouse on Amazon, but doesn’t look too much like a gaming mouse, which is good, because I couldn’t look at one of those and take myself seriously.
  • It only has two side buttons, which is just the right amount for me. I bound them to back and forward in Safari, Xcode, etc.
  • The driver software is fantastic for the tiny bit of tweakiness I want (assigning those side buttons), and also totally Mac compatible. You can even easily set different button configurations for different apps, and it will switch automatically.
  • It feels pretty good in my hand. The buttons feel nice and clicky, too. The Magic Mouse gives me hand cramps.
  • It was only $50.

The things I miss are interial scrolling and gestures. But those suck on the Magic Mouse anyway, and are easily fixed by placing my trackpad on the other side of my keyboard for gestures.

The “Why Am I Anxious?” Checklist

I’ve come up with a list of things I should ask myself and do if I’m feeling anxious or antsy. Here it is:

  1. Did I not have any coffee today? Have some.
  2. Have I had too much coffee? Drink some water. Take a walk.
  3. Did I sleep not enough or too much? Keep working on that.
  4. Am I worried what someone is thinking of me? Talk to them.
  5. Am I worried about something I’m not doing? Stop worrying and do some of it.

No matter what:

  1. Remember you’re not stupid and people like you.
  2. Drink some water and take a walk.

Brent Harping on Swift Limitations

Brent is harping on limitations you hit when trying to use protocol oriented programming in Swift:

But these days we’re smarter: we use protocols. There’s no reason Folder and File should descend from the same class — they’re almost entirely different, and inheritance is a pain to deal with, so we use protocols instead.

And we’re happy. It works great.

Until you realize that, in Swift, you can’t do this.

I hit something like this yesterday. So no, it’s not just him.