List iTunes Apps by Purchaser

I finally developed a way to list all your iTune applications by Purchaser, and even better, I can do it from the command line.

Last year I was helping a friend who has pretty poor internet connectivity upgrade his iPad to the latest version of iOS. To do this, I connected his iPad to my system, performed a backup in iTunes, then synchronized to update the operating system. This had the side effect of beaming some of his applications to my iTunes, which in order to continue, he authenticated against. His iPad updated great, and he was on his way.

Things on my machine seemed okay for a while, that was until some of the apps he purchased that I didn’t have wanted to update. Not having his password, I wasn’t able to update them, but even worse, Apple wasn’t announcing which apps needed updating with his account so I could simply delete them as I wanted to.

Instead, for over a year, I was greeted in iTunes by a numerical indicator saying I needed up update my apps, but when I went to do it, I was up to date. Every once in a while I’d recognize an app that I didn’t purchase (in a haystack of nearly 1,000 iPhone apps) and delete it. Only then did the number drop, but later rise again when some other app needed updating.

What I needed to do was list out all the apps by Purchaser.

One of things that really annoys me about Apple is that stuff that is trivial to implement, like putting an optional Purchaser column in iTunes, they don’t do. The feature is half heartedly there, though. Press Command-I for Info, and you can see the purchaser for an item.

Only now you have to click and inspect your whole app list. And with the number of applications I own, this doesn’t scale well at all.

Searching the web reveals that others are in a similar bind, and that Apple seems to really care less about the few handful of users with this problem. Like much on the Apple Support Site, it’s unhelpfully silent.

Frustrated, I decided to solve this problem once and for all.  Open Terminal and cut’n’paste the following in:

