Archive for July 2014

Thursday, July 31, 2014

1Password App Extensions

AgileBits:

The video embedded here, produced by our fearless co-founder Dave Teare, speaks for itself. Thanks to Apple’s incredible new developer features in iOS 8, third-party apps can let 1Password fill Logins without the user ever leaving the app. Yep, complete with Touch ID for unlocking the vault.

AgileBits:

With just a few lines of code, your app can add 1Password support, enabling your users to:

  1. Access their 1Password Logins to automatically fill your login page.
  2. Use the Strong Password Generator to create unique passwords during registration, and save the new Login within 1Password.
  3. Quickly fill 1Password Logins directly into web views.

This is probably what I’m looking forward to most in iOS 8.

The Indie Game Bubble Is Popping

Jeff Vogel:

Because this flood of games is so unmanageable, Steam has been doing everything it can to throw open the gates and get out of the messy, stressful business of curation. This is absolutely inevitable. It’s also going to winnow out a lot of small developers, who don’t have the PR juice to get noticed in the crowd. (Think iTunes app store.)

With so much product, supply and demand kicks in. Indies now do a huge chunk (if not most) of their business through sales and bundles, elbowing each other out of the way for the chance to sell their game for a dollar or less. Making quick money by strip-mining their products, glutting game collections and making it more difficult for the developers who come after to make a sale. (I am NOT making a moral judgment here. It is the simple consequence of a long series of calm, rational business decisions.)

[…]

Suppose you are a super low-budget micro-developer like me. It’s not super-hard to survive, because I can get enough sales to get by with a little cheap marketing and word of mouth advertising. I’ll be all right.

Suppose, alternately, you are a huge AAA developer with massive budgets. You can afford the massive marketing necessary to generate the big sales you need to pay for your expensive games. You’ll be all right, until you’re not.

But suppose you’re a mid-tier (sometimes called AAA Indie) developer, with $500K-$2 million budgets. You have a problem. You need advertising to get sales, as word-of-mouth won’t cover it. But you can’t afford a big campaign. The only way you will turn a profit is if you get huge free marketing from Steam/iTunes placement and press articles.

Abusing Twitter API

Nicolas Seriot:

Twitter claims that the consumer keys are needed to kill applications used by spammers, but OAuth was simply not designed to be used for that purpose. Additionally, it may not be efficient at all, since spammers will use consumer tokens from official clients, and blocking official clients is not an option. Closing individual spammer accounts makes much more sense.

[…]

The consumer tokens are fundamentally insecure when used within a client application. Additionally, requesting the consumer keys to be kept secret effectively kills open-source applications.

Twitter asks developers to protect their keys in an environment where users have complete control over the execution flow and access to full address space, so it’s impossible to prevent keys extraction.

This problem is somehow similar to the DVD / HDMI / HDCP decryption. At some point, the user has to use a machine that will load in memory cryptographic keys that will be use to decrypt the protected content. It’s just a matter of time and motivation until motivated hackers extract the keys and can replicate the decryption process.

Twitter’s uses OAuth for something it is not made for.

[…]

It appears from our work that the main reason for switching from basic authentication to OAuth is not user security or spam fighting, but simply third-party applications control.

This post is from 2012, but the details are still interesting.

Making Money on Apps

Max Child:

So how do you do that? Three ways:

  1. Charge them for something that helps them make money.
  2. Charge them for an emotional experience.
  3. Don’t charge them, charge someone else for helping that someone else make money.

[…]

So what to do if you’re an indie developer? Pick a strategy. Most seem to be going with #2, and that’s fine. But I highly recommend you charge $0 up-front and build an emotional connection strong enough to charge more later.

The History of Civilization

Benj Edwards (via Ole Begemann):

By 1990, Sid Meier had cranked out flight simulator games for as long as he knew how, at the request of his boss and partner. But Meier’s life, and the world of computer games around him, had changed so much since the two men entered the market in 1982. Meier felt the undeniable urge to broaden his horizons as a designer; it was time to move on to greater things. Despite considerable opposition within the very company he co-founded, Meier broke the status quo and changed the course of computer strategy games forever. As the naysayers sank in his wake, he engineered lasting success and achieved design immortality with an epic game based on nothing less than the history of mankind.

I never got into Civilization, but it’s fascinating how enduring it has been.

Personal Audio vs. Adam Carolla

Joe Mullin:

Personal Audio LLC is an East Texas shell company that gleaned national attention when it claimed it had the right to demand cash from every podcaster. The company was wielding a patent on “episodic content,” which it said included anyone doing a podcast, as well as many types of online video.

Now the company is trying to walk away from its highest-profile lawsuit against comedian Adam Carolla, without getting paid a penny—but Carolla won’t let the case drop.

[…]

Carolla sent Ars a statement saying he’ll continue to pursue counterclaims against Personal Audio, seeking to invalidate the patent “so that Personal Audio cannot sue other podcasters for infringement of US Patent 8,112,504.” Lotzi (Carolla’s company) has already “incurred hundreds of thousands of dollars in fees and expenses to defend itself” against the Personal Audio patents.

Gen. Hospital:

