@benguild: The official homepage of Ben Guild.

How to restore disappearing iTunes song star ratings.

14 Feb 2015  |  Tags: , , , , , , ,

A little over a week ago I noticed that my song star ratings in iTunes were randomly disappearing. Entire playlists were blanked out, and so were other tracks scattered across various albums. To put into perspective how this feels… some of these tracks I hadn't modified the rating for in over 10 years.

I can't understand how this happened en masse, but I believe that it's due to a current bug involving the combination of iTunes Match being active on my Mac yet disabled on my iPhone, and having iTunes music manually syncing back and forth to my iPhone only via a few designated playlists that I have selected. — This issue is actually still happening to me periodically at this time of writing! Yikes!

…Not cool! But luckily, I was able to write some code to repair the ongoing damage.

I generally don't ever remove a song's star rating. Once it's rated, it stays rated… even if its rating is later changed to something else by me. Because of this, I was able to write a script to find any songs that were not currently rated at all in my iTunes Library, and then have it look for the most recent rating that could be found amongst a series of backup iTunes Library files that I restored from a backup drive. That's the key here… I keep routine backups! You should, too.

With some preprocessing (described below), the script that I wrote will output a custom AppleScript for your Mac that will reassign the most recently recovered rating when run for songs whose rating is missing but present in one or more of the backup files that you provide to it.

“This PHP script will find songs in your iTunes Library without star ratings, and will then scour your specified backup files to find the most recent star rating for that file in case it was somehow removed or lost somewhere along the way for some reason. It will generate an AppleScript as output that can be run on your Mac to automatically re-set all of the missing ratings!”

Proceed with these steps at your own risk! This process and code are only designed to work on Mac OS X, and there's no warranty here for the code or anything, of course. I just wanted to share my solution with you in case you ran into this same problem and wanted a head start on fixing it programmatically. :)

The script uses the XML variant of the “iTunes Library” database files as mentioned. If you're restoring these files from a Time Machine backup of your Mac, please know that Time Machine automatically excludes these files from being backed up. To recreate the XML files from ITL files (which are backed up), you're best off creating a temporary additional user account on your Mac and replacing that user's “iTunes Library.itl” file with your backed up version then (…one at a time) opening and quitting iTunes to generate the XML equivalent in the same folder. — I have a tweakable Automator workflow that I used to do this with 30+ files automatically. You can reconfigure and use it (at your own risk) to do the same.

Once you have a folder of your “iTunes Music Library.xml” files of the past (not the *.itl version!), you can run the PHP script as outlined in its included “README.md” file. The output, as mentioned, is an AppleScript that contains unique commands to fix each missing rating for songs in your library. You can run the PHP script as often as you want to find any missing ratings, since it will only generate output if there are ratings missing and the output is only for those particular songs! — I hope that this helps you out if you're a Mac user who has run into this issue, but please keep in mind (again) that this process and any of its steps can potentially make drastic changes to your music library and should be followed at your own risk! Be sure to backup your data, as you hopefully have been doing already. :)

  Comments  | 

Accounts, official launch.

14 Nov 2014  |  Tags: , , ,

Last week was an exciting week for Accounts. We officially launched on Thursday, November 6th!

Download Accounts for iOS…

Accounts launch release screenshot
The design, feel, and function continue to evolve.

Our beta period was lengthy. Over 6 months. Although I first posted about Accounts back in May, we'd been working on the platform for quite some time even before that. So, this launch was a big one for us.

For those that are unfamiliar, Accounts is a contacts network that serves as your own “futureproof communication layer” for relationship retention. It's designed to be a cross-platform system that works with any device, operating system, or app/service. At the surface, it's a sort-of “social, auto-updating address book” at first glance. — The idea is that you can add your contacts once, and then have pointers to whatever services those contacts use to communicate with others (and you!) in the future. By connecting within the simple context of, “What's your username or handle on ‘Service XYZ’?” or “What app or email is the best way to contact you?”… this information can change anytime but you'll still be in touch with that person via Accounts. Furthermore, you'll automatically receive notifications when people change their information or join a new app or service.

There are other perks to the system as well, such as our future API for contact portability between apps, and the ability to limit which of your contact information can be seen by your contacts based on the group that you place them into. (ie. Family, Friends, Work, etc.)