for f in ~/Music/iTunes/iTunes\ Media/Mobile\ Applications/*.ipa; \
 do (echo "$f" ; unzip -p "$f" "iTunesMetadata.plist" | \
 plutil -p - | egrep -i "\\"(itemName|artistName|AppleID)\\"" ) | \
 perl -e 'while (<>) { if (m!^/!) { chop; $fqn=$_; } if (m/"(.+)" => (".+")/) { $e{lc($1)}=$2; } } print "\\"${fqn}\\",$e{\\"itemname\\"},$e{\\"artistname\\"},$e{\\"appleid\\"}\n";'; \
done

It Still Works!

I’m absolutely shocked at what we now consider as “working.”

I absolutely loved this description a friend shared of her Dell laptop, which is seven years old.  By her definition, it’s still working and doesn’t need replacement just yet. It’s used for Reddit, Facebook, Hulu, and applying for jobs.

Here’s what “working” means:

  • It’s missing the E key.
  • It runs so loudly she can’t sleep at night and has to turn it off.
  • There’s no such thing as a battery, there’s a gaping hole in the bottom of the laptop, so it has to be plugged in.
  • The power plug has duct tape around it.
  • It overheats and Blue Screens of Death about three times a week.
  • It looses WiFi about every five minutes or when it’s not in the mood to be social.

Avoid Awesome Screenshot

I was getting some pretty bad web performance, with a little exploration I learned it was a Safari Extension that was doing things I did not like.

While doing some web page debugging, I noticed that a simple, static, html file was pulling in a ton of web resource. Most noticeably from a place called Superfish, and sucking in with it a good deal of JavaScript libraries. On. Every. Page. Load.

The culprit seems to be a Safari Extension called Awesome Screen Show 1.3.7 by Dilgo. However, the developer site isn’t coming up, and I’m not all that encouraged by what I see over at Superfish either.

Uninstall the extension, as here’s the overhead you’ll be saving:

Turning Web Share Back On in Mountain Lion

Apple removed Web Share from Mountain Lion. Next they’ll be removing the Start button… oh, wait… that’s someone else. Here’s how to bring back Apache for those people who use their Mac to test and design websites.

I was rather surprised and disappointed to learn that Web Sharing was removed from Mountain Lion.

According to this post, it’s possible to bring back.

Per-user Web Sharing is gone from Preferences but can be easily re-enabled via Terminal.app. Copy the following snippet into /etc/apache2/users/USER.conf:


<Directory "/Users/USER/Sites/">
 Options Indexes MultiViews FollowSymlinks
 AllowOverride All
 Order allow,deny
 Allow from all
</Directory>

and restart Apache with sudo apachectl restart.

And PHP has been hidden as well, but again thanks to this article, it can come back as well.

Uncomment these lines by removing the leading pound sign in /etc/apache2/httpd.conf:

  • LoadModule rewrite_module libexec/apache2/mod_rewrite.so
  • LoadModule perl_module libexec/apache2/mod_perl.so
  • LoadModule php5_module libexec/apache2/libphp5.so

Why Readers Lose Interest in Sequels

This week I was fortunate enough to be visited by long time friend, Danny Adams. Our friendship runs so deep that I often forget as we’re having dinner that sitting across from me is a well published author (whom if I’m not mistaken, is being interviewed in StarLog magazine this month).

During our conversation, I started to ask a question but distracted myself with a full scale analysis of sequels and it wasn’t until I realized Danny wasn’t saying anything that I stopped. Apparently this was useful feedback, but before we could finish, we had to leave.

Danny, and all interested authors, here’s my take on why readers lose interest in sequels.

What makes a story good?

I suppose the ideal story is one that drags you into it that you actually forget that you’re actually reading. But, how is that accomplished?

The common components that I’ve noticed from stories that I’ve enjoyed are ones where the main character is thrust into an unfamiliar environment, stumbles into an adventure as he learns the rules of the environment, events unfold and he becomes the reluctant hero, pushing his own boundaries, and eventually learning something about himself, and in the end making a difference.

This generalization appears everywhere: Neo from the The Matrix, Luke Skywalker from Star Wars, Ralph from Greatest American Hero, Stile from Splity Infinity, Zane from On A Pale Horse, William from Wizard’s Bane, and even Harry from Harry Potter and the Sorcerer’s Stone.

But it’s at this point where things diverge. Some stories end after they are told, other’s have long standing sequels, where others flop. What makes Spiderman 2 enjoyable while Ghostbusters 2 and Weekend At Bernie’s II a forgotten memories? Why are people so enthralled with The Lord of the Rings? How does Star Trek and Stargate SG-1 and Dr. Who to keep going with endless spin-offs, and what caused Babylon 5 to crash in the last season?

The thing in common with series that fail is where the author simply tried to capitalize on the existing relationship and knowledge from the prior story.

Superman II holds far less interest than Smallville, primarily because we are joining in on the character as he develops.

It’s just as enjoyable to share Author’s realization that he’s just done something incredible as he pulls the sword from the stone.

A story needs to continue the growth of the character.

Stories like Star Trek and Stargate SG-1 survive because each time they visit a different world, the rules, culture, and context are different — they have to learn all over again. Discovering the environment with the main character is vital, it’s provides the energy and wonder. Deep Space 9 had things come to them, but it wasn’t the same. Making a human the alien was a brilliant move on the part of Farscape, there was endless discovery.

A story needs a dynamic environment, in which the main character can rediscover himself and continually be tested, rise to the challenge, or even fail.

Resetting MobileMe[ss]

Recently I noticed that my iPhone 4 started acting really, really badly. It wouldn’t unlock when a call was coming in, I couldn’t swipe between screens on the desktop, I couldn’t scroll within mail, clicks in the calendar weren’t working.

What was really strange is that it was Apple’s apps that weren’t working right, the regular store purchases were for the most part. And that’s when I noticed that things seemed to lock up hard when the phone was doing networking, even more so when going over AT&T’s instead of WiFi, though both did it.

What changed? MobileMe, specifically it’s calendars.

When I did the famous upgrade process on the MobileMe site, it never finished; I got the script is running too slow dialog. Later visits to the site threw up dialogs asking if I’d like to let Apple know there’s something wrong.

Eventually my calendar on the website came back, but there were dozens and dozens of repeating events that had happened years ago. I suspect this was a data log jam like no other, and worse, it wanted to push it all to my little phone. There appears to be no online web facility for bulk management. I tried on my laptop as well, but that too became borked as Apple synchronized its new calendar data to me.

I speculate, simply because the GUI would not respond to any input at this time, that perhaps Apple’s own applications may violate the rule about doing updates on the GUI thread. Either that, or that the message pump got so backed up, the GUI just couldn’t respond. How I wish there was an “abort” other than a violent shutdown.

While I’ve reset MobileMe in the past for other reasons, I ended up having to do a bit more.

By pulling the plug on the Internet and rebooting, I was able to come up in an isolated environment where I could shutdown all MobileMe syching and preferences. That let me peek at what was going on.

My thought: if I could recover the calendar on my laptop, I could push the valid subset back onto the MobileMe server.

With Calendar shutdown, my trip began by going to ~/Library/Calendars. Insider there are a bunch of GUID based folders. I deleted anything that had Cache in the name, as well as Calendar Sync Changes.

Then, I went through each folder. The Info.plist files had a Title entry followed by the name of the calendar. If it wasn’t a calendar I wanted, or was suspicious of, I deleted the GUID-looking folder completely.

If it did warrant keeping, I then went into the Events subfolder and looked to see how many .ics files there were. Casual browsing with Apple’s built-in previewer showed what the events were.

In my case, I found one folder related to MobileMe with over two thousand entries. Sure enough there were repeats of the same event, like a synchronization gone wrong, rather than a single event marked for repeation. So, I nuked that GUID-folder as well.

Sometimes there’d be no Events folder, but the .plist file looked like it was going to some external server. Sometimes there’s be an addition subfolder with a GUID-looking name, and maybe even an Inbox subfolder, these seemed to be more associated to GMail. I kept those.

When I restarted iCal, it knew something changed; it announced it was doing an upgrade for the folder formats, and then it presented me with some empty calendars that I knew I had gotten rid of. I deleted those from the application.

Once I was sure I could start and stop iCal without it hanging or requiring a Force Quit, I reset MobileMe.

Some fast tips here on how to do this.

  1. Hold down OPTION which clicking the Sync icon in your toolbar. You can reset the Sync services that way. Apple tells how.
  2. There’s a python script you’ll want to run at the Terminal, it’s inside that “Apple Tells How” link above.
  3. Finally, you want to deregister all your machines from MobileMe via the System Preferences, the machine you’re using last. When you do, it will offer to let you delete all the data off their servers.
  4. Then, when you re-register, you put yourself in Manual mode first, and use the Advanced… button to push all your data at their server first.
  5. Then, and only then, can you start putting things back to normal.

Andrew Robulack has a wonderful write-up about how to reset MobileMe. It’s an excellent guide.

All that said, apparently when I re-synced, there was some cruft left when I let iCal resync with MobileMe.

Then I read these horrible words from Apple: Resetting Syncing or SyncServices will not impact the new MobileMe Calendar and should not be used as a troubleshooting step for the new MobileMe Calendar.

Some support articles, after winding through their Support Express Lane wizard:

I’ve Deleted My Orkut Account in Favor of Facebook

While I’m a pretty big fan of Google based technologies, the social site Orkut just never seemed to get off the ground from my perspective.

It felt klutzy, but more importantly it too easily seemed to allow strangers to spam you. And, frankly, I got tired of getting emails telling me that someone was commenting on my message board only to discover it was someone dumping links in Spanish.

So, Google, while I still love you, I’ve deleted my Orkut account.

Facebook, on the other hand, seems to be the place everyone who’s anyone is heading toward. So, that’s where you can find me doing the social networking thing.

I’d be there a whole lot more, except that the PackRat developers destroyed everything that was fun about the game in the latest update and added insult to injury when they added pay-to-play.

Groking Objective-C for Modern Day Programmers

Here’s what I think trips up solid programmers about the Objective-C language.

One of the nice things about Apple’s OS X for the Macintosh is that they include a free copy of Xcode, a very sweet graphical development environment allowing developers to make Cocoa applications using Objective-C.

The problem is, jumping straight into the Cocoa framework, even with tutorials, can be a daunting task if you’re not comfortable with Objective-C.

Yes, there are a number of books out there, but today I stumbled across, quite by accident, a fairly decent tutorial on Objective-C.

That got me thinking. In a world where we can easily pick up C++, C#, Java, Python, and Ruby… what is it about Objective-C that makes it hard to follow? Here’s what I think the major stumbling blocks are:

Notation Preconceptions Clouding C as the True Origin
In the classic examples, we think in terms of an object with methods and members, often using a dot-like syntax. As such, we tend to want to force fit Objective-C’s way of doing thing into some preconceived mold, and when the syntax doesn’t express that, things fall apart.

The Solution: Back off. Drop all the way back to C. Consider Objective-C nothing more than a well written pre-processor to useful object like extensions to the C programming language. Sure your implementation may very well be a compiler, but don’t think in those terms.

You’ve Got Classes Wrong
You’re used to thinking that a class is a data type. Don’t, think of it as a thing. In fact, Objective-C only needs to know a variable is a class, it doesn’t need to know which one or what it exposes. Classes are things whose primary role is to produce instances.

It’s Supposed To Feel Like Macro Magic
When you’re working on the guts of a class, you’ve got a lot of blocks that start with @class, @interface, @end, …. If it feels like something’s acting as a pre-processor and is converting that stuff into data structures and functions, it is. You’re not going to see pretty syntax that feels integrated into the language.

Hard Crunchy Outside, Soft Gooey Inside
A class exposes an interface, this is how the outside world sees and interacts with your class. Specifically, its your methods. And they’re all public. Get over it. Test. Only your members can be protected or private.

Remember, there are class-things and instance-things.

Declarations and Definitions
With C, there’s declarations that define the type and are often used for forward references; additionally, there are definitions where the memory is actually allocated and a value assigned.

Objective-C objects work similar. There’s an @interface / @end block that describes the object, its members, and its methods. And there’s an @implementation / @end block that actually contains the real code.

void * and id
A pointer in C, indicated by a *, points at a data type. If the pointer is given a void type, the compiler does no type checking. You know this. The id type holds a object, regardless what type it is.

Messages are not Methods
Any object can be sent any message. An object maps a message to a method. However, if there’s no mapping available, it can be handed to a general handler for the object — which can be clever and analyze the message.

Extended classes… and instances.
The mapping between message and method can be extended; you can think of it as subclassing. However, it’s possible to extend an instance. Meaning, a class might not respond to a message, while instance A does and instance B doesn’t.

Categories
Because messages are bound late to an object, and the magic is done with data structures rather than types, it’s possible to create a collection of methods and add them to a class, even pre-existing ones you don’t have source code for.

Protocols
A protocol neither exposes an interface, nor does it provide an implementation. It is simply a named collection of method signatures which is attached to classes. Because any message can be sent to any object instance (or class), it is helpful to be able to “ask” if certain messages will be honored; that’s what protocols are for.

It’s Not Named Parameters
The syntax of a method may look odd, primarily because parameters appear to have additional text:
-(void) rotate:(String *)shape clockwise:(float)degrees;

In many modern languages, a signature can be overloaded. However, go back to the trick “What Would Macros Do?” In this case, any text that appears in front of a parameter is not a named parameter, but part of the method name. The above method would be the logical equivalent of void rotate_clockwise( String *shape, float degrees ) in raw C.

Constructors / Destructors
In today’s languages, performing a new allocates memory and initialized the object. Objective-C splits these into two discrete operations; this allows you to allocate memory from different heaps, as well as deferring expensive initializations – no bogus empty constructors here.

Note, you are also responsible for calling the superclass’s init, before doing your own init. If you have a method to deallocate the object, when done you need to call the superclass’s deallocation routine.

C requires you to take on more responsibility and pay attention to order; Objective-C classes require the same amount of vigilance.

Extra Data Types
Objective-C provides some helper data types, but some of them are tied quite strongly to the messaging framework.