So, if I understand this correctly, Carolla solicited donations to fight this case. Personal Audio LLC want to drop the case now that they’re up against someone who aren’t scared. The way I see it, Carolla has got three options. One; agree to drop the case, and pay back his donors (impractical). Two; agree to drop the case, and keep the money (unethical). Three; refuse to drop the case, and spend the money the way the donors intended.

Update (2014-08-24): Daniel Nazer:

Adam Carolla has settled with the podcasting patent troll Personal Audio. Although the settlement is confidential, we can guess the terms. This is because Personal Audio sent out a press release last month saying it was willing to walk away from its suit with Carolla. So we can assume that Carolla did not pay Personal Audio a penny. We can also assume that, in exchange, Carolla has given up the opportunity to challenge the patent and the chance to get his attorney’s fees.

[…]

The most disappointing aspect of today’s settlement is how unsurprising it is. Almost every defendant, no matter how strong their case, ends up settling with the patent troll. Litigating patent cases is extraordinarily expensive. Carolla raised almost half a million dollars and that still would not have been enough to fund a defense through trial.

spindritf:

On his podcast he said he spent it all and over 100k on top of it on the pre-trial legal and expert fees.

Building a Business, Not an App

Ben Thompson:

[Mike] Love thinks the fact he started from day one with the new business model in mind gave him a competitive advantage to the dictionaries already in the store, but I think he sells himself short; after all, it’s been five years and only now are most independent developers starting to realize that free with in-app purchase is the only viable monetization model. To put it another way, Love differentiated himself again by being a student not just of APIs and frameworks, but of business models as well.

[…]

This point blew me away. Love invested real money into differentiating his free app (Love still had the great handwriting engine, but iOS’s built-in handwriting – while hugely inferior – had lessened that advantage). Love was confident that after he won in free, he could make up the difference with his plethora of paid add-ons, which at this point included not only additional dictionaries – several of them exclusives – but also modules like stroke order diagrams, different fonts, a document reader, and a year later, optical character recognition (OCR).

[…]

Much of that time has not been spent on development or design. Rather, it’s been spent understanding and listening to customers (which led to the aforementioned bundle change), making business deals with slow-moving publishers, careful consideration around pricing and app store presentation, investments in both free and paid differentiators, and a whole bunch of time spent on an Android app that doesn’t make that much direct money but that marks him as a leader in his space.

Core Data, External Binary Data Storage, and Migration

Alexander Edge:

I have benchmarked the difference between migration using binary data with external storage and using just a unique identifier. The sample project is on GitHub.

The test creates 1000 objects, each with a unique identifier and (optionally) a video file of 165KB as binary data. By adding a data model version with a new attribute, lightweight migration is performed on the next application launch.

When using binary data with external storage, migration took 37.5 seconds.

When not using binary data with external storage, migration took just 0.6 seconds.

It’s clear to see that storing large files in the file system with a naming scheme is the way to go. I have already begun working on an on-disk cache instead of using binary attributes.

External BLOB storage is important because storing BLOBs as linked lists in the database can be inefficient. When Core Data added -setAllowsExternalBinaryDataStorage:, this sounded like a good solution to the problem, but various problems were reported in early versions. It sounds like there are still issues, which is unfortunate because this sort of feature (commonly needed, tricky to do well) should be a selling point for a more full-featured framework like Core Data.

Monday, July 28, 2014

A Candid Look at Unread’s First Year

Jared Sinclair:

After a huge spike in sales the first day, sales dropped in what is (to my knowledge) a typical launch week curve for iPhone apps. The week after launch, Unread was featured on the main page of the App Store. This feature did not lead to a spike in sales. Rather, it kept sales from dropping any further for that week, then tapered off. I conclude from this that an App Store feature may not be as helpful as positive, prominent reviews from influential writers.

[…]

Half of the lifetime sales of Unread were generated in the first five days1. It would take another 170 days (24 weeks) to generate that same amount again.

[…]

Despite all of these circumstances, Unread still only earned $42K in sales ($21K after taxes and expenses) and is on a course that doesn’t promise much growth. I conclude from all this that anyone who wants to make a satisfying living as an independent app developer should seriously consider only building apps based on sustainable revenue models. I suspect this means through consumable in-app purchases, like those in Candy Crush Saga or Clash of Clans, or through recurring subscription charges, like those in WhatsApp.

My iPhone and iPad are great places to read articles that I’ve saved, but I prefer to process the RSS feeds from the Mac.

Update (2014-07-28): Tyler Hall:

And that leads me to another difference between developing for iOS and Mac. On the App Store, the price for apps has bottomed out. There are countless stories of developers, Jared included, failing to gain traction by setting an upfront paid price. Apps can require thousands of hours of work and yet can’t command a price of even $0.99. The only apps making money that I’m aware of are littered with scummy in-app purchases. For developers who take pride in what they build and don’t want to lower themselves to that level, there doesn’t seem to be a route to profitability.

With VirtualHostX [a Mac app], the opposite is true. In 2007, I priced the app at $7. Over time I raised the price to $9, $12, $14, $19, $24, $29, $34, $39, and, now, $49. With each price increase my total sales and revenue have only gone up. And, as an extra bonus, the quality of my customers has increased as well. I never received as many angry emails from customers as I did when the app was priced cheaply. Now that VirtualHostX costs “real money”, I weed out those users who aren’t willing to make a financial commitment to the app and my company.

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

