Archive for October 29, 2013

Tuesday, October 29, 2013

How Java’s Floating-Point Hurts Everyone Everywhere

John Carmack found an interesting 1998 paper by William Kahan and Joseph D. Darcy (PDF):

Java’s floating-point arithmetic is blighted by five gratuitous mistakes:

  1. Linguistically legislated exact reproducibility is at best mere wishful thinking.
  2. Of two traditional policies for mixed precision evaluation, Java chose the worse.
  3. Infinities and NaNs unleashed without the protection of floating-point traps and flags mandated by IEEE Standards 754/854 belie Java’s claim to robustness.
  4. Every programmer’s prospects for success are diminished by Java’s refusal to grant access to capabilities built into over 95% of today's floating-point hardware.
  5. Java has rejected even mildly disciplined infix operator overloading, without which extensions to arithmetic with everyday mathematical types like complex numbers, intervals, matrices, geometrical objects and arbitrarily high precision become extremely inconvenient.

Darcy went on to work for Sun to improve the situation.

Weather Line 1.0

I’ve been using Weather Line (App Store) for about 10 days now, and it’s my new favorite weather app. It does such a good job of providing useful information at a high density. The chart shows nearly all the important information, and in enough detail that I don’t need to look elsewhere. (I’d like to see precipitation percentages over time and also information about snow accumulation.) You can also tap on an individual upcoming day to get a short textual forecast such as “Light rain in evening.”

The main flaw is that this version doesn’t take advantage of iOS 7’s Background Fetch feature, so sometimes it takes a few seconds to update when I launch the app.

Federico Viticci:

What I like about Weather Line’s UI is that the line has been elegantly augmented with icons, color, and text to carry more information: degrees are shown above the line, and crisp icons indicate weather conditions for each hour, day, or monthly average. For nightly hours, the line is dark, but it turns yellow at predicted sunrise time; if there’s rain on the forecast, the line turns blue.

Update (2013-11-01): Developer Ryan Jones e-mailed to say that the lack of background updates is a deliberate design decision:

We tested and considered it deeply. However, weather data actually changes too rapidly. If we updated in the background, we would still have to update again when you launched the app. So then we’d just be wasting your battery with a background update that we never used. The best experience comes by refreshing data as fast as possible when you launch the app. And we did, it’s very fast.

I’m not convinced. Apple’s own Weather app supports this, and users could always turn it off if desired. For me, battery life has not been a concern. My phone is often docked and on Wi-Fi. However, it is relatively common for me to be out and about with a slow or non-existent cell connection. In these cases, slightly old weather data (e.g. from when I left home) would be preferable to waiting 10–15 seconds to refresh or having to make do with days-old data if it can’t connect. If it makes sense to fetch tweets in the background, I just don’t see a good reason not to do this for relatively less intensive but more important weather data.

Jones also pointed me to the Breckenridge, CO forecast, since we haven’t had much snow here in NH yet. It looks like Weather Line handles snow forecasts pretty well.

Key-Value Observing for the Mainstream

I was going to write about the rare NSHipster article that I wouldn’t recommend, but Damien DeVille already has:

The truth is, in practice it is very important to always use the context to differentiate between observed objects and not rely on the key path. We are working with an object-oriented language and we should always accommodate for the case where a class might be subclassed or a super class expecting a behavior that your own class will prevent.

[…]

Or even worse, would you ever consider handling a signal for a memory error due to calling free on a freed piece of memory because you couldn’t remember whether you previously retained this object and decided to release it anyway.

No. Because this is madness.

Update (2013-10-30): Damien DeVille has more on +keyPathsForValuesAffectingValueForKey::

I hope this helped you understand how the key dependency KVO mechanism works. As I said in the previous post, KVO has very simple rules and is very powerful, as long as you follow the rules.

HyperCard Stacks Decoded

Andreas Pehnack:

Now you can download a free grammar for Synalyze It! that decodes most of the HyperCard stack files. The file format can be easily displayed in a tree view.

Synalyze It is a cool app that I’d like to play with more.

CNET Adds Adware to Mac Downloads

SecureMac:

Direct download links for a variety of popular Mac software products have been replaced on CNET's Download.com with installers for browser toolbars, commonly used by adware to track user browsing habits. A wide variety of Mac apps have had their download links replaced with the adware installer, including popular Mac antivirus software. At this time it is not clear if CNET had provided any prior notification to the creators of affected apps, but it appears that many of the companies were unaware that their download links had been switched to one that installed toolbars and changed web browser settings.

I miss the old VersionTracker. Fortunately, MacUpdate is still good.

Update (2013-11-06): Derek Currie:

VersionTracker used to be heaven for Mac users! It was one of the top 5 best Mac websites on the Internet! I have net friends who work there! I used to haunt the place every day! ...Then CNET bought them.

Mac Pro Posters and Odd Copy

Jeff Carlson:

Opening the tube revealed a set of large Mac Pro posters and a sheet that reads:

It’s the computer we were insane to build. The one that turns conventional thinking on its head, then kicks the living $#&% out of it. We challenged all our assumptions. Abandoned our preconceptions. And blew away limitation after limitation. This is the new Mac Pro. It’s like no Mac we’ve created before. And we can’t wait to see what you create with it.

Neven Mrgan:

This juvenile, defensive, unfunny copy on the Mac Pro posters is positively upsetting. Between this and the Sotheby’s glitz-crap, it’s like all the middle-age insecurities of Apple management are leaking through in their products.

When I first saw this copy, I thought it was a parody. The product seems to actually be good, but it sounds like the writer didn’t believe this was self-evident. Rather than showing, it tells. You don’t need any expansion slots; move along. And, as with “Redmond, start your photocopiers,” I think it’s in poor taste.

Kindle MatchBook

