91: Seeing double with regular expressions

A few weeks ago, David and Katie were kind enough to have me on Mac Power Users to talk (to the extent that's possible) about regular expressions. It's a massive topic and we barely scratched the surface, but having listened back to the segment, I think it gives Mac users a number of points of entry. Even so, there was one big topic on my outline that I forgot to cover: multiple matches.

As David said, the basic conceit of regex is "find and replace on steroids". I think even that description is limiting, since the basic model of find and replace is to find one thing and replace it with one other thing. But once you're proficient in the basic search syntax, you can go much further by learning the replacement syntax. (Frustratingly, this tends to vary from app to app. I'll describe things with BBEdit's syntax, which I'm most familiar with.)

If you want to match multiple components of your overall regular expression, all you have to do is enclose them in parentheses. Then, each of these can be referenced in order, left to right, in your replacement string by using \1, \2, \3, and so on — though it gets pretty unwieldy after 4 or 5. This can be used for mundane tasks, like reordering parts of a date string, but it's also endlessly flexible, especially because you can refer to a captured group more than once.

This past week at work I applied multiple matches to what would have otherwise been a tedious clicky-draggy spreadsheet task. I was setting up software for some computer-based tests, including mapping the number of questions answered correctly to a standard score. (Remember the SAT? It's out of 1600 points, but there aren't 1600 questions. Thankfully.)

I had an Excel spreadsheet that a coworker made, but the software required a CSV, with each row having the low raw score, high raw score, low scaled score, and high scaled score for different ranges. We had already run an analysis and decided these correspondences for every possible value, so I needed those pairs of columns to be duplicates of one another. Yes, I could do that in Excel or Numbers, duplicating columns and saving out CSV files via an Export dialog. Or I could make a much faster round trip to BBEdit.

The routine was simple: paste two spreadsheet columns into a text file, giving me numbers separated by a tab. I captured the first number, matched a tab, and captured the second number: (\d+)\t(\d+). Then, since I needed to both flip the column order and duplicate them, I replaced the string with \2,\2,\1,\1. And thanks to BBEdit making the "Replace all" command available even without opening the Find and Replace window, transforming new data only took one keystroke: ⌥⌘=. 15 repetitions of the process only took a couple minutes. (This was right on the threshold of "should I automate this?" If it was 100 repetitions, the answer would have been a definite "yes".)

Now, chances are you'll never have to perform this exact task. In fact, the chance that I'll have to do this again are near zero. But the chances that you'll have to rearrange some lines of text are pretty high. Even if you have to look up the syntax, just knowing that the apps you have on your Mac are up to the task will enable you to solve the problem and get the work done faster.

90: Envisioning a Mac Pro-bo

I've been crafting a vision of what the Mac Pro (Mid 2018) may look like ever since the line was declared definitely-not-dead in April. I don't have many pro needs; podcast production, light image editing, and the occasional Handbrake session are as intensive as my computing gets. Even so, I built my core idea around the one thing I struggled with when configuring an iMac: storage (especially the question of to NAS or not to NAS).

 I'm sure Jony can do better than this.

I'm sure Jony can do better than this.

There's a lot that's appealing about network attached storage. It offers redundancy, it's available from everywhere in the world, and it can be shared among devices while at home. But it has major downsides too. It's essentially a second computer and carries the price tag to match, even before you fill it with hard drives or SSDs. And because NASes like those from Drobo and especially Synology are computers, they run their own operating system…which isn't Mac OS. I don't care how lightweight and convenient it is; I want no part in managing a Linux box through a fake Windows GUI in a browser. Even if I took that leap, dealing with network drives still isn't a native Mac experience. (I see this frequently at work with our office-wide Samba share. You can't put files in the trash and Spotlight is nonexistent. It's no way to live.) So I configured my iMac with a 2TB Fusion Drive and hung a 4TB USB drive off the back.

Even though the drives I hooked up to my iMac are nowhere near full, I would love to see a device that integrates the mass storage of a NAS with the power and software of a high-end Mac — a Mac Pro-bo, if you will. I considered it a total pipe dream for a while. Remember, the last Mac to offer expandable, multiple drive storage was a 40-pound cheese grater from 2012. But the recent sneak peek at the iMac Pro actually gives me more hope than ever that we'll see something like it.

On the WWDC slides and on the iMac Pro website, there's a new schema for what Apple considers the pro setup, and it's a 5K display sitting next to a box full of hard drives. Given the current lineup, that involves an iMac display and a third-party box to the side. The converse — a trash can Mac Pro with a third-party display — proved less than viable. The big design question for the future Mac Pro is whether these two components, one centered around the display and one centered around storage, are the "modules" Apple referred to in the Mac Pro roundtable.

 The other future of computing.

The other future of computing.

Swappable storage, backed by APFS and macOS would certainly be a unique product. Many assume that the Mac Pro has to be even more expensive than the iMac Pro, but Myke Hurley and Jason Snell pointed out on Upgrade that it might be best if the Mac Pro sat in the middle. Tim Cook's Apple loves to hit every price point, and there's a huge gulf between $2300 at the top of the iMac range and $5000. I imagine that $3500 could offer a lot in terms of CPU, RAM, and storage in a compact Mac — especially with no display and nothing but air in some storage bays. Max out the storage or add a putative $1500 Apple 5K display and the Mac Pro would be comparable in features and price to its all-in-one cousin, with room to grow. It's still just a dream, but maybe it's not so farfetched after all.

89: Does Apple need a branded design language?