But with how prices have fallen — how people are now accustomed to not paying anything until they’re hopelessly addicted and need the $4.99 packet of imaginary things that will get them to the next level — I can’t recommend to anybody that they quit their job to just write their own iOS apps.

Update (2014-07-29): Gus Mueller:

My basic strategy is to make a useful quality product, and sell it at a fair and sustainable price. If your app is quality, it will find customers. And then those customers will tell their friends, and the news sites will notice it. And since you’re charging a fair price a virtuous circle will form.

If you are just starting out, this might take years (maybe even exactly 1,068 days). It’s a long road of hard work, pain, joy, and just showing up every day. Eventually you will get lucky and gain some traction—but it’s not luck alone that is the key to success. You need to recognize opportunities as they come along and grab them. And just as equally important—you need to recognize time sinks and stupid ideas that come along as well. There will be more of the latter.

Update (2014-07-31): Jared Sinclair:

Since posting yesterday’s article about the numbers behind Unread’s first year on the App Store, several people have asked me why I didn’t do any promotion for Unread. The answer is that, in fact, I scrounged up as much promotion as I could afford. I did not just naively dump my app on the App Store and expect the bucks to start spilling through the mail slot.

Here’s a list of the promotional activities supporting Unread (both iPhone and iPad), either directly by me or through good fortune[…]

Faruk Ateş:

There is an overlooked element to the saying, “a jack of all trades, master of none” which is that there is hard-to-measure value in knowing how different skills complement and offset one another. There is value in understanding database architectures even if you’re an app designer; there is value in understanding interaction design even if you’re a copywriter. But when it comes to today’s world of apps, this value of the generalist does not overcome the challenges you face when trying to compete in a market with dozens, maybe even hundreds of competitors (or hundreds of thousands, if you’re making a game).

Update (2014-09-03): Paul Kim:

I’ve been doing Hazel for over seven years and I think it’s fairly safe to say that I’ve been successful doing it. I’m making more money than I did employed at other companies and I’m much happier with my job.

But it wasn’t easy and it wasn’t overnight.

Sunday, July 27, 2014

Canvas Fingerprinting Instead of Cookies

Julia Angwin (via John Gordon):

The type of tracking, called canvas fingerprinting, works by instructing the visitor’s web browser to draw a hidden image, and was first documented in a upcoming paper by researchers at Princeton University and KU Leuven University in Belgium. Because each computer draws the image slightly differently, the images can be used to assign each user’s device a number that uniquely identifies it.

Why You Only Have to Wipe a Disk Once

Chris Hoffman (via Uli Kusterer):

To understand why the Gutmann method isn’t necessary for all drives, it’s important to note that the paper and method were designed in 1996, when older hard drive technology was in use. The 35-pass Gutmann method was designed to wipe data from any type of drive, no matter what type of drive it was – everything from current hard disk technology in 1996 to ancient hard disk technology.

As Gutmann himself explained in an epilogue written later, for a modern drive, one wipe (or maybe two, if you like – but certainly not 35) will do just fine[…]

I had not heard that before. However, these days most of my drives are encrypted with FileVault 2, so there’s probably little reason to wipe them, anyway.

Saturday, July 26, 2014

Who at the Table is an Indie iOS Developer?

Brent Simmons:

There are a ton of Mac and iOS developers in the Seattle area — and almost all the iOS developers are making money either via a paycheck (they have a job) or through contracting.

The only local indie iOS-only developer I could think of was me — and even that won’t be true for much longer, as we’re working on Vesper for Mac.

[…]

[…] indie developers — people who make all or most of their money via products they create and sell — are fairly rare these days. Most of the local developers I know work at Omni, Black Pixel, or Apple or do contracting.

See also the responses from Rich Siegel, Ole Begemann, James Thomson, David Barnard, and Daniel Jalkut.

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

But with how prices have fallen — how people are now accustomed to not paying anything until they’re hopelessly addicted and need the $4.99 packet of imaginary things that will get them to the next level — I can’t recommend to anybody that they quit their job to just write their own iOS apps.

Update (2014-07-29): Marco Arment:

The app market is becoming a mature, developed industry, with vastly increased commoditization compared to its early days. Competition is ubiquitous, relentless, and often shameless, even in categories that were previously under-the-radar niches. Standing out requires more effort than ever, yet profits are harder to come by than ever.

Full-time iOS indie developers — people who make the majority of their income from sales of their apps, rather than consulting or other related work — are increasingly rare. I thought Brent Simmons would get flooded with counterexamples when he proposed that there are very few, but he didn’t.

Update (2014-07-31): Nick Bradbury:

I also gave up pursuing the indie life because I wanted to make the switch to mobile development, and I didn’t see much future for indie mobile developers. The economics of the various app stores coupled with the plethora of free software didn’t paint a rosy picture for one-person companies building consumer apps.

Michael Burford:

