Archive for May 2016

Tuesday, May 31, 2016

1PasswordAnywhere No Longer Works With Dropbox

David Teare:

In the coming days, 1PasswordAnywhere (the 1Password.html file within your Agile Keychain folder) will stop working for 1Password data stored in Dropbox.

Logging into my Dropbox account, it looks like this day has already arrived.

Those were the 3 main use cases for 1PasswordAnywhere when we designed it and each one has a better alternative available today.

Hopefully in 2016 you no longer need 1PasswordAnywhere.

To me it has always been about reducing dependencies. Plain HTML and JavaScript files are about as permanent as possible. The passwords should be accessible even in the unlikely (and unfortunate) event that Agile’s apps and Web service are not available. Even from a different platform and with no network access. It was a nice bonus that syncing via Dropbox produced an up-to-date, globally accessible but password-protected backup.

First, you can continue to use 1PasswordAnywhere with an Agile Keychain stored locally or on a USB drive. Many browsers restrict access to local files, however, so be sure to configure your browser to allow local file access. Just be aware that this could potentially pose a security risk.

Khad Young:

You can get around local file restrictions in Safari by selecting Develop > Disable Local File Restrictions from the menu bar. (You will need to enable the Develop menu first if you haven’t already. This is done by checking the box for “Show Develop menu in menu bar” on the Advanced pane in Safari’s preference.)

In my view, these instructions should be in the HTML file itself, kind of like Apple did with the HFS wrapper.

Also note the recent change in the “Lock on sleep” behavior:

Previously we had it set to auto-lock when the computer itself slept; a recent update made it so it auto-locked when the display slept because that’s what most people expected from the app. (I suspect that most people think a laptop goes to sleep as soon as their display does. It’s too bad Apple got rid of the little “breathing light” indicators on its MacBooks!)

That explains why it started prompting for my password every time I returned to my Mac. I always sleep the display but leave it running.

Mocking Dependencies With Generics

Elmar Kretzer (via Andy Bargh):

You can inject code dependencies in a transparent way by using generics and typealias.

[…]

Those dependencies are loosely coupled, but in my opinion they belong together in a semantic way.

[…]

We end up with:

  • a generic ModelFor taking a type conforming to Environment
  • a typealias Model representing ModelFor<RealWorld>
  • no code necessary to manage the dependencies with properties or whatever

Seven Hundred Million

Nick Heer:

That’s approximately how many passwords to popular web services were leaked over the past week or so, as lists from LinkedIn, Tumblr, MySpace, and others have all showed up for sale on pseudonymous marketplaces.

Troy Hunt is the creator of Have I Been Pwned, a service that allows you to type in your email address or username and see if your account is among those compromised by major security breaches:

Swifty Objective-C

Peter Steinberger, Michael Ochs, and Matej Bukovinski:

Using Swift without binary compatibility would mean that we have to offload technical details to our customers and restrict them in their choice of Xcode to a point where they might not be able to update to Xcode 7.3.1 if our SDK is still compiled with 7.3.0.

[…]

Instead we decided to use Objective-C++ to complement pure Objective-C where appropriate. […] In our Objective-C classes, we only use a very tiny amount of C++ to benefit from the convenience, safety, and performance features of C++. In contrast to full blown C++ implementations, learning a small subset for use in a mainly Objective-C codebase is very easy, even for developers without any prior C++ experience.

[…]

When using generics it gets quite annoying to type the type specifier […] auto will transform at compile time to the above — it doesn’t require any runtime features.

[…]

In Objective-C NSArray can only contain objects. This is both more complicated and — because of boxing — slower for primitive types. […] With Objective-C++ we can simply use std::vector:

[…]

The C++ lock is automatically released when it goes out of scope. The RAII pattern is everywhere in C++ and it’s really great and deterministic. This allows us to do work that requires locking inline with a return statement as the lock is only unlocked after the return.

[…]

Compiling .mm files will take a bit longer than standard .m files, however in our experience it’s worth the slight compile time penalty.

Sunday, May 29, 2016

Making Paw Extensible With JavaScript Core

Micha Mazaheri:

There was a dilemma on the choice of the scripting language. Sketch exposes an CocoaScript interface that lets users mix JavaScript with a syntax inspired by Objective-C, and gives access to all available OS X APIs. This would have been a serious security concern for Paw being a place where developers may store their production server credentials: letting 3rd party have unrestricted access to the app didn’t feel right.

[…]

Since OS X 10.9 / iOS 7, the JavaScript Core framework exposes great Objective-C to JavaScript bindings (it had a C API before). This meant objects from either language would be bridged to the other by just following a simple protocol and following a few rules for memory management. The whole thing would run in a JavaScript Virtual Machine we would fully control. We would create JavaScript APIs to let 3rd parties safely access the data we wanted to expose.

Opening Files and Never Closing Them

Lloyd Chambers:

A few days ago, I wrote about a nasty bug in QuickLookSatellite that can bring the system to its knees, requiring a force kill of QuickLookSatellite or a logout or reboot. That page has now been updated with command line alternatives that make it instant to terminate the offending QuickLookSatellite processes.

[…]

Apple Mail has bugs in failing to close open files as well: send an image in an email, then put the file in the trash. Even hours after the email has been sent, the file(s) may remain open, so the Trash cannot be emptied.

I see this with Mail and Preview all the time.

iTunes 12.4 Applies Song Ratings to Albums and Destroys Smart Playlists

Kirk McElhearn:

When iTunes 12.2 was released, the app changed some song ratings to album ratings. This means that if you have smart playlists that look for, say, five-star songs, iTunes will add all the tracks from the album with the five-star rating to those playlists. After iTunes 12.2 was released, this happened occasionally; but with iTunes 12.4, my entire library was changed. Every single song rating in my library got changed to an album rating. (Note that neither iTunes Match, iCloud Music Library, nor Apple Music are active on this Mac, so these services are not responsible for the changes.)

Obviously, this broke my smart playlists.

Previously: iTunes 12.4.

Friday, May 27, 2016

Google : 2010s :: Microsoft : 1990s

Jason Snell:

So when I look at Google and see a latter-day version of 1990s Microsoft, I don’t mean to portray it as a monster. Truth be told, just as I used Word 5.1 back in the day, I use many Google services today. My email is served by Gmail, and my comings and goings are arranged with Google Calendar. Most of my podcast and website collaboration happens in Google Sheets and Google Docs. (I also thought the Google I/O keynote last week was the best one I’ve seen–disciplined and focused in a way previous I/O keynotes weren’t.)

But some of the stuff Microsoft pulled in the 1990s was awful, and made users angry. And Google seems to still be making decisions that are more about promoting the greatness of Google than showing respect for users.

[…]

As someone in Google’s ecosystem as well as Apple’s, I’m happy that they continue to develop apps for iOS. Unfortunately, every time I open one of them, I’m brought back to the mid-’90s and Word 6.

John Gruber (tweet):

Jason specifically calls out iTunes on Windows as being in the same boat. I’d add the late Safari for Windows, too.

Don Melton:

We simply couldn’t compete with Google when they were paying everybody to bundle [Chrome] and blitzing TV.

People don’t realize the Safari for Windows team, the platform engineers, was only three people. That’s it.

And if I could have gotten marketing support dollars, …

… I could have gotten the engineering budget to support the effort to address those issues.

.NET Core is Boiling the Ocean

Aaron Stannard (via Hacker News and Reddit):

.NET Core is about decoupling .NET from Windows. Allowing it to run in non-Windows environments without having to install a giant 400mb set of binaries.

This will allow .NET to run in containers on Linux and lots of other places it can’t today and presents a very exciting opportunity for those of us in the server-side .NET development space to start taking advantage of modern DevOps and deployment tools.

[…]

I had originally imagined that .NET Core would be “released” in a stable form this year, 2016.

Now I no longer have any certainty with anything in regard to .NET Core, because the roadmap has been changing rapidly.

[…]

I’m left with the impression that .NET Core is trying to do everything at once: static linking, new tooling, support for 3D games, web applications, cross-platform desktop applications, browser-based apps, and anything else that could be aptly labeled under the masthead of “panacea for .NET developers.”

The Mac Admin Library

Tom Bridge:

No matter how you learn, there are good resources in print for the Mac Admin, be they books and manuals, blogs and journals, magazines and other news media. This library, catalogued below, is far from canonical, but it does have the resources that I consider to be the best of breed.

FaceTime, iMessage Hang in the Balance After Apple Loss to Patent Troll

David Kravets:

Patent troll VirnetX, fresh on the heels of a $626 million FaceTime and iMessages patent victory over Apple, now wants a federal judge to permanently turn off those popular features.

VirnetX on Wednesday also asked the judge presiding over the litigation to increase the damages the East Texas jury awarded in February by another $190 million or more. Apple wants a retrial, claiming that VirnetX’s lawyers misrepresented evidence to the jury and that the evidence presented at trial didn’t support infringement.

Update (2016-05-28): See also: Hacker News.

Thursday, May 26, 2016

Dropbox’s Upcoming Kernel Extension

Damien DeVille (via Hacker News):

Traditionally, Dropbox operated entirely in user space as a program just like any other on your machine. With Dropbox Infinite, we’re going deeper: into the kernel—the core of the operating system. With Project Infinite, Dropbox is evolving from a process that passively watches what happens on your local disk to one that actively plays a role in your filesystem. We have invested the better part of two years making all the pieces fit together seamlessly. This post is a glimpse into our journey.

[…]

FUSE is an incredible technology, but as we gained a deeper understanding it became clear that it didn’t fully satisfy the two major constraints for our projects—world-class performance and rock-solid security.

[…]

We use the Kernel Authorization (or Kauth for short) kernel subsystem in our kernel extension to manage file authorizations within the BSD portion of the kernel. By listening to actions on the KAUTH_SCOPE_VNODE scope, we can detect and deny actions that happen in the Dropbox folder. In the examples cited above, for example, we are interested in the KAUTH_VNODE_DELETE and KAUTH_VNODE_ADD_FILE actions since they allow us to check whether a file or folder in a user’s shared folder is being deleted or moved. From there, it’s just a matter of checking with the user whether the operation was in fact intended and inform them of the consequences of the operations for other members of the folder.

Previously: Dropbox’s Project Infinite.

Building on Auto Layout

Bridger Maxwell:

It is common to use addConstraint directly, but Auto Layout is actually a great engine to build layout systems on top of. In this post I’ll talk about different abstraction layers on Auto Layout and show its advantages with my library StackLayout.

[…]

The simplest way we can build on Auto Layout is a thin syntactic layer for creating constraints that we still manage manually. Until iOS 9, the built-in way to create a constraint was quite verbose.

[…]

Higher up the abstraction scale is the Visual Format Language. When I interned at Apple on the Cocoa Frameworks team I helped with the initial implementation of Auto Layout and especially on the parser for the VFL. This lets you specify a few common layouts that can be written as ascii art.

I’ve experimented by reimplementing some of it in Swift using operator overloading. The idea is the same, but has the advantage of compile-time checking.

Wednesday, May 25, 2016

When to Move to Swift

Soroush Khanlou:

Despite this newfound revelation, I still think the prudent choice is to continue writing apps in Objective-C. Those who are fully on board with Swift commonly reply: every line of Objective-C you write is a legacy. While this is true, Objective-C code will still be viable for at least another five years, and probably won’t stop working for closer to 10 or 15. This is based the fact that every one of Apple’s OSes is written in it, as well as the frameworks themselves. (How long did Carbon code work for? How long before Finder was rewritten in Cocoa?)

However, your Swift 2.2 project is also going to become legacy code, and that transition will happen this September. Your migration will be a bloodbath, and it will have to happen in one fell swoop (including your dependencies!) because of a lack of ABI compatibility. Latent bugs will creep in from the migrator, and you’ll have to keep your swift-3 branch updated with regular, messy merges. In the end, git bisect will stop working, and your compile times will still be awful.

Ben Sandofsky (via John Gruber):

I strongly believe Swift is the future of iOS development. It’s only a matter of when, and the blocker is the breakneck speed it evolves. For smaller apps, Swift is good enough. For big apps, it’s at least a year away.

I’m using “big” as shorthand for a few different categories. It can mean lines of code, number of developers, complexity, or low-tolerance for problems.

There are pros and cons to both paths. Personally, I lean towards using Swift for new projects and new major versions. I am less worried about the breaking sources changes in Swift 3 than I am about the poor Xcode experience (broken auto-indentation and unreliable syntax highlighting, code completion, and symbol lookups). Nearly two years after the initial release, I thought those would have been fixed.

Previously: ABI Stability Deferred Until After Swift 3.0.

Update (2016-06-01): Bridger Maxwell posted a diff of his app’s changes for Swift 3 (via Soroush Khanlou).

Tuesday, May 24, 2016

MVC-N: Isolating Network Calls From View Controllers

Marcus Zarra:

We have a network controller: it talks to the internet, your local network, or even be a flat file system. It then pushes data into your cache, into your persistence engine. Here comes the exciting part: your entire view layer talks to the cache only. It does not get data from the internet directly. The ViewController’s job is to display or update that data, not to do networking code. This design will serve you forever, and it has so many benefits that you’ll never want to use the anti-pattern ever again.

[…]

We can use the concurrent design of the NSOperation to do our network requests. In Swift, because we cannot access the property directly for finished, we have to do hacking (which I do have a radar for, and I am hoping they will fix this). The idea behind this overrided var is that we need to tell the queue that we are done. To do that, the queue is listening for “isFinished”. In Objective-C, isFinished translates into the variable Finished fine; in Swift, it only listens for “isFinished”, it does not listen for the actual property of Finish, you cannot change it.

Recursive Tail Calls and Trampolines in Swift

Umberto Raimondi (via Natasha Murashev):

In this post we’ll see how the lack of predictable tail call elimination in Swift could be overcome using trampolines and a few alternatives to recursion will be described.

[…]

A trampoline is not much more than a loop that executes iteratively functions that can either return the next function in the sequence (in form of a thunk or continuation, a data structure that contains the information needed to perform a specific function call) or another kind of value (in this case the content of the accumulator) to signal the end of the iteration.

[…]

And even if this implementation [is] slower than the original one for all the code needed to operate the trampoline that was added, this version solves our biggest issue related to stack exhaustion[…]

Swift Tuples Aren’t Equatable

Erica Sadun notes that Swift will let you create an array of tuples:

let a: [(Int, Int)] = [(1, 2), (3, 4)]

But you can’t use the contains() method:

a.contains((3, 4)) // no!

Its definition looks like:

extension SequenceType where Generator.Element : Equatable {
    /// Returns `true` iff `element` is in `self`.
    @warn_unused_result
    public func contains(element: Self.Generator.Element) -> Bool
}

