Category Archives: Uncategorized

Maybe you’re not that special.

Edward Sung dove deep into the well of consciousness, inspired by the age old question, “Do teleporters kill and recreate you, and if so, is that really you?”

It got me thinking about how ill-defined consciousness is and why we care so much about it.

Sometimes, I think consciousness is important, but other times, I feel it’s narcissistic for us “higher” order organic systems to make a big deal out of consciousness.

We’re systems that sustain ourselves for a period of decades. When these systems operate, the layers of reactions that are furthest from outside the system manifest as consciousness.

When we observe other systems that take actions in response to stimuli in a way that is similar to ours, we assume that those other systems work in a similar way and assign it the status of being conscious.

When a system such as, say,

  • A plant
  • A unicellular organism
  • A virus
  • A tire fire, or
  • A star

does not respond to stimuli in a way similar to ours, we say that it is not conscious.

However, they have their own ways of sustaining themselves, and they have their own particular internal tensions and reactions. How can we be sure that these are really that different from what we have labeled consciousness?

The greatest Lovecraft tale that never was

Katt: I have never read any Lovecraft.

Me: He’s a pretty bad writer, but some of his stories are great.

Katt: I get the impression they’re all like “Dear readers, I was in Providence for fishing and science, and I learned of the unspeakable horror of the beast known as Harnlthyanahggh.

Katt: He is a blind dead lizard man with tentacles who lives under the sea and makes ominous BLORP noises. One day, when his eternal Game Boy finally runs out of battery power, he will eat the coastline.

Katt: In the deepest reaches of space, there is a hole that leads back to a drainpipe in Queens. Here is where all the antimatter lives, and the Marlaghthtrangh lies eating popsicles.

ALAssetsLibrary and threads

I’m working on an iOS app right now with a feature that uses images from the Photo Library. This was all solid for me, and I had worked with it for a nearly a month before putting it before my alpha testers.

With a set up like that, you know where this is going: It totally did not work for them. At all. After the users would pick a photo from the library, the spinner letting the user know an image was being loaded would sit there forever, and eventually, this would show up in the console logs:

May 19 14:51:17 THE-MOON SpringBoard[27] : MultitouchHID(1ed4d440) uilock state: 0 -> 1

May 19 14:52:00 THE-MOON SpringBoard[27] : jotunheim[725] has active assertions beyond permitted time:
identifier: CoreLocationRegistration process: jotunheim[725] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:725 preventSuspend preventIdleSleep ,
identifier: CoreLocationRegistration process: jotunheim[725] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:725 preventSuspend preventIdleSleep

May 19 14:52:00 THE-MOON SpringBoard[27] : Forcing crash report of jotunheim[725]...

For the life of me, I could not reproduce this bug on my phone or my girlfriend’s phone. Which, of course, is bewildering. Googling pointed to a lot of problems related to threading, and indeed I was using a dispatch queue of my own making to do the image work.

I know there’s things that absolutely must be started on the main thread: Network calls (which end up on the web thread) and UI stuff. But I wasn’t doing anything with the network or the UI, as far as I knew. And why would this only happen on my users’ devices and not on devices in my household?
I’ll spare you a recounting the red herrings that I surveyed.
It’s because the first time you try to get stuff out of the Photo Library with ALAssetsLibrary, it asks the user if your app can have access to location data. (Photo metadata can contain with location data.) But it can’t show a UIAlertView from a thread other than the main thread, it can’t, so things will just stall out.

My phone and my lady friend’s phone have had on them previous builds of the app that used ALAssetsLibrary from the main thread. So, back then, that dialog was able to show, and location data access permission was saved. Deleting the app doesn’t revoke that permission. The current build, which used ALAssetsLibrary from a non-main thread, ran into no problems because it had the permission and didn’t need to show any dialogs.
The lessons I can see are:

1. Doing work in helper queues is great, but think twice about whether or not the things you do there are going to lead to UI or network stuff.

If I had read carefully, I would have noted that the documentation says:

When the asset is requested, the user may be asked to confirm the application’s access to the library. If the user denies access to the application, or if no application is allowed to access the data, the failure block is called.

2. Things that affect your app get saved outside of your app and don’t get cleared when you delete your app.

I hope this saves someone somewhere some time.