Sales are still not $0. At the current rate, it could have supported just me a bit longer (at a pretty low income, a fraction of what I'm making at a regular job as an iOS programmer) but the writing is on the wall. I found something new rather than waiting 6 months or a year when things could be much more desperate.

Its crazy that even working somewhere else full time, and doing Headlight work in my spare hours, it is still likely one of the bigger Indie developers--which is a sad sign for all app developers.

Peter Burford:

One of the main systemic problems with the AppStore is that it grew out of a music store. Music works very differently than software. As music gets old it may become less popular, but it never becomes obsolete. There are people in the world that are listening to Mozart, or Sgt. Pepper's, or London Calling, or OK Computer (or...hell, why not: New Kids on the Block) for the first time today and enjoying that music just as much as the people who listened to those songs when they were new. But no one is loading up Asteroids, or VisiCalc, or Doom, or Word 2.0 and feeling the same way people did when those pieces of software were new. Software doesn't work that way. You may feel nostalgia, but you won't feel mind-melting awe.

David Smith:

The word ‘Indie’ has taken on a somewhat mythical connotation within our community (whether conscious or unconsciously). It can take on the persona of this genius engineer, tirelessly toiling away on their work, sweating the details, making the hard decisions and then (after much noble blood, sweat and tears) emerging with a gleaming product. They then take this product out into the world and it begins to generate “passive income” sufficient for them to continue their artisanal craftsmanship. I must say I love this story. It sure does sound nice. It lets us elevate and aspire towards a rather delightful ideal. However, as someone for whom this title is oft ascribed I can say the reality is almost nothing like this.

Mark Bernstein:

In fact, not only is no one making a living from building mobile software: almost nobody is even scraping by.

This is deeply disturbing. There ares millions of the devices out there. They do amazing things. Mobile apps do incredible stuff, things nobody expected. And these are some terrific apps.

Update (2014-08-01): Mark Bernstein:

If you think all the failures in mobile software arise from the shortcomings of the products and/or their creators, then you think that you can look into the seeds of time and say which grain will grow and which will not.

[…]

But, speaking of the seeds of time, it sounds increasingly like none of the seeds are growing. One advantage of looking at indie products is that it’s hard to fudge: a big company can explain away weak sales in product A because A helps sell product B and B is what really matters. Are Pages and Numbers profitable? Who knows? My guess is that Apple has no idea, and we really have no idea. But if few or no isolated mobile software apps are thriving, we’ve got a real problem.

Michael Göbel:

It was a nice bubble. It lasted for almost four years and some of us made some decent money.

In 2012 I made more money than I earned the other eight years before that combined. In 2013 I ‘only’ made half of it and I better not talk about the current year; it will be half of the half.

The App Stores are dead. At least as long as you don’t write games or ripp off your customers.

Jason Brennan:

The real reason why it’s so hard to sell iOS apps is that iOS apps are really just websites. Implementation details aside, 95 per cent of people think of iOS apps the same way they think about websites. Websites that most people are exposed to are mostly promotional, ad-laden and most importantly, free. Most people do not pay for websites. A website is just something you visit and use, but it isn’t a piece of software, and this is the exact same way they think of and treat iOS apps. That’s why indie developers are having such a hard time making money.

Update (2014-08-23): Allen Ding (via Brent Simmons):

From a financial perspective, in the words of the wise, it’s been a toxic hell stew. Pretty ironic for an app meant to help people with expenses.

Laying it out there and admitting the app has been a failure isn’t easy, but it is the truth. The revenue from the app has barely been able to cover the cost that I paid for ads. About the only good thing you might be able to say is that the magnitude of the financial failure isn’t quite as depressing as some other apps which sometimes make nothing even though they deserve much better.

iTunes 12 and the Case of the Missing Sidebar

Kirk McElhearn:

I’ll miss the sidebar, and I wonder why Apple is removing it. For those who use it, it’s a convenient way to access much of your iTunes library. According to screenshots published on a variety of websites, there is no longer even a drop-down menu at the top-left of the iTunes window when the sidebar is hidden; you access the various libraries and devices by clicking icons in the navigation bar.

Jim Tanous:

It’s clear that Apple is trying to steer users away from the sidebar, and the company’s default album view is visually impressive. But longtime iTunes users who prefer the “traditional” iTunes layout may be fighting a losing battle with Apple. It’s great that the company preserves some forms of sidebar and list views in iTunes 12, even if they’re harder to find and lack some functionality, but how much longer will Apple continue quietly relegating these layouts before they’re gone completely?

The sidebar’s gone, but the modal preferences window remains. I’m not really attached to the old sidebar, but I found it essential to turn it back on in iTunes 11, and the new design does not seem to be a clear improvement. It seems even less friendly to those of us who like to navigate by menus or keyboard shortcuts, rather than by clicking tiny, unlabeled buttons.

Sidebar Translucency in Yosemite

Neven Mrgan:

Translucency in 10.10 is gross with fullscreen apps (which I dig). What does that blotchy, blurry sidebar “show” me?

This seems like an endless cycle with Apple. Introduce a new appearance that values form over function, one that in many cases it doesn’t even look good, unconvincingly try to justify it as useful, gradually tone it down over the releases, and eventually add a new horror. We’ve seen this movie before. Can’t we just skip the first several steps?

Flipboard Explorer

FLEX:

FLEX (Flipboard Explorer) is a set of in-app debugging and exploration tools for iOS development. When presented, FLEX shows a toolbar that lives in a window above your application. From this toolbar, you can view and modify nearly every piece of state in your running application.

List All Unprefixed Objective-C Classes for a Given SDK

Cédric Luthi has written a useful script that uses nm to inspect compiled frameworks.

How To Make Tilt Scrolling That Doesn’t Suck

Marco Arment:

My solution is to have tilt scrolling always default to off, make the user toggle it on every time they want it, and use the phone’s current orientation as the zero point when they tap the button. Critically, this means they can toggle the button off and on again to reset the zero point whenever they want, like if they change positions while sitting or in bed.

Amazon has apparently chosen instead to set this when the article is first loaded, but that will never work well enough in practice. I assumed my method was common sense, but apparently not.

Apple “Frustrated” That “People Don’t Want to Pay Anything”

Jared Nelson:

The second really interesting thing to come out of this interview is that, according to Watson, Apple is also sick of the race to the bottom mentality and rampancy of free to play games. “Apple is frustrated, along with everybody else, about the mentality that’s gone rampant in mobile app markets, where people don’t want to pay anything,” says Watson. “They think that four dollars is an exorbitant amount to pay for a game, which is very illogical considering most people’s lifestyles. They’ll spend $600 on an iPad, and $4 on a coffee, drop $20 on lunch, but when it comes to spending four or five dollars on a game, it’s this life-altering decision. I’m frustrated with that too.”

I don’t see any evidence in the article that Apple is frustrated. Apple literally encouraged the race to the bottom with its initial App Store pricing guidance (99 cents or free). And it continues to encourage it through the lack of trials, the types of in-app purchases it allows, and the types of apps that it features.

Update (2014-08-01): Lukas Mathis:

But I think there are other aspects to this: Apple intentionally commoditized apps, and still encourages unsustainable app pricing despite publicly claiming the opposite.

Friday, July 25, 2014

Nil-coalescing Operator in Swift

Josh Smith:

As seen in the last example above, I created a custom operator function, dubbed the nil-coalescing operator. That operator function evaluates to an optional’s value unless it is nil, in which case it evaluates to a fallback/default value. This is based on the null-coalescing operator in C#, which is formed by two adjacent question marks (??). Since Swift does not allow custom operator functions to include a question mark, I instead opted for two adjacent exclamation marks (!!). I think of it as “If the optional cannot be unwrapped (because it’s nil), then use this value instead.”

Update (2014-08-17): As of beta 5, Swift now has nil-coalescing operator:

The nil coalescing operator (a ?? b) unwraps an optional a if it contains a value, or returns a default value b if a is nil. The expression a is always of an optional type. The expression b must match the type that is stored inside a.

Airspeed Velocity:

Is this behaviour of ?? a bug? I dunno, probably not. You could prefer it to behave like the raw ternary operator, or fail to compile by somehow mandating the right-hand type really be what’s contained in the left-hand optional. But you could also say it’s behaving correctly, based on how the language works, and you might even need it to behave this way in some scenarios.

Either way, it’s a useful case study if you plan on implementing a generic function that takes optionals yourself.

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.

Update (2014-07-26): Dan Frakes:

As with previous versions of OS X, it’s not difficult to create a bootable installer drive from the Yosemite beta installer, though the processes have changed slightly since Mavericks. I show you how, below.

Kirk McElhearn:

It’s neat to get a first glimpse at a new operating system. But most users don’t really need this, so think carefully whether you do. If you decide to install it, make sure to do it safely.

Kirk McElhearn:

Sorry, you’re wrong. Your app may be compatible with the latest beta of Yosemite, but claiming that it’s compatible with Yosemite is misleading. Until the GM – the golden master, the final release version – is released, no one can be sure that their apps are compatible with an operating system.

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.

Stack Overflow 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.

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

In iOS, pcapd is available on every iOS device out there, and can be activated on any device without the user’s knowledge. You also don’t have to be enrolled in an enterprise policy, and you don’t have to be in developer mode. What makes this service dangerous is that it can be activated wirelessly, and does not ask the user for permission to activate it… so it can be employed for snooping by third parties in a privileged position.

[…]

Apple is being completely misleading by claiming that file relay is only for copying diagnostic data. If, by diagnostic data, you mean the user’s complete photo album, their SMS, Notes, Address Book, GeoLocation data, screenshots of the last thing they were looking at, and a ton of other personal data – then sure… but this data is far too personal in nature to ever be needed for diagnostics.

[…]

Additionally, this claim that your data is respected with data-protection encryption. The pairing record that is used to access all of this data is sent an escrow bag, which contains a backup copy of your key bag keys for unlocking data protection encryption. So again, we’re back to the fact that with any valid pairing, you have access to all of this personal data – whether it was Apple’s intention or not.

Now I hear the argument pop up from a few people who don’t understand how all of this works that, “of course you can dump personal info after you’ve paired, it’s supposed to sync your data”. Well, no. The trust dialog (the only pairing security there is) was only an afterthought that got added last year after another researcher showed how easily you could hijack iOS 6 by simply plugging it into a malicious charger. In fact, Apple added backup encryption to iOS specifically because they realized people’s devices were pairing with a bunch of hardware that the user didn’t trust. If pairing were meant to be a means to security, there would be no need for backup encryption at all.

[…]

In addition to downplaying the services themselves, Apple has stated that the user must “explicitly grant consent” for these services to be used. This is not the case. The user has had no idea these services even exist at all on the device until recently. There is no dialog asking the user to allow the packet sniffer to run, or to access your photos/contacts/sms/etc to provide to AppleCare (the dialogs you’re used to seeing third party apps present are not presented when these services are accessed). This consent simply doesn’t exist. The only consent is pushing that “trust” button, which (unbeknownst to the user) gives complete carte blanche access to the mobile device, wirelessly, indefinitely, and bypassing the backup encryption that the user believes is protecting their data from unwanted eyes.

Jonathan Zdziarski:

In spite of my warnings to the media (via email and telephone inquiries) not to pitch this as a conspiracy theory, they have still managed to completely derail the original intention of this research, and so I think a quick proof-of-concept video will help to clear up any misunderstandings about what this technique can and can’t do. I’ve also outlined the threat models that will and won’t work for this attack.

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.

Update (2015-02-11): Part 2 introduces __FILE__ and __LINE__. Swift does not have a way of capturing the expression as a string, among other limitations from not having 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.

Update (2014-08-01): Mike Ash:

Swift memory layout for generics is completely straightforward. The values are laid out just as they are with non-generic types, even if it means that class instances change size. Optionals of reference types represent nil as all zeroes, just like we're used to in Objective-C. Optionals of value types append a byte to the end of the value to indicate whether or not a value is present. Protocol types take up 40 bytes of storage, with the last two pointers containing references to type metadata tables, and the rest available for storying the underlying value. If more than 24 bytes of storage is needed, the value is automatically placed on the heap, and a pointer to the allocation is stored instead.

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.”

Update (2014-07-29): Adrianne Jeffries:

Dozens of current and former Comcast employees told The Verge they had to constantly push products, even if they worked in tech support, billing, and general customer service.

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.

Update (2014-08-18): For reasons I don’t understand, VMware started reporting the error “The parent virtual disk has been modified since the child was created,” even though I thought I had made fully independent copies of my virtual machines via the Finder. I am now using the Create Full Clone command, which hopefully will work better.

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. :)