The problem is that it requires the element to conform to the Equatable protocol. Equatable only includes one method:

func ==(lhs: Self, rhs: Self) -> Bool

And the tuple does implement ==. But the compiler can’t use that fact because Swift doesn’t allow tuples to conform to protocols. This is the sort of thing that annoys people about static languages. The workaround is to use a different version of contains():

extension SequenceType {
    /// Returns `true` iff an element in `self` satisfies `predicate`.
    @warn_unused_result
    public func contains(@noescape predicate: (Self.Generator.Element) throws -> Bool) rethrows -> Bool
}

to call == directly via a closure:

a.contains({ $0 == (3, 4) })

Monday, May 23, 2016

Apple Offers to Replace iPads With MacBooks in Maine Classrooms

Tim Hardwick:

According to a report in the Lewiston-Auburn Sun Journal, schools in Auburn and other districts in Maine are set to benefit from the “Refresh” swap, following surveys of students and teachers across grades 7 through 12, which revealed that 88.5 percent of teachers and 74 percent of students preferred laptops over iPads.

iPads were perceived to have poor educational value in the classroom and were often used to play games in class, while laptops allowed students better opportunities for school work. The preference gap widened even more when it came to older students, who saw laptops as better devices for coding and programming tasks.

Tom Warren:

Google’s low-cost Chromebooks outsold Apple’s range of Macs for the first time in the US recently. While IDC doesn’t typically break out Windows vs. Chromebook sales, IDC analyst Linn Huang confirmed the milestone to The Verge. “Chrome OS overtook Mac OS in the US in terms of shipments for the first time in 1Q16,” says Huang. “Chromebooks are still largely a US K-12 story.”

IDC estimates Apple’s US Mac shipments to be around 1.76 million in the latest quarter, meaning Dell, HP, and Lenovo sold nearly 2 million Chromebooks in Q1 combined. Chromebooks have been extremely popular in US schools, and it’s clear from IDC’s comments the demand is driving US shipments.

Update (2016-05-25): Matt Novak (via Adam Chandler):

But something happened about a year ago when my Macbook Air was running on fumes. I looked at the Macs and gave my brain a half-second to entertain other options. I owned a functioning Mac desktop, which is my primary machine for heavy lifting. But I started to wonder why I wasn’t entertaining other options for my mobile machine.

The biggest consideration was price. When all was said and done, even the cheapest Mac laptop was going to set me back about $1,300 after taxes and AppleCare. And the siren song of a computer under $200 was calling my name. I got the Acer Chromebook with 2GB of RAM and a 16GB drive. It cost a shockingly low $173. And

Monument Valley: iOS 42% of Downloads But 73% of Revenue

ustwogames (tweet, Hacker News):

3rd April 2016 marked the two year anniversary of Monument Valley’s release and with that we now have a lengthy window to analyse how the game’s performed and what we’ve managed to do with it post release. So with that in mind we’re happy to present Monument Valley in Numbers: Year 2.

Daniel Gray:

Numbers are slightly skewed due to the insanely high number of free downloads during iOS free week. Revenue came purely from IAP.

Jared Schnelle:

We’ve wanted to go free for a period on Google Play but unfortunately it’s not possible, when you go free with a paid game you can never go back.

fasteddie:

Monument Valley, one of the most polished and loved premium mobile games ever, has made $15m in its lifetime. Meanwhile, there are multiple F2P games with over $1b in revenue.

Now, $15m is fantastic, especially for a small studio. But high-production value F2P games from bigger studios cost around $3-5m to make, not including marketing/UA, so its pretty clear to see why studios aren’t investing in premium titles at all, unless they are ports of existing content.

Previously: iOS App Sales Data.

94% of App Store Revenue Comes From the Top 1%

Randy Nelson (via Ilja A. Iwas):

The most surprising takeaway from our analysis of U.S. App Store publishers is that the top 1 percent of those who monetize their apps accounted for 94 percent of the store’s revenue last quarter. That means approximately $1.34 billion of the estimated $1.43 billion in net revenue generated by the store during Q1 went to 623 publishers, the remaining 6 percent—approximately $85.8 million—was divided among the other 61,677 publishers whose apps are paid or feature in-app purchases.

[…]

There were approximately 1.38 billion app downloads on the U.S. store in Q1, and approximately 966 million of those were generated by the top 1,270 publishers out of 127,000 we analyzed. The remaining 99 percent of publishers split the other 414 million downloads between them.

Previously: Over 70% of App Store Purchases Are for Games.

C Compilers Break for Objects Larger Than PTRDIFF_MAX Bytes

Pascal Cuoq (via Jean-Francois Roy):

The malloc call in the program below succeeds (the program would return 0 if the malloc invocation failed), despite Clang having the same half-the-address-space limitation for 64-bit as for 32-bit.

[…]

Unfortunately, an optimizing compiler’s code appears to be littered with optimizations that assume object sizes are less than PTRDIFF_MAX. As an example, we all know that X86 Clang and GCC implement pointer comparison as an assembly unsigned comparison (“cmpl” is an agnostic comparison instruction, but here it is followed by “cmoval”, where the “a”, for “above”, indicates conditional move based on an unsigned comparison). This means that it is allowed to compare pointers inside a putative 2.5GiB array on a 32-bit platform, right?

Not all pointer comparisons.

Because of this optimization.

Continuous iOS Code Coverage With Jenkins and Slather

Matej Bukovinski:

Before Xcode 7, we already had code coverage reporting set up with Jenkins. We generated coverage data in the gcov format and used LCOV together with a custom script to integrate the coverage data into Jenkins. It all worked pretty well. However, with the introduction of Xcode 7, Apple dropped support for the legacy gcc coverage file format and introduced a format of its own: profdata. Of course this broke our setup as soon as we migrated our CI servers to Xcode 7. As framework developers, we always have to be early adopters of the latest iOS versions, so we can make sure our code is ready before our clients make the switch. Unfortunately, this means in some cases we need to make a few compromises. In this particular circumstance, it meant dropping code coverage because there were simply no convenient tools around to get the data into Jenkins. Xcode ships with llvm-cov, a command line tool that can convert the coverage data into a more human readable format. However, there is still quite a bit of work needed to get it into a format that Jenkins could handle.

[…]

After running llvm-cov Slather parses the output data, processes it a bit and then outputs it into one of the supported formats. In our case an XML file suitable for Cobertura.

To get all that running on Jenkins, we simply added a call to rake coverage_ios right after we run our test suite. We have some extra logic to prevent coverage from running in certain configurations or if the tests fail but that is essentially all that is needed to generate the XML coverage data. After adding the call, we just need to install the Cobertura plugin and configure it so it can find the generated XML.

Saturday, May 21, 2016

Dynamic Swift

Brent Simmons (see archive for more):

In case it’s not clear: with recent and future articles I’m documenting problems that Mac and iOS developers solve using the dynamic features of the Objective-C runtime.

My point isn’t to argue that Swift itself should have similar features — I think it should, but that’s not the point.

The point is that these problems will need solving in a possible future world without the Objective-C runtime. These kinds of problems should be considered as that world is being designed. The answers don’t have to be the same answers as Objective-C — but they need to be good answers, better than (for instance) writing a script to generate some code.

Manton Reece:

Leaning on the Objective-C runtime feels like a temporary solution because it only exists on the Mac and iOS. Great web frameworks like Ruby on Rails, for example, can’t be built without relying on a more dynamic language. (And to me a great promise for Swift is being able to use it everywhere.)

[…]

I think it’s telling that the “dynamic” keyword isn’t even mentioned in the main language guide. Anything related to Objective-C is off in a separate set of documentation, which includes discouraging statements such as “Requiring dynamic dispatch is rarely necessary” and “use of the performSelector APIs is discouraged”.

Gus Mueller:

What I didn’t add was a giant switch statement like we did in the bad old days of classic Mac OS programming. What I didn’t add was glue code in various locations setting up targets and actions at runtime that would have to be massaged and updated whenever I changed something. I’m not checking a list of selectors and casting classes around to make the right calls.

Marcel Weiher:

However, an even bigger worry, at least for me, is that Apple will take Brent’s concern extremely literally, and provide static solutions for exactly the specific problems outlined (and maybe a few others they can think of). There are some early indicators that this will be the case, for example that you can use CoreData from Swift, but you couldn’t actually build it.

And that would be missing the point of dynamic languages almost completely.

Previously: The Case for Message Passing in Swift, “It’s a Coup”, Dynamic Swift.

Update (2016-05-23): See also: Hacker News, particularly the comment by Drew Crawford:

While it is true that ObjC’s dynamism has all kinds of problems we want to avoid, we’re also running into lots of cases where the obvious solution is dynamism, and the other solutions aren’t obvious.

One concrete example I can offer you is NSCoding, which is being reimplemented right now in corelibs-Foundation. That API pretty much needs a way to look up classes at runtime, (there’s really no other sane way to provide the feature). You could argue that we don’t need NSCoding (in fact that was argued), but ultimately, we decided we needed NSCoding more than not. So Swift 3 adds a _typeByName API which does dynamic lookups of classes by string. It landed, it exists, the ship has sailed.

Another concrete example that may be interesting is XCTest. The way XCTest works is your unit tests are written as functions on a class, and we “discover” the tests by enumerating the functions at runtime. But oops, Swift has no way to enumerate functions at runtime, so we can’t find any of your tests. The solution to this problem is actually pretty interesting: the latest proposal is to do sourcecode analysis from the compiler to enumerate your test functions, dump that somewhere, and then generate a second program that uses the dump to call the enumerated functions.

Update (2016-05-24): Paul Kim:

Looking back on my years with Java, I find the biggest problems with the platform was this idea that everything can be done by the compiler. It sounds great on paper but when implemented, it resulted in all sorts of contortions to work around not letting any dynamism in. It resulted in a lot of glue being written that I wouldn’t have to write in a more dynamic platform. It resulted in cascading changes across code to make trivial modifications just to appease the compiler. Maybe in a future post I’ll go into specific language features that I found problematic and show parallel trends/features in Swift but let’s just say that less is more. It’s an aesthetic that I always felt that put Apple above the rest and something which I feel like in some ways is being abandoned.

[…]

Ultimately, though, I need something that solves my problems. My problems aren’t performance. They aren’t type-safety (maybe it’s just me, but I rarely have issues with it and when I do, the time it takes to fix it is far less than the time specifying everything to a tee everywhere else). They aren’t being able to write clever VDLs. For me, it’s writing apps that solve my users’ problems and getting them out in a timely fashion.

[…]

Now maybe these same problems can be solved in a static way but what I’m not seeing from the static-camp are (decent) solutions. What I’m seeing are either hand-waving or the same crufty code-generation, write tons of repetitive boilerplate type of solutions that I had hoped we had left behind in the 90s.

Daniel Jalkut:

Apple is in all likelihood the single largest owner of valuable, time-tested, customer-pleasing Objective-C code. Thus they face, as a company, the same challenges that Paul Kim and many other developers do: they can’t afford to put everything on the line, divert all their attention from Objective C, just to embrace a language that is not completely mature, and which doesn’t offer the same features as its predecessor.

[…]

Swift is a fascinating, beautiful language. How will it evolve to prove superior, in the long-run to Objective-C? By providing a suite of impedance-matched frameworks that fulfill all the needs of current iOS and Mac developers. How will those frameworks come to be in an environment where Apple’s most experienced framework developers, and Apple’s most experienced 3rd-party developers are steeped in a tradition that favors patterns not supported by Swift? I’ll be very eager to see how that plays out.

Brent Simmons:

In other words — if you think that the various people writing about Swift and dynamism are anti-Swift, you’ve got it wrong.

John Gruber:

I can’t prove that dynamic nature of Objective-C and the frameworks has been essential to the success of the Mac and iOS for app development. But a lot of people who’ve spent years — or decades — creating those apps sure think so.

Update (2016-05-25): Marco Scheurer:

Paradox: programmers advocating static typing trust that everything can be known in advance and that programmers cannot be trusted.

Update (2016-05-26): Arik Devens:

I’ve been thinking about it for a while now, and the only conclusion that I’ve come to is that it’s just far too soon to judge. Swift is practically brand new, and with such different strengths and weaknesses than Objective-C. Swift is so dissimilar to Objective-C, that I think if Apple could have gotten away with not supporting interoperability at all, they would have been much happier. They’ve managed to do an impressive thing, getting the two to play semi-nice together, but it’s an awkward fit at best.

Brent Simmons:

I saw a thing on Twitter that said I’m just an old guy complaining about the new ways. Then the tweet was deleted, to the credit of its author. But let me take up the point.

It’s not the new ways that bother me — it’s the old old ways. That is, how I wrote apps before I started using AppKit. […] We remember how these problems were solved by the static languages of the day, and we don’t want to go back.

Chris Eidhof:

As long as AppKit and UIKit will be around, we’ll have Objective-C and its runtime. If Apple releases a Swift-only successor to either one of these frameworks, I’m confident that they will do a good job: they’ll make us write less boilerplate, rather than more.

Although on Apple’s platforms we have the Objective-C runtime, Swift on the server can’t lean on that. So there are already consequences today, not just for hypothetical future frameworks. Also, tellingly, none of the people saying that dynamic features aren’t needed have demonstrated good alternatives in Swift. Instead I see hand-waving.

Andrew Abernathy:

I like that this doesn’t claim Brent’s anti-Swift. But I’m uncomfortable with “I trust Apple” — no-one is perfect.

People far more qualified than I am are leading this discussion. But I remember Apple heavily pushing Java over Obj-C for a while.

Wolf Rentzsch:

Best thing about Swift is forcing us to elucidate our points (again)

Worst thing is that we’re going to lose (again (until next round))

Nicholas Riley:

The programming language equivalent of Greenspun’s tenth rule?

Brent Simmons (tweet):

When I talk about dynamic programming on iOS and Mac, I mean this:

  1. An app can learn about its structure at runtime.

  2. An app can do things based on what it knows about its structure.

  3. An app can make changes to its structure.

Update (2016-05-27): Samuel Ford (via Daniel Jalkut):

My experience working with type strict frameworks is that they are fussy. It’s like if the only way you could chop things when cooking is with an array of specialty chopping tools that have to be assembled from pieces every time you needed them. And you have one for garlic, another for potatoes, and so on.

Every time you start to cook, you’ll feel the weight of taking those tools out, assembling the pieces, then taking them back apart, washing them, and putting them away. What you’ll find over time is that the recipes themselves will adapt to require fewer chopping tools and will become more plain and more similar over time.

So will the framework change the app. You’ll begin to avoid the things the framework makes tedious.

Wil Shipley (tweet, Hacker News):

