Thursday, July 24, 2014

The Magic Question That Turns Transactions Into Relationships

Heidi Roizen:

In short, the problem with people asking for what they need, is they used only their brain to figure out what they need. It is far more powerful to also use the brain of the person on the other side of the table.

So, next time you are in a negotiation, instead of stating what you (think you) need, or even asking the other party what they (think they) need, instead ask this:

“What problem are you trying to solve?”

Yosemite Beta Program

Apple:

Please note that since pre-release software or beta software has not yet been commercially-released by Apple, it may contain errors or inaccuracies and may not function as well as commercially-released software. Be sure to back up your computer using Time Machine before installing this pre-release software and install it only on non-production or machines that are not business critical.

[…]

Yes, the pre-release software is Apple confidential information. For example, don’t install the pre-release Apple software on any systems you don’t directly control or that you share with others, don’t blog, post screen shots, tweet or publicly post information about the pre-release Apple software, and don’t discuss the pre-release Apple software with or demonstrate it to others who are not in the OS X Beta Program. For clarity, if Apple has publicly disclosed technical information about the pre-release software then it is no longer considered confidential.

Jason Snell:

The first public build of Yosemite is the same one received by registered Mac developers earlier this week. Developers who are testing Yosemite are on a different track than regular users, however, and both groups may receive different updates at different times as testing continues.

Apple developers know to use the company’s Radar bug tracker to file bugs, but regular users won’t need to. Instead, Apple will ask users to send feedback and communicate bugs via the Feedback Assistant app, which will be installed along with Yosemite on all beta-test systems.

Wednesday, July 23, 2014

Verizon Made an Enemy Tonight

Colin Nederkoorn (via Landon Fuller):

This Netflix video streams at 375 kbps (or 0.375 mbps – 0.5% of the speed I pay for) at the fastest. I was shocked. Then I decided to try connecting to a VPN service to compare.

[…]

It seems absurd to me that adding another hop via a VPN actually improves streaming speed.

Clearly it’s not Netflix that doesn’t have the capacity. It seems that Verizon are deliberately dragging their feet and failing to provide service that people have paid for.

Tuesday, July 22, 2014

Scrollbar History

Jack Wellborn (John Gruber):

In Xerox’s demo, the scroll bar of one particular application has multiple scrolling operations depending on which mouse button is pressed that only get invoked when that same button is released. Even today’s users with decades old scroll bar experience would struggle to understand this implementation. I can’t imagine it being intuitive in 1982 when most computer users had no concept of a mouse driven user interface, let alone scrolls bars.

StackOverflow Scalability

Todd Hoff:

Stack Overflow still uses Microsoft products. Microsoft infrastructure works and is cheap enough, so there’s no compelling reason to change. Yet SO is pragmatic. They use Linux where it makes sense. There’s no purity push to make everything Linux or keep everything Microsoft. That wouldn’t be efficient.

Stack Overflow still uses a scale-up strategy. No clouds in site. With their SQL Servers loaded with 384 GB of RAM and 2TB of SSD, AWS would cost a fortune. The cloud would also slow them down, making it harder to optimize and troubleshoot system issues. Plus, SO doesn’t need a horizontal scaling strategy. Large peak loads, where scaling out makes sense, hasn’t been a problem because they’ve been quite successful at sizing their system correctly.

[…]

Is 20 Gb massive overkill? You bet your ass it is, the active SQL servers average around 100-200 Mb out of that 20 Gb pipe. However, things like backups, rebuilds, etc. can completely saturate it due to how much memory and SSD storage is present, so it does serve a purpose.

[…]

Go into the IL (assembly language of .Net). Some coding is in IL, not C#. Look at SQL query plans. Take memory dumps of the web servers to see what is actually going on. Discovered, for example, a split call generated 2GB of garbage.

[…]

SO goes to great lengths to reduce garbage collection costs, skipping practices like TDD, avoiding layers of abstraction, and using static methods. While extreme, the result is highly performing code.

There are also some comments on Hacker News.

XCTest​Case / XCTest​Expectation / measure​Block()

Mattt Thompson:

With Xcode 6, we’ve finally arrived: the built-in testing tools are now good enough to use on their own. That is to say, there are no particularly compelling reasons to use any additional abstractions in order to provide acceptable test coverage for the vast majority apps and libraries. Except in extreme cases that require extensive stubbing, mocking, or other exotic test constructs, XCTest assertions, expectations, and performance measurements should be sufficient.

I do find it helpful to use additional macros to make the assertions more concise. For example, I use EQ() instead of XCTAssertEqualObjects(). This was also nice because I didn’t have to change all my code when Apple renamed its macros. I also have macros like EQARRAY() that make it easier to see how the failing object differs from the expected one. And I have ones for structs like NSPoint because Apple removed support for those with XCTAssertEqual() and never added it back.

Tower 2.0

Tower 2 is now available. I like some of the new features, such as support for multiple windows, the new Open Quickly feature, changing the tabs to a sidebar, sending folder diffs to BBEdit or Kaleidoscope, and the removal of the popovers.

Previous versions would hang forever when there were a large number of changes in the working copy. I think this is fixed—at least I never saw that happen during beta testing.

There are some problems, though:

Why Smartphone Screens Are Getting Bigger

Ben Taylor:

As smartphones become our primary devices, doing the jobs once held by computers and even televisions, we need a product that can change, like a chameleon, to serve all of these functions.

Before 2010, the extra real estate was unnecessary. After all, we were using phones mostly for making calls, listening to music, or doing a bit of light web-browsing on bad mobile interfaces, making mental notes to do our real work when we got back to our computers.