Strings in Swift

Ole Begemann:

In this article, I want to take a closer look at how strings are handled in Swift. I see this as a follow-up to a piece titled NSString and Unicode that I wrote for objc.io a while ago. Please refer to that article for a more thorough explanation of the Unicode features I mention below. I also assume that you have read the chapter on Strings and Characters in Appleʼs Swift book.

[…]

Swift strings do not have a length property. You can use the global countElements() function (which works on any Sequence, including strings) to count the number of Characters in a string. In the following example, countElements() counts the number of characters correctly whereas NSString does not. Because of the differences in what constitutes a character between String and NSString, NSStringʼs length property has been renamed utf16count when you access it on a Swift string.

[…]

Because of the way Swift strings are stored, the String type does not support random access to its Characters via an integer index — there is no direct equivalent to NSStringʼs characterAtIndex: method. Conceptually, a String can be seen as a doubly linked list of characters rather than an array.

[…]

Character and range indices are based on the opaque String.Index type, which implements the BidirectionalIndex protocol (an extension of the ForwardIndex protocol). To construct an index for a specific position, you have to first ask the string for its startIndex and then use the global advance() function to iterate over all characters between the beginning of the string and the target position (again, an O(N) operation; advance() will simply call succ() several times):

[…]

Another implication of this design is that String.Index values are not freely interchangeable between strings.