While I think it’s great for the community to discuss what needs to be added to Swift as it grows, I’ve also seen a lot of violations of what I’ll call “Shipley’s 2nd Law” (because my ego knows no bounds). The first law, is, of course, “Less code is better code, no code is best code.”

Shipley’s 2nd Law states, “Groups that have brought you good things in the past will tend to continue to bring you good things, and groups that have brought you shit will continue to pile shit on top.”

I think this is generally true, but one should also consider that although the LLVM/Clang/ARC team has a great track record, they are not the same people who have a history of delivering good frameworks for apps. Rather, as Shipley and Marcel Weiher note, they’re the ones who have been tightening the screws on Objective-C, making some of its dynamic features harder to use. No one doubts that this team will produce a great language for writing a compiler—the question is how it will handle apps. Apple is attempting something very ambitious: a single language that can span the spectrum. They are in uncharted territory, which is why people don’t know exactly what to expect.

Roopesh Chander:

Since the dynamic modifier exists only for interoperability with Objective-C, this isn’t sufficient evidence to say that Swift classes will gain dynamism similar to Objective-C classes.

Jesper:

But lookup tables are exactly how message passing works. The problem isn’t that they exist, it’s any solution where, as Guy reminds us, you have to manage and see boilerplate.

So what if Swift let you code classes that looked like Swift but behaved dynamically? What if Swift let the virtualness of methods bleed out into runtime, and it could gradually be bolted down as the application ran, depending on the actual types, actual objects, actual methods, actual messages passed, call site by call site? What if that metadata was allowed to remain, could be used later and maybe even be extended?

Wolf Rentzsch:

Crazy thing is you can have both static analysis and runtime dynamism at the small cost of code size and a perhaps a Mach-O tweak.

I’m talking about runtime phase-change from static-to-dynamic as needed.

#UseTheDynamismLuke (via Jonathan Wight):

Commemorate the Objective-C vs Swift Dynamism Wars by buying the official t-shirt.

Update (2016-05-29): Joe Groff shows how to dispatch a method on an Any.

Samuel Ford:

Now, the ASP.NET team could have taken the Rails approach and implemented it more or less identically. The facilities exist within the language using reflection to do exactly the same thing. After all, ASP.NET MVC was inspired by Rails. They did not, though; they approached it with a static language mindset and in the spirit of the larger .NET framework.

I’m not suggesting that’s wrong. They should implement their framework in the style and accent that’s natural for them. What I want to point out is how differently a static view of the world can be.

Matthew Johnson shows a minimalist responder chain implemented in pure Swift:

There is not a switch statement or dispatch table anywhere in this code.

[…]

Instead of using a selector directly, messages are reified as instances of types conforming to the Message protocol.

There is the equivalent of a protocol for each selector, and he implements the messaging in a library, whereas Cocoa uses the language’s own messaging facilities.

The benefits of that additional work are:

  • Static conformance checking for Handler types.
  • The opportunity to attach any data we wish to the event.
  • No need to dynamically check the types of arguments handler.

Update (2016-06-06): Chris Eidhof (tweet):

The responder chain is cool, but I’m not sure if we need to replicate it in Swift. Rather, we could try to think of a way that is just as easy as the responder chain, but also simple. It should be easy to refactor code. It should be easy to understand. It should be easy to debug. In order to make a local change, you shouldn’t have to worry about the global effects. I’m not sure if we can solve all these issues, but I’m pretty sure we can solve a few of them.

Roopesh Chander:

Building on that suggestion by Joe Groff, if we can’t invoke selectors directly, we can introduce a new Command type to abstract that out. The Command type gives us a uniform interface to perform a command on a corresponding Responder object. (This interface is conceptually similar to what Matthew Johnson came up with, but is simpler and therefore hopefully easier to wrap our heads around.)

With this interface, whenever we introduce a new command, we have to define two new types[…]

Update (2016-06-07): See also: this Ars Technica discussion.

Update (2016-07-07): psu:

I find it confusing that anyone would object to more compile-time checking. I only have anecdotal evidence to offer, but in my lifetime working on the very large piece of Objective-C code that I work on I have fixed or diagnosed dozens (maybe hundreds?) of bugs that required me to go and figure something out at runtime that a modern compiler could have told me about at compile time.

Compile-time checking and static analysis are great. The problem is when said checking limits what your program can do because it’s not possible to prove to the compiler that it’s correct, even when it is. Secondly, my own experience is that (my) bugs are almost never caused by things that the compiler hypothetically could have caught. So I go through a lot of ceremony to feel better about my code without much practical benefit, at least for reliability.

The general perception is that the dynamic features of Smalltalk, LISP, and Objective-C made the transparency of these tools possible. There was no need for generated code, no lookup tables, and so on. It was all in the “native language”. A desire for this sort of runtime meta-recursiveness is a dominant trait in software developers.

This seems like a fair summary.

But these are all small points. The larger point is that you don’t want to do any of these things at all if you can help it. They are bad.

Yes, you shouldn’t if you can help it. My point is that it’s better to let programmers use them with care than to forbid them entirely. Nasty code that works in the real world is preferable to code that the compiler assures you is safe but that doesn’t get the job done because of bugs or limitations outside the compiler’s knowledge.

Friday, May 20, 2016

Swift Assertions

Andy Bargh:

If we dive into a bit more of the detail behind assertions in Swift, we find that the Swift language actually supports five, different types of assertion. These are:
assert()
precondition()
assertionFailure()
preconditionFailure()
fatalError()

Each of these assertions behave slightly differently and in the majority of cases the optimisation level that the code is compiled with has a direct effect on whether they are evaluated or not.

Update (2017-03-15): Previously: precondition vs. assert in Swift.

Testing IBOutlets and IBActions With Curried Functions in Swift

Ben Chatelain:

Currying helps to simplify these outlet and action test functions so that the view controller doesn’t have to be passed in every function call. Just like the sumA function holds onto the value of the first parameter, these test functions hold onto a reference to the view controller being tested. There’s also the benefit of being able to give the returned function a very readable name.

[…]

So, what is that hasButtonOutlet magic? It’s a partially-applied function saved in a local variable.

[…]

Shortly after @allonsykraken posted Hipster Swift, I learned that the super-clean syntactic sugar version of curried functions is going away in Swift 3 and it made me sad.

Code Coverage From the Command Line With Clang

Alastair Houghton:

Having searched the Internet several times to find out how to get coverage information out of clang, I ended up feeling rather confused. I’m sure I’m not the only one. The reason for the confusion is fairly simple; clang supports two different coverage tools, one of which uses a tool with a name that used to be used by the other one!

[…]

In both cases, you need to pass the coverage options to the clang or clang++ driver when you are linking as well as when you are compiling. This will cause clang to link with any libraries required by the profiling system. You do not need to explicitly link with a profiling library when using clang.

Separate, Support, Serve

Benjamin Pollack:

I want to do two things in this blog post: convince you that Embrace, Extend, Extinguish is a grossly invalid understanding of Microsoft’s strategy; and convince you that an alternative strategy of Separate, Support, Serve provides a much better lens to view the modern Microsoft.

[…]

First, Microsoft has to enable me to even use Microsoft technology in the first place. If Microsoft keeps tying all Microsoft technology to Windows, then they lose. If I have to use Windows to use SQL Server, then I’ll go with PostgreSQL. If I have to use Windows to have a sane .NET server environment, then I’ll pick Java. To fix that, Microsoft needs to let me make those decisions separately.

That’s indeed the first phase of their strategy: separating Windows from the rest of their technologies. SQL Server is available on Linux not to encourage lock-in, but because they need you to be able to chose SQL Server even though you’ve got a Docker-based deployment infrastructure running on RedHat. .NET is getting great runtimes and development environments (Visual Studio Code) for Unix so that I can more reasonably look at Azure’s .NET offerings without also forcing my entire dev team to work on Windows. This strategy dramatically increases the chance of me paying Microsoft money, even though it won’t increase the chance I’ll use Windows.

Thursday, May 19, 2016

Google Assistant

John Gruber:

Google is clearly the best at this voice-driven assistant stuff. Pichai claimed that in their own competitive analysis, Google Assistant is “an order of magnitude” ahead of competing assistants (read: Siri and Alexa). That sounds about right. This might be like Steve Jobs’s 2007 claim that the iPhone was “5 years” ahead of anyone else.

Manton Reece:

Only Google has the expertise in web services and the massive amount of data to keep going beyond basic questions. I expect both Siri and Alexa will hit brick walls that Google will get past, especially in conversational queries that let the user drill down below the most popular, superficial facts.

Caitlin McGarry:

It’s a problem that could be solved with a Siri API for app developers, but according to a recent Reuters report, Apple’s Siri shortcomings can be attributed to the company’s stance on privacy.

The company has a trio of so-called “privacy czars” who vet every decision, even inspecting lines of code that might violate laws or company standards. When Apple bought Siri five years ago, it was decided that data on what you ask Siri would be stored separately from personal data, so Siri lacks a lot of the knowledge about you that it would need to be a truly useful assistant.

Ben Thompson:

The net result is that Google has no choice but to put its founding proposition to the ultimate test: is it enough to be the best? Can the best artificial intelligence overcome the friction that will be involved in using Google assistant on an iPhone? Can the best artificial intelligence actually shift human networks? Can the best artificial intelligence win the home in the face of a big head start?

[…]

Google’s competitors, by virtue of owning the customer, need only be good enough, and they will get better. Google has a far higher bar to clear — it is asking users and in some cases their networks to not only change their behavior but willingly introduce more friction into their lives — and its technology will have to be special indeed to replicate the company’s original success as a business.

Update (2016-05-22): Marco Arment (Slashdot):

Today, Amazon, Facebook, and Google are placing large bets on advanced AI, ubiquitous assistants, and voice interfaces, hoping that these will become the next thing that our devices are for.

If they’re right — and that’s a big “if” — I’m worried for Apple.

James Atkinson:

Every year i/o announces new tech. Every year people state Apple is doomed. Google can’t create things people actually want.

Update (2016-05-23): Dave Winer:

Apple could be replaced, for me, by a phone that was somewhat elegant, hardware-wise, and had software that was as easy and reliable as it should be, nine years after the iPhone was first introduced. You expect a certain amount of bugginess at the outset, but over time the glitches should be out and the product should become part of the background, the focus being on what you use the product for. The iPhone resists that. Every time they come out with a new version of iTunes or iOS, it all breaks, and I have to find a new set of workarounds.

Daniel Eran Dilger:

Rather than focusing on the incremental innovation needed to win back the attention of enterprise users and premium consumers, Google’s vision for Android this year has again leapt in new directions which appear even less attainable. Android’s scattered, imitative strategies du jour are resulting in a platform that looks a lot like Apple’s—albeit the very unsuccessful Apple of the mid 90s.

New Touch ID Rules

Glenn Fleishman:

A previously undocumented requirement asks for a passcode in a very particular set of circumstances: When the iPhone or iPad hasn’t been unlocked with its passcode in the previous six days, and Touch ID hasn’t been used to unlock it within the last eight hours. It’s a rolling timeout, so each time Touch ID unlocks a device, a new eight-hour timer starts to tick down until the passcode is required. If you wondered why you were being seemingly randomly prompted for your passcode (or more complicated password), this is likely the reason.

This has been bothering me for months. I thought it was a bug.

How Typography Can Save Your Life

Lena Groeger:

In the case of the weather service’s all-caps type, it’s the font version of the boy who cried wolf. Using ALL CAPS for everything — from severe hurricanes to a slight chance of showers — means that EVERYTHING LOOKS THE SAME AND EVERYTHING LOOKS IMPORTANT. Once people realize that most of the time it’s not, they may become desensitized to warnings. When nothing stands out, people are likely to miss real emergencies.

Now that the weather service can use ALL CAPS sparingly — as a tool to highlight real danger — the public is more likely to pay attention.

Previously: Highway Gothic to Clearview—and Back.

Tuesday, May 17, 2016

ABI Stability Deferred Until After Swift 3.0

Erica Sadun quotes Chris Lattner:

That said, it is also clear at this point that some of the loftier goals that we started out with aren’t going to fit into the release [Swift 3.0] – including some of the most important generics features needed in order to lock down the ABI of the standard library. As such, the generics and ABI stability goals will roll into a future release of Swift, where I expect them to be the highest priority features to get done.

Jeremy Pereira:

Compare the Swift-Evolution goals for Swift 3 to how they were before Chris changed them. They used to be Stable ABI; Resilience; Portability; type system clean up and documentation; complete generics; focus and refine the language; API design guidelines. Only two of those goals will be met – the last two.

Judged by its original goals, the Swift 3 release is a failure. Clearly we lost focus on what we were trying to achieve and we need to understand why. Unfortunately, Chris’s relocation of the goalposts is likely to obscure the fact of the failure and probably the same mistakes will be repeated for Swift 4.

I’m not worried because (a) I see a lot of the stuff that went into Swift 3 as more important than the stable ABI, and (b) I really want them to take the time to get Resilience right. ABI stability doesn’t affect app developers that much. The main issue is that it means you have to build from source, so you can’t include (Swift) libraries that were compiled by someone else, but I don’t see that as a common problem.

Update (2016-05-18): Greg Parker:

If we tried to rush Swift ABI stability out the door for Swift 3 we would certainly end up with deliberate or accidental flaws like the above. Being able to take the time to get it right is a rare luxury.

Erica Sadun:

The move to Swift 3.0 isn’t just going to be disruptive. It’s going to be traumatic. With its expansive renamification and redesigned core types and APIs, Swift 3 is going to be a tidal wave of retraining and refactoring. And with a list of objectives that didn’t quite make the cut, and a laundry list of of items that should have, Swift 3 just doesn’t have enough time or scope to be perfected.

So why not just push it back? Let us devs use Swift 2.2, which is terrific, for a few more years and get Swift 3 right the first time?

[…]

These arbitrary “update every year” advances that Apple has bought into are more than a little ridiculous when it comes to firmware and OS updates; for languages it pushes beyond the practical.

This is why I thought it was good to get the major source-breaking changes into Swift 3 at the expense of ABI stability. However, it remains to be seen whether that goal can be reached on schedule.

Update (2016-05-23): Joe Groff:

A late ABI is only late until it’s finished; a bad ABI is bad forever.

Ben Snider:

So while ABI compatibility might seem like a big deal to have been pushed off, it very likely doesn’t affect the day to day of most Swift developers.

The most compelling arguments thus far have been around the fact that some developers would like to distribute libraries in binary form so as to protect intellectual property, license agreements, etc. Not having ABI compatibility is actually a legitimate concern for developers wishing to distribute binary libraries, but I don’t really feel like that’s a very large number of developers.

[…]

Which leads to the second major concern: that Swift compile times are a) slow, b) unlikely to get much faster and c) will only get slower as projects increase in size and complexity. Having some libraries built as binary libraries that are simply linked with additional Swift sources would likely result in much faster build and test cycles.