Today, the web—from site interfaces to television to native apps—is often designed primarily for the mobile format. The smartphone is no longer just a phone, but a hybrid of devices—and increasingly, the most common way to interact with the world. A bigger screen allows a mobile device to play all of these roles at once.

I’m still annoyed at having to hand-shimmy, but it seems hard to imagine going back to a 3.5-inch screen after using a 4-inch iPhone 5s. I’m not sure yet whether a phone that’s between the size of a 5s and an iPad mini would be perfect or too large for my pockets and hands.

Changes to Swift in Beta 4

Airspeed Velocity:

Other than access control, no big changes to the language with Beta 4, unlike with Beta 3. But still plenty of changes to the standard library.

Erika Sadun:

RIP CString. It’s now all ConstUnSafePointer<Int8> all the time. I still can’t get most of my straight C stuff ported but it looks like things are getting closer.

Brent Simmons:

So if internal access is the default, and I don’t want to use it (or want to use it exceedingly sparingly), what do I do?

Update (2014-07-24): Apple:

In Xcode 6 beta 4, Swift adds support for access control. This gives you complete control over what part of the code is accessible within a single file, available across your project, or made public as API for anyone that imports your framework.

The Right Dictionary

James Somers (via Gabe Weatherhead):

I could go on forever listing examples. I could say, “Look up example, magic, sport. Look up arduous, huge, chauvinistic, venal, pell-mell, raiment, sue, smarting, stereotype. Look up the word word, and look, and up. Look up every word you used today.” Indeed that’s what motivated this post: I’d been using Webster’s dictionary for about a year; I kept looking words up, first there, then in whatever modern dictionary was closest to hand, and seeing this awful difference, evidence of a crime that kept piling up in my mind, the guilt building: so many people were getting this wrong impression about words, every day, so many times a day.

There’s an amazing thing that happens when you start using the right dictionary. Knowing that it’s there for you, you start looking up more words, including words you already know. And you develop an affection for even those, the plainest most everyday words, because you see them treated with the same respect awarded to the rare ones, the high-sounding ones.

[…]

Note that the modern Merriam-Webster, even though it does derive directly from Webster’s original, has been revised so much that it’s actually less similar, content-wise, than some of the impostors. It, too, is one of the “wrong” dictionaries.

He has a tip for how to get the Mac OS X dictionary app to use Webster’s 1913 dictionary instead of Oxford.

Update (2014-07-23): Brent Simmons:

(Byron. Wow. I like a metaphor like that because you learn something about both sides, about the Almighty and tempests both.)

This is after two minutes of clicking around. There’s an entire language of rewards in there.

New New Yorker Web Site

The New Yorker (via Jason Kottke):

Beginning this week, absolutely everything new that we publish—the work in the print magazine and the work published online only—will be unlocked. All of it, for everyone. Call it a summer-long free-for-all. Non-subscribers will get a chance to explore The New Yorker fully and freely, just as subscribers always have. Then, in the fall, we move to a second phase, implementing an easier-to-use, logical, metered paywall. Subscribers will continue to have access to everything; non-subscribers will be able to read a limited number of pieces—and then it’s up to them to subscribe. You’ve likely seen this system elsewhere—at the Times, for instance—and we will do all we can to make it work seamlessly.

[…]

Beginning this week, every story we’ve published since 2007 will be available on newyorker.com, in the same easy-to-read format as the new work we’re publishing.

It’s not entirely clear, but it sounds like the articles will all be available in a Web-friendly format. Previously, I had no interest in paying for the digital edition because the only fully accessible articles were the free ones; the ones with the blue padlocks were only readable via a different Web site that essentially looked like giant screenshots of the printed pages.

Carbon and Cocoa as a Metaphor for Objective-C and Swift

Michael Buckley:

But even the Cocoa version of InDesign is not a great platform citizen. OS X reports that it always uses significant energy, even when idle. Its dialog boxes are just an NSWindow with an NSView. Adobe draws text and buttons in the NSView, and tracks mouse clicks in the view manually. Since there are no NSTextFields or NSButtons, these dialogs are completely invisible to screen readers.

This is in stark contrast to Lightroom, which was written with Cocoa in mind from the beginning. It's still a cross-platform app, but all of its UI elements are subclasses of Cocoa classes. The app is accessible, and it doesn't use significant energy while idle. More importantly, it can quickly adopt new features of the OS.

[…]

There are many features of Swift that make it a great language for Apple to write its future frameworks in. It probably won't be long until some of these frameworks start to use Swift-only features like generics. Taking full advantage of platform improvements requires adopting new frameworks, and any Objective-C programs that wants to use these frameworks will need to write adapter code in Swift.

But Swift and Objective-C have different design philosophies. As time goes on, it will be harder to reconcile Objective-C's design philosophy with native Swift frameworks. In order to simply get their apps to work, developers will spend a lot of time figuring out how to refactor their existing Objective-C codebases to fit within the constraints imposed by Swift, leaving them with less time for other improvements.

Update (2014-07-23): Chris Lattner:

Swift is a new option for developing on the platform. We have no plans to drop C, C++ or Objective-C. If you’re happy with them, please feel free to keep using them.

Of course, that’s what Apple said about Carbon as well.

The Majority Of Today’s App Businesses Are Not Sustainable

Sarah Perez:

Though the app stores continue to fill up with ever more mobile applications, the reality is that most of these are not sustainable businesses. According to a new report out this morning, half (50%) of iOS developers and even more (64%) Android developers are operating below the “app poverty line” of $500 per app per month.

[…]

The report’s authors detail the specifics around the trend where a tiny fraction of developers – actually, it’s 1.6% to be exact – generate most of the app store revenue.

[…]

