Posts in Category "Uncategorized"

The Unique ID Situation & iOS

I’ve written earlier to explain that AIR doesn’t include a device identifier API because it doesn’t have a useable definition across platforms. (Also, it can be easily replaced for most use cases with a random identifier generated by the app.)

Now comes news that this capability is becoming even less implementable: Apple is deprecating their own UDID API. TechCrunch has the story at http://techcrunch.com/2011/08/19/apple-ios-5-phasing-out-udid/.

Math.random() is your friend.

Social Algorithm

if( message.length <= 140 && message.isPublic ) {
    Twitter.tweet( message.text );
} else if( message.isPublic ) {
    if( !intersection( message.recipients, Contacts.facebookOnlyUsers ).isEmpty ) {
        FaceBook.setStatus( message.text );
    } else {
        GooglePlus.share( message.text, GooglePlus.PUBLIC );
    }
} else {
    circles = GooglePlusUtilities.computeRelevantCircles( message.recipients );
    GooglePlus.share( message.text, circles );
}

Application Structure and Composition

Recent mobile application models impose some surprising straightjackets that defeat the ability to compose applications from constituent parts.

On the desktop, composition support is de rigeur. On Windows it’s possible because there simply aren’t many rules. Want to use a DLL that uses another DLL that loads some external resources? There’s an API for that. Well, APIs, anyway. You can string them together by solving for units, which by the way also works wonders in high school physics.

On Mac OS composition is by design. Which is fortunate, since otherwise it probably wouldn’t be allowed. Depend on a framework? There’s a place to put it. Framework depends on another framework? Yes, there’s a place for that, too. All places rationally named, everything is a bundle, layout standardized.

iOS? Not so much. Mostly because dynamic code loading isn’t allowed, at least not outside of OS frameworks. We have to revert to linking everything together into one big blob. And then all linker symbols appear in a common namespace, so we’re denied the pleasure of embedding multiple copies of the PNG library into the same application without modifying any of them to use unique prefixes.

The real surprise for me, though, was Android. Surely an open platform would support composition? But alas, resources on Android get compiled into one big block of unique IDs. No way to use this mechanism to create a library beforehand with its own set, because there’s only one R.java file to rule them all.

No doubt there’s a method to the madness that I just can’t see. Maybe they can break it down into pieces for me.

AssocQueryString and the Unknown Association

Most Apollo development for Windows is still being done on Windows XP, but we’re testing against at least some of the versions of Windows Vista.

On Windows XP, we’ve been using AssocQueryString to find the application associated with a particular file extension. (AssocQueryString is a utility function in the Shell that retrieves information about file types.) This broke on Vista, where the call was returning an answer even if no application was associated with the file extension.

The solution is to add ASSOCF_IGNOREUNKNOWN to the flags parameter. Otherwise, on Vista, if a file type is not registered it may return you information about the “Unknown” application instead of just fessing up and admitting nothing is registered. Again, this is a change from XP, which would admit the truth without this flag.

One more thing: Although ASSOCF_IGNOREUNKNOWN is defined in the Platform SDK documentation, it may not be defined in older versions of the Windows headers. Actual value: 0×400.