Update (2014-07-22): Ole Begemann:

I have completely rewritten my article on Strings in Swift from earlier this month. Xcode 6 beta 4 fundamentally changed how the String and Character type handle Unicode characters that are composed of multiple code points.

Secrets of Swift’s Speed

Mike Ash:

A simple array index is quite a bit faster than objc_msgSend, even with its fancy caching and finely tuned assembly code, so this is a nice performance win.

The call to testmethod2 is even nicer. Because it’s declared @final, the compiler knows that nothing can override it. No matter what happens, the call will always go to the implementation in Class. Thus the compiler doesn’t even need to emit a vtable lookup. It can just make a normal function call that goes straight to __TFC9speedtest5Class11testmethod2fS0_FT_T_, which is the mangled name of the testmethod2 implementation in my test case.

[…]

The different method call semantics allow speed improvements beyond simply using faster dispatch techniques. Because the compiler can better understand where control goes, it can optimize the code better. It can potentially inline method calls or even eliminate them entirely.

[…]

Swift omits the _cmd parameter, freeing up an additional argument register for more useful purposes. For methods that take several explicit parameters (three or more for ARM, five or more for x86-64, and seven or more for ARM64), this means a small performance win on every call due to better use of argument registers.

Goldman Says Google Blocked E-mail With Leaked Client Data

Jonathan Stempel (via Nick Heer):

“Google complied with our request that it block access to the email,” Goldman spokeswoman Andrea Raphael said. “It has also notified us that the email account had not been accessed from the time the email was sent to the time Google blocked access. No client information has been breached.” A Google spokeswoman declined to comment.