Accounting for 47% of app developers, the “have nothings” include the 24% of app developers – who are interested in making money, it should be noted - who make nothing at all.

Meanwhile, 23% make something, but it’s under $100 per month. These developers are sometimes unable to cover the basic costs of development PCs, test devices, and an account to publish apps, the report states. However, in case you’re wondering why so many developers still go iOS first, it’s because those who prioritize iOS app development are less likely to find themselves in this group, with 35% earning $0-$100 per month, versus the 49% of Android developers.

Saturday, July 19, 2014

iOS Backdoors, Attack Points, and Surveillance Mechanisms

Jonathan Zdziarski (PDF):

Overall, the otherwise great security of iOS has been compromised…by Apple…by design.

Via Michael Yacavone.

Update (2014-07-22): Jonathan Zdziarski:

I have NOT accused Apple of working with NSA, however I suspect (based on released documents) that some of these services MAY have been used by NSA to collect data on potential targets. I am not suggesting some grand conspiracy; there are, however, some services running in iOS that shouldn’t be there, that were intentionally added by Apple as part of the firmware, and that bypass backup encryption while copying more of your personal data than ever should come off the phone for the average consumer. I think at the very least, this warrants an explanation and disclosure to the some 600 million customers out there running iOS devices. At the same time, this is NOT a zero day and NOT some widespread security emergency. My paranoia level is tweaked, but not going crazy. My hope is that Apple will correct the problem. Nothing less, nothing more. I want these services off my phone. They don’t belong there.

Dan Goodin:

Zdziarski said the service that raises the most concern is known as com.apple.mobile.file_relay. It dishes out a staggering amount of data—including account data for e-mail, Twitter, iCloud, and other services, a full copy of the address book including deleted entries, the user cache folder, logs of geographic positions, and a complete dump of the user photo album—all without requiring a backup password to be entered. He said two other services dubbed com.apple.pcapd and com.apple.mobile.house_arrest may have legitimate uses for app developers or support people but can also be used to spy on users by government agencies or even jilted ex-lovers. The Pcapd service, for instance, allows people to wirelessly monitor all network traffic traveling into and out of the device, even when it’s not running in a special developer or support mode. House_arrest, meanwhile, allows the copying of sensitive files and documents from Twitter, Facebook, and many other applications.

[…]

Zdziarski said the services aren’t easy for anyone to abuse, making it unlikely that hackers could exploit them on a wide scale. Still, he said the functions are within easy reach of technically knowledgeable people who have access to a computer, electric charger, or other device that has ever been modified to digitally pair with a targeted iPhone or iPad. During the pairing process, iDevices create a file containing a set of digital keys. Anyone with access to such files can make almost unfettered use of the services, often wirelessly, until the iPhone or iPad undergoes a factory reset.

Dan Moren:

The company also reiterated its stance that it doesn’t compromise its systems for the purpose of providing those access points to the authorities: “As we have said before, Apple has never worked with any government agency from any country to create a backdoor in any of our products or services.”

While such statements may be intended to assuage fears over the privacy implications of these systems, they’re hard to classify as categorical denials in this case. For one thing, Apple hasn’t yet explained why anybody needs the breadth of information that these tools seem to provide access to, nor why these services, if indeed for diagnostic use, are not presented for users to opt into. In the case of enterprise environments where devices are provided by a company, users are generally made aware of the access that IT departments have to their devices. But when we’re talking about the general public, no such warning is given—nor should it be needed.

[…]

Apple has taken a firm stand on privacy, and it’s disappointing to see the company not fully and transparently explaining why these systems have the range of access that they do, why they circumvent security processes the company itself put into place, and why there’s no way for a user to easily disable them. That’s the kind of attitude that we’ve grown to expect from the company, and we’d like to see them live up to it.

Update (2014-07-23): Jonathan Zdziarski:

In a response from Apple PR to journalists about my HOPE/X talk, it looks like Apple might have inadvertently admitted that, in the classic sense of the word, they do indeed have back doors in iOS, however claim that the purpose is for “diagnostics” and “enterprise”.

[…]

The problem with this is that these services dish out data (and bypass backup encryption) regardless of whether or not “Send Diagnostic Data to Apple” is turned on or off, and whether or not the device is managed by an enterprise policy of any kind. So if these services were intended for such purposes, you’d think they’d only work if the device was managed/supervised or if the user had enabled diagnostic mode. Unfortunately this isn’t the case and there is no way to disable these mechanisms. As a result, every single device has these features enabled and there’s no way to turn them off, nor are users prompted for consent to send this kind of personal data off the device.

[…]

Obviously, Apple realized that pairing in and of itself offered very little security, as they added backup encryption to all backups as a feature – something that also requires pairing to perform. So Apple doesn’t trust pairing as a “security” solution either. And for good reason: it wasn’t designed to be secure. It is not two factor; it is not encrypted with a user paraphrase; it is simply “something you have” that gives you complete unfettered access to the phone. And it can be had as easily as copying one file, or created on the fly via USB. It can be used if law enforcement seizes your computer; it can be stolen by someone hacking in; it is by all means insecure. But even with the pairing record, I would have expected the data that comes off my device to be encrypted with the backup password, right? These services completely bypass this.

Apple responds on its site, but doesn’t really address what people are concerned about (via Cabel Sasser).

Update (2014-07-24): Dan Goodin:

The episode is a good example of the way Apple’s trademark secrecy can come back to bite the company. Apple may have legitimate reasons for folding these services into iOS, even when it isn’t running in special diagnostic or support modes. But the company never took the time to disclose these services or to respond to Zdziarski’s private entreaties to executives until the undocumented functions became an international news story. Zdziarski’s larger point seems to be that the services he brought to light represent vectors that ex-lovers, housemates, co-workers and, yes, spy agencies can exploit to bypass cryptographic protections designed to prevent sensitive data from being accessed by unauthorized parties. Until last weekend, that point was only implicit. It has now been made explicit.

