Archive for February 23, 2018

Friday, February 23, 2018

Debugging NSNotificationCenter and NSRunLoop

Tim Ekl:

The debugDescription property has been around for quite awhile. Formally first appearing as a @property on NSObject in iOS 5 and macOS 10.8, it came across into Swift as a member of the CustomDebugStringConvertible protocol, and continues to be incredibly useful today.

[…]

I don’t remember why I decided to try printing plain old NSNotificationCenter.defaultCenter in lldb, but I do remember being very surprised at the output. Rather than a plain object class-name-and-pointer pair like most things return, I found a long list of registered notification observers, complete with column headers[…]

Rob Mayoff:

NSRunLoop/CFRunLoop also provides a very detailed debugDescription.

Practices Make Perfect (Backups)

Dave Nanian:

If you need to store more than one backup on a physical device:

  • If you’re on 10.12 or earlier, partition the drive into the number of volumes you need to back up. So, three source volumes to back up? Three partitions on the backup drive.
  • If you’re running 10.13 or later, format the backup drive as APFS, and use APFS’s very flexible “volumes” as your backup destinations, one per source volume.

[…]

Having an archive volume is fine. Keep it separate from your backup volume. And back it up.

[…]

I truly believe you should never, ever use a network drive as your only backup. It’s fine to have a network backup as a secondary backup. But by its very nature, it’s going to be the least reliable one.

[…]

Remember, you should never rely on a single backup device, or a single backup program. No matter what you’re using for your backups…use something else too.

[…]

My daily backup is left unmounted but connected.

Dave Nanian:

And speaking of “don’t cheap out, get a backup drive”, these Seagate USB3 drives are on sale. 3TB for $76, 4TB for $100, 8TB for $150.

Big List of Naughty Strings

Max Woolf (via Daniel Martín):

The Big List of Naughty Strings is an evolving list of strings which have a high probability of causing issues when used as user-input data. This is intended for use in helping both automated and manual QA testing; useful for whenever your QA engineer walks into a bar.

[…]

blns.txt consists of newline-delimited strings and comments which are preceded with #. The comments divide the strings into sections for easy manual reading and copy/pasting into input forms. For those who want to access the strings programmatically, a blns.json file is provided containing an array with all the comments stripped out (the scripts folder contains a Python script used to generate the blns.json).

Previously: Another iOS Crash Caused By Sending Unicode Character.

Update (2018-11-16): See also: Hacker News.

Reasons to Get an Apple Watch

Vlad Khvatov:

Should you get an Apple Watch or not?

To answer this question, I asked dozens of tech experts and prolific bloggers to reveal what is best about this watch and what to look for by asking them a simple question:

“If you had to pick only 3 reasons to get an Apple Watch, what 3 reasons would you choose?”

When macOS High Sierra’s Content Caching Isn’t Working

Cabel Sasser:

Tip: have lots of iOS / Mac devices in your house? And a Mac that’s usually on? Turn on “Content Caching” in Sharing prefs, and updates will be downloaded to all your devices from your Mac, saving time and bandwidth.

(This used to be a macOS Server-only feature, but no more! The best part is zero configuration is needed on all of your devices — they’ll automatically find and go to your local Content Cache first.)

(Also there are some hard-core settings probably useful to someone if you option-click the, er, Options… button.)

Steve Troughton-Smith:

Incidentally a great way to nab the IPAs for platforms like tvOS

Maynard Handley:

It’s nice in theory. Unclear that it works in practice. (Like 80% of what Apple ships these days: buggy? broken design?)

I’ve been monitoring it across a few updates (OS and XCode) and as far as I can tell it works for El Capitan clients (!?) but NOT for High Sierra Clients…

Glenn Fleishman:

However, shortly after I wrote the column noted above, content caching stopped working for me.

[…]

I decided to solve this, and found a detailed article explaining the command line tool AssetCacheManagerUtil, which offers more controls than those found in the preference pane.

[…]

When you select a different drive to store the cache, that drive has to have the folder:

/Library/Application Support/Apple/AssetCache/Data

If it doesn’t exist? It stalls. This seems like a foolish testing error on Apple’s part: no message explains what’s going on, and there’s no text or other information that tells you a particular folder has to be on the destination volume you’re choosing for caching.

StarCraft: Emulating a Buffer Overflow for Fun and Profit

Elias Bachaalany (via Omar Cornut):

Basically, the classic StarCraft 1.16.1 had a buffer overflow that was exploited to create impressive maps well beyond the original game programming.

In this talk, I explained how I tackled the problem and emulated the buffer overflow so that exploited maps work on the latest version of StarCraft.