The Rationale Behind Standard Paper Sizes Like A4 and A3

Tracey Bryan:

The A series of paper sizes are designed so that when you cut one in half, you get two pieces of the next-smallest-size, and every size has height and width in the same proportion. A little math reveals that one can achieve this by having the height and width in the ratio sqrt(2):1, or approximately 1.414:1.

[…]

In the case of the A series of paper sizes, an A0 piece of paper is exactly 1 square metre, requiring width x width x 1.414 = 1, which gives a width of 84.1cm and height of 118.9cm (to the nearest mm).

[…]

Another interesting consequence is that it becomes easy to calculate the weight of single sheets. Standard photocopy paper is usually 80gsm (grams per square metre), thus an A0 sheet, being 1 square metre, weighs 80g. An A1 weighs 40g, A2 is 20g, A3 is 10g, and A4 is 5g. (And so on.)

Brian Beej Hall:

This “halving” situation is also fantastic for envelope sizes. A C4 envelope will hold a sheet of A4 paper. A C5 will hold A5… or A4 folded in half. A C6 will hold A6, or an A4 folded in quarters.

John Whitehead:

Because the ratio of the sides of all A size papers is root 2, or 1.41, it’s always the case that expanding a document from one size to the next largest needs a factor of 141% dialled into your photocopier or typed into Illustrator or whatever. Reducing from one A size to the next smallest requires a factor of 1 over root 2, or 0.71, or 71%.

Rob Choucroun:

Say, for example, you have a map printed on A1 paper and the map is at a scale of 1:1,000. If you want to print the map on smaller paper, because of the ratio of the paper sizes, you can drop the paper two sizes (to A3) and the scale will reduce to 1:2,000.

See also Wikipedia’s articles about paper size and ISO 216.

Inspecting Yosemite’s Icons

Nick Keppol:

The shapes and sizes of the icons have been adjusted to provide a better visual rhythm on screen. I have not seen it published anywhere, but there appears to be a grid system that helps achieve this consistency.

[…]

There are three basic shapes utilized for application icons across the system. A circle, a square, and a tilted rectangle. Of course, Apple is consistently inconsistent and deviates from this system in a few places, but they are clearly outliers.

[…]

The old tilted rectangle icons, like the one on the left, are fully placed in 3D space, with natural perspective. They have a vanishing point on all axis. Put another way, if you drew a rectangle, and rotated it -11°, you would still have to skew it in perspective to match the shape.

The Yosemite icons appear orthographic at first, but with depth. They are a straight-on view of an object, with no perspective on the axis facing “the camera”. If you take a rectangle and rotate it -9°, you don’t have to skew anything, other than false 3D depth. (e.g., add the pages of the book, a drop shadow, an edge, etc.) They are much simpler in look, and easier for artists to draw.

[…]

Grey scale is out — warm and cool tones are in. It’s been a popular look in Hollywood blockbusters: yellow/orange highlights, blue/teal shadows. The new Yosemite icons use similar tonal shifts with their metal materials. If we consider these icons as materials, this tone represents an environment reflection — not merely a color effect.

A First-Person Engine in 265 Lines

Hunter Loftis (via Hacker News):

In this article, we’ll compose a first-person exploration from scratch, quickly and without difficult math, using a technique called raycasting. You may have seen it before in games like Daggerfall and Duke Nukem 3D, or more recently in Notch Persson’s ludum dare entries.

Raycasting feels like cheating, and as a lazy programmer, I love it. You get the immersion of a 3D environment without many of the complexities of “real 3D” to slow you down. For example, raycasts run in constant time, so you can load up a massive world and it will just work, without optimization, as quickly as a tiny world. Levels are defined as simple grids rather than as trees of polygon meshes, so you can dive right in without a 3D modeling background or mathematics PhD.

A Closer Look at Android RunTime (ART)

Andrei Frumusanu:

The Android RunTime, ART, is the successor and replacement for Dalvik, the virtual machine on which Android Java code is executed on. We’ve had traces and previews of it available with KitKat devices since last fall, but there wasn’t much information in terms of technical details and the direction Google was heading with it.

[…]

First, ART is designed to be fully compatible with Dalvik’s existing byte-code format, “dex” (Dalvik executable). As such, from a developer’s perspective, there are no changes at all in terms of having to write applications for one or the other runtime and no need to worry about compatibilities.

The big paradigm-shift that ART brings, is that instead of being a Just-in-Time (JIT) compiler, it now compiles application code Ahead-of-Time (AOT). The runtime goes from having to compile from bytecode to native code each time you run an application, to having it to do it only once, and any subsequent execution from that point forward is done from the existing compiled native code.

Of course, these native translations of the applications take up space, and this new methodology is something that has been made possible today only due to the vast increases in available storage space on today’s devices, a big shift from the early beginnings of Android devices.

This shift opens up a large amount of optimizations which were not possible in the past; because code is optimized and compiled only once, it is worth to optimize it really well that one time. Google claims that it now is able to achieve higher level optimizations over the whole of an applications code-base, as the compiler has an overview of the totality of the code, as opposed to the current JIT compiler which only does optimizations in local/method chunks.

[…]