Wickwick:

Example: You’re dating someone who uses your laptop when she visits. Unbeknownst to you, she emails herself the keys from your laptop.

You break up. She visits the same Starbucks as you. While you’re reading emails, whatever she uses the wifi to turn on File relay and copies everything off your phone. There’s no alert, there’s no dialog box. Your phone just starts dumping information.

All an adversary needs is temporary access to a single trusted device once and they have the keys to the kingdom forever.

joosters:

What’s really disappointing is that there seems to be an all-or-nothing security model here. If I pair my phone with a computer, then suddenly it has complete access to spy on me, install monitoring tools that can continue to run, etc. Why can’t there be a way where I can transfer music/photos to/from my phone without providing this full device access?

You’d be pretty annoyed if the front door to your house, when you opened it, also opened up your document safe, emptied your wallet onto the floor and invited visitors to leave bugging devices to spy on you later.

Also, the defence of “just don’t agree to pair your phone with an unknown USB device” can actually be tricky. On a flight, I plugged my phone into the USB port on the seatback to charge it. The phone repeatedly kept asking if I wanted to pair it with something (who knows what it was? the entertainment system, maybe?). If I had accidentally hit the wrong button only once (on a prompt that randomly appeared), my phone could have been owned, and there’s no easy way to un-pair.

A Modest Proposal: C++ Resyntaxed

Ben Werther & Damian Conway (2002):

We describe an alternative syntactic binding for C++. This new binding includes a completely redesigned declaration/definition syntax for types, functions and objects, a simplified template syntax, and changes to several problematic operators and control structures. The resulting syntax is LALR(1) parsable and provides better consistency in the specification of similar constructs, better syntactic differentiation of dissimilar constructs, and greater overall readability of code.

Google, Roboto and Design PR

Khoi Vinh:

I don’t point this out to mock or criticize the author’s errors or misconceptions about what goes into designing typefaces, but rather in fact to marvel at how well Google is selling the story of its design efforts.

There’s essentially no news in this article other than, “Google has revised Roboto using some recent best practices of type design.” And yet the Mountain View company has been able to spin that non-story into a story that claims that the company is fundamentally reinventing typography.

Building assert() in Swift

Apple:

When designing Swift we made a key decision to do away with the C preprocessor, eliminating bugs and making code much easier to understand. This is a big win for developers, but it also means Swift needs to implement some old features in new ways. Most of these features are obvious (importing modules, conditional compilation), but perhaps the most interesting one is how Swift supports macros like assert().

@auto_closure is great, but I still wish for the power of actual macros.

Exploring Swift Memory Layout

Mike Ash:

It looks similar to an Objective-C object, but there's 16 bytes of metadata instead of just 8 as is the case for Objective-C. It turns out that it is an Objective-C object that can be inspected using the APIs in objc/runtime.h.

Joe:

The other 32-bit value in the reference count is the unowned reference count, which is incremented by unowned references. The object is destroyed when its strong reference count hits zero (which also decrements the unowned reference count), and deallocated when its unowned reference count hits zero. This allows the runtime to verify that unowned references don't dangle, while avoiding the full cost of a nil-ing weak reference.

Still, it seems like lot of memory used in each instance for reference counting, when most objects won’t have very high reference counts.

Thursday, July 17, 2014

Guess What This Perl Does

Mark Dominus (author of an advanced Perl book):

A few weeks ago I asked people to predict, without trying it first, what this would print:

perl -le 'print(two + two == five ? "true" : "false")'

(If you haven’t seen this yet, I recommend that you guess, and then test your guess, before reading the rest of this article.)