Twitter to Stop Counting Photos and Links in 140-Character Limit

Sarah Frier (via Dan Moren):

The change could happen in the next two weeks, said the person who asked not to be named because the decision isn’t yet public. Links currently take up 23 characters, even after Twitter automatically shortens them. The company declined to comment.

It’s a step in a larger plan to give users more flexibility on the site. Chief Executive Officer Jack Dorsey said in January that the company was looking for new ways to display text on Twitter, and would experiment based on how people use the service. For example, some people tweet screenshots of longer text in articles, or send many tweets one after the other to tell a story.

Bravo.

Nick Heer:

Strangely absent from this scoop: any mention of also discounting @-replies and user handles. Sometimes, discussions can become deeply nested with many participants, and the character count can impede the discussion, particularly if it involves people with longer handles.

Previously: Twitter Removes 140-Character Limit From Direct Messages, Twitter Won’t Raise 140-Character Limit.

Update (2016-05-26): Twitter:

In the coming months we’ll make changes to simplify Tweets including what counts toward your 140 characters, so for instance, @names in replies and media attachments (like photos, GIFs, videos, and polls) will no longer “use up” valuable characters.

Michael Rockwell:

I’ve seen a lot of outrage in my timeline since this announcement — all of it directed toward the changes to mentions. Users don’t want cluttered timelines and I completely understand that complaint. But I think you’ll be surprised at how few tweets that start with a username are initiated without the reply button — I don’t think Twitter would have made this change if that wasn’t the case.

[…]

That “ceiling of 50 names” only matters specifically for replies. In order for usernames not to count toward your 140-characters, you’d have to reply to a thread that included 50 other users. It’s not as if spammers could just add 50 arbitrary names to a tweet and send it out without restriction.

Update (2017-01-23): David Heinemeier Hansson:

It’s been 8 months since Twitter announced links wouldn’t count against 140 limit. They still do. Oy.

iTunes 12.4

Kirk McElhearn:

When I reviewed iTunes 12 back in late 2014, I said, “Overall, I find the navigation confusing—it requires too many clicks to get around.” I find the changes Apple has wrought to the interface of iTunes 12.4 to be both positive and intuitive, and I think all users will find these new ways of navigation to be more efficient, once they get used to them.

Navigating iTunes is now—or, again—centered on the sidebar and a single menu in the navigation bar. (You can show or hide the sidebar in the View menu.) Instead of a lot of confusing media kind buttons in the navigation bar, there is now a popup menu that Apple calls the Media Picker. Click it to choose a media library, edit the Media Picker menu, or mount another iTunes library with Home Sharing.

[…]

Apple has thankfully merged the two different types of contextual menus, in most locations. Instead of one menu displaying when you click the ... button, and another when you right-click an item, the menus are the same, and work in the same way.

Kirk McElhearn:

But there are a lot of little changes I’ve spotted in the latest version of iTunes. Here are some of them[…]

Doug Adams:

Apple released iTunes 12.4 today. It features a significant UI change as well as updates under the hood. And AppleScript additions!

Benjamin Mayo:

The sidebar is a resurrection from the days of iTunes 11. I like the sidebar better than the transient popover (OS X has enough screen real estate to allow such affordances) but it hasn’t been thought through. It’s shoddy and incomplete. There are distinct sidebar sources for Albums and Compilations and yet selecting Albums still shows Compilations in the detail view when you scroll down. Some media types do not hide the sidebar but have no sidebar items to choose between (Podcasts). Many media views have no sidebar at all, leading to jarring transitions between tabs, including all of Apple Music.

See also: MacRumors.

Update (2016-05-20): Kirk McElhearn:

As timmorrislw points out in the comments, there’s a new iCloud Status of No Longer Available. This shows tracks that you added to your Apple Music library that record labels are no longer allowing to be streamed. It’s interesting to create a smart playlist with this condition, to find how many tracks have been removed. Previously, I had, as the comments said, a smart playlist excluding all the other statuses. Out of 16,000 tracks in my Apple Music library, 843 are no longer available.

Update (2016-05-21): Doug Adams:

The podcast value for media kind will confuse older scripts that look for the podcast property of track. The podcast property for track (“is this track a podcast episode?”) was removed in iTunes 12.4. Similarly, the iTunes U property of track has also been removed and is now a value for media kind.

Monday, May 16, 2016

Larry and Steve’s Plans to Save Apple

Larry Ellison (via Ole Begemann):

“My idea was simple, buy Apple, and immediately make Steve CEO. Apple wasn’t worth much back then, about $5 billion dollars. We both had really good credit and I had already arranged to borrow all of the money. All Steve had to do was say yes.

“Steve proposed a somewhat more circuitous approach. First, persuade Apple to buy NeXT computer, then Steve would join Apple’s board and over time the board would recognize that Steve was the right guy to lead the company.

Restoring Google Chrome Tabs

The best way is to go to the settings and change “On startup” to “Continue where you left off.” However, if you haven’t done this before you relaunch Chrome and want your tabs back, you can press Command-Shift-T. This corresponds to the “Reopen Closed Tab” command in the File menu, which sounds like it will just bring back the last tab that you closed, but it will actually restore all the tabs in the window. It is not as good as Safari’s “Reopen All Windows From Last Session,” which will restore all your windows.

Spotting Fake Amazon Reviews

Lauren Dragan:

Have you ever seen some random product for sale that’s from some brand you’ve never heard of, and the company has no website—yet its widget has somehow garnered 15,000 five-star reviews since … last week? We sure have. This situation is likely the result of a compensated-review program. Such compensated reviews—orchestrated by businesses that cater to companies that want more public positive feedback—violate Amazon’s terms of use but are difficult to police.

[…]

You have a few ways to suss out what may be a fake review. The easiest way is to use Fakespot. This site allows you to paste the link to any Amazon product and receive a score regarding the likelihood of fake reviews.

Previously: Amazon Sues Fake Review Site.

Texting Siri

Rene Ritchie:

No matter how enabling and useful Siri is, though, there will be times when it’s simply not possible or socially acceptable to talk out loud to our phones or tablets. In those situations, being able to type “Cupertino weather” or even “Text Georgia I’ll be late” would be incredibly useful.

Via Joe Cieplinski:

What makes the Echo or Siri useful is not the voice activation. It’s the (somewhat) intelligent response.

[…]

A Spotlight text field should be able to do whatever Siri does. Don’t get caught up in the trend of talking to our devices; concentrate on expanding how Siri, Alexa, etc. interpret our prompts, spoken or otherwise.

Announcing SyntaxNet

Slav Petrov (Hacker News):

At Google, we spend a lot of time thinking about how computer systems can read and understand human language in order to process it in intelligent ways. Today, we are excited to share the fruits of our research with the broader community by releasing SyntaxNet, an open-source neural network framework implemented in TensorFlow that provides a foundation for Natural Language Understanding (NLU) systems. Our release includes all the code needed to train new SyntaxNet models on your own data, as well as Parsey McParseface, an English parser that we have trained for you and that you can use to analyze English text.

Friday, May 13, 2016

Gboard

Rajan Patel:

iPhone users—this one’s for you. Meet Gboard, a new app for your iPhone that lets you search and send information, GIFs, emojis and more, right from your keyboard.

[…]

With Gboard, you can search and send all kinds of things—restaurant info, flight times, news articles—right from your keyboard. Anything you’d search on Google, you can search with Gboard. Results appear as cards with the key information front and center, such as the phone number, ratings and hours. With one tap, you can send it to your friend and you keep the conversation going.

John Gruber:

This privacy policy could change in the future, of course. Deals can be altered, and Google’s history of deliberately circumventing iOS privacy features is well-documented. But right now, it looks like Gboard is actually private. In fact, so far as I can tell, not only are you not required to sign into a Google account to use it — there is no way to sign in to a Google account even if you wanted to. Queries sent through Gboard don’t show up in my Google search history, even when I’m signed into my Google account in other Google iOS apps. Only what you type in Gboard’s search input field gets sent to Google, and even that is always sent anonymously.

With iOS multitasking and clipboard actions being relatively awkward, this could be really convenient. I was pleasantly surprised by how well swipe-typing worked—much better than with other iOS keyboards I had tried. However, there are two major flaws: it doesn’t support 3D Touch cursor movement, and it doesn’t support the system typing suggestions. These are probably due to OS limitations.

Update (2016-05-13): Edward Marczak:

GBoard apparently supports cursor moment via sliding right and left on the spacebar. Great for us non-3D Touch people.

This is interesting because it seems faster and more reliable than 3D Touch, but it does not support moving vertically.

Update (2016-05-14): Gboard has a nice feature where the Delete key deletes the entire previous word if the cursor is at the end. I also noticed that TextExpander expansions in OmniFocus don’t work when using Gboard.

Honza Dvorsky:

Google knows very well who you are, since shared containers of all apps from one company share data.

David Pogue:

Plenty of little companies make those free software keyboards, of course. But how weird is it that two behemoths—Microsoft and Google—both turn out to have been working on iOS keyboards in parallel?

[…]

If you tap it, you insert only a link to a Google search for that information—not the information itself […] You’re forcing your recipients to open their browsers and, of course, do a Google search, rather than just showing the information you’re seeing in the results.

[…]

Before you rush off to download Gboard, here’s a sobering bit of news: You lose the ability to dictate text.

Update (2016-05-16): John Gruber:

They could use shared containers to share login data, but they don’t in Gboard, at least now.

Packing Bytes in Swift

Russ Bishop:

I want to do this purely in Swift and mostly analogous to what you’d do in C because it’s relatively quick, doesn’t introduce any dependencies, and the decoder is really simple and could be implemented on any platform.

[…]

We can calculate the appropriate location in the buffer by performing arithmetic on the UnsafeMutablePointer itself. The key is that unsafe pointers in Swift know the size of the type they are working with and all adjustments are made in terms of the size of that type, not in bytes! (A Void pointer does work in terms of bytes since it knows nothing about the size of the type).

[…]

Why pass in a deallocator function? Technically you might be able to get away with NSData(bytesNoCopy:length:freeWhenDone:) but that would just be an accident of implementation. If the Swift runtime did (or does) use a different allocator than the default system malloc/free then You’re Gonna Have a Bad Time.

He doesn’t show them, but Swift numbers actually do have built-in methods for endian conversion.

The Natural History of Palatino

Jennifer Kennard (via Nick Heer):

The Book Club of California has announced the release of a definitive account of Herman Zapf’s enduring typeface Palatino, written and designed by Canadian poet, historian, linguist, typographer, and book designer, Robert Bringhurst. Published nearly a year after Zapf’s death at age 96, Palatino, The Natural History of a Typeface, explores the evolution of his most ambitious design project; from his original sketches in 1948, to the first trial cutting of Palatino roman at the Stempel Foundry in 1949, and to the last authentic digitally drawn members of the family which Zapf himself carefully supervised just ten years ago. The story of Zapf and his notorious typeface which he originally named Medici, also bridges one of the most transitional periods in all of the history of typography and printing; spanning the age of metal type, photo lettering and then digital.

Previously: Hermann Zapf, RIP.

Apple Shortening App Review Times

Alex Webb (Hacker News, MacRumors):

Apple Inc. has cut the approval time for new submissions to its App Store from more than a week to less than two days, part of a broader push to increase revenue from services including mobile applications.

The accelerated pace allows app developers to fix bugs faster, try out new features more regularly and better react to market changes, while building developer loyalty to Apple’s iOS mobile operating system. The mean approval time has fallen from 8.8 days a year ago to 1.95 days in the past two weeks, according to AppReviewTimes.com, which analyzes user-submitted data. In December, the average was more than five days.

John Gruber:

Wonder how Apple is achieving this. More reviewers? Lower standards?

Federico Viticci:

The Mac App Store, which is smaller in volume than the iOS App Store, is currently seeing app review times of 24 hours.

In addition to AppReviewTimes’ crowdsourced data, anecdotal experience from my own conversations with developers indicate that, particularly over the past two weeks, approval times of 2-3 days have become quite common for iPhone and iPad apps.

I have been hearing good reports from developers, too. Hopefully, it continues.

A lot of people have been questioning the explanation that the impetus was to increase Apple’s revenue from services. I wouldn’t read too much into that or worry about which bucket costs and revenues will be counted in. First, Apple has been trying to create a services narrative because of the decline in hardware sales. So it would be strange not to mention a services angle. Second, if you presume that Apple always knows how to maximize its long-term profit, a change like this will never make sense because either they were leaving money on the table before or they’re doing so now. The proper way to think about this is that Apple is always trying to do what’s best (for Apple) but that its idea of how to do this can change. Developers have long believed that improving the experience for them would ultimately benefit Apple. Better software would make the platform stronger, Apple would sell more devices, and it would collect App Store fees on increased sales. Perhaps Apple is starting to believe this as well.

Thursday, May 12, 2016

Proposed Client-side Encryption in OmniFocus

Wim Lewis (via Ken Case):

Our main goal is to secure your data against a passive attacker: someone who can read the files on the server, intercept them on the network, look at old backup tapes, etc., but who cannot modify your files on the server. This describes a lot of real-world compromises. The passive attacker should be able to learn very little about your use of OmniFocus. They will, by definition, be able to tell when you’re making changes and syncing them, and they can tell if you’ve added an especially large attachment, for example, because of the increase in traffic. But they should not be able to read the contents of any of your tasks.

[…]

An OmniFocus sync database is a directory full of files which are read and written asynchronously by multiple clients that don’t have other ways to communicate.

An encrypted database has one extra file, the “encryption metadata” or key management file. Your passphrase decrypts this file, which contains one or more file-encryption subkeys, each with an identifying key index.

[…]

TL;DR: PBKDF2-SHA256, AESWRAP, AES128-CTR, HMAC-SHA256.

Long List of Ways Mac OS X Starts Code Running

John Gordon:

Without an uninstaller we end up doing a hunting expedition when weird things happen. Code that starts automatically is particularly hard to track down. I wrote this post as a reference for me, drawing from a few Super User and other posts[…]

Keir Thomas:

Moving beyond Gordon’s analysis, two free apps can help begin to sort out the mess and discover what apps are attempting to run in the background of your Mac:

  • KnockKnock: Malware installs itself persistently, to ensure it is automatically executed each time a computer is restarted. KnockKnock uncovers persistently installed software in order to generically reveal such malware.
  • Etrecheck: EtreCheck is a free tool that explains what is going on inside your Macintosh. It consolidates information from over 50 different diagnostics tasks and displays it all on one concise report.

Beware the UIKit Visitors

Rupert H:

My discovery for the day is iOS has an O(n^2) cost to add a subview so never have too many subviews on a view or performance goes to shit