Rather than retain various overlapping social media accounts (with out-of-sync contacts lists) for sole the purpose of staying in touch, or fuss with updating your contact information manually amongst your contacts, wouldn't you rather just let that information be updated automatically and control who sees it? Wouldn't you like a contacts system that supported all of your apps? Wouldn't it be great to receive notifications when someone that you know joins a cool new messaging app, or to automatically notify your contacts of the same? — Bring your contacts list to Accounts, a place where it won't lose relevance as your needs and interests change. Free yourself from the privacy constraints and concerns of content sharing for the sake of remaining active on various social networks. Be connected through any service now or in the future, and always have everyone's latest contact information.

I see the future of apps and social media being people maintaining smaller contacts lists within their favorite apps. There are so many apps nowadays that the fragmentation is out of control. Maintaining a primary list of contacts in a contentless, platform neutral environment makes sense. Accounts is an exciting initiative.

Now that our first non-beta version has been released to the public, we're working even harder on what's next. Stay tuned, and please check out the app if you haven't already! It's the simplest way to stay connected, longterm.

  Comments  | 

Accounts, Beta 2 for iOS

17 Sep 2014  |  Tags: , , ,

Accounts has been a very intense project to design and architect. For this reason, it has been released in stages. — Each stage… more and more exciting.

Accounts, Beta 2 (promo)

The first public beta of the App was an MVP, and the current is (even still) a very functional “work in progress”. While no piece of complex software is ever truly finished, I believe that this one will continue to evolve alongside human needs and nature. We will soon be at a crossroad where Accounts will introduce things that you have never seen before, and the “beta” tag will be removed.

[ Download the 2.0.9 beta for iOS… ]

Beta 2.1+ is already in development, but the 2.0.x series marks the native introduction of a syncable, offline iOS App for your contacts and extended networks. It's faster, smoother, and more interactive.

Stay tuned for more updates. http://accounts.ms

  Comments  | 

Fixing AutoLayout on UILabel(s) in iOS Development

15 Jul 2014  |  Tags: ,

AutoLayout is a really quick way to create responsive layouts on iOS 6, 7, and higher / Mac OS(es). However, I found that there's a really stupid problem with UILabel(s) in getting them to act like actual paragraphs that resize themselves to their own contents. They often don't do that properly using just AutoLayout constraints....

Oddly enough, calling “[label sizeToFit]” manually can band-aid the issue, but then hose the rest of your AutoLayout in some instances. — So what's wrong? Isn't AutoLayout supposed to “compress” UILabel(s) to their minimum required size based on their assigned constraints?

iOS AutoLayout UILabel Bug demonstrated (graphically)
As you can see, without this fix the pink-colored label is taller in the same context when the view is loaded on a larger screen.

The tricky thing about UILabel(s) is that they generally will actually resize themselves, but this doesn't always work predictably due to this bug in UIKit. On iPads, you might end up with taller labels… where as on a 3.5-inch iPhone they might look just fine with the display oriented vertically and then grow taller when rotated horizontally.

The easiest solution to this behavior is to subclass UILabel and add this little gem to force the “PreferredMaxLayoutWidth” on the label to reset automatically whenever the view is resized. This makes its width 100% of its container's width (as it most likely should be), and leaves only its height to be adjusted dynamically by whatever the UILabel's content and AutoLayout constraints actually should negotiate between themselves:

- (void)layoutSubviews
{
    [self setPreferredMaxLayoutWidth:[self bounds].size.width];
    [super layoutSubviews];
}

This approach not only keeps your code clean but also keeps the issue isolated. One can now rely almost solely on AutoLayout for controlling text and content variations amongst varying localizations and differing device resolutions or aspect ratios. (… and in the least annoying way possible!)

  Comments  | 

Announcing "Accounts"

18 May 2014  |  Tags: , , , ,

I started this project called Accounts on a plane ride last year… while thinking, “What would a social network that I'd actually want to use look like?” — All in all, it came down to one thing: the lowest common denominator.

Accounts (logo)

[ Download the 1.0.16 beta for iOS… ]

Nowadays, we try new Apps and services constantly, but the “lock-in” of social networks somewhat limits our mobility. Our contacts list on our mobile-devices is more or less our only form of portability, and yet it doesn't provide much interactivity beyond just the traditional contact methods themselves. — No notifications, no seamless updates… you're responsible for your own address book presently, and many of them are in complete disarray.