Picomac is back! I never intended to stay away from it forever, and there's just way too much good stuff from WWDC 2017 to talk about.

Rumors swirled before the WWDC keynote about whether Apple would bring major design changes to iOS 11. The answer is that Apple took the middle path: there's nothing like the major shift from iOS 6 to 7, nor will this year's iOS look exactly like last year's. There's also a clear direction of change. Nearly every new piece of interface is taking its cues from the 2016 edition of the iOS Music app. The theme of iOS's design is quickly moving to unify around the theme of bold header typography, rounded cards, and gentle translucency effects.

 The App Store has gotten the Apple Music treatment in iOS 11.

The App Store has gotten the Apple Music treatment in iOS 11.

But those are the terms we have to talk about it in: directions, themes, specific interface elements. Apple hasn't decided to craft a brand around its software design or give it a name. (Though perhaps that's for the best, given the dubious names that came out of this keynote.) As of earlier this spring, Apple is the only major operating system provider who doesn't have a branded design language. Google has been refining its Material Design since 2014, and Microsoft unveiled the Fluent Design System with Windows 10 in May. Beyond providing a quick way to describe these interfaces, they offer connotations, just like a good brand should. "Material" indicates touch and a tactile experience; "Fluent" shares a root with "fluid" and "fluency", getting at both smoothness and ease of use.

So the question is: does Apple need a branded design language to go up against Google and Microsoft? Need is a strong word, of course; iOS's interface can certainly match and surpass its competitors without a catchy name. To paraphrase Steve Jobs, design isn't what it's called; it's how it works. And what would Apple call what we can only call "the Apple Music look" or "iOS 11's design"?

The closest they've come to coining an interface term recently is "vibrancy" (and it's confusing evil twin, "dark vibrancy"). In truth, this effect is a major part of the Mac and iOS aesthetic, so Vibrant Design would be an apt name; it also fits with the splashy color and heavy font choices that are in favor now.

Another option would be to go abstract. A "California" design language would evoke the phrase "Designed by Apple in California" present on all their hardware and packaging. It would also offer more flexibility than a descriptive name. After all, interface design evolves at a rapid pace and is subject to trends in fashion. Today's fresh and vibrant design could easily be as passé as skeuomorphism and linen in a few years. A rebrand would always be possible, but that takes extra effort. So perhaps the best approach is for Apple to push its interface design along as they see fit…and to let the rest of us worry about what to call it.

88: Genesis of the Touch Bar

Since the MacBook Pro with Touch Bar was announced a couple weeks ago, there's been plenty of speculation on why exactly it exists and what role it will serve in the Mac lineup of the future. The same kind of questions arose when the Force Touch trackpad was added to the MacBook Pro a couple years ago. There, the answer to "why this?" seemed fairly simple: as a non-moving part it eliminated internal space and made better use of its ever-increasing surface area, since an equal amount of force registers a click on any part of the trackpad.

The answer for the Touch Bar isn't so obviously pragmatic. It doesn't save space, as it occupies the exact same area as its predecessor function keys; the low end model that retains those keys reflects that exactly. And since the machines still aren't even in the hands of reviewers, the jury is still out as to whether the touch interface features will make the Mac more of a joy to use. Nobody knows if the Touch Bar will be liberated from the MacBook enclosure and put in standalone input devices, like when the Force Touch trackpad became the Magic Trackpad 2. (And unlike the Magic Trackpad, given the components involved, it seems nearly certain that a standalone Magic Keyboard 2 with Touch Bar will not be a $0 build-to-order option with the iMac of the future.)

Nevertheless, I think that Touch Bar technology will spread to all Macs, even if it comes at a cost to consumers. The reason is the problem that I believe served as the entire genesis of the Touch Bar technology: someone inside Apple looked at the glyphs on their function row keys and said "why do we keep letting these become obsolete?"

There was once a time when that wasn't a concern; Apple's desktop and laptop keyboards just had plain, numbered function keys. This was even the case when Apple started assigning essential features to them, like when Exposé was introduced in Panther. Its features were originally mapped to the blank F9, F10, and F11 keys, and I learned to use them by feel on my 2003 PowerBook G4. (It was super easy, as the function keys were physically grouped into F1–4, F5–8, and F9–11.) But the next wave of Apple hardware brought dedicated media playback keys in the function row, and they landed on the only glyphless function keys available: F9–11.

 Nothing to see here, move along.

Nothing to see here, move along.

Obviously my keys didn't change overnight, but their associated actions did. Software "broke" perfectly good hardware. And other mismatches constantly arose. Hardware keyboards could easily outlive the features printed on them. Until just last year I was still using a keyboard that had a Dashboard key on it (yes, Dashboard is still technically alive, but just barely). And uniformity is impossible, as today's laptop keyboards with backlight controls put them on F5 and F6, while Apple's standalone keyboards — designed to work with any Mac — just offer blank space there. "This keyboard doesn't have backlighting, so, I dunno, have a couple extra buttons." It's inefficient design.

So rather than scrap the function keys as hopelessly broken, Apple is trying to turn a weakness into a strength. The function keys keep changing every couple years, and it's a problem. Instead, make them change every couple seconds and it's a delightful solution. Maybe someday the Touch Bar will vanish into a fully interactive keyboard. After all, the original Mac keyboard had no function row and neither does the iPad Smart Keyboard. iOS goes as far as dropping number keys, hiding them in a separate mode. I can't predict the future of Apple's input devices beyond the Touch Bar, but it seems a safe bet that they'll be capable of changing — quickly.