Wooji Juice:

I’ve found that setting tintColor on the view manually before adding it to the hierarchy helps a lot.

Benjamin Encz:

This means, that as soon as a _UITintColorVisitor has an original visited view (which is true after it visited its first view), the outlined code checks if the subviews array of the originalVisitedView contains the currently visited view. This check scans the full array of subviews; in cases where the originalVisitedView is our root view, the cost of this operation grows linearly with the amount of added subviews.

[…]

Once we know the memory address offset we can create breakpoints in lldb based on addresses in Hopper.

[…]

With this approach I identified that with the current sample code, eax always refers to the root view. This means we are iterating over all subviews of the root view, N times for each subview that is added.

Update (2016-05-14): See also: Hacker News.

Compile Time vs. Run Time Type Checking in Swift

Benjamin Encz:

The dynamic type check in the above example actually works correctly. The body of the if let block is only executed for types that conform to our two expected protocols. However, we cannot convey this to the compiler. The compiler expects a concrete type (one that has a fully specified type at compile time) that conforms to HumanType and HasName. All we can offer is a dynamically verified type.

[…]

The solution of the “type erased” function that accept an Any argument isn’t really nice either; but in practice I have used similar approaches in cases where other code guarantees that the function will be called with the correct type, but there wasn’t a way of expressing that within Swift’s type system.

Update (2016-05-12): Joe Groff:

It is possible to “open” a protocol<> type into a concrete type via a protocol extension.

Wednesday, May 11, 2016

Now I Get It: Snapchat

David Pogue:

I don’t use Snapchat. And no wonder: Most people who use it are under 25, and 70 percent of them are female. I’m neither.

At the same time, I’ve been dying to understand Snapchat. I mean, it’s a major cultural force: 200 million people are using it. They send 20,000 photos a second and watch 8 to 10 billion videos a day. The company has yet to turn a profit, but it turned down Facebook’s offer of $3 billion; today, it’s valued at $20 billion.

[…]

First, you need to know that Snapchat is really three apps crammed in one.

New Instagram Icon

Armin Vit:

The skeuomorphic camera icon that has accompanied Instagram until today is a modern-day classic. Not because it’s good — it’s not, really — but because of its omnipresence in users’ phone screens. I bet it’s on the home screen of 99% of people who have the app and who tap it very regularly. When the iPhone first came out — if you’ll remember — skeuomorphism was the default aesthetic and now, for better or worse, it’s all about flat design with a dash of optional gradients so it’s no surprise that’s where Instagram has headed. If there was any surprise it’s that Instagram held on to the skeuomorphism for a relatively long five years.

[…]

About 75% of the negative reaction will be simply to the fact that it has changed and the other 25% will be to the not-quite-fact that there is a generic aesthetic to the new icon where it could be a “camera” icon for the upcoming smart microwave from Apple or whatever other user interface you would imagine. This is not to say it’s a bad-looking icon, no… as far as camera icons go, this is quite lovely and has the minimal amount of elements necessary to be recognized as a camera BUT not the minimal amount of elements necessary to be recognized as Instagram.

It’s interesting to compare with this hypothetical flattening of the old icon.

Update (2016-05-12): See also: John Gruber, Nick Heer, Dan Counsell.

Update (2016-05-18): See also: Eli Schiff.

No More Logs for Missing NSAutoreleasePool

Uli Kusterer:

So apparently Apple removed the “object autoreleased with no pool in place” error message.

Chris Nebel:

Not removed, but disabled by default. Set OBJC_DEBUG_MISSING_POOLS=YES to get it back. (Set OBJC_HELP=YES for more options.)

See also: What does “Autoreleased with no pool in place” mean?.

Update (2016-05-12): Greg Parker:

Note that the environment variable also changes behavior: it introduces leaks anywhere that the implicit pool would have worked.

Show TODOs and FIXMEs As Warnings in Xcode

Jake Marsh (in 2011):

Now just build and you’ll see all your //TODO: and //FIXME: comments have become warnings. I love this technique, it might not be right for everyone, but hope it helps someone.

Xcode parses the output of a shell script build phase looking for “warning:”.

Via Daniel Jalkut:

Since I complained yesterday about Swift’s lack of a counterpart to Objective C’s #warning directive, folks have been in touch to encourage another solution to this problem.

“Please Rate My App” Dialogs

Amy Worrall (tweet):

I used to really dislike the door-slam dialog boxes that many apps pop up when they’re updated, saying “Please rate my app”.

[…]

John Gruber encouraged his readers to rate apps that asked for ratings with one star. Now that the App Store is so hard to make money in, I’ve come up with an analogy for that:

Pressing “No Thanks” to the rating dialog is like refusing to give change to a beggar. Rating the app 1 star because of the dialog is like punching the beggar in the face to try and discourage people from begging.

[…]

I put a distinctive, attention-grabbing ratings prompt into the table view on the main screen of the app, three days after an update is installed. But it doesn’t stop you using the app. You can navigate to other screens without issue, and still use all the features. The prompt stays there until you press one of the buttons.

I’m not sure the analogy holds, but I am much more sympathetic to ratings requests these days—if they’re not modal dialogs.

Update (2016-05-20): Dan Moren:

Blackbox upends the usual iOS way of doing things in a number of ways, of which convincing users to rate the app is only just one. Ryan’s post is well worth a read, especially for developers trying to figure out how to get those reviews without raising users’ hackles.

Tuesday, May 10, 2016

Some Static Analyzer Warnings Off by Default

Peter Steinberger:

The Static Analyzer in Xcode 7.3 learned a few new tricks that are off by default.

I added the following to my xcconfig file:

CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES
CLANG_ANALYZER_LOCALIZABILITY_EMPTY_CONTEXT = YES
CLANG_ANALYZER_NONNULL = YES
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES

Nicolas Bouilleaud:

I thought “Missing localizability” was about missing translations, which would be super useful.

Instead, it warns when using raw, unlocalized NSStrings into UI methods. Which is cool, but less useful.

Now how does clang know which API is “UI”? Behold

It’s pretty impressive in that it can even find an NSString that’s used to create an NSAttributedString that’s used for a menu title. However, it also finds some false positives because it assumes that every string needs to be localized. For some that doesn’t make sense. And others, such as my alert help anchors, may not need to be based on your specific situation.

Clang:

If your project deliberately uses unlocalized user-facing strings (for example, in a debugging UI that is never shown to users), you can suppress the analyzer warnings (and document your intent) with a function that just returns its input but is annotated to return a localized string.

[…]

There is currently no solid mechanism for suppressing an analyzer warning, although this is currently being investigated.

However:

When the static analyzer is using clang to parse source files, it implicitly defines the preprocessor macro __clang_analyzer__. One can use this macro to selectively exclude code the analyzer examines.

I’m using that because the analyzer complains about an AuthorizationItem.value being NULL even though the documentation says it can be.

Update (2016-05-11): Note that the analyzer warnings don’t work for Swift code.

PSPDFKit Framework Size

PSPDFKit:

The PSPDFKit SDK covers most of the PDF specification, which contains thousands of pages, and thus is quite complex. PSPDFKit includes a complete PDF renderer, cryptography and many UI components. This results in a lot of code and thus a sizable binary, although there are certain factors that make it appear larger than it actually is. We’re working hard to ensure the framework size stays as low as possible.

[…]

The PDF specification requires us to embed a sizeable list of character maps that add a few megabytes per architecture to ensure that text in PDF form can be converted to Unicode to make search and text selection work as expected.

[…]

PDF has been around since 1993 and evolved a lot since then. This also means that there is a lot of legacy baggage in the specification - and one of the main promises of PDF is that even your 20-year old documents will still render as they were, pixel-perfect. The specification, currently at version 1.7, has 756 pages.

[…]

Next to the official specification, there’s also “real world” PDF which often has bugs based on misunderstandings or bugs in creation software that need specific workarounds and hacks. Adobe Acrobat is very forgiving in terms of invalid references, duplicate entries, typos and allows various drawing command variations that are nowhere documented - these are things that have to be found out via trial and error and also add to the complexity of a rendering engine.

Tweetbot 4.3 Introduces “Topics” for Easier Tweetstorm Creation

Federico Viticci:

Here’s how Tapbots turned a hacky workaround into an elegant option: you don’t have to actually reply to yourself, remove your username, or chain tweets every time. You can just tweet by opening the compose screen and assigning a topic. Under the hood, Tweetbot will find existing tweets belonging to a topic, it’ll fetch the latest tweet from that group, and it’ll send the new tweet as a reply to it. It even takes care of automatically stripping your username at the beginning of the tweet. Everything happens behind the scenes. You don’t have to manage any of it, and you’ll end up with a series of threaded tweets that’s really a string of messages in reply to each other. It’s much simpler and faster than creating a tweetstorm by replying to yourself. It feels like a native Twitter feature.

It gets better if you decide to publish a topic as a collection. Until today, Tweetbot had no way to display Twitter Collections, let alone create new ones. Twitter itself doesn’t support adding tweets to collections on its iOS app – you’ll have to use Tweetdeck. With Tweetbot 4.3, Tapbots added support for the Collection API to add tweets from a topic into a collection. Ironically, Tweetbot has a better chance at making collections more widely used than Twitter’s own iOS apps.

Dropbox API v2

Alexandra Feldman (via Max Seelemann):

Developers, it’s time to start migrating your apps to API v2. To help with this transition, today we’ve published a migration guide that will take you through all of the changes you’ll need to make to get your app running on API v2. […] Remember, any new functionality in the Dropbox API will only be added to API v2. So, upgrade your apps to v2 now, and make sure your users are getting the most out of your app’s Dropbox integration.

Tim Johnsen:

In a bold move, Dropbox’s client library for iOS was written in Swift instead of Objective-C like their v1 library was. Furthermore, their Swift client library was written in a way that’s actually incompatible with Objective-C, making it challenging for a lot of existing apps using the v1 library to adopt.

Many developers are unhappy with this decision, as there’s not a clear path to upgrade from v1 to v2 that doesn’t involve rewriting an app in Swift or adding a Swift-to-Obj-C compatibility layer.

[…]

A couple weeks back I decided to start writing an Objective-C Dropbox v2 client library to use in Close-up, and I’m proud to announce today that I’m open sourcing that library. It’s named TJDropbox, you can check it out here!

Previously: Dropbox API v2 Drops Objective-C SDK.

Update (2016-06-29): Alexandra Feldman:

As of today, Dropbox API v1 is deprecated. This includes both the user endpoints (a.k.a. the Core API), and the team endpoints (a.k.a. the Business API). In order to provide our developers with the most up-to-date features and support a single, consistent platform, we’ll be turning off API v1 a year from now, on 6/28/2017.

Dropbox:

We are working on an Objective-C SDK for API v2, and expect to release it in August.

Ole Zorn:

Good to hear, but announcing a shutdown date before having an SDK for >90% of existing iOS apps seems insane.

No More Mac Accelerometers

Avi Drissman:

Apple stopped putting accelerometers into MacBooks. Never in the new MacBooks, not since 2009 in the Air line, not since 2013 in the Pros.

He was using it to implement the deviceorientation property in Google Chrome.

Apple:

All Intel-based Mac notebooks have Sudden Motion Sensor technology. […] Computers with Solid State Drives (SSD) or Flash Storage do not use SMS as the drives have no moving parts.

Lost Calendar Events, Change Notifications, and iCloud

Google Calendar initially did not seem to be fully reliable with iOS, so I’ve been using iCloud’s calendar pretty much from the beginning. It worked great until about a month ago. Since then, I’ve lost at least four calendar events, in a strange way. I would edit an event’s title or note and see this reflected on the calendar. Then, within a day or so, the event would disappear from all my devices. The only reason I noticed this is that, because of the recent edit, it was fresh in my mind that I had an upcoming appointment.

My first thought was that maybe I had deleted the events by mistake. The events were on a shared calendar, and my wife had subscribed to receive e-mail notifications of any changes that I made. She had an e-mail for each edit, but there were no records of the deletions. So it doesn’t seem like I deleted them. She wouldn’t intentionally delete my events, and if she had done so by accident I should have received notification e-mails, which I didn’t.

Could it be due to a client bug or error? I don’t think so, based on my rough understanding of how CalDAV works. Plus, an accidental delete command should have generated a notification e-mail from iCloud, anyway. I use Fantastical on all my devices, so I contacted Flexibits Support. I got an immediate reply, but they had not heard of problems like this and agreed that it didn’t seem like Fantastical was responsible. Calendar clients don’t directly add and delete shared files; they send streams of commands to the server. So even if the wrong command were sent, the server should still have sent a notification.

Step two was that I wanted to make sure I wasn’t missing any other calendar events, ones that were not fresh in my mind. I archive my old calendars to PDF, so I know I have a safe copy of everything from prior years. But I certainly don’t want to miss something that’s coming up.

Apple’s tools don’t seem to provide a good way to answer this question. Calendar does not support browsing using Time Machine. The Web version of iCloud did recently add a way to restore previous calendar versions, but this is not a good fit for several reasons. First, there is no way to download or browse your calendar backups, much less compare them to find the differences. You have to overwrite your current calendar—actually all of your current calendars, and reminders. Second, restoring a backup is problematic. It warns you that “all sharing information will be removed” and that “scheduled events will be cancelled and recreated, and invitations reissued.” Plus, it wasn’t clear to me what to do. How far back should I restore? How exactly would I find deleted events? Reapplying all the changes from the backup to now would be practically impossible, so I would actually need to restore again, from the most recent backup, and then try to recreate just the deleted events. If there were a problem with the backup or restore I could end up in a much worse situation. I didn’t like this approach.

A better idea seemed to be to dig into the files myself. I had backups from my Mac and could compare the files if needed. But, even better, I have been making regular Git archives of my local Calendar store, which is essentially a folder of .ics files, one per event. I was able to look through the Git logs and see which files had been deleted. They were all ones that I had edited recently. I recreated the events manually in Fantastical.

Step three was to try to set up better logging for the future. If I could easily see a log of the changes that I had made, it would help me to notice anything missing, and I would also have a backup, of sorts, that could be used for easier manual reconstruction. iCloud’s e-mail change notifications would make a pretty good log, but they only notify you of changes that other people make. To get a complete log of changes, I needed to create a separate Apple ID that would only be used to receive notifications. It turns out that doing this from the iCloud Web site doesn’t work because you won’t have access to Calendar, only to the iWork apps. I had to sign into the iCloud account from a Mac OS X installation in VMware in order to activate the Calendar features. Then I could access Calendar from the Web. (The e-mail notification option is only in the Web version, anyway.)

