Archive for November 20, 2013

Wednesday, November 20, 2013



f.lux makes your computer screen look like the room you’re in, all the time. When the sun sets, it makes your computer look like your indoor lights. In the morning, it makes things look like sunlight again.

Tell f.lux what kind of lighting you have, and where you live. Then forget about it. f.lux will do the rest, automatically.

In other words, it makes the color temperature cooler (bluer, higher Kelvin) when the sun is high and warmer (yellower, lower K) when it’s dark out. In theory, this is easier on your eyes compared with the normal calibration of always using cool/bright whites; and the warmer colors keep your body from being confused about the time of day, which can help you sleep. There’s also an iOS version, but of course this sort of system-level utility is only possible via jailbreaking. The Kindle, Instapaper, and iBooks apps include a sepia mode, which provides a similar effect. (iBooks only provides this option for certain types of books.)

Update (2015-11-06): GammaThingy doesn’t require jailbreaking on iOS, but you have to compile the app yourself.

NSNotificationCenter With Blocks Considered Harmful

Great post from Drew Crawford:

This could be, I think, the single biggest API blunder in iOS. (Except maybe iCloud Core Data.) I have debugged issues that were root-caused to this misleading API more than ten times. I have lost more than four weeks to this API. I have no less than six radars open about it.


The documentation lists no fewer than six sample code projects underneath the Notifications-with-blocks API. And five out of six Apple model projects are wrong. Let that sink in.

It’s exacerbated by documentation bugs/omissions, such as that NSAssert should not be used in blocks. He links to two alternative APIs, FXNotifications (which uses swizzling) and NSNotificationCenter-JNWBlocks (which uses associated objects). Both use weak object references, which means they won’t work on Mac OS X 10.6.


Gwynne Raskind:

This tool is intended to present an active visual representation of the execution of a virtual CPU. It’s something of a take on valgrind; it emulates a CPU core reading opcodes and does the syscalls and linking and all that itself instead of creating a full system environment like a true emulator would. The idea is that it’s an abstraction atop what a CPU is really doing, allowing you to see what a given flow of ASM code is doing in a visual representation of its effect, rather than worrying about nitty details of things like paging tables and stack frames and so forth that don’t matter to 99% of coders.