By Casey Liss
 

Today, Apple is going to be unveiling the next version of the iPhone. I’ll be joining my buddies Jason Snell and Dan Moren of Six Colors, as well as Stephen Hackett, and Myke Hurley, on a live chat hosted by Talk Show.

I’ve embedded the chat below, but you can also find it here, or in the native Talk Show app. We’re doing a Q&A before the event, and then join us while we discuss the keynote, 1 PM today!


 

Today I joined Dan Moren, Jason Snell, and Brianna Wu on this week’s Clockwise. As with all episodes of Clockwise, it’s four topics from four hosts in thirty minutes.

This week, we discussed Amazon’s $5/mo music service for Alexa, Bloomberg’s report on Apple Watch 2, old software we just can’t get rid of, and our policies with beta OSes on our devices.

Guesting on Clockwise is one of my favorite things to do, as I always have a blast. Making a point despite the constant pressure to be very succinct is always a fun challenge. In fact, Brianna described it well in a series of tweets today.


Swiftly Discovering an Error

At work last week, I was debugging some odd behavior in one of our apps. A user, on a detail screen, would tap a Save button, and nothing would happen. Not a crash, not an error message, no log entries. Just, nothing.

I started digging into the code, and quickly found we were trying to add this new item represented by the detail screen onto a custom collection. Something along these lines (the names have been changed to protect the guilty):

[self.customCollection addItem:self.collectionItem];

As it turns out, a couple of classes above this one, the instance of customCollection wasn’t being properly initialized; it was simply nil.

That means in the code above, we were passing a message to nil. In Objective-C, that means the message is dropped on the floor, and ignored.

In many other languages, such as C♯, calling a method on a null variable would cause a crash. Messaging to nil being acceptable is considered a feature in Objective-C, and not a bug. Crashes are never a good thing, after all.

In Swift, by comparison, we can only have nil values on Optionals. We do have the handy optional chaining syntax, however, that would change the code above to:

self.customCollection?.add(item: self.collectionItem)

As a Swift developer, seeing that ? would immediately cue to me that it’s possible for customCollection to be nil. Something that is worth investigating.

That being said, any Objective-C developer worth their salt will think the same of any class instance. To a Swift developer, that sounds exhausting, but it’s still a reasonable point. Further, many Swift developers only use optional chaining in cases they’re pretty damn sure things will either be non-nil, or it’ll work itself out if things are nil. The ? may get overlooked.

In our case, where nil really is bad news, a good Swift developer would improve upon the above:

guard let collection = self.customCollection else {
    // Take evasive action, or just punt:
    fatalError("Custom Collection cannot be null!")
}

// If we get here, we are *guaranteed* 
// that collection is non-nil.
collection.add(self.collectionItem)

Here, it’s made explicitly obvious what’s happening: the guard let indicates this thing had better be true, or else bad things have happened.

“But wait!” shouts the Objective-C developer. “We have NSAssert!”

Okay, sure. But NSAssert isn’t always enabled; in fact, in general, it’s disabled by most in release builds.

The point isn’t that Swift’s Optionals or guard let have no equivalents in Objective-C. The point is that thinking deliberately about these things—and proactively protecting yourself from error conditions—is a fundamental part of how you write Swift.

Some people may find being that concerned with what is Optional and what isn’t to be exhausting. I find it to be lovely. I find myself being far more deliberate with the Swift code that I write. In many ways, it’s reminiscent of the C♯ I wrote in the past, but with better tools such as guard let and optional chaining (which was just added in C♯ 6.0, actually).

I like Swift, and I like being that careful with my code. Swift instills a care in me that I like to think is innate, but is now compulsory.


It all started with an uncomfortable discovery:

I was previously using a PPTP VPN to allow myself to tunnel into my home network from work or when I’m out. I don’t use the VPN terribly often, but I consider it critical enough that I couldn’t stand to be without it.

Since PPTP is, by anyone’s measure, woefully insecure, Apple has removed it from iOS 10 and macOS Sierra. Thus, I needed to make a change.

I have a Synology DS1813+ (now replaced by the 1815+), which is an absolutely brilliant home server, in addition to being a dumping ground for all my e-hoarding. Among the Synology’s many features is acting as a VPN server. In fact, it was the machine hosting the PPTP VPN server.

