Archive for October 30, 2017

Monday, October 30, 2017

iOS 11 Changes Localized Date Handling

Jaanus Kase:

If you enable Estonian language/region support as shown on the above image, and developers are formatting dates with the correct/default NSDateFormatter approach that Apple has trained them to do for years, then…

… in iOS 10, you see dates and times in Estonian in many apps, even those that are not explicitly localized.

… in iOS 11, you see dates and times in Estonian only in those apps that are themselves localized into Estonian. Which, let’s be honest, is like 2 apps out of a million. The dates shown in the apps are not what Apple shows as “Region Format Example” in the screenshot. Unless you are on the home screen, which nevertheless chooses to still show the date in Estonian, making affairs just more confusing.

[…]

From a purist standpoint, seeing Frankenstein UI where English-language apps have Estonian dates in them may be undesirable. As a user, though, I am not a purist. I am a human. I prefer my own language, even if the support is Frankenstein-like and incomplete.

Redesigning Adobe’s File Type Icon System Language

Anny Chen:

When we factor in the number of sizes and formats for each file type icon, we’re looking at over 7,000 assets to modify and manage with each release cycle.

[…]

Only primary file types would get the product logo color association. For example, .PSD would be blue and .AI would be orange.

Create a neutral palette for secondary file types that are supported by multiple applications. For example, Photoshop and Illustrator would use the same .PNG file type icon, instead of each having their own unique version of the icon through brand color association.

[…]

One of the main drivers behind the redesign was to simplify and remove as many elements on the file type icon without losing its significance. We dropped the tag, and moved the file type mime to the bottom of the icon. We also removed the page curl to flatten the design and create a more modern visual language.

Previously: New Lightroom CC and Lightroom Classic CC.

Locks, Thread Safety, and Swift: 2017 Edition

Mike Ash:

Note that pthread_mutex_t, pthread_rwlock_t, and os_unfair_lock are value types, not reference types. That means that if you use = on them, you make a copy. This is important, because these types can't be copied! If you copy one of the pthread types, the copy will be unusable and may crash when you try to use it. The pthread functions that work with these types assume that the values are at the same memory addresses as where they were initialized, and putting them somewhere else afterwards is a bad idea. os_unfair_lock won't crash, but you get a completely separate lock out of it which is never what you want.

If you use these types, you must be careful never to copy them, whether explicitly with a = operator, or implicitly by, for example, embedding them in a struct or capturing them in a closure.

Additionally, since locks are inherently mutable objects, this means you need to declare them with var instead of let.

[…]

You must be careful with the pthread locks, because you can create a value using the empty () initializer, but that value won't be a valid lock. These locks must be separately initialized using pthread_mutex_init or pthread_rwlock_init[…]

Previously: Locks, Thread Safety, and Swift, OSSpinLock Is Unsafe, os_unfair_lock.

Update (2018-07-31): Vadim Bulavin (via Andy Bargh):

In this article we will benchmark performance of most notable Apple locking APIs and suggest best options based on their characteristics.

[…]

Based on the benchmark results, DispatchQueue must be your best choice for creating a critical section in your code.

Under 10000 calculations it performs almost identical to locks, while providing higher-level and thus less error-prone API.

Amazon Now Has a $1 Billion Ad Business

Shareen Pathak (via Hacker News):

According to recent research by Merkle, Sponsored Products Ads are the most heavily targeted format and accounted for 82 percent of all Amazon ad spend, though Headline Search Ads and Product Display Ads did grow faster quarter over quarter in terms of spend.

Amazon has also invested in programmatic, growing its self-serve offering and trying to get more “non-endemic” brands into its platform so it can lessen reliance on retail. That’s involved courting advertisers from brands that don’t sell on Amazon, such as auto brands or wireless and telecom companies.