Enter Accounts. It's currently for iOS, but there are also mobile-web and desktop (then Android) versions coming soon. It detects the Apps on your device, and gives you a list of three things: your services, your contacts, and your contacts' services.

…That's it. (oh, and their basic contact information such as email/telephone)

Account screenshot #1   Account screenshot #2   Account screenshot #5

It keeps this information up-to-date, and serves as a longterm reference. It's time for something like this to exist on all platforms, and remain simple. Forever.

“Won't I be locked into this, as well,” you ask? No, because there's nothing on it. It's just your contacts, and the services that they use. If you want to leave, there's nothing to leave because your content isn't there.

We'll even make it easy to leave by syncing your contacts through our future API interface, for both your own use and other third-party developers' use.

Account screenshot #3   Account screenshot #4

I think that this is a great way to stay connected, because it actually forms a longterm connection with no strings attached. There's no featureset to judge or become bored with, no content to manage, and no complex settings to control. We're not cramming features down your throat, violating your privacy, or making you look at ads in a spammy news feed. It's just you, the people you know, and the services that you both use for getting in touch with them. Accounts updates this information automatically for you, and through the API it can become the “contacts backbone” of the Apps that you'll love in the future. It's a stable and simple ‘base’ product, with powerful tools for developers.

This could eliminate social network lock-in, and provide true contacts and relationship portability. With your interest, I'm building a company around this idea.

Check out the beta App, and stay tuned for updates. http://www.accounts.ms

  Comments  | 

Longterm storage: NAS + HDDs + CrashPlan Unlimited (for ARM devices) vs. costly Amazon Glacier [cost analysis]

17 May 2014  |  Tags: , , , , , , ,

OK, it's not really fair to call Amazon Glacier “costly”. However, it might not be your cheapest option for storing a few terabytes of data for a few years (or more)....

01010100 01101000 01101001 01110011 00100000 01101101 01100101 01100001 01101110 01110011 00100000 01101110 01101111 01110100 01101000 01101001 01101110 01100111 0101110

For large-volume data storage with a target lifespan of 2 years or less, Glacier can be a great option. It costs just $0.01/GB per month at this time of writing. — The costs can definitely add up, though. To store 2TB (2,000GB) it would cost $240/year, and there's no longterm discount currently. While they may drop their prices at some point, the current costs are still too high for most consumers needing to store more than a few hundred gigabytes longterm.

  • If you're storing a few hundred GB, then chances are a NAS is not worth the cost to you.
  • If you're storing a lot more than that, to get the best of both worlds, the best option for this is to get a network-attached storage device (NAS) and back that up to CrashPlan for $60/year unlimited instead of paying Amazon $0.01/GB every month.

A NAS is a box of hard-drives with a lightweight computer embedded to ideally mirror your data across multiple drives (using RAID technology) for redundancy in the event of one or more drives failing. It can run some basic software (such as CrashPlan for offsite backups, or BitTorrent Sync for your own secure Dropbox-like syncing folders), and also, if a drive has a failure, can recreate that drive's data onto a freshly inserted drive using the data already sharded across the other drives that are still operating. Cool, huh?

The case for Glacier

Cost: $0.01/GB per month ($120/year per TB, 1000GB)

If you're storing data for less than 2-3 years, or not very much data at all, then Glacier is probably going to be cheaper. If you're archiving lots of photos, videos, or other large files, you'd most likely want to invest in a NAS and back that up to CrashPlan as your cloud storage option. — If you already own a NAS, then there's no need for Glacier unless your new data is too large for the NAS's existing storage configuration. (but you could also expand that by buying larger drives!)

Amazon Glacier (logo)

It's possible that Amazon Glacier could drop significantly in price in the future. Storage technology keeps getting cheaper and more efficient, and people are already questioning how Glacier is able to operate at such a low cost. Some speculate that they are using the offline cold-storage of optical media (BDXL).

  Read more of the full post »

  Comments  | 

The weekend that I tried to sell three plasma TVs: FOBO, vs. Craigslist, vs. "Fulfilled by Amazon"

10 Feb 2014  |  Tags: , , , , , ,