At this point, I thought I was done except that, a day or so later, the notification e-mails stopped. I had not touched that iCloud account since enabling the notifications, so I know that I didn’t change anything. However, when I logged in again I found that “Email me shared calendar updates” was mysteriously unchecked. I checked it again and since then the notifications have worked as desired. Fingers crossed that this continues.

In conclusion, iCloud Calendar is not as reliable as I thought it was. This is probably not the type of reliability problem that would show up in Apple’s statistics. Indeed, I did not report it to Apple because I did not know how to do so in a useful way. Contacting Apple’s support didn’t seem like a productive avenue, and since my Mac is more than three years old it’s no longer covered by Apple Care, anyway. So I’m hoping this was just a fluke that won’t happen again. More generally, Apple seems to be trying to get rid of the notion of files, but the tools for dealing with non-file-based data are few and crude. And this all becomes more complicated when the data is shared among multiple users.

Tim Schmitz:

The details have shifted over the years, but the basic form remains the same: [Notes] Changes made on one device sometimes don’t show up on others. The situation improved somewhat since Apple introduced CloudKit and started migrating apps to it, but problems still occur. It happened to me just recently: I added a note to the Apple Notes app on my iPhone, then switched to my Mac, where Notes was already running. No note.

[…]

I get where Apple’s coming from: They want sync to feel seamless and effortless, something that happens without the user having to think about it. But the fact of the matter is, it doesn’t work that way. Sync rarely does, because it’s a very hard problem to solve. Apple isn’t alone in having trouble with it by any measure. But by not giving users a way out when problems do happen, they increase the perception that Apple services don’t work well.

Tom Harrington:

iCloud backups from iOS are broken. Again.

If you think your phone is backing up to iCloud, you should check. When it fails, it often fails silently, and for weeks at a time.
Don’t trust iCloud backups on your iOS devices.

See also: Siracusa’s Pages lament.

Ben Thompson:

Cloud services, meanwhile, are still less reliable than Apple’s competition, and the integration — Apple’s supposed strength! — with Apple’s software is at best a source of irritation and at worst very worrisome from a security perspective: little things like constantly being prompted to enter one’s password are not only annoying but also corrosive when it comes to what should be a healthy skepticism about sharing the keys to your life.

The problem in all these cases is that Apple simply isn’t set up organizationally to excel in these areas[…] The root problem in all these cases is the lack of accountability: as long as the iPhone keeps the money flowing and the captive customers coming, it doesn’t really matter if Apple’s services are as good as they could be. People will still use the App Store, Apple Music, and iCloud, simply because the iPhone is so good.

Update (2016-05-10): Russell Ivanovic:

Tried to sync a desktop background over iCloud Drive. On the other side: “Can’t open Document (null)”. Can’t copy the file either.

Deleted the PNG, added it again, same thing. Gave up and put it in DropBox, works fine.

Update (2016-05-11): John Chaffee informed me that BusyCal’s log of changes from the server could help spot deletions. BusyCal also has an automatic backup feature that can restore a single calendar and does not have to overwrite existing calendars.

Update (2016-05-12): Hwee-Boon Yar:

I have had events that were around for a while mysteriously duplicated. When I delete one of them, both disappeared.

Update (2018-05-01): I’m continuing to have problems with iCloud Calendar not consistently sending e-mail change notifications.

Monday, May 9, 2016

Apple’s Actual Role in Podcasting

John Herrman:

It is, in other words, an industry now, one that Apple essentially gave life to and still dominates. Yet at this moment of triumph for podcasting, concerns are growing in the community about how much Apple actually cares.

Interviews with over two dozen podcasters and people inside Apple reveal a variety of complaints. The podcasters say that they are relegated to wooing a single Apple employee for the best promotion. That sharing on social media is cumbersome. And that for podcasters to make money, they need more information about their listeners, and Apple is in a unique position to provide it. The problems, they say, could even open up an opportunity for a competitor.

Marco Arment (Hacker News):

This New York Times article gets a lot wrong, and both podcast listeners and podcast producers should be clear on Apple’s actual role in podcasting today and what, exactly, big producers are asking for.

Podcasts work nothing like the App Store, and we’re all better off making sure they never head down that road.

[…]

Critically, despite having these large roles, Apple never locked out other players, dictated almost any terms to podcasters, or inserted themselves as an intermediary beyond the directory stage.

Federico Viticci:

The takeaway from the NYT story is that Leading Podcast Professionals would love ways to have more data about podcast listening habits as well as monetization features to sell access to podcasts via iTunes.

[…]

Right now, the iTunes Store for podcasts is essentially a glorified catalogue of external RSS feeds with show pages, charts, curated sections, and search. And that”s a beautiful thing: there’s little to no barrier to entry. Anyone can make their own podcast feed, host podcast files wherever they want, and Apple’s system will provide users (and other apps) with tools to search and subscribe from a unified location dedicated to podcasts. Ultimately, you own your podcast files, your RSS feeds, and the ads you sell.

Benjamin Mayo:

There’s a possibility Apple’s proactive involvement will be damaging. If I’m right about Apple’s motivation (influx of large corporations), then there’s a good chance independents will get shafted in whatever policies Apple implements. There’s also a chance that it’s a good thing. It’s not out of the question that Apple will add a storefront, so people can subscribe to shows for a monthly rate. Putting to one side the inevitable 30% cut, an easily-accessible subscription model Apple service could open up a new revenue stream for podcasts. More simply, Apple could also improve its podcast marketing and featured content efforts, potentially improving discoverability for good — but low listenership — shows.

Update (2016-05-09): Dave Mark:

It’s hard to make money creating content, whether it be writing, filming, or podcasting. There’s a temptation to hand over the reins, with the hope that a large platform will bring in infrastructure, detailed access to customer usage patterns and, most importantly, a steady paycheck.

Update (2016-05-12): See also: Upgrade.

Update (2016-05-13): Tim Schmitz:

Those responses did a great job of covering things from the podcaster’s perspective, but there’s something else bothering me as a listener. It’s a feeling that podcasting as it stands today, a medium that I get a great deal of enjoyment from, is about to change for the worse. Regardless of whether Apple or any other company caves to their demands, it’s clear that the Big Media world is coming for podcasts, and that doesn’t sound like a good thing.

[…]

In fact, the only changes I’m likely to see (hear?) as a listener are ones that will make my experience worse. Suppose, for example, that some shows become exclusive to tailor-made podcast clients that provide analytics data that others don’t. That only makes my life harder.

Locking in WebKit

Filip Pizlo (Hacker News):

Compared to OS-provided locks like pthread_mutex, WTF::Lock is 64 times smaller and up to 180 times faster. Compared to OS-provided condition variables like pthread_cond, WTF::Condition is 64 times smaller. Using WTF::Lock instead of pthread_mutex means that WebKit is 10% faster on JetStream, 5% faster on Speedometer, and 5% faster on our page loading test.

Making WTF::Lock and WTF::Condition fit in one byte is not easy and the technique behind this has multiple layers. Lock and Condition offload all thread queueing and suspending functionality to WTF::ParkingLot, which manages thread queues keyed by the addresses of locks. The design of ParkingLot is inspired by futexes. ParkingLot is a portable user-level implementation of the core futex API. ParkingLot also needs fast locks, so we built it its own lock called WTF::WordLock.

[…]

Adaptive locks combine parking and spinning. Spinning is great because it protects microcontention scenarios from doing parking. Microcontention is when a thread fails the fast path lock acquisition because the lock is not available right now, but that lock will become available in less time than what it would take to park and then unpark. Before WTF::Lock::lock() parks a thread, it will spin 40 times, calling yield between spins.

[…]

One advantage of OS mutexes is that they guarantee fairness: All threads waiting for a lock form a queue, and, when the lock is released, the thread at the head of the queue acquires it. It’s 100% deterministic. While this kind of behavior makes mutexes easier to reason about, it reduces throughput because it prevents a thread from reacquiring a mutex it just released. It’s common for WebKit threads to repeatedly acquire the same lock.

[…]

It’s clear that the OS mutex is doing exactly what it set out to do: no thread gets to do any more work than any other thread. On the other hand, WTF::Lock does not guarantee fairness. Analysis of the algorithm shows that a thread that has been waiting the longest to get the lock may fail to get the lock and be forced to go to the end of the queue. But this chart shows that even without having a fairness guarantee, the unluckiest thread using WTF::Lock got better treatment than any thread using the guaranteed-fair mutex. It’s almost as if the OS mutex is not actually fair because while thread 1 is served equally to thread 2, all 10 threads are underserved relative to a hypothetical thread 11, which is using a different algorithm. Indeed, we can think of thread 11 as being the OS context switch handler.

Demangling Swift With Swift

Matt Gallagher (tweet):

I rewrote the C++ implementation of Swift’s Demangle.cpp in Swift. My reimplementation is completely standalone and can be dropped directly into any Swift project.

[…]

From the first line, we can see a difference between the Swift and C++ versions. Swift has a standard set of protocols and constraints for defining data providers, so it makes sense to use them. C++ could use a template parameter to define the data provider but since C++ lacks an equivalent to Swift’s protocol constraints and lacks a corresponding set of standard behaviors, the mulitple constraints for the data provider would be a confusing black box thrust upon any user of NameSource – likely manifesting in weird errors in internal headers if any requirements were not met.

[…]

But the most visible difference in adopting Swift error handling is a significant reduction in code size. Switching to Swift error handling immediately eliminated 149 return nullptr early exit lines from the C++ version. Furthermore, Swift can happily exit from a function in the middle of an expression when a parse attempt fails instead of needing to break expressions into multiple pieces either side of early exits.

[…]

Many large C++ projects – Swift included – are compiled with C++ exceptions entirely disabled. Why deliberately remove a potentially useful feature from the language? The Swift developers answer this question when considering error handling options for Swift[…]

[…]

This shows the advantage of a two value switch being idiomatic in Swift: compared to the strange series of #define, if and switch constructions in C++, this is clear, simple and readable.

He downplays the usefulness of the project, focusing on the code comparison with C++. However, I think the code is actually very useful because I want to record readable stack traces when throwing or propagating an error.

Update (2016-05-09): Cédric Luthi mentions the built-in _stdlib_demangleName(), but I think it’s private API.

Friday, May 6, 2016

stringdups: Identify Duplicate Strings or Other Objects

stringdups (via David Smith):

stringdups examines the content of malloc blocks in the specified target process. For all blocks which have the same content, it shows a line with the number of such blocks, their total allocated size (the total size in the malloc heap, not just the specific size of their content), and the average allocated size.

If the MallocStackLogging environment variable was set when the target process was launched, stringdups also displays stack backtraces or call trees showing where all the blocks with a particular grouping of content were allocated.

Updated CrashPlan for Home EULA

CrashPlan e-mailed me some highlights from their license agreement:

We like your feedback on our products. If you do provide feedback, you give us the ability to use your feedback.

[…]

You must connect the devices you back up to the public cloud to CrashPlan Central at least once every 6 months. We may delete data stored in our public cloud associated with devices that have not been connected within such 6-month period.

This clause is new:

You agree that any and all disputes or claims that have arisen or may arise between you and Code42, whether arising out of or relating to this Agreement (including any alleged breach thereof), the Code42 Products and Services, any advertising, any aspect of the relationship or transactions between you and Code42, shall be resolved exclusively through final and binding arbitration, rather than a court, in accordance with the terms of this Arbitration Agreement, except that you may assert individual claims in small claims court, if your claims qualify. […] You agree that, by entering into this Agreement, you and Code42 are each waiving the right to a trial by jury or to participate in a class action. Your rights will be determined by a neutral arbitrator, not a judge or jury.

See also: Arbitration Everywhere, Stacking the Deck of Justice, In Arbitration, a ‘Privatization of the Justice System’.

A Tale of Two Optimizers

Daniel Jalkut:

Today, Apple got back to me with a followup, suggesting rather gently that I may have neglected to disable optimization in my target. Rookie move! The kind of behavior I was seeing in the debugger is exactly what happens when lldb can’t make as much sense of your code because of inlined functions, loops that have been restructured, etc.

In fact, I had correlated the symptoms with such a problem, but when I went to check on the status of my optimization settings, everything looked fine.

[…]

So why does debugging Swift fail so hard for me? Because Swift doesn’t use that optimization setting.

It uses SWIFT_OPTIMIZATION_LEVEL instead of GCC_OPTIMIZATION_LEVEL.

On Flexible Systems

Gerald Jay Sussman (video):

Most systems we build work well for the application that they were designed for, but they are brittle in that adapting to even small changes in the problem requires large changes in the code. Can we optimize for flexibility, trading off other virtues like proofs of correctness or efficient execution? I think this is often the right path.

[…]

I will show where it is to our advantage to make systems with extensible generic operations, and how to control such systems.

He talks about the virtues of late binding, “careful but dangerous” programming, and prioritizing code that is easy to modify and fast to debug.

You Could Almost Do Anything

Eli Schiff:

Several questions present themselves. Firstly, why do modernist designers feel the need to justify obvious (or should I say opaque) abstractions by appealing to metaphorical significance, where no metaphor still exists? This charade certainly fools no one, except perhaps other designers and obsequious journalists.

[…]

A second, more important, question emerges–how can non-designers have confidence in minimalists’ designs if the designers themselves so clearly don’t. How can there be any integrity to glean from–when the designs so readily fail by their designers’ own criteria for judgment?

Thursday, May 5, 2016

Claude Shannon Turns 1100100

Siobhan Roberts:

“It would be cheesy to compare him to Einstein,” James Gleick, the author of “The Information,” told me, before submitting to temptation. “Einstein looms large, and rightly so. But we’re not living in the relativity age, we’re living in the information age. It’s Shannon whose fingerprints are on every electronic device we own, every computer screen we gaze into, every means of digital communication. He’s one of these people who so transform the world that, after the transformation, the old world is forgotten.”

Apple Officially Discontinues WebObjects

Hugi Thordarson (via Kif Leswing):

We probably all know that WO’s been practically dead to Apple for a long time, but unfortunately Apple has refused to state so officially (at least I don’t recall there being an official statement).

Anyhow… In the past years I’ve regularly sent letters to Tim Cook, asking about the state of WO (being the naggy guy I am) and recently, I was contacted by Apple executive relations regarding my questions. The guy I spoke to called a couple of times, at first, he had absolutely no idea what WO was but the second time he called, he had obtained information and had a clear statement: “WebObjects is a discontinued product and will never be upgraded”.

I know this information is extremely redundant, but I still wanted to tell you since it was something of a relief. Felt a little like the police calling you to let you know that they’d found the remains of your friend that’s been missing for 15 years and finally declared him dead.

Update (2016-05-05): Gianluca Bertani:

So discontinued that they built iTunes Connect with it.

Update (2016-05-14): See also: Hacker News.

Improving Apple Music

Mark Gurman:

