1. parislemon:

    dbreunig:

    The evolution of the iPhone camera

    Getting there.

  2. McDonald’s Theory — What I Learned Building…

    YES YES YES

  3. ARC Doesn’t Clean Up After an Exception

    I recently discovered that ARC does not clean up objects automatically when an exception is thrown, which was the cause of some strange test pollution in my specs.

    An example will best illustrate how this can happen. Here’s a simple assertion method that raises an exception if an object is not an instance of a given class:

    - (void)assertObject:(id)object isKindOfClass:(Class)class
    {
        if (![object isKindOfClass:class])
        {
            [NSException raise:NSInternalInconsistencyException
                      format:@"Expected %@, received %@",
                               NSStringFromClass(class),
                             NSStringFromClass([object class])];
        }
    }
    

    When the exception is thrown, object will leak. Here’s why: ARC calls retain on all objects passed to your methods, and pairs them with a release when your method returns. But it doesn’t call release if an exception occurs.

    This is not a bug. The ARC documentation explicitly states:

    By default in Objective C, ARC is not exception-safe for normal releases:

    • It does not end the lifetime of __strong variables when their scopes are abnormally terminated by an exception.

    • It does not perform releases which would occur at the end of a full-expression if that full-expression throws an exception.

    The reasoning is that exceptions in Objective-C are reserved for very exceptional cases. They are not suitable for control flow or general error handling and typically signal that the app is about to crash.

    This assumption falls flat if you’re running automated tests. As the assertObject:isKindOfClass: method implies, Objective-C testing frameworks typically do use exceptions for control flow. As a result, the default behavior can cause your tests to leak memory and cause test pollution.

    Luckily there’s a way to turn on ARC exception handling by providing the -fobjc-arc-exceptions flag when compiling. This ended up solving my obscure case of test pollution. If one test failed it would leak a global object and in turn cause others run after it to fail in strange ways.

  4. My octopus broke a tentacle, so I made him a peg-tentacle. I’m thinking of calling him Octothorpe.

  5. Old and new on Flickr.

  6. texturism:

    do something. tomorrow wil soon be today. | via brycedotvc: lisatwight

    Future selves are amazing! They are archeologists, medal winners, and all-around bad-asses!

    Unfortunately, the closer future self comes to past self, the more mundane future self becomes. Past self is future self’s kryptonite, and present self is where they meet.

    On the plus side, future self is only amazing because future self has learned from all the stupid stuff past self has done.

    (via parislemon)

  7. badlipreading:

    “THE NFL: A Bad Lip Reading”

    I haven’t laughed so much I cried in a long time.

  8. parislemon:

    thefrogman:

    We’ve come so far. 

    Those Fisher-Price phones totally run Android.

  9. kthread:

    thedailywhat:

    Gangnam Style Marching Band of the Day: The legendary Ohio University Marching Band takes on PSY’s “Gangnam Style” and kills it — especially the dancing.

    [devour]

    Great stuff, but where is the Colorguard?

  10. kottke.org: Some thoughts about XOXO

    jkottke:

    I attended the XOXO Festival in Portland, OR this past weekend. I don’t have a great deal to say about it because — and I’m not trying to be a dick here — you had to be there. As in, physically in the room with the speakers and the attendees. But I did want to mention a few things.

    - XOXO was…

    I was also at XOXO and completely agree.