Archive for January 31, 2017

Tuesday, January 31, 2017

Fun With Swift String Interpolation

Ole Begemann:

The source of the problem is that “unsafe strings” and “safe strings” are so fundamentally different that we should often treat them differently, yet we tend to use the same String type for both. So let’s introduce separate types for these concepts. I’m calling these UnsafeString and SanitizedHTML.


If we make sure that all rendering APIs only accept SanitizedHTML as input, the new types make it impossible to accidentally render an unescaped string.


Customizing how your own types interpret an interpolation string is an extremely powerful feature, especially for DSLs. Building SQL queries or localized strings are just two examples where you could employ the same techniques (here’s an implementation of the latter by Brent Royal-Gordon). Any task that needs strings built from components can probably profit from it.

It Just Works

Adrian Kosmaczewski (via Andy Lee):

I start iTunes. It tells me that I need to log in to Apple Music. I do not remember ever having logged off. I enter my username and password. The dialog goes away. iTunes still does not allow me to listen to music. I close and re-open iTunes. I log off and on a few times. I finally reboot my Mac. I discover that the artist I would love to listen to that morning is not available on iTunes Music. I select another artist. I hit play. Music does not come out from the built-in speakers. I plug in my old 2002 Harman Kardon SoundSticks. I plug the USB 3 to USB dongle first.


I sit on my Mac and open a Pages file stored on iCloud, one I was working on my iPad Pro during the weekend. The sync fails and I cannot see the last modifications I made on my iPad Pro. Open and close apps on both devices. I reboot them both. Pages for Mac tells me that there is a conflict between the versions in both devices, even though I have never edited the file on the Mac. I select the version on the iPad. My changes are lost.


I try to open an application I bought yesterday on this Mac. The operating system protests, telling me that I have to login to the App Store because the application was bought in another Mac. It is not true. I log in anyway. The app opens.

This seems too bad to be real, but I’ve had days recently that feel like this. I have an old Mac and sometimes think a new one would be more reliable, until I read about problems people are having with a brand new MacBook Pro and display. At least I don’t have kernel panics.

Lloyd Chambers:

I had mangled a bunch of html files as part of a major site overhaul, and I just wanted the top-level folder back as of 12 hours or so prior—that’s the type of thing perfect for Time Machine.

  1. Enter Time Machine.
  2. Restore Folder.
  3. Observe that the restored folder now has ZERO files in it (empty). Time Machine WIPED OUT everything. No error message, no indication of any issue (that folder has had files for many years, and thousands of them).

Update (2017-01-31): Peter Steinberger:

Huh, has it been another month yet? About time for Time Machine to break again.

Mac App Store Top Charts for 70 Cents

Jeff Johnson (tweet):

I’m not sure exactly what it means to be near the bottom of the overall charts. I do know exactly what it means to be near the bottom of the Social Networking charts: nothing! There are 180 apps each on the Top Paid Social Networking and Top Grossing Social Networking charts. My app was 18 out of 180 and sold 1 unit.


We do know that some developers are doing very well on the Mac App Store. The question is, how many? It’s hard not to conclude that the top charts themselves are extremely top-heavy.

Previously: Exploring the App Store’s Top Grossing Chart.

Update (2017-02-02): Nick Heer:

Of note, most of the apps ahead of Underpass are third-party implementations of popular iOS apps like Instagram, WhatsApp, and Facebook Messenger. And, at number thirteen in the Top Grossing chart, Apple’s long-outdated FaceTime app. That doesn’t sound like a healthy ecosystem.

LG 5K Display and Wi-Fi Interference

Sebastian Anthony (via Peter Steinberger, Hacker News):

The spiritual successor to Apple’s Thunderbolt Display, the LG UltraFine 5K monitor, which only started shipping out from the Apple online store this week, appears to suffer from a major fault: when placed within two metres (6.5ft) of a wireless router, the display starts to flicker; move it really close, and the monitor goes black and becomes unusable. An LG Electronics support person confirmed the issue, saying it “only happens for the 5K monitors we have, not other LG monitors.”

If that wasn’t bad enough, 9to5Mac’s Zac Hall reports that his LG 5K monitor, under the duress of a nearby Wi-Fi router, can freeze the MacBook Pro that it’s plugged into, forcing a reboot to bring it back. When he moved the router (an Apple AirPort Extreme) from beside the monitor to another room, everything went back to normal.

The Apple Store reviews are also a horror show.

Previously: LG Ultrafine 5K Reviews.

Update (2017-01-31): McCloud:

I bought the 4K version and it literally worked only twice. Third time plugging it in it died.

Luc Vandal:

The first 5K display I received had the same issues as the 4K except that it worked for about a minute and then just died. Since I had similar issues with the previous display, I went to the Apple Store to exchange the laptop for a new one, thinking that something was wrong with it. Unfortunately it didn’t solve the issue and had to, once again, send the display back to Apple and order a new one.


The thing wobbles like a Bobblehead. I don’t have the most stable desk but that was never an issue with my iMac.


The overall construction quality not what you would expect from a product endorsed by Apple. This display is more expensive than a Thunderbolt Display and yet it feels much cheaper. That Apple is fine with that is beyond me.

Update (2017-02-03): Benjamin Mayo (iMore, MacRumors, Hacker News):

LG has now said that it has identified the hardware problem in which Wi-Fi routers within 2 feet of the display resulted in signal interference issues. All new UltraFine units produced after February will not be affected as they will be fitted with ‘enhanced shielding’. Existing owners of the UltraFine 5K Display, recommended by Apple as the best companion to the 2016 MacBook Pro, will need to contact LG support for assistance.

Activation Lock Status Checker Removed

Juli Clover:

As it turns out, the Activation Lock website was a vital part of a bypass hack used to unlock devices bricked by Activation Lock, perhaps hinting at why Apple shelved it.

The process is demonstrated in the video below. By changing one or two characters of an invalid serial number, hackers are able to generate a valid serial number, using the Activation Lock tool for verification purposes to make sure it’s functional. That valid number, which belongs to a legitimate device owner, can then be used to unlock a previously non-functional iPhone or iPad.

The Activation Lock scheme that steals valid serial numbers from existing iOS users potentially explains a mysterious Apple ID bug that’s been plaguing iPhone owners for months.