The new version of Apple Music, which Apple recently announced has 13 million users so far, focuses on a redesigned user-interface, a few new functions, and reorganization as well as simplification of existing features. The new user-interface ditches the current colorful and translucent look in favor of a simpler design that emphasizes black and white backgrounds and text. For instance, the user interface in the albums view will no longer change in appearance based on the color of a particular album’s art. While the new interface will eschew color in the user-interface, album artwork will become “huge” and a larger part of the interface in order to avoid a dull black and white look, according to people who have seen the updated Apple Music service.

The new interface will also make use of additional 3D Touch shortcut previews and better promote the ability to share songs. However, the social Connect feature will remain mostly unchanged in this year’s revamp.

John Gruber:

I still think the most obvious solution is to make Apple Music its own standalone app. “All your music in one app” sounds like a great idea in theory, but in practice, I believe that is what has led to the confusing UI. It’s yet another major feature added to iTunes on Mac and Windows — an app that everyone seems to agree already has too many features and responsibilities. What do you see when you open the Spotify or Pandora apps? Just the streaming music you have access to. That makes them less complicated, by definition. “Everything you see is in the cloud, and you have access to it because you are a subscriber” is easy to understand. “Some of this is in the cloud, some of this you own” is more complicated.

Kirk McElhearn:

The promise of Apple Music and iCloud Music Library was this ability to merge your own iTunes library with music from Apple Music; unfortunately, when Apple Music and iCloud Music Library were launched, it was a disaster, causing no end of problems to people (like me) with large, carefully curated music libraries.

[…]

What is confusing is all the buttons and options, and the poorly designed For You section, which offers useless recommendations that you simply cannot get rid of. If I see a playlist I don’t want to know about in Apple Music, and choose I Don’t Like This, it should disappear, not stay there. It shouldn’t be just about tweaking my personal algorithm, it should instantly go away.

And the other problem – on the desktop at least – is the fact that you can go from Apple Music to the iTunes Store, but not from the iTunes Store to Apple Music. It’s understandable; Apple doesn’t want to give away what it might be able to sell, but it’s crippling Apple Music by not allowing people who get to the iTunes Store via links and making them manually search for an item in Apple Music if they want to stream it.

Update (2016-05-05): Jim Dalrymple (tweet):

I think we can be honest and admit you released Apple Music when it wasn’t ready. There were just too many bugs for it to be any other way, but you did it regardless.

Developers and consumers want to know you heard us—that you took our criticisms to heart and you fixed the problems.

Update (2016-05-06): Tony L:

Regarding Apple Music. AM has 13 million paying users. Pandora has 80 million active users but only 4 million paying users.

Nick Heer:

At its core, as a pure “queue up a song I don’t own” streaming service, I have found Apple Music totally competent. However, there are lots of ways in which the service is failing to live up to the promises of last year’s introductory keynote.

[…]

After reading this series of somewhat disjointed thoughts, you might reasonably conclude that Apple Music is a failed product. I do not believe this is the case. But I do think that it is unfinished, it was rushed, and it does not behave in the real world as Apple imagined it might.

Apple Music Deletes Personal Music Files

James Pinkstone (via Hacker News):

What Amber explained was exactly what I’d feared: through the Apple Music subscription, which I had, Apple now deletes files from its users’ computers. When I signed up for Apple Music, iTunes evaluated my massive collection of Mp3s and WAV files, scanned Apple’s database for what it considered matches, then removed the original files from my internal hard drive. REMOVED them. Deleted. If Apple Music saw a file it didn’t recognize—which came up often, since I’m a freelance composer and have many music files that I created myself—it would then download it to Apple’s database, delete it from my hard drive, and serve it back to me when I wanted to listen, just like it would with my other music files it had deleted.

[…]

What Apple considers a “match” often isn’t. That rare, early version of Fountains of Wayne’s “I’ll Do The Driving,” labeled as such? Still had its same label, but was instead replaced by the later-released, more widely available version of the song.

[…]

Should I choose to reclaim my songs via download, the files I would get back would not necessarily be the same as my original files. As a freelance composer, I save WAV files of my own compositions rather than Mp3s. WAV files have about ten times the number of samples, so they just sound better.

[…]

Amber relayed to me that she’s had to suffer through many calls from people who cancelled their Apple Music subscription after the free, three-month trial, only to discover that all of their own music files had been deleted and there was no way to get them back.

So my files were temporarily restored; but the only way to prevent this from happening over and over, according to Amber, was to cancel my subscription to Apple Music (which she herself doesn’t use due to the above-listed reasons) and to make sure my iCloud settings did not include storing any music backups.

Update (2016-05-05): Warren L. Habib:

All true. Happened to me and same reason I don’t use Apple Music tools at all.

Rosyna Keller says that iTunes moves the files to the trash but doesn’t itself delete them and notes Apple’s documentation on the subject:

When Apple Music adds these matched songs to your iCloud Music Library, Apple Music doesn’t change or alter your original music files that reside in iTunes for Mac or PC or on your iOS devices from which they were added.

[…]

Songs that we find that are available in our catalog are instantly accessible on all of your other devices, and you can save them for offline listening on your devices indefinitely. When iTunes Match adds these songs to your iCloud Music Library, iTunes Match doesn’t change or alter your original music files that reside on iTunes for Mac or PC or on your iOS devices from which they were added.

This explanation of how it’s intended to work seems to contradict both Pinkstone’s report and the statements of Apple support person Amber. It may be that Apple’s documentation is wrong, that Pinkstone is mistaken about what happened and what he was told, or that the software is not working as documented.

Songs that can’t be matched are uploaded from iTunes to your iCloud Music Library and stored in iCloud in their uploaded form. You can also download them in that same uploaded form when you save them offline on your other devices.

It does not say what form it uploads them in, though the iTunes Match FAQ says that it supports WAV.

Rosyna Keller notes Apple’s other documentation:

Songs encoded in ALAC, WAV, or AIFF formats will be transcoded to a separate temporary AAC 256 Kbps file locally, before they’re uploaded to iCloud.

Previously: Apple Music: Problems Adding Albums, Songs Deleted.

Jason Snell:

I’ve got a 103GB music library, including that original Fountains of Wayne song, in iTunes library, attached to Apple Music. All fine.

What that piece is right about is Apple Music’s terrible matching and inability for the user to override/replace bad matches. It’s painful.

Jason Snell:

My theory is that this dialog box is causing a fundamental misunderstanding of what happens next.

Serenity Caldwell:

iCloud Music Library is confusing as all hell, and it’s been so since the first days of iTunes Match. That’s absolutely Apple’s fault.

[…]

So no, Apple Music did not mysteriously delete Pinkstone’s library, and it won’t delete yours. That’s simply not how the service works on the Mac. But if you’re not aware of how iCloud Music Library stores copies of tracks, you may delete your local copies to save space, thinking you can get them back — and get screwed as a result.

Jason Snell:

It’s possible there is also a bug in iTunes that is deleting files. It may be just confusion, or there may also be another vector?

My takeaway from all the people commenting is that no one seems to fully understand how it’s intended to work, or whether it works as intended, so it’s best to stay far away.

Update (2016-05-06): The comments on Caldwell’s piece show the same divide that Pinkstone’s post noted:

I’d already visited the online forum, I said, and they were no help. Although several people had described problems similar to mine, they were all dismissed by condescending “gurus” who simply said that we had mislocated our files (I had the free drive space to prove that wasn’t the case) or that we must have accidentally deleted the files ourselves (we hadn’t).

As Caldwell explains, Apple surely didn’t intend to “steal” anyone’s music, which is why I didn’t use the original headline. But I would not make the leap from defense of Apple’s intentions to assuming that the users who say their files were deleted are at fault or mistaken.

Marco Arment:

It sounds like either a severe user error or a severe bug, and there’s no way to know which it is, but regardless, this aside is good advice[…]

Update (2016-05-07): Ben Lovejoy:

I was extremely unamused when, less than a month later, I boarded a 10-hour flight, got out my iPhone and prepared to listen to some music only to discover that hardly any of it was there. Of all my favorite albums, lovingly selected as the ones I wanted to have available at all times, just a handful were still present. Others claimed to be present but in fact had just one or two tracks. Everything else had the cloud download icon next to it – which did me no good at all at 37,000 feet.

The iOS Apple Music app had, entirely arbitrarily and without consulting me, dumped most of it.

The poll in the comments says that 72% of readers have had local music disappear.

Update (2016-05-09): Juli Clover:

Apple Music users with personal music collections should create a backup on an external hard drive, which will ensure no music ever goes missing through user error or an Apple Music bug.

Kirk McElhearn:

Amber is wrong. Neither Apple Music nor iCloud Music Library deletes music files. This simply doesn’t happen.

[…]

I don’t know exactly what happened to this user. I contacted him by email trying to get more information, and he told me that he no longer uses Apple Music, so he really can’t help elucidate the issue. There are a few hypotheses circulating about what may have happened, and none of them make total sense. Something deleted his music files—including music he composed—and it’s hard to figure out what was responsible.

Jesper:

People normally sold on more or less everything Apple – people, indeed, through which Apple leak their event preannouncements – have tried and simply given up. The thing eats people’s files. I keep backups and I avoid turning on iCloud Music Library, so I thought I was safe, but in the year I’ve been using it, it’s been pulling down duplicates of things I bought on iTunes ages ago and inserting them as new entries at the top of my library (sorted descended by Date Added). On iOS, it has “very helpfully” restored some ugly-as-fuck album art that I “Got Info” on ages ago and deleted the album art from. And just a few days ago, it seems to have re-checked a bunch of albums and songs that I for various reasons have unchecked through the ages. (Every song in iTunes has a checkbox, and if you uncheck it it won’t be played unless you manually start playing it. If iTunes is to Winamp/VLC what Excel is to TextEdit/Notepad, imagine silent data loss in the form of formatting, value or formula changes in spreadsheets. Heads would roll.)

Update (2016-05-10): Ruffin Bailey:

iTunes Match should’ve let Apple know that they weren’t doing a great job of providing its eponymous function -- matching -- and they really needed to make sure they could get 1.), 2.), & 3.) right before going whole hog into a unified Apple Music. But it’s still just a database management problem. They “simply” should have been much more defensive with Apple Music for when matching failed. If your user doesn’t have a file three places, don’t delete it.

But as long as you have a space for a flag on each file to say which it is -- an unDRM’d original*, an unDRM’d “likely match”, or a DRM’d file that’s never been matched -- you don’t have this trouble.

Update (2016-05-13): Serenity Caldwell:

Based on several Apple Support threads, it appears that the most recent version of iTunes 12.3.3 contains a database error that affects a small number of users, and can potentially wipe out their music collection after the update. The error has been mentioned a few times, primarily on the Windows side, in the weeks since the 12.3.3 update, but appears to be rare enough that it hasn’t previously received major press. Apple did put out a support document shortly after the 12.3.3 update that walks you through some fixes if you find that your local copies of music are missing.

I can’t state for certain that Etropolsky and Pinkstone fell victim to this bug, but based on their descriptions and screenshots, it seems likely that the following happened[…]

Update (2016-05-14): Serenity Caldwell:

Apple on Friday confirmed to iMore that a very small number of users have reported seeing issues with iTunes removing their locally-stored music library. The company has yet to be able to reproduce the error, but plans to release an update to iTunes next week in hopes of fixing this issue and reducing customer confusion.

Serenity Caldwell (via John Gruber):

I read it as “we’re still not convinced it isn’t user error, but we’ll make the dialog boxes less terrible.”

Kirk McElhearn:

There’s no log in iTunes recording what you add and what you delete, no way to look back at previous versions of your library to compare it with the present. However, if you use Time Machine to back up your media, there is a way to see what has been deleted during each backup.

[…]

When you run Backup Loupe, and scan a backup, it takes a while to compare all the files to the previous backup, and you can then examine the differences. Here’s an example. Backup Loupe indicates deleted files by a red number in parentheses. You can see that on my Music disk, 35 files were removed; I drill down in the folder structure to see which files those were.

Update (2016-05-17): Kirk McElhearn:

Plenty of people delete individual files, and if there’s a bug in iTunes that causes the app to trash all your music when you delete one file, that rules out some very unlikely behavior by users. I have no idea if this is what’s going on with deletegate, but it’s certainly worth looking into.

Update (2016-05-18): James Pinkstone (Hacker News):

Tom, along with his boss Ezra, had just spent most of Saturday at my dining room table with me, trying to recreate a disaster like we were Netflix green-lighting Fuller House. So far, no luck.

In the days leading up to our face-to-face encounter, they’d earned more of my trust when they acknowledged that A), they’d read the phone transcripts, and although they maintained that she was mistaken, they did not dispute my account of what Amber had told me, and B), they, too, were convinced this was not user error.

Via Chance Miller:

The Apple engineers hooked up an external hard drive to Pinkstone’s laptop and ran a specialized version of iTunes trying to recreate the mass deletion of music. They spent most of Saturday running tests and communicating heavily with Cupertino throughout the process. On Sunday, Tom returned to Pinkstone’s house to collect data of his iTunes and Apple Music usage on Saturday night, hoping to find some correlation between his habits and the deletion of music. But ultimately there was nothing.

Pinkstone says that overall nothing apparent came from the hours the Apple engineers spent troubleshooting at his dining room table, but he noted it’s an odd issue to recreate. He explained that there’s no pattern to the files that were lost. There were various file types and genres all lost with no relation to one another.

App Store Search Is Currently Broken

Paul Haddad:

App Store search issues reported, let’s see what’s going on with my app. Yeah looks about right.

Ignoring that the right app isn’t showing up.

1. Related search terms are WTF

2. Videos almost never load

3. Barely one result/screen

But Apple, sure go ahead and start charging for search results.

I just searched for “Tweetbot” and also got only Hootsuite and Echofon. This type of thing seems to happen so often. Why doesn’t Apple have a monitoring system that makes sure that apps always show up when you search for them by name?

Milen Dzhumerov:

Search results are currently broken across both AS and MAS for loads of apps (Airbnb, Minecraft, etc). Seems like a bug.

Ole Zorn:

Yep, App Store search is completely broken now. I’m actually curious how much this will affect sales.

John Voorhees shows that searching for Zorn’s Editorial app returns VANIDADES USA Revista by Editorial Televisa Digital.

Maximilian:

None of my apps can be found in search, so I’d assume a lot

David Harrison:

In the Canadian store, I’m not getting ANY results at all.

Ole Zorn:

As always, when Apple has obvious server problems, everything is green, yay!

Craig Grannell:

I realised that I’ve seen this problem crop up quite a bit recently, although I’d never really thought much of it. When writing round-ups, I’d not find the odd app by searching the App Store, and would then check online to see if it still existed. I’d end up on iTunes Preview, click View in iTunes, and then go straight to the app’s page to install it.