An important difference that Google is applying over Apple, at least inside VM runtime applications, is that they are using reference compression to avoid the usual memory bloat that comes with the switch to 64-bit. The VM retains simple 32-bit references.

iOS 8 Share Extensions

Rene Ritchie:

With iOS 8 and Extensibility, gone are the days when Apple had to make a deal with social networks and laboriously integrate them one and a time into iOS. Now, any app you download from the App Store can hook into the Share Sheets and give you the option to share or upload your content with other members and to the service.

[…]

Because of custom sharing extensions, you also get the ability to customize your sharing options. Scroll all the way to the right on a Share Sheet and you’ll see a special “More” icon. Tap it and you’re taken to the Activities panel where you can toggle on or off all the sharing options (with the exception of Messages and Mail), and move all of them around into any order you like.

[…]

System defaults are both quick to implement and offer a lot of functionality, like image preview, text entry, audience picker, etc. “for free”. They also help maintain continuity of experience. Custom sheets are more work but can leverage code from the existing app and better show off a service’s branding. That can be useful in continuously, visually reminding someone which service they’re sharing to throughout the process.

[…]

Both web URL and web pages are supported. The first is all about sharing a link. The second is all about pulling the data from the web page itself. Developers can, via JavaScript, determine which parts of a webpage their extension wants.

Swift Instance Methods Can Shadow Functions

Dan Wineman (via Twitter):

Swift allows you to call instance methods from other instance methods with no scope prefix, indistinguishably from function calls. This leads to the dangerous situation of function calls being shadowed when identically-named instance methods are added to a base class.

This seems like a really bad idea. In other areas, Swift adds more protections for this sort of thing.

Swizzling and Touch Forwarding

Peter Steinberger:

This works as expected in most cases, but has the issue that the original implementation will be called with a different _cmd than it expects. This can be a problem when _cmd is actually used, such as in the touch forwarding logic. I learned this the hard way after swizzling touchesMoved:withEvent: to inject additional logic. The app crashed with the popular doesNotRecognizeSelector: exception.

Instead of exchanging the method implementations, one could replace the old method and store its IMP outside the runtime. But then:

We are now modifying the touchesBegan:withEvent: method of our custom UIView subclass. There is no default implementation yet, so we get the IMP from UIResponder and then manually call this. Imagine if at some later point, somebody else would swizzle touchesBegan:withEvent: on UIView directly using the same technique. Assuming UIView has no custom touch handling code, they would get the IMP from UIResponder and add a new method to UIView. But then our method gets called, which already captured the IMP of UIResponder and completely ignores the fact that we modified UIView as well.

Perhaps I’m missing something, but it seems like it would be possible to exchange the method implementations. When you need to call the old method, use the new selector to fetch the old IMP. Then call the old IMP passing in the old selector. Then the old method would still receive its expected selector, and you would still be safe if other code swizzles the same method.

iOS 8 Privacy Updates

Luis Abreu:

The latest updates to iOS 8 and OS X Yosemite introduce some very welcomed changes to the way Security and Privacy is dealt with on these platforms and may serve as an inspiration for others.

I’ve gathered this information by watching over 17 hours of WWDC 2014 sessions and carefully reviewing, analyzing what was said, and writing a huge number of notes on Security, Privacy, UX and other areas which I will be publishing here in the coming weeks.

[…]

As a side note: you can now direct the user directly to the applications’s privacy controls in iOS Settings from your app without having to display step-by-step instructions for the user to follow.

Sounds like this sort of guidance won’t be as necessary.

Facebook Big Likes

Paul Kafasis:

Alas, Facebook Messenger 6.1 has already been released, and it obliterates all reference to version 6’s revolutionary upgrades. Let this post serve as a testament to the ingenuity on display at Facebook, in the form of “Big Likes”.

iCloud Drops Support for Third-Party AIM Clients

Dan Moren:

Thanks to enhanced security that Apple has put in place as of July 1, folks with those specific [mac.com/me.com/icloud.com] usernames can no longer connect to the AIM service with clients other than Messages running on OS X 10.7.2 or later.

[…]

If you don’t want to upgrade your version of OS X or switch to Messages, your alternative is to create a new AIM account. Of course, that requires that you re-construct your buddy list, which may be a not insignificant amount of work.

Wednesday, July 2, 2014

Swift and Inheritance

David Owens II:

So what is the take-away when foundational types of the language that are classic examples of types that should be classes are implemented as structs? To me, it seems the API designers for Swift are already compensating for weaknesses in the language’s runtime and are trading supposed run-time performance over platform extensibility and that we, as developers of frameworks, should be doing the same.

SortedArray is perhaps a poor example, but I agree that there seems to be a code smell here. The more I learn about Swift, the more I see a, perhaps unavoidable, tension: Swift is (promised to be) faster, but Objective-C is more flexible. Swift doesn’t have much in the way of libraries, so it’s designed to work well with Objective-C’s, but there’s friction at this border.

What is the long-term plan? Keeping the frameworks all Objective-C would hold Swift back. But making pure Swift APIs would cut off access from Objective-C. Swift seems best-suited to lower level code where performance is more important than flexibility, i.e. the areas where Apple is now using C++ underneath an Objective-C API. But Apple is clearly pushing for its use on the other side of Objective-C, calling in.