People familiar with Perl guess that it will print true; that is what I guessed. The reasoning is as follows: Perl is willing to treat the unquoted strings two and five as strings, as if they had been quoted, and is also happy to use the + and == operators on them, converting the strings to numbers in its usual way. If the strings had looked like "2" and "5" Perl would have treated them as 2 and 5, but as they don’t look like decimal numerals, Perl interprets them as zeroes. (Perl wants to issue a warning about this, but the warning is not enabled by default. Since the two and five are treated as zeroes, the result of the == comparison are true, and the string "true" should be selected and printed.

Of course, that’s not what it does.

Jazzy

Jazzy (from the developers of Realm):

jazzy is a command-line utility that generates documentation for your Swift or Objective-C projects.

Instead of parsing your source files, jazzy hooks into clang and uses the AST representation of your code and its comments for more accurate results.

jazzy’s output matches the look & feel of Apple’s official reference documentation, post WWDC 2014.

Asynchronous Unit Testing in Swift

Chris Adamson:

Fortunately, this is where Xcode 6′s asynchronous testing comes in. It allows us to create XCTestExpectation objects, which are not tests but timers. We create expectations with XCTestCase’s expectationWithDescription(), which just takes a string to describe what we’re waiting for. Then, prior to the end of the test… method, we call waitForExpectationsWithTimeout(), passing in a timeout period and a completion handler closure. This prevents the test method from exiting until either the timeout expires, or some asynchronous test code calls fulfill() on the expectation object, which unblocks it.

Update (2014-07-22): Mattt Thompson:

Perhaps the most exciting feature added in Xcode 6 is built-in support for asynchronous testing, with the XCTestExpectation class. Now, tests can wait for a specified length of time for certain conditions to be satisfied, without resorting to complicated GCD incantations.

Why Your Comcast Rep Is Yelling at You

Adrianne Jeffries:

The man who spoke to Block is a “retention specialist,” a position Comcast describes as “equal parts detective, ally, troubleshooter, and negotiator” in job listings. Comcast’s retention reps are paid a low hourly wage supplemented by a monthly commission that depends on how many customers they are able to drag back into the fold.

[…]

In other words, the incentive structure is really about punishment. Reps start out the month with a full commission, but every canceled product deducts from that amount. Once reps fall below a certain threshold, they get no commission at all. That means a rep could get all the way to the second-to-last day of the pay period only to have a customer cancel four products. Suddenly the rep is below her goal, losing $800 to $1,000 off her paycheck.

This reminded me of Joel Spolsky’s Measurement article from 2002. (Spolsky cites a book about Amazon customer service by Mike Daisey—yes, that one—and parts of the book have since been shown to be exaggerated.)

Update (2014-07-23): Chris Morran (via John Gruber):

A week after the posting of the neediest customer-retention call in Comcast history, the fallout continues, with the company’s Chief Operating Officer telling Comcast employees in a memo leaked to Consumerist that the incident was “painful to listen to,” but that the rep “did a lot of what we trained him…to do.”

Wednesday, July 16, 2014

Compacting VMware Disks and Avoiding Snapshots

I use VMware Fusion to test my products on different versions of Mac OS X. This has worked very well over the years. Every time I installed a new version of the OS, I would make a snapshot, and I ended up with a tree of them. At first, snapshots were relatively space-efficient. If space got tight, I would delete all but the leaf snapshots, i.e. Mac OS X 10.7.5, 10.8.5, and the current stable and pre-release versions of 10.9 and 10.10.

I thought this was the smart way of doing things, using snapshots to let VMware efficiently manage the storage and share the bits that hadn’t changed among multiple OS versions. Unfortunately, I got to the point where VMware was using 108 GB of disk space to store only 27 GB of data. My MacBook Pro’s SSD was almost full. I thought it would be a simple matter to compact the virtual disk and reclaim the unused space. However, after some research, it looks to me like there is no good way to do this.

The General tab in the VMware settings showed that none of the disk space in my virtual machine was reclaimable. I found a post in the VMware forums that describes how to compact a virtual machine, but the first step is to delete all of your snapshots. If I were going to do that, I might as well start a new virtual machine!

Surprisingly, there does not seem to be any way to export a snapshot as a new virtual machine. I think the best I could do is to boot from each snapshot and clone the disk to a drive or disk image outside of VMware. Unfortunately, there also does not seem to be a way to create a new virtual machine from an existing drive (except that of a Windows PC). There are some command-line tools for creating a new virtual disk from a mounted volume, but I kept getting errors like “Failed to convert disk: You do not have access rights to this file (0xd).” Since the virtual machines are just clean OS installations, I decided it would be easier to just built new virtual machines by reinstalling each OS version.

Because snapshots don’t work with compaction, I decided to create wholly separate virtual machines for each major OS version. If necessary, I can copy the .vmwarevm packages in the Finder to manage my own heavyweight snapshots.

It is then possible to compact the virtual disks:

  1. From the Virtual Machine menu, choose Install VMware Tools.

  2. A disk will mount in the virtual machine. Run the installer that’s on it.

  3. In Terminal (in the virtual machine) enter the command:

    sudo /Library/Application\ Support/VMware\ Tools/vmware-tools-cli disk shrink /
  4. This will take a while, and the OS will complain about running out of disk space, but eventually it will finish and reboot.

After installing Mac OS X 10.7 and using the Mac App Store to update to 10.7.5, my virtual machine was using 18.2 GB. After the above procedure, it shrunk to 9.8 GB.

For another virtual machine, I installed Mac OS X 10.8 and updated to 10.8.5 with the combo updater. This brought it to 15.4 GB, which shrunk to 7.1 GB.

I have not yet built my 10.9 and 10.10 virtual machines, but it seems clear that the total of four independent ones will not be much more than the 27 GB with snapshots for each major version. Duplicating a virtual machine package in the Finder is actually not much slower than saving a snapshot. And I should no longer have problems with virtual machine bloat, since virtual machines without snapshots can be compacted. So I now believe that there is no compelling reason to use snapshots the way I had been using them. Using separate virtual machines also means that I can run multiple instances simultaneously.

Overcast 1.0

Marco Arment:

It’s been a long road, but 1.0 is finally done. I’m proud of what I’m shipping today.

Overcast FAQ:

The servers do the heavy lifting of constantly checking for updates so your device doesn’t need to download each show’s entire feed every few minutes to make sure you get new episodes quickly. The servers send only what’s new to the app, and it only takes a few seconds. This saves substantial battery power and data usage over time.

Jason Snell:

Overcast is free, though feature-limited. “I want to offer a better alternative for the mass market, so it must be free,” Arment says in a statement on the Overcast website. For a $5 in-app purchase, however, users can unlock numerous additional features, including: support for downloads over cellular, features that modify or improve sound output (more on those below), and unlimited playlists and episodes in playlists (there’s only one playlist, with 5 episodes, by default).

[…]

Overcast does the best job of speed-alteration I’ve heard, and now I listen to many podcasts on slightly higher than 1x speed.

Separately, Overcast offers a Smart Speed feature that intelligently removes silence from podcasts, shortening episodes even if you don’t choose to listen at a higher speed. (You can also use the two features simultaneously for even more time saving).

It sounds good to me, but I doubt there’s a good way to import my current podcast state: which episodes I’ve listened to, deleted, partially played, imported separate from loose files, etc.

Update (2014-07-17): See also these reviews from Federico Viticci, Rene Ritchie, and Josh Centers.

Update (2014-07-22): Kirk McElhearn:

Below, two screenshots show what you see when playing an episode. To the left, I’ve scrolled up on the podcast’s icon; it shrinks and displays show notes, with clickable links. To the right, you can see the Effects screen, which is the feature that has won me over. This lets you speed up podcasts, without the sort of Alvin and the Chipmunks sound that most podcast apps give you. The Smart Speed setting cuts out bits of silence, helping you save a bit more time when listening to podcasts, and Voice Boost equalizes the podcasts for vocal frequencies, making them clearer. Altogether, I find this the best playback of any podcast app I’ve used.

Introducing Realm

Realm (via Tim Burks):

Today we are very proud to introduce Realm, the first database built from the ground-up to run directly inside phones, tablets and wearables, and the fruit of several years of labor since we came out of YCombinator. Realm uses very little resources, is incredibly easy to use, and lets you interact with your data faster than any current alternative.

[…]

Realm’s designed to give you amazing ease-of-use: data is directly exposed as objects and queryable by code, removing the need for ORM’s riddled with performance & maintenance issues. Plus, we’ve worked hard to keep our API down to just 3 common classes (Object, Arrays and Realms) and 1 utility class (Migrations): most of our users pick it up intuitively, getting simple apps up & running in minutes.

[…]

Realm also offers a full set of checks and guarantees to make it easier for you to build apps without shooting yourselves in the foot, including full ACID transactions by default and an object schema that is enforced directly through your object definitions. Finally, a lot of you will be happy to hear that Realm databases are safe across threads so you can easily asynchronize tasks without any cognitive overhead whatsoever, and finally explore all the concurrency potential of multi-core handsets.

[…]

We’ve seen many libraries try to offer a similar level of features on top of SQLite, at the expense of speed. In contrast, Realm is faster than even raw SQLite on common operations, while maintaining an extremely rich feature set.

[…]

Realm’s efficiency comes from years of work on a custom C++ core designed to fit the needs of much more primitive devices, that leverages bit-packing, caching, vectorization and a zero-copy architecture to realize truly amazing gains in memory usage and speed. Since Realm internals allow for easy concurrency and measurement of deltas and follows an MVCC model, we are also working on adding sync capabilities to Realm.

Here’s the GitHub project.

Achieving Zen With Auto Layout

Justin Williams:

Achieving Zen With Auto Layout is the eBook companion to my talk of the same name, but with the goal of being much more expanded than what I am able to do in a 45-60 minute on-stage presentation.

This is a beta book right now. There are no screenshots (iOS 8 does still have a tiny bit of NDA that prevents those), copy editing hasn’t been done, and I still need to hire an illustrator to do a cover and some other things in the book for me. Content-wise though, I’m proud of what is there so far, and I’m excited to finish the rest of the book in time for the iOS 8 launch later this fall.

How to Flawlessly Predict Anything on the Internet

Andy Baio:

This is a modern update to a classic confidence game—find a risky scenario with limited possibilities, bet on every single combination, and then hide your failures. The result is that you look like you’re either psychic or a goddamned genius.

Sunday, July 13, 2014

Swift and Cocoa Error Handling

I’ve not see much written about how to do real-world Cocoa error handling in Swift. That is, you’re calling Objective-C methods with NSError ** parameters and need to return an NSError back to your caller. This is very common with Cocoa.

NSError is unwieldy, especially when you must consider that the output parameter could be NULL. The way I handle this in Objective-C is to use a macro to reduce the amount of error handling code that’s visible:

NSError *e = nil;
NSString *string = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:&e];
MJT_REQUIRE(string, e, error);
[string doSomething];

