Archive for January, 2006

A word on CDDB

Friday, January 27th, 2006

CDDB is a real mess. Despite the fact that new track info gets fetched from CDDB I still have to double check all the music info on every CD I import – I’ve gotten wrong ID3 tags one too many times. Problems range from having the Title and Artist fields swapped to misspellings and incorrect CD track counts. And it doesn’t just happen once in a while – I would guess it’s a problem about with 2 of 3 CDs.

For a controlled system 1 in 3 success rate sure doesn’t seem very impressive. You can submit changes, but with no assurance that changes will be made I’ll only on finding myself doing that (I hope) when I’m really, really, bored.

Wouldn’t that make an interesting Wiki..? hmmm…

Keep it Clean!

Friday, January 27th, 2006

Despite my best efforts I’ve never been able to understand how people can allow their music libraries get to out of control (could it be because searching is so convenient now? – I dunno sounds like that could be another post).

It just boggles my mind. Take this for example:

An unorganized iTunes library

Don’t let this happen to you!

Oh the Humanity! Why? Why I ask, must you have duplicate genres? “Hip Hop”, “Hip-Hop”, “Hip Hop/Rap” then further down there’s “Gansta”, “Gansta Rap”, “Rap”, “Rap & Hip Hop”, “Rap/Hip-Hop”, and “Rap/R&B” (mean:26 median:18 songs). MADNESS.

Sigh… but what are you going to do, eh? If people don’t want to keep their libraries clean they’re free to do so..

Of course there’s never anything to keep you from having a nice, clean, organized, beauty of a library if you want. It’s a fight against nature – but if I want a clean library by golly I’m gonna get one! – damn the pesky forces of entropy.

To keep my library from falling to shambles I’ve adopted these rules for imports to my library:

  • All song titles should match the following format. (in Title Text)
    $songName ($alternateName)*(Feat. $janeDoe)*[$version]*
  • Compilations should be marked as compilations. (ie. The Matrix)*
  • Composers should filled only if it really has a composer. (ie. Classical)
  • If album is a set of CDs then CD number is set and album name is the same for each CD (ie. Beatles Anthology 1)
  • Unless all you can find is really terrible coverart – set the Album art.
  • Only one name for an artist. Use either “DJ Armin van Buuren” or “Armin van Buuren” not both.
  • Basic genres, unless you have a huge amount of a specific genre and really need it split up don’t. (Electronic in place of Electro/Trance/Dance/Goa/Chilled)**

* Not sure if things like Anthology 1 should be considered compilations or not… as of right now I don’t treat them as compilations
**for most things just making a playlist with the best of each sub-genre would work well.

Gradients in Cocoa

Sunday, January 15th, 2006

CGShadings are a pain, or well, lets just leave it at all of Core Graphics (CG). While CG is a heck of a powerful library… It always seems to take an elaborate amount of code (as well as time, if your not yet acquainted with it) to do some of the simplest little things. For a discussion on creating gradients with CGShading go here.

cocoa gradient

Now, AppKit provides a pretty decent layer of abstraction, but I find that there are still a number of holes in its coverage of those lower level APIs that could use some filling.

One of those that AppKit doesn’t cover (that it really, really should, especially given the whole resolution independence thing that’s in the works – 10.5 maybe? please?), are gradients.

When I started coding up a sourcelist (you know, the tableView with the iTunes/iPhoto/Mail styling) and also thinking of a few of the mini-projects that I had plans for, many of which could use gradients also – I figured that I might as well take a little detour and try my hand at filling in that gap.

And so, let me introduce you to my little Cocoa Obj-C Gradient class, CTGradient. It’s a small class that should provide a decent cocoa interface for CGShading.

In my case, CTGradient has gone a long way toward making the code in several of the projects I’ve been working on significantly less cluttered (and that’s always a welcome change). I no longer have lines of GCContext junk in my drawing functions nor do I have CG function callbacks proliferating my code. The few convenience methods that I tacked on help a bit with readability as well.

Download CTGradient
< 100 KB

And so, that said, I figure a few people might find it handy.

As it stands right now, it’s not quite finished (I expect the interface to change by a fair amount in the not to distant future – I have a few additions to make). But in any case the code is stable, so if it does what you need it to do, go ahead and make use of it!

With that I’ll end with a short list of those additions I have plans to make:

  • Radial Gradient (just need to figure out best method interface)
  • Chromatic blending (blending HSB)
  • CTGradientWell (counterpart to NSColorWell – with palette to boot)
  • CTGradientSlider/Selecter? (view to let you add/remove/adjust color stops)
  • Miscellaneous methods for color stops
  • More pre-made gradients styles

Update: Updates and other info will be maintained at svn.oofn.net.
Update: With OS 10.5’s AppKit, I would recommend using only NSGradient.

Badging for Everyone

Sunday, January 8th, 2006

Apple’s badges are excellent. Apart from just looking good (notice the subtle shading on the right) and standing out, they are effective.

The fundamentals of any good interface should always be, most important, simplicity; next, consistency and after that, specificity. And these badges are just that, they send a simple, clear and consistent message to the user – “there ## number of things you care about right here”.

But to dig a little deeper… what makes these badges excellent? – the fact that they pervade the user’s environment, that’s what is key.

When badges pop up any time you drag messages in Mail, songs in iTunes, people in Address Book, or pictures in iPhoto, for users, the little icons send more then just a message, they convey meaning and a sense of familiarity.

When a badge comes up on one of my dock icons I know there is something at that application that I ought to check out (in a timely – but not quite urgent fashion). It doesn’t matter what the meaning is – the message is the same regardless of the fact that they may mean errors in xCode, unanswered messages in iChat, or unread messages in Mail.

And so it’s a shame that AppKit doesn’t doesn’t provide a way to create badges for your own OS X apps – developers, I’m sure, would love to tap into this useful interface element. Apple devs probably wouldn’t mind either – as it stands each and every app that uses the badges has its own copy of the badge images… and NSApp doesn’t provide a private method either (I’ve checked).

Download CTBadge
~150 KB

But these badges are just too good to pass up (no, really, they are) so here are a few tiny methods that’ll do the work for you.

As a side note, notice how the badge in iTunes is noticeably different than the badge in Mail/iPhoto/etc? Radar 4402569

Update: Updates and other info will be maintained at svn.oofn.net.