Chris Welch:

Amazon’s Kindle MatchBook service has gone live today, allowing customers to buy a heavily discounted Kindle copy of physical books they’ve purchased from the online retailer. Prices range between free and $2.99, offering a quick and cheap way to expand your Amazon ebook library. And on that note, there’s good news: Amazon says that 70,000 books are enrolled in MatchBook at launch, dwarfing the original 10,000 titles it announced last month.

It’s a great idea, but I’ve been purchasing books from Amazon since the 90s, and it was only able to match 14 of them. Many of the unmatched books are available from Amazon—for full price.

Videos Pulled From iTunes and Amazon Stores

Juli Clover:

According to the customer who noticed the missing titles, Disney elected to remove the content from the iTunes Store, preventing customers who have purchased the movies/TV shows from re-downloading the content via iTunes in the Cloud, which allows users access to previously purchased content.

[…]

On Amazon.com, searching for the titles results in a notice that licensing agreements have prevented the content from being purchased or rented, and as AppAdvice points out, Apple’s iTunes Store Terms and Conditions does specify that previously purchased content can be made inaccessible.

Mavericks and AppleScript’s “exists process”

Dave Nanian notes that running an AppleScript that asks System Events merely whether a process is running brings up the new accessibility permissions dialog. This has caused some problems for SuperDuper. Unfortunately:

LinkedIn’s IMAP Proxy for MobileMail

Martin Kleppmann:

Intro’s approach of proxying IMAP is a novel way of delivering software to users. It operates at the limit of what is technically possible, but it has a big advantage: we can enhance the apps you already use.

The iOS Mail app doesn’t support plug-ins, so LinkedIn built a server that intercepts messages between your mail server and your iPhone so that it can inject content and controls directly into the message body.

Mavericks and Multiple Displays

Mavericks is famously supposed to improve the multi-display experience:

OS X Mavericks takes full advantage of every display connected to your Mac, giving you even more flexibility to work the way you want. There’s no longer a primary or secondary display — now each has its own menu bar, and the Dock is available on whichever screen you’re working on. You can run a full-screen app on one display and have multiple windows on another display, or run a full‑screen app independently on each display. You can even turn your HDTV into a fully functional second display using AirPlay and Apple TV.

My experience has been that, when not using full-screen, the new design is a regression. It seems to be designed around the idea of using this application on this display and that application on that display. Using one application on multiple displays doesn’t work as well as in previous versions of Mac OS X (or, indeed, classic Mac OS). Apple tried to make a “power user” feature easier to use but ended up making it less powerful and less useful.

Applications no longer remember which display a window was on. Instead, they always seem to open on the display that currently has the menu bar. If I have a document open on my auxiliary display, save it, close it, and double-click its file in the Finder, the window re-opens on the other display.

Likewise, there are some auxiliary windows (Mail and EagleFiler’s Activity windows, various downloads windows) that I like to have off to the side, while working with the main application windows on my main display. Instead, every time I open Mail it puts the Activity window on the main display, right on top of my inbox.

Another problem is that once I move the auxiliary window to the side, where I want it, it becomes a magnet that attracts future primary windows to the wrong display. For example, if an Activity window is on the small display and all the other windows have been closed, the application’s menu bar will be on the small display, which means that documents will open there (and have their windows shrunk) even though I have always specifically placed them on the large display.

These issues also apply when there are no auxiliary windows, for example if you use the same application to work on two different projects. It is natural to want the windows for project A on one display and the windows for project B on the other display. Mavericks wants you to either put all the windows on one display or to group the windows by application rather than by project.

Update (2013-10-30): Pierre Igot reports that you can get the old multi-display behavior back by unchecking Displays have separate spaces in the Mission Control preference pane. I actually saw that option but didn’t think it would have that effect, however it sort of makes sense when you think about it. Unfortunately, this also brings back the Mountain Lion behavior of only being able to use one display when using an app in full screen.

Apple Discussions

Lawrence Lessig:

What’s striking about the comments on the Apple community site is the frustration — frustration because of Apple’s apparent policy not to respond to comments. Unlike really helpful companies which try to reward people who spend time making community boards the best source for technical support by engaging with posts, and at least acknowledging the problems, Apple’s policy seems to be a “never comment” policy. Which leads its users — and again, people who are volunteering their time to help lower Apple’s customer support cost — to express increasing exasperation at the unanswered problems.

The Apple support forums are an excellent resource. On the one hand, it seems unimaginable that Apple would encourage its support representatives to participate there on the record. It likes to carefully manage its public image. On the other hand, what a difference it could make if done well. If I’m considering buying an app and see that the user forum is full of unanswered questions, that’s a red flag. In the Apple forums, there are threads with hundreds or even thousands of replies, none from Apple. True or not, this leaves the impression that Apple doesn’t know about the problem and doesn’t care.

Lessig also mentions that Apple moderates the forums and deletes certain types of comments that are potentially useful to customers. This is a separate issue that I don’t think is clear-cut.

Mavericks Font Smoothing

Since updating to Mavericks, I’ve noticed that text is not rendered as crisply. Here are some screenshots showing Verdana in Safari 7:

Mountain Lion

Daring Fireball on Mountain Lion
FogBugz on Mountain Lion

Mavericks

Daring Fireball on Mavericks
FogBugz on Mavericks

It feels harder to read, and compared side-by-side the Mavericks text looks like a fuzzy mush to me.

Related:

Update (2015-03-11): Mike Ash had the same problem with Xcode and multiple displays:

Fixed Xcode’s antialiasing dumbness. Patch -[NSTextView drawRect:], do [[self layoutManager] setUsesScreenFonts: YES];.

I made a hacked Xcode plugin. There’s an undocumented API for that. I might see about cleaning it up and publishing something.