This leaves straight-line code, with no indentation, for the normal case. The macro, inspired by Apple’s AssertMacros.h, does nothing if its first parameter indicates success. Otherwise, it propagates the second parameter (the local error object) to the third parameter (the passed-in error pointer), but only if the latter isn’t NULL. It can also add some contextual information to error object, to track the source of the error. Lastly, it returns nil to indicate failure to the caller.

(I also have MJT_BOOL_REQUIRE(), which returns NO instead of nil, and MJT_REQUIRE_PARAMETER(param, error), for when a parameter can’t be nil. This is sometimes preferable to raising an exception with NSParameterAssert(), and it is otherwise very verbose to construct an appropriate NSError to return.)

Swift doesn’t have macros, so it’s not clear to me how this sort of pattern can be encapsulated. It looks like the code would be something like this:

var e : NSError?
let possibleString = NSString(contentsOfURL:url, encoding:NSUTF8StringEncoding, error:&e)
if possibleString == nil {
    if error {
        error.memory = addErrorContext(e, context)
    }
    return nil
}
let string = possibleString as NSString
string.doSomething()

I don’t like the way this code looks. I could probably write a helper function to make it something like:

var e : NSError?
let possibleString = NSString(contentsOfURL:url, encoding:NSUTF8StringEncoding, error:&e)
if failed(possibleString, e, error) {
    return nil
}
let string = possibleString as NSString
string.doSomething()

But I don’t see how to hide that if and return. And then there is the matter of having to create a second variable for the non-optional string if you don’t want to add ! after each use. I hope I’m missing something here, because it looks like Swift is making basic code more tedious without providing any real benefit.

Saturday, July 12, 2014

New Apple TV Flickr App

Flickr:

Beautiful photos deserve beautiful displays and if you’ve ever shown off your photos on a TV, you know how stunning they look on a large high definition screen! For the first time with Apple TV, sign into Flickr and view all your photos, videos, Favorites, Albums, and Groups. In one click, make any album into a slideshow or screensaver ready to share with friends, or customize in real-time with over fifteen different slideshow and screensaver modes.