[…]

Developer Gary Riches says this screw-up has led to daily sales falling by 66 per cent, and adds that you “literally cannot find my app, even by keyword”.

Federico Viticci:

FWIW, iTunes API search results are all kinds of broken right now too, and Apple Music is also acting up this morning.

Joe Rossignol:

A significant number of users on Reddit and Twitter, corroborated by multiple tips we have received, are affected by an ongoing App Store issue preventing a number of popular iOS apps from showing up in search results unless already installed, including Google, Periscope, Spotify, Tidal, Tumblr, Uber, Vine, Waze, and many others.

[…]

Apple is aware that users have been “experiencing a problem with the App Store” since about 2:00 a.m. Pacific. Apple is “investigating and will update the status as more information becomes available.”

The system status page for the App Store now says: “Service is not working as expected for all users.”

Searching for my apps in the Mac App Store currently finds no results, either.

Update (2016-05-05): See also: James Thomson and Michele Titolo.

Paul Jones:

This reminds me of a fact I learned at an iOS meet up that deserve repeating: as app developers, Apple is our biggest dependency. Mostly this deal works out great: Apple take 30% and the hardware profit to promote and sustain the marketplace for 3rd party apps. But Apple is still a dependency, and this isn’t the App Store’s first year, it’s not Apple’s job to promote 3rd party apps, it’s your job as a publisher. If you don’t like that, there are other platforms.

Joseph Keller:

It also seems as though the problem is impacting the Mac App Store as well, with Apple’s Xcode missing from search results.

James Thomson:

And just like that App Store search works...

Searching now finds one of my two apps in the Mac App Store.

Paul Haddad:

Results are back. Video key frame still hosed, related results still WTFIsh. But I guess it’s something.

Update (2016-05-11): Sarah Perez:

According new analysis from Tune, the majority (65%) of all apps lost more than 10 percent of downloads because of the App Store glitches.

Some apps had it even worse, however.

Around 15 percent of all applications lost more than 50% of their downloads because of the App Store glitch, Tune reports.

Wednesday, May 4, 2016

Apple TV 4 After Six Months

Ole Begemann:

The remote looks really nice, and I imagine it works great in Jony Ive’s perfectly-lit, tidy, pure white living room. In real life, it often is a usability disaster[…]

[…]

Navigating the UI via touch works mostly fine, although it does feel imprecise at times. I imagine that a simple four-directional pad would actually work better for most things I frequently do. However, I can see why Apple went with touch because it allows interactions that would be impossible with buttons, like scrubbing.

[…]

The default UI animations are slooooooow and block user input while they’re running.

[…]

Despite all the problems I mentioned, I really like the new Apple TV and use it almost daily.

Josh Centers:

The problem isn’t a complete lack of apps (there were over 2600 back in December, and likely many more than that now), but a dearth of those that make the Apple TV compelling (see “Apple TV App Store Growing Quickly… In the Wrong Direction?,” 11 December 2015). Just about every cable channel that offers a provider-activated streaming app has an entry in the tvOS App Store. But highly anticipated apps such as Amazon Video, Sling TV, and Spotify are nowhere to be found.

[…]

Elsewhere, Apple TV gaming seems to be struggling. Disney recently announced that it’s already dropping support for its Apple TV version of Disney Infinity, saying in a forum post […] That’s disturbing news for anyone who shelled out $99.95 for the Disney Infinity 3.0 Edition Starter Pack from the Apple Store, which is still on sale! Given that Apple also sells many of the accompanying Disney Infinity action figures, Disney’s abandonment of this app has to be a big blow to the Apple TV team.

[…]

A common lament these days is that Apple promotes big developers while ignoring the little guys. […] That’s if you’re a small fish. If you’re a big developer, you have to worry about Apple competing with your core business! Why should Spotify help boost the new Apple TV with an app when Apple is hoping to drive them out of business with Apple Music? If you’re a content provider, why support the Apple TV, when Apple is likely going to compete against you soon?

Marco Arment:

The new Apple TV is decent, but not great — exactly what I’d say about the Apple Watch, the other new Apple platform launched last year.

[…]

I’d say Apple TV, Apple Watch, and Apple Music all suffer from the same issues facing many Apple products today: […] To summarize it in one word: hubris.

Update (2016-05-04): Lee Bennett:

When writing about TV4, why do people always forget the fact that tapping the four trackpad edges is like the cursor pad they want?

Update (2016-05-05): Nick Heer:

I wasn’t aware of Siri’s language limitations, but so far, the Apple TV has been the best voice control and dictation experience for me. It seems more consistent and reliable than iOS or watchOS, and many of the baffling early-day omissions — lack of App Store or Music search, for instance — have been remedied.

Survey of Developers Who Use Macs

Fournova:

Most programmers would probably agree that unit tests improve code quality. Nevertheless, our survey reveals a big gap between theory and reality: be it lack of time or budget, but only a minority of developers writes unit tests regularly.

[…]

A whopping third of developers uses Trello for task management. This makes it the most popular tool by far, followed by JIRA, Omnifocus, and Wunderlist.

[…]

Developers seem to manage bugs & issues in one of three ways: using JIRA, GitHub Issues, or no special tool at all! With almost one in four developers not using a dedicated tool, a lot of text files and emails must be floating around.

[…]

The overwhelming majority of development teams does not use any dedicated tools to handle customer support. […] On the other hand, those people that do use a customer support tool are in agreement that Zendesk is the go-to service.

The GCD Handbook

Soroush Khanlou:

Calling dispatch_semaphore_wait will block the thread until dispatch_semaphore_signal is called. This means that signal must be called from a different thread, since the current thread is totally blocked. Further, you should never call wait from the main thread, only from background threads. […] One notable caveat is that each time you call enqueueWork, if you have hit the semaphore’s limit, it will spin up a new thread. If you have a low limit and lots of work to enqueue, you can create hundreds of threads.

[…]

If you have many blocks of work to execute, and you need to be notified about their collective completion, you can use a group. dispatch_group_async lets you add work onto a queue (the work in the block should be synchronous), and it keeps track of how many items have been added. Note that the same dispatch group can add work to multiple different queues and can keep track of them all. When all of the tracked work is complete, the block passed to dispatch_group_notify is fired, kind of like a completion block.

[…]

GCD’s barrier set of APIs do something special: they will wait until the queue is totally empty before executing the block. Using the barrier APIs for our writes will limit access to the dictionary and make sure that we can never have any writes happening at the same time as a read or another write.

Update (2016-06-06): Michael Rhodes:

The problem I saw here, which Soroush also notes, is that this approach starts a potentially unbounded number of threads, which are immediately blocked by waiting on a semaphore. Obviously GCD will limit you at some point, but that’s still a lot of work and a decent chunk of memory. While this code is necessarily simplified to introduce this use of semaphores, the bunch of waiting threads needled at me.

To achieve effects like this with queue-based systems, I often find I need to combine more than one queue. Here, in the solution Soroush and I got to, we need two queues to get to a more efficient solution which only requires a single blocked thread.

Twitter Is Back on My Phone

Eddie Smith:

It’s because I created a worse problem by removing Twitter. My desire for news and information didn’t die when I took Twitter away, and I began using the Apple News app. This turned out to be a horrible idea because no matter how much I tried to curate and tell Apple News what I wanted to see, it filled my “You” tab with mainstream headlines of death and disaster. The unfortunate reality of a news aggregator is that by the time you cover every tragedy in the last 24 hours, there’s no room for anything else.

The F-35’s Buggy Software

Dan Grazier (via Hacker News):

Despite many fixes, the aircraft’s Autonomic Logistics Information System (ALIS) is so flawed that government auditors believe the computer system may not be deployable. These problems may also delay the Air Force’s declaration of Initial Operational Capability.

[…]

ALIS is the ground-based computer system meant to diagnose mechanical problems, order and track replacement parts, and guide maintenance crews through repairs. It also allows pilots to plan missions and later review their performance. At least, it’s supposed to do all of those things.

So far, the software has been so flawed that maintenance crews have had to resort to time-consuming workarounds. In one instance, maintainers even had to manually burn data onto CDs and drive off base to send the massive files across a civilian WiFi network.

acomjean:

Speaking as someone who left a company that did radar software development in ADA (and some C). We were a subcontractor of Boeing and wrote the software for them.

We didn’t formally verify the code, its way too complex, but everything was reviewed and heavily tested. And tested again. Then integrated and tested…

Ada is pretty strict and if it compiles you usually had some confidence it was going to at least run ok.

The industry was moving to C/C++ because developers know it and promises of higher productivity. I did kinda grow to like ada. It had its warts, but it was good. It reminds me a bit of GO with its packages.

Tuesday, May 3, 2016

Intel Splits on Atom

Daniel Eran Dilger:

Intel initially intended for Atom to scale down its legacy Wintel desktop x86 processor architecture for use in efficient mobile devices such as phones and tablets, but that strategy has been effectively abandoned as the chipmaker now moves to refocus its sights on modems, data center, Internet of Things and memory chips.

[…]

The move kills Intel’s once enthusiastic plans to muscle its way back into smartphone devices after first fumbling the ball in 2006, when its former chief executive Paul Otellini overlooked the prospect of supplying chips for Apple’s original iPhone as not worth doing.

See also: Hacker News, Slashdot.

Update (2016-05-04): See also: The Talk Show.

Update (2016-05-16): Jean-Louis Gassée (Hacker News):

The Wintel virtuous cycle was running at full speed when Steve Jobs made his visit to Intel. Despite Otellini’s gut feelings, the iPhone was an unproven product in a misunderstood market. It didn’t fit Intel’s financial model — which reminds us that a spreadsheet isn’t a window through which to view the future.

Search Warrant to Force Unlocking iPhone With Touch ID

Mitchel Broussard:

For the first time in a federal case, authorities in a Los Angeles courtroom have issued a search warrant forcing a woman to bypass her iPhone’s biometric security using Apple’s Touch ID system (via LA Times).

[…]

According to jail records, U.S. Magistrate Judge Alicia Rosenberg signed the Touch ID-related search warrant about 45 minutes after Bkhchadzhyan was taken into custody on February 25. By the afternoon of her arrest, the suspect pleaded no contest to the charges of identity theft and gave the court her fingerprint to unlock the iPhone.

[…]

The court’s decision in the case follows the thin rules regarding a person’s Fifth Amendment’s protection against self-incrimination, which relates that numeric passcodes are protected individual privacies, but fingerprints are not. For this reason, some believe new modern laws need to be enacted specifically detailing fingerprint-related security features.

Kuro5hin, RIP

Rusty:

What happened was basically that Internap shut down the data center we were in and had to move the servers, and I conspicuously failed to Deal With Things around that. The content is probably not gone forever, but it may be a little while before it reappears. There’s a very good chance that it will reappear in the form of an archive of static html pages though, not a live community. So if you’d like to, this is probably a good time to mourn what it was, although in that sense K5 has clearly been over for years.

Slashdot:

All the old school Slashdotters remember K5 and understand why this is a sad day. None of the new people have heard of it. In some ways, it was better than Slashdot and had features that Slashdot still doesn’t have. As I recall, users voted on the stories that showed up on the front page. There were trolls, but the flame warriors and crapflooders weren’t tolerated. I didn’t post on K5 very much, but I sure appreciate it. I wonder if, in ten years, people will have the same reaction to Slashdot that you’re having to K5.

Broken Apple Man Page Links

Dr. Drang (tweet):

Yesterday, I discovered that Apple had changed the URLs of all its online man pages. Without, I should add, creating redirects so old links would continue to work. This broke all the man page links I had here at ANIAT and undoubtedly broke links across the internet.

[…]

Most of the URL is the same, but the “mac” part is gone, and the whole library has been moved to the “legacy” subdirectory, which is kind of ominous. I suppose there could be another copy of the library outside the “legacy” subdirectory, but I haven’t found it, and so far neither has Google.

Nick Heer:

Adding a redirect from the prior URL to the new one is old-hat basic stuff. I’d be shocked about this if I didn’t run into an issue earlier this year where I discovered that Apple News links don’t automatically redirect from the http:// version to the https:// version, and simply display a 404 error page instead.

Apple has the same problem for regular documentation links.

Ole Begemann:

Linking to Apple’s site in a blog post is uncomfortable. Most links will be broken or the content will be totally different in a year.

Update (2016-05-03): Jack Lawrence:

I’ve spoken with the team & the redirects were added last weekend. Please test & let me know if you’re still having issues.

I just tested a bunch of links from my old blog posts, and the redirects all worked.

Photosmith Development Ends

Chris Horne (October 2015):

Nearly 5 years ago, two intrepid guys took their photography hobby and years of development background to the relatively new world of the iPad. The iPad was only 8 months old, iOS 3.2 was the latest and greatest, and Lightroom 3 was just released. It was the gold rush era of apps.

[…]

However, we struggled with app crashes—nearly all due to iOS itself. To tap into the Camera Connection Kit, we had to use the built-in photo library tools, and thus Apple’s official photo management library: ALAssets. ALAssets was a poorly designed library, and lamented by developers across the web. Nearly all functions require stopping activity that controls the user interface (a design unique to ALAssets), and even if the function works, it still has a tendency to just crash the app randomly. We were never able to wrangle ALAssets enough to have a usable app.

[…]

It was difficult to constantly keep up with ever-changing Lightroom versions, Facebook and Dropbox API’s and other changes. But to have the main operating system make such drastic changes was devastating to morale, and ultimately, the project; it’s demoralizing to constantly re-write the same parts to try to keep up with Apple’s random changes. Especially when we wanted to focus on features, stability, and other app-related features – not just chasing to keep up with what we had.

Chris Horne:

Undoubtedly, that is a lot of money and most iOS developers would gladly disassemble themselves for such a haul. But consider that that total is spread over four years and has to pay contractors, advertising, cloud services, software licenses, and hardware devices it actually doesn’t go that far. After all expenses the developers took home under $20,000 a year before taxes. A nice sum to be sure, but far short of a full-time wage especially considering we were working 40+ hours/week routinely.

[…]

Over and over we were told to drop the price and make it up in volume. We did experiment with that a few times and always found that the support load of higher volume overwhelmed any positive revenue changes.

[…]

One interesting thing that we did find testing pricing is that Photosmith has an unexpected demand curve and was actually more successful at high price points. The following chart does not show the associated support costs but they were directly correlated with volume and thus dropped as we increased price so our net revenues were far higher at $20 than they were at $10.

Via Michael Yacavone:

Apple might want to consider what it takes to make an app with 24K downloads (over four years) successful.

Update (2016-05-05): ALAsset was deprecated in iOS 9. There is now a completely new PHAsset framework.