How best to resell three TVs, whilst also trying to figure out the best way to sell stuff in the future? Watch these services duke it out: it's the ultimate electronics resale showdown!

TL;DR Don't ship TVs! eBay wasn't considered for this reason, but Amazon was due to their heavily discounted rates for inbound warehouse shipments. — FOBO = item sold in under two hours, made $20 less than Craigslist but with least effort, coolest people, best experience for the buyer, Craigslist = took 2 weeks, made an extra $20 over FOBO (lucky), no fees, Fulfilled by Amazon = after 3 weeks it sold for almost 150% more, but the “oversize item” fees actually made it around ~20% less. Read on for more details!

I'd been wanting to try out this new service in San Francisco called FOBO. It's a “quick” auction service for used electronics. They come and pickup your electronics from you if nobody buys them, but otherwise allow nearly anyone to “bid” up the price in a short auction. It's like eBay, but only 97-minutes in duration for each item. You're guaranteed a certain minimum price (which you're presented with upfront), and that's the price that FOBO pays you if nobody bids. They come pick it up from you, so it's definitely gone within 48 hours and you'll get cash directly in your bank account for it.

The three TVs!
For some, there's a long road ahead. But for the lucky ones, a new home is just days away!

Sound good? It is, but it also depends on what you're selling and how quickly you want to sell it. Once, I tried to use FOBO for a Retina MacBook Pro, and they offered me $1350 as their minimum starting price. I felt like I could maybe make a bit more by sending it to Amazon's warehouse. I've written about this before. — I ended up selling it on Amazon for $1579 (= around $1460 net after shipping costs and Amazon's ~9% fees), but it required some extra effort on my part. — It's possible that FOBO users could have bid the laptop's selling price from $1350 to something higher, but within only a 97-minute auction it can be a bit chancy. On top of that, you're also paying a 15% fee, so you have to kind of do the math beforehand. Either way, it's gone the same day, but FOBO settles the transaction much faster vs. waiting for a buyer on Amazon.

FOBO even buys stuff from you for the minimum starting price if nobody else bids, so it's definitely out the door and gone within 48 hours. Nice. — I literally sold the TV on FOBO and bought a Fitbit Force from someone else on there before I even received the box that I purchased from Amazon to ship one of the other two TVs to Amazon's own warehouse. I see why the service is catching on, because there are a lot of sweet deals on it and it's ridiculously convenient by comparison to what other options are available.

FOBO (logo)

As a classic alternative to FOBO and Amazon, there is also “good ol' fashioned” Craigslist. Craigslist offers free, local classifieds that are completely user-regulated and offer no sort of structured negotiation or payment/delivery. This freedom can be both great and terrible at the same time, due to the potential of being scammed or hassled by “no shows” or trolls. The potential to be scammed in all three of these services is the same ranking in which they were mentioned… with FOBO being the lowest potential for a scam, Amazon offering insurance and “customer service” for sellers as well as buyers (including returns), and Craigslist offering virtually no insurance or guarantees what-so-ever.

All three services are very different but ultimately all aim to accomplish the same task: get rid of excess or outdated stuff as quickly, conveniently, and profitably as possible. — Watch me try to sell three near-identical plasma TVs… three different ways! Bring on the TVs!

  Read more of the full post »

  Comments  | 

Flat iOS 7 design: LifeSim game I built for iOS based on "Conway's Game of Life"

24 Nov 2013  |  Tags: , , , ,

During my parents' recent visit to San Francisco, my mother and I checked out the local Exploratorium science museum. I loved some of their interactive visual displays, and decided to build my own rendition of “Conway's Game of Life” for the iPhone/iPad that same night.

LifeSim, based on Conway's Game of Life and built stylishly for the iPhone/iPad and iOS 7