mister_grey:

On the new AppleTV client, you can connect to your friends more easily, (you basically couldn’t do this at all previously), but again, the pictures are presented to you in cropped, heavily compressed versions that you have no control over at all. It also has new browse and search options, but once you find a picture, there is no way to go to the account of that person, or see other related pictures etc.

It’s nice to be able to view my non-public photos now. I’m not sure whether it’s the compression or a problem with the app, but my photos still don’t look very good on the TV. I get better quality with Apple TV video content or even a USB stick of the same photos via my Blu-ray player.

Update (2014-07-12): Flickr developer Phil Dokas:

In the Flickr AppleTV app you can long-select on any photo to go to the photographers profile.

And the photos aren’t compressed, they’re exactly the same as used on the site and apps.

Yep, since day 1! There is some cropping (e.g. square thumbnails) but only in lists, and that’s because of OS requirements.

I no longer have the photos USB stick handy, so I can’t do an A/B comparison right now. Perhaps it doesn’t look as good as I remember.

Friday, July 11, 2014

Design Is How It Works

Jim Ray:

Hey, Johny, maybe turn the ports 90° so I can actually unplug the goddamn things

Via ATP, which has a good discussion of the ports on the AirPort Extreme Base Station as well as on the Mac Pro.

Scripting From a Sandbox

Craig Hockenberry:

That’s a great solution for scripts written by a user. The user can then open that folder using a control in your app and edit scripts in any way seen fit.

But sometimes you’ll want to help the end user install scripts that you’ve written. Chances are, you’re a better programmer than your average customer, and you know how to write code that makes your app work better with your customer’s other apps. The natural place to put your own scripts is in the application bundle, but how do you get scripts into the user’s scripts folder?

The solution here is to get permission to write into that folder. In Xcode, you need to update your app’s Capabilities to “User Selected File to Read/Write,” under App Sandbox > File Access. Again, user intent is the guiding factor here, since you’re being given permission to add scripts to the folder.

This works, technically, but I had thought it was not allowed by the Mac App Store rules, probably rule 2.30:

Apps that do not comply with the Mac OS X File System documentation will be rejected

This is the same reason that applications aren’t allowed to have a button to install PDF services. Has this changed?

Update (2014-07-11): Craig Hockenberry:

xScope 4 does it. The User Scripts folder is documented as a place where this stuff MUST go.

Making Your Mac App’s Data Scriptable

Brent Simmons:

That’s not much code — most of the work is in designing the interface and editing the sdef file.

In the old days, you’d still be writing Apple event handlers and working with Apple event descriptors and all kinds of crazy jazz. In other words, you’d be a long way from done. Thankfully, these aren’t the old days.

iTunes Extras on Apple TV and iOS

9to5Mac:

Apple today released iTunes version 11.3 and with it is making its iTunes Extras feature available for HD movies on Macs. Apple also announced today that the feature is now available for Apple TV with update 6.2 and will arrive on iOS 8 this fall.

While we’ll have to wait for iTunes Extras to arrive on iOS with the release of iOS 8 this fall, the Apple TV OS 6.2 update rolled out late last month to users alongside iOS 7.1.2.

smith.dan:

This is some clever marketing, because the other part of what they’re announcing is that “iTunes Extras” as it previously existed is being discontinued.

Old feature: Downloadable bundle of videos that you store and archive however you like. Offline viewing supported. If you’re willing to unbundle the videos, you can organize them however you like and sync them to your devices. Direct playback of the bundle on iOS devices not supported.

New feature: Essentially a rich Web page that pops up when you play the movie. Similar content. No option to download anything. No way to get at the unbundled videos. No offline viewing. Apple and the studios have total control of the content -- if they take something down, it’s gone. Direct playback of the bundle on iOS devices is supported but is streaming-only.

Apple:

If you bought original iTunes Extras before July 10, 2014, you can download them again from the purchased page on the iTunes Store. iTunes Extras aren’t available in certain countries.

Pixar Wage-Fixing Cartel

Mark Ames (via John Siracusa):

A top Pixar producer reveals in her email that Catmull had in fact flown down to Sony Animation and met with the two co-heads, Penney Finkelman Cox and Sandy Rabins, to rope Sony into the non-recruitment cartel. That meeting presumably took place in 2004, when Catmull emailed Steve Jobs his intention to meet Sony about poaching employees.

[…]

Catmull admits to what appears to be further criminal behavior, in violation of the Sherman Antitrust Act: An attempt by a top executive to get other executives to agree to secretly fix their employees’ wages and career opportunities.

Sources with knowledge of the discussion told Pando that Sony Animation’s understanding of the Catmull meeting was very different, and that Catmull had only asked Sony, informally, to let him know in future if they were hiring any Pixar employees.

Their different interpretations were born out in their actions: Catmull was still angry at Sony in 2013; and Sony did not join the Pixar-Lucasfilm non-solicitation agreement.

Update (2014-07-20): Oluseyi Sonaiya:

Just a few months ago I was thinking to myself that the lead inventor of the Catmull-Rom spline could qualify as a career role model for me in many ways. Not anymore. Now he is a cautionary tale, but in my disappointment I must take caution not to discard everything I learned from him. Creativity, Inc. is still a great book, and I will finish reading it and look to apply lessons from it to my work. The journey of Pixar is still impressive and inspiring to me, and I will allow elements from it to influence how I approach some day (soon) building my own company.

Swift In Flux

Karol S. Mazur (via Brent Simmons):

The community is creating some incredible analyses and writing about Swift. What I keep asking myself whenever learning and reading about Swift is: how likely is this to change soon?

