Archive for December 11, 2015

Friday, December 11, 2015

Comcast Stream TV and Net Neutrality

Klint Finley:

Comcast says this isn’t a violation of network neutrality law because, although you’re viewing Stream TV on your computer via your Comcast broadband connection, the service isn’t technically offered over the Internet, but over Comcast’s cable television network, much like its Xfinity Xbox 360 service, which allowed Xbox users to view video that didn’t count against their data limits and was shuttered last summer.

This arrangement won’t affect many Comcast customers, at least at first. The company only imposes a 300GB limit on users in 15 areas so far. According to Ars Technica, which first reported that Stream TV won’t count towards those limits, some parts of Maine within the greater Boston area are the only areas where Stream TV availability and data limits overlap. But Comcast plans to expand Stream TV into other markets, and it might expand its data caps into other regions as well. As it does, network neutrality advocates will surely challenge Comcast’s claims.


But Comcast is in a unique position: under the terms of its merger with NBC Universal in 2011, Comcast is specifically barred from zero-rating its own services while counting data from competing services against a data cap.

NSFileHandle’s Indeterminable readabilityHandler

Sven (via Jeremy W. Sherman):

The problem is that I need to know when the last chunk of data was read. availableData should return an empty NSData instance if it reached end-of-file, but the problem is that the reachability handler is not called again on EOF.

I can’t find anything about how to get some kind of notification or callback on EOF. So what am I missing? Is Apple really providing an asynchronous reading API without an EOF callback?

The Grand Unified Theory of Apple Products

Above Avalon (comments):

One theme that has come to represent the Tim Cook era is product line expansion. Over the past four years, Apple has doubled its product lineup from 12 distinct models to more than 24, including a new product category. On a SKU basis, the growth is even more noticeable when taking into account additional finish options and various iPhone models geared toward specific mobile carriers.


The message behind the slide was simple: each distinct product category possesses a different ratio of personal technology and power. The smaller the device, the more personal the technology. Meanwhile, the large iMac is positioned as the ultimate computing machine. The best choice as to what to buy or use is dependent on the individual. All of a sudden, Apple had a way to explain iPad’s declining sales momentum (cannibalization by other Apple products), while also planting the seed that not every one will want an Apple Watch in the near-term. Instead, it’s all about personal preference.


The first thing to notice about Schiller’s new product theory is that it is actually a series of goals that also serve a dual purpose: help describe the product. What is the Apple Watch? It is a device that is supposed to handle a growing number of tasks once given to your iPhone. What is the iPhone? It is a device that is supposed to handle a growing number of tasks once given to your iPad.

Swift’s Lazy Weak References

Mike Ash:

Weak references to an object will cause that object’s memory to remain allocated even after there are no strong references to it, until all weak references are either loaded or discarded. This temporarily increases memory usage. Note that the effect is small, because while the target object’s memory remains allocated, it’s only the memory for the instance itself.


Extra memory is required to store the weak reference count on every object. In practice it appears that this is inconsequential on 64-bit. The header fields want to occupy a whole number of pointer-sized chunks, and the strong and weak reference counts share one. If the weak reference count weren’t there, the strong reference count would just occupy all 64 bits by itself. It’s possible that the strong reference could otherwise be moved into the isa by using a non-pointer isa, but I’m not sure how important that is or how it’s going to shake out in the long term.

Joe Groff:

We do plan to make weak references use a side table implementation like ObjC so we can eagerly reclaim their memory.

It’s nice for perf, yeah, but leaking the memory is unacceptable for things like outlets and delegates that get hit infrequently.

Mike Ash:

The current implementation of weak references has a race condition when multiple threads read the same weak reference to a deallocating object simultaneously.

Previously: Weak and Unowned References in Swift, How Swift Implements Unowned and Weak References.

Update (2015-12-13): Here’s the mailing list discussion for the thread-safety bug.

Double Core Data Accessors by Omitting @NSManaged

Trevor Squires:

If our implementation is not exposed to Objective-C, then Core Data will not find it at runtime, which means that, yes, Core Data will dynamically generate the accessor implementation for us.


This is why I now consider Swift to be the most satisfying language for using Core Data. The fact that (more expressive) types can’t be represented in Objective-C is a benefit, not a limitation.

Swift NSManagedObject subclasses can provide Swift-only accessors which happily coexist with Core Data’s dynamically-generated ones, and that feels like the best of both worlds.

Update (2016-06-07): Marc Charbonneau:

When you declare an @NSManaged var in your managed object subclass, normally it can be an Int, Bool, or Double. But not for Core Data primitive accessors! Primitive accessors (not to be confused with primitive types, I’m talking about methods that are a shorthand for primitiveValueForKey: … ) must be declared as an NSNumber. You don’t have to explicitly wrap your value in an NSNumber, you can still assign an Int or Double to your var and Swift will box it up for you. Not a big deal, but something to remember if you find your app crashing.