Archive for August, 2006

Hi-MD && SonicStage? No, thanks Sony!

Saturday, August 26th, 2006

I have the Sony MZ-RH 1 for some weeks now (see the blog entry about it) and the Sony Windows software named SonicStage gets on my nerves so badly it is worth another blog entry.

The Hi-MD and especially the MZ-RH 1 are really fantastic devices but the usability of the Windows music (mis-)management software Sonic Stage just sucks. Sorry Sony but that’s how it is and you can easily find out googling for it

The Pro/Contra list boils down to this Cons:

  • Windows only (showstopper alone)
  • slow
  • looks ugly (heavily overthemed)
  • does not read all CD (e.g. some with copy protection that otherwise read out fine with other software and sometimes even not ordinary ones without any copy protection at all)
  • mutable locks all over the place, e.g. no name or meta info editing while importing a CD and the like
  • crashes more often than not
  • once corrupted the MiniDisc’s data integrity and as a result crashed even more often and forced me to reformat the disc loosing all my music on it!

You miss the Pros? Sorry that’s right - there are no Pros (despite if you like to count “after a lot of caffeine it sometimes transfers music files to the player - that is if it was able to read the CD and did not crash on the way).

Now not only does Sony force us to use Windows software where many people these days happily have no Windows anymore at all - this software is as annoying as I seldom have seen any other software in this millenium. Especially not in the content providing industry. Look at Apple’s iTunes or other HD Player that allow you to just drag’n drop your files on the USB storage device.

A pity this Software really prevents the Hi-MD from becoming a success, especially as Sony allows to drag’n drop mp3 onto and out of other models including cell phones (such as the k750i and m600i). On those cells you even can push the files too all the other people in school, a party or all the stranger in the subway just fine!

For the brave hearted I decided to publish my first bits to read the TOC and print the offset positions of the on-disc data structures rather now than later. Maybe someone else will take a look and help out decoding more of the disc’s meta data and the like. Much luck!

Apple’s Cocoa’s NSTokenField advance use explained

Wednesday, August 23rd, 2006

Historically the specification of tokens to be used in custom strings such as file names and report generation was just to use some special character such as ‘%’ or ‘@’ and pair it with some more ore less cryptic token to specify the kind of the replacement, e.g.: ‘%d.4′ or ‘%User’ and other variants such as ‘@day@’.

Of course this is not what today’s end users, especially on Apple Mac OS X want to see. I was already thinking how to make this more comfortable in one ouf our Mac products and with Adobe’s recent Lightroom demo I got an inspiration: Basically they use what Apple introduced with Apple Mail’s address field, rounded visual tokens you can inserted and drag around easily. So I set out to implement this using the NSTokenField, new in OS X 10.4, however I had to find out making it behave as wanted was not as easy as I hoped. One needs quite some Cocoa and ObjC experience to implement normal text intermixed with those rounded tokens and Google was quite sparse on on details and thus I decided to document the details here:

Note I’m not a Cocoa guru - feel free to comment suggestions and improvements!

Of course introducing it in your UI just means dropping it ouf of the Interface Builder’s toolbox into your project. The difficulties begin when you want to control the appearance of the tokens and display some as ordinary text.

For this you need to create your own class and add it to the NSArray that the NSTokenFieldCell uses to hold the tokens. Furthermore you need to define a delegate for the NSTokenField so that this delegate can respond to requests such as:

- (NSString *)tokenField:(NSTokenField *)tokenField displayStringForRepresentedObject:(id)representedObject

and

- (NSTokenStyle)tokenField:(NSTokenField *)tokenField styleForRepresentedObject:(id)representedObject

so you gain control about the formating of the individual tokens and the ordinary text parts can get the default NSPlainTextTokenStyle and you can return NSRoundedTokenStyle as well as the display text for your custom tokens.

When you want a context menu for your tokens you furthermore need to implement:

- (BOOL)tokenField:(NSTokenField *)tokenField hasMenuForRepresentedObject:(id)representedObject

as well as:

- (NSMenu *)tokenField:(NSTokenField *)tokenField menuForRepresentedObject:(id)representedObject

and to allow drag’n drop of your precious tokens your class need to adhere to the NSCoding protocol and implement:

- (void)encodeWithCoder:(NSCoder *)encoder

and

- (id)initWithCoder:(NSCoder *)decoder

and though deprecated you must use the old, non-keyed coding and decoding for this drag’n drop code:

In my example code this just was:

[encoder encodeObject:name];

respective:

name = [[decoder decodeObject] retain];

I hope this is a help for other people that want to use the NSTokenField and find the current Apple documentation slightly lacking detail. The full Xcode project is attached below:

TokenFieldTest