The Synology offers two alternatives to PPTP: L2TP/IPSec and OpenVPN. For the former, L2TP is simply a tunneling protocol; IPSec provides the security. For the latter, OpenVPN covers everything, but does not have native, out of the box support on Apple operating systems. To me, that meant it was a non-starter.

On the Synology side, thanks to the work I had already done, I was able to configure L2TP by checking a checkbox and setting a shared secret. To connect to the VPN, I need not only my user’s account password, but also a shared secret that is, well, shared amongst all users.

Setting up L2TP on the Synology

That part was easy.

However, I kept having problems connecting from my work MacBook Pro. For the life of me, I couldn’t figure out why, but I felt like it was a firewall issue. I eventually confirmed it to be so by just doing the obvious and attempting to connect to the VPN from within my network.

As noted on Synology’s website, L2TP requires the following ports to be open:

  • UDP 1701
  • UDP 500
  • UDP 4500

However, what isn’t made clear is that some protocols need to be forwarded as well. I discovered this thanks to this very difficult to parse post on the Verizon forums. It seems to me the following protocols also need to be forwarded:

I am a Verizon FiOS user, and because I didn’t know better at the time it was installed in 2008, my internet connection is through a coax line. Though it’s possible to insist to your Verizon installer that they use ethernet to deliver your internet connection inside the house, mine was done over coax, and I don’t want to be bothered changing it.

The only problem that comes of this—which isn’t much of a problem at all—is that I have to use a router that has a coax connection on it. Which means I’m still using the same router that I received in 2008. That said, it operates flawlessly, and has only ever caused me trouble this time, when I attempted to configure the port forwarding rules for L2TP.


The appropriate way to configure the Verizon FiOS ActionTek router for L2TP/IPSec is as follows.

Begin by setting up a new port forwarding rule. Out of the box, the ActionTek comes set up with rules for many (then-) modern services. Setting up a new rule allows for the several ports/protocols to be grouped together as one. However, critically, a port forwarding rule is the only way to forward the GRE protocol.

To set up a new port forwarding rule, begin by logging into your router, likely by pointing your web browser to http://192.168.1.1/. Using the “tabs” at the top, choose Advanced. In the bottom, you will see Port Forwarding Rules; choose that:

Location of ActionTek Port Fowarding Rules

Here, we will create a new rule. You can do so by scrolling all the way to the bottom, and finding the little Add link:

Location of ActionTek Add Rule link

Now we can start adding ports and services, much like it works when setting up a normal port forwarding record. Notice that here, we can choose protocols as well as ports (by way of their TCP/UDP protocols):

Choosing a port or protocol to set up

When everything is configured, it should look something like this:

Completed port forwarding rule

Now this new port forwarding rule can be leveraged, and it can be pointed at the Synology. In the “tab bar”, choose Firewall Settings and then, on the left, Port Forwarding. In the leftmost drop down at the top, select the IP for the L2TP host. In the Application to forward drop down, the new VPN setting should be an option; in my case, it’s Casey VPN:

Using the new rule

Click Apply, and everything should be all set.


On the macOS and iOS sides, the new VPN connection can be set up as a standard L2TP VPN. Just be sure to enter the shared key and password exactly right.

Now I’m ready for the new operating systems this fall, and as an added bonus, I’m more secure today.


Subler

Nothing is worse than having an itch you can only scratch by playing a particular song from a particular concert film, and then having to seek through the entire 1-2 hour file to get to it.

Chapter 1, Chapter 2…

My general workflow for digitizing my DVDs and BluRays is as follows:

  1. Rip the disc with MakeMKV
  2. Transcode the resultant MKV to MP4 using Don Melton’s Scripts
  3. Name appropriately

Between MakeMKV and Don’s scripts, any chapter markers in the original disc are preserved in the resultant MP4. However, they are named as one would expect, and as shown above: Chapter 1, Chapter 2, etc.

Enter Subler.

Subler has many uses, including remuxing files between formats without a full transcode, in some cases. However, the feature of Subler that’s useful in this context is that it allows me to go through the file that Don’s scripts generated, and rename the chapters.

After a little work on my part figuring out which chapter is which song, Subler lets me transform the above to this:

Intro, Crazy, Get it Together

In the rare case the source material didn’t have chapters, I can even take the liberty of adding them. In the Subler window:

Gear → Insert a chapter every

That will give you a decent place to start from. Unfortunately, you’ll have to scrub through to find the exact times of each song, but you’ll only have to do it once.

When you’re all done, you should see something like this:

Completed Subler Window

Tell Subler to save the file, and it will overwrite the existing one in place, in just a few moments. No transcoding required, unless your source is something that doesn’t support chapters and/or chapter names.

In my case, once these files are post-processed, I drop them in a place that Plex can see them. When I play them back on my Apple TV, I swipe down on the remote to see the list of chapters. On the Plex app, there is an icon on screen to jump between chapters.

A little time up front can prevent a total buzzkill later.


Australian tyre (ugh) retailer Tyroola has lovely visualizations of how superchargers and turbochargers work in modern engines. The models work well on both desktop and mobile browsers. You can pan and zoom and see how all the parts of an internal combustion engine work together to generate more power.

If you’ve ever wondered how these devices work, these visualizations are a great way to learn more.

Turbocharger in motion

Many manufacturers seem to be turning to turbochargers in lower-cost cars in order to generate more power, and do so efficiently. Some more powerful cars like the Corvette ZR-1 use superchargers, and supercar manufacturers seem to be investigating hybrid and KERS systems in order to eke out whatever power they can.

It’s an exciting time to be a car fan. Many technologies are at work, all trying to stave off our likely future just that much longer.


 

Today I joined Dan Moren, Jason Snell, and new-to-the-show Tonya Engst on this week’s Clockwise. Four hosts, four tech topics, 30 minutes.

On this week’s show is Apple’s forthcoming reality show, unsung heroes of your iPhone, Pokémon Go, nephophobia, and great tabletop games.

The Relay FM Alphabet

As I’ve mentioned in the past, sometimes it’s hard to be a public persona, even in the small little circle of the internet that I inhabit.

Sometimes, it’s not so hard at all.

Quinn Rose made this adorable video, The Alphabet of Relay FM:

Thanks, Quinn. That really made me smile. 😊 Particularly the footnote about Erin, Declan, and myself. :)

Fun fact: when we were picking out names for 🌱, we were completely lost. It occurred to me that between my brothers, myself, and Erin, we’re A, B, C, E. Why not fill in that gap? We started looking at D names, and eventually landed on Declan.


Starting Anew on macOS

A few months ago I had to give up my primary computer, and had just purchased a new iMac. In doing so, I came up with a checklist of things to do before disposing of an old Mac, and when installing on a new one.

Recently Aleen was going through something similar, and she encouraged me to post my lists.

I’m not going to cover backing up, installing macOS, or any of the other obvious steps. These are just the things I always seem to forget.

Cleaning Your Mac

These are the things I do before giving up a Mac:

  • Remove Dropbox
  • Disassociate the computer with the iTunes Store
  • Disassociate the computer with the Mac App Store
  • Disassociate the computer with iMessage in Messages.app
  • Turn off Find My Mac
  • Remove the Mac from my support profile
  • If desired, reinstall macOS as per Apple’s instructions

Re-installing on a New Mac

In no particular order, these are the things that I do and install once I get a new Mac. Naturally, this list may or may not work for you.

Additionally, the following groups of files should be transferred:

  • Music
  • ~/Desktop
  • ~/Desktop/Incoming (basically, my dumping ground)
  • ~/Downloads if anything is there
  • ~/Documents

Naturally, your mileage may vary. But that’s my list.


Goodness Gracious

Goodness gracious, not many people care
Concern is getting scarcer, true compassion really rare
I can see it on our faces, I can feel it in the air
Goodness gracious me

Goodness gracious, my generation’s lost
They burned down all our bridges
Before we had a chance to cross
Is it the winter of our discontent or just an early frost?

Goodness gracious, of apathy I sing
The baby boomers had it all and wasted everything
Now recess is almost over and they won’t get off the swing

Goodness gracious my grandma used to say
The world’s a scary place now; things were different in her day
What horrors will be commonplace when my hair starts to grey?

Kevin Gilbert, 1966-1996. “Goodness Gracious”.