Archive for September 6, 2017

Wednesday, September 6, 2017

Is This My Interface or Yours?

John Saito (via Ole Begemann):

In later versions of Windows, Microsoft changed the label of this [My Computer] icon to Computer, then changed it again to This PC. Did they change it because “my” was misleading? Inconsistent? Unnecessary?

[…]

Unfortunately, cutting out “my” or “your” doesn’t work 100% of the time. Sometimes you really do need to differentiate the user’s stuff from someone else’s stuff. For example, in YouTube, you can’t just say “Channel,” because it’s not clear whether that’s referring to your channel, channels that you’ve subscribed to, or channels that YouTube is recommending to you.

[…]

When to use me: Use I, me, my, or mine when the user is interacting with the product, like clicking a button or selecting a checkbox. But only add these words if you absolutely need to for clarity.

When to use you: Use you or your when your product is asking questions, giving instructions, or describing things to the user. Just imagine what a personal assistant might say.

1980s Apple Ads

Jeff Jackson has a collection of old Apple ads for AppleCare and HyperCard.

Via Janne Aukia:

The focus on business customers is interesting. Many of the selling points would be valid still today.

Data Locality and STL vs. Swift

David Owens II (tweet):

What if I told you that even in an array of 10,000 items and a linked list of 10,000 items, insertion into the middle is still going to be faster in the array? Would you believe me?

[…]

The problem is that the -> operator (de-referrencing) is a relatively expensive operation.

He also found that for the simple case of an array of integers, Swift’s Array was about half the speed of std::vector. This is pretty good, and it looks like there’s room for it to be improved.

Joe Groff:

The optimizer is also not great at telling that insert/append-type operations maintain uniqueness so it can leave out checks.

If you’re seeing protocol overhead it’s probably also failing to specialize something.

Update (2017-09-06): David Owens II:

Actually, they are even perf now. I was using Int instead of Int32, so the size was 64bits instead of 32bits like the C++ version. 🙄

Joe Groff:

Another linked list variant is a contiguous array of (value, next index) pairs, so you get locality and can efficiently insert by appending

and you can easily sort in-place into an ordered vector as a pre-pass to benefit from sequential memory access

Swift and KVO Context Variables

Michael Brown:

I found the solution to the problem in this Apple Swift Blog post about interacting with C pointers from July 2014! So this has been a problem right since the start of Swift, but only now, perhaps with improved runtime checks in Swift 4, is it causing crashes.

The relevant part is here (emphasis mine):

These conversions cannot safely be used if the callee saves the pointer value for use after it returns. The pointer that results from these conversions is only guaranteed to be valid for the duration of a call. Even if you pass the same variable, array, or string as multiple pointer arguments, you could receive a different pointer each time. An exception to this is global or static stored variables. You can safely use the address of a global variable as a persistent unique pointer value, e.g.: as a KVO context parameter.

The best fix is probably to use the new KVO API, but this issue is worth keeping in mind for other APIs that use C pointers.

Update (2017-09-06): Joe Groff:

That use case should work with the latest Xcode 9 betas.

I forget details, but exclusivity enforcement for passing pointers to ivars was relaxed to accommodate this kind of use.

1Password Command-line Tool Public Beta

Connor Hicks (via Rick Fillion):

The 1Password command-line tool makes your 1Password account accessible entirely from the command line. A simple op signin will securely authenticate you with the 1Password service and give you access to a wide range of capabilities[…]

[…]

One of the most frequent requests we receive from 1Password Teams customers is the ability to export the Activity Log. With the Pro plan, op list events makes it easy to ingest activity data into the application of your choosing. Be it Splunk, Kibana, Papertrail, or your own tool, op outputs JSON, so it’s simple to work with.