It's a pretty simple game, but has some nice effects and only took me a few hours to code. There's iPad support as mentioned, and it of course bears a stylishly flat “iOS 7” design and icon. Check it out! (it's free)

  Comments  | 

Did you know that you can't undo text edits on Android? Here are 4 other major reasons why I won't switch...

20 Nov 2013  |  Tags: , , , , ,

The Nexus 5! I'd been Android-curious for a while. Aside from losing iMessage access, I was honestly willing to give it a solid “go”. Maybe I could get all of my friends to use Google Hangouts instead? Ha.

I hated the original iPhone. Things like copy-and-paste, lack of tethering, the inability to attach a photo to an email after you'd drafted it, etc. — The simplicity drove me away. I didn't switch back to iOS until the iPhone 4, and had adopted a BlackBerry until then for its then superior communications and ability to do things like tethering, copy-and-paste, and the ability to attach a photo to an email after you'd drafted it. Things like the Retina screen on the iPhone 4 didn't really matter to me at the time, but I quickly began to love the device and appreciate iOS as well thereafter. My main requirement, though, was that I didn't want my phone to get in my way.

Nexus 5, brand-new in box!

The Android OS itself looks great from the pictures. I was excited! And yet, I kept hearing random tidbits from people about how Android “sucks” or how it was a “UX nightmare”. Also, I heard about how nearly every Android phone had a “terrible camera”.

The most uniform complaint was the inconsistent experience across carrier builds and the inconsistent customization by various manufacturers. These parties would apply their own custom software interface “skins” and “bundled Apps” (bloatware) that generally varied from tolerable to terrible. The Nexus 5 avoids all of this by shipping with the latest, vanilla, updatable build of Android… straight from Google with no “bloatware”.

Switching now wasn't the right choice.

Many of the people trash-talking Android have never used it. Many people trash-talking anything have never used the latest version of that something.

Wrong way roadsign

Android is so close, but just not quite there for me. — On paper (or in mind), the Nexus 5 seemed like the ideal phone: simple, discreet looking hardware with vanilla Android and no carrier bloatware! It had the latest Android v4.4 KitKat pre-installed, an integrated Google cloud-based backup services, and the rest of Google's services and email/calendar built-in. Nice!?

  Read more of the full post »

  Comments  | 

Remerging iTunes Match music libraries from multiple computers locally using AppleScript + external drive(s).

04 Nov 2013  |  Tags: , , , , , , , , ,

Solid-state drives have created serious storage constraints on today's portable computers. I originally purchased a 128GB MacBook Air in 2010 with the intention of only using it while in class (at school) and while traveling. When I moved to San Francisco, this machine became my primary computer… although temporarily. Because of its limited storage, I had had to leave behind the majority of my multimedia on my older desktop machine (ie. music collection, photos/videos from travel, etc.), and only recently (this weekend) have I been able to solve this problem.

The temporary bandage for this situation had previously been hosting my entire music collection “in the cloud” using Apple's own iTunes Match service. ($24.99 USD per-year)

iTunes Match completed within iTunes on a Mac

A few months after adopting my MacBook Air as my primary computer in 2012, I was having terrible problems with eye-strain. I'd never had issues like this before! Its tiny 11.6-inch display was causing me to see double after using it for several hours at a time. After visiting two eye doctors with no conclusive explanation, I ended up replacing the computer with a 15.4-inch Retina MacBook Pro based on my own suspicions. The main driver of this purchase was that I'd found that using a Retina iPad was much more comfortable, and I'd hoped that the larger screen on the MacBook Pro (which was also Retina) would help solve this. — Luckily, it did!

This machine was so much faster than my 2006 Mac Pro desktop that I decided to migrate solely to portable machines again. The only problem with this was that the Mac Pro desktop had offered a 2TB RAID of storage, where as my new MacBook Pro only offered 256GB of solid-state storage. — For over a year thereafter, I kept using iTunes Match exclusively for my music because of this. Recently though, Apple revised its MacBook Pro line yet again (this being the “Late 2013” revision), and these updates brought along the option for 1TB of SSD storage! I decided to order this computer, with the plan of reorganizing and clearing out my data thereafter by defragmenting it from so many different external storage solutions.

To alleviate storage constraints on my previous MacBook Pro (256GB SSD), I had already bought an external Drobo storage array and crammed it full of 5 x 1TB hard-drives in a semi-permanent backup archive. On this Drobo, I had put my music collection, raw video footage from the various trips I'd been on, and anything else bulky that I did not need to access very often. I have some backups of the Drobo itself as well, and a live backup of my music “in the cloud” through this iTunes Match service.

While still I plan to leave the bulky video-files stored externally from now on… with this new computer I knew that I could finally “undo” the iTunes Match migration and store all of my music locally again! — And, here's how I did that.

  Read more of the full post »

  Comments  |