This document is an attempt to gather the Swift features that are still in flux and likely to change.

Thursday, July 10, 2014

Lightroom Never Fully Expires

Peter Krogh:

Buried in the recent Adobe Creative Cloud rollout was a revolutionary change to the way Lightroom licensing functions.  When the license expires, the program keeps on working.* This is a radical development. If you’ve been paying attention to the sturm und drang around the Creative Cloud licensing model (here, here, here, here) , this is a mind-blower.

First, the * part. Not all functions of Lightroom keep working. The sliders in the Develop module become inactive. Develop will still render the photo, but it won’t let you run the sliders. (You could still use Quick Develop in Library to make further adjustments if you like.)

[…]

But other than Develop and Map, everything else works. You can make new catalogs, add new photos, add keywords, make collections, books, web galleries. prints, slideshows, exports, published copies… Basically, you have Lightroom LE. For free, if you want it.

Wednesday, July 9, 2014

The Indie Life

Luc Vandal:

Let’s face it, the app gold rush is well over. It is now much harder to make it into the market and it requires more planning, financial investment and time. On top of that, competition is fierce, your app may get sherlocked (1) by Apple and become a part of the next OS release or may lose traction because a VC funded company is offering a free alternative and has near to unlimited funds for market it while they figure out how to monetize it. (2)

[…]

I have spoken with other successful developers and many told me the same: sales are generally down. They are still doing great but there are more and more competitors are also taking a slice of the same pie.

Update (2014-07-15): Chris Adamson:

That’s @jonathanpenn, as he heads off to Apple. He follows a number of top indie developers/author/speakers to head to the mothership in the last few months, including Patrick Burleson, Kevin Hoctor, and if we’ll go back a little over a year, we can throw in my former iOS SDK Development co-author Bill Dudney.

This is causing a little bit of angst among those of us who hate to see our friends decamp from our communities to California, and to suggest that maybe indie iOS development/writing/speaking isn’t tenable.

Janie Clayton-Hasz:

I don’t even know if what I want to do is feasible. Other developers that I have spoken to have seen contract work dry up because iOS has become a mature enough platform that companies are creating in house developer teams rather than hiring contractors to do piecemeal work. Additionally, it is conventional wisdom that the market for paid apps has also mostly dried up.

Matt Gemmell:

We’ve had our (latest) software Renaissance in the form of the mobile platforms and their App Stores, and I think the software biz is now starting to slide back towards consolidation and mega-corps again. It’s not a particularly great time to be an indie app developer anymore.

Small shops are closing. Three-person companies are dropping back to sole proprietorships all over the place. Products are being acquired every week, usually just for their development teams, and then discarded.

Update (2014-07-16): Matthew Smith (via David Barnard):

Our revenue has fluctuated and declined significantly over the past 2 years. We have tried everything we could think of to reverse that declining revenue trend, and nothing has worked. We have had a blast making high quality educational kids apps, but at some point you have to take a step back and say ‘Is this sustainable?’.

Auto Layout on OS X: Backwards Compatibility

Milen Dzhumerov:

Unfortunately, as it regularly happens on OS X, the need for maintaining backwards compatibility has lead to important differences and unexpected behaviour in the exact same API when compared to iOS.

[…]

The situation is slightly different on OS X – once Auto Layout is enabled, AppKit insists that the positions of all views be determined by the constraint system, even for views which are not referenced by any constraints. AppKit will flag any such layout as ambiguous, even though it is not in practice - all views part of the constraint system have well-defined positions. I consider this to be a bug, as I cannot see a reason why such hierarchies need to be flagged as ambiguous (in fact, it works just fine on iOS). The good news is that even though the layout is incorrectly deemed ambiguous, everything seems to be working fine.

[…]

While the difference seems small, it has a very important implication. The reason why -setFrame: is used on OS X is due to backwards compatibility, as a -center property does not (necessarily!) exist at the NSView level (it exists only when layer-based). But due to the introduction of Core Animation in a backwards compatible way, it means that when we have a layer-based view tree, the positions are ultimately stored by the CALayers. And crucially, calling -setFrame: on a CALayer is semantically different to calling -setBounds:, -setPosition: and -setAnchorPoint:.

CALayers do not really have a frame property, as frame is a function of bounds.size, anchorPoint, position and transform. So when Auto Layout sets the frame of the layer, it also resets the transform to the identity. This is an extremely important behavioural difference that needs repeating: Auto Layout on OS X resets -transform of the the auto laid-out CALayers, essentially turning it into a read-only constant. Obviously, this does not happen on iOS as -setFrame: is not used. This behaviour prevents us from using the transform property – e.g., we might want to scale or rotate views but Auto Layout will be overwriting the changes we apply.

Auto Layout and Views That Wrap

Jonathon Mah:

The first call to [super layoutSubviews] will evaluate the constraints on the label (since it’s a direct subview) and change its frame accordingly. At this point the width is useful, but the height is not; the height was set using the label’s intrinsic content size, which in turn relied on a preferred max layout width value that is now stale.

Now we know the actual width of the label, we set that as its max layout width. Internally, this causes the label to invalidate its intrinsic content size; when it’s next queried, it will have the accurate height for its current width. With all layout information in place, we call [super layoutSubviews] again.

Sunday, July 6, 2014

iOS 8 Keyboards Can’t Implement SwipeSelection

Andrei Puni (via Clark Goble):

Your custom keyboard does not have access to the view hierarchy of the input, it cannot control the cursor and select text.

I’m really surprised that Apple hasn’t improved text selection yet.

Update (2014-07-08): Ole Zorn:

Looks like it's possible to move the cursor with a custom keyboard in beta 3. :)