Objective-C library for MusiXmatch API

September 28th, 2010 No Comments »

There’s a new cool startup called MusiXmatch which provides an easy access to lyrics.
They already have tons of lyrics and they recently opened their API to the alpha testers.
I wrote a basic library for accessing this service. While it’s incomplete, it already provides the most often used functionality such as searching for tracks and getting lyrics.
Example usage:

// Get a track
Track *track = [Track trackWithId:123];
NSString *lyrics = [track lyrics];
 
// Or use the service directly
MusiXmatchService *service = [MusiXmatchService sharedInstance];
NSArray *tracks = [service trackSearch:@"dreamer" numResults:10];
for (Track *track in tracks) {
    NSLog(@"TrackID: %u, Artist: %@, Title: %@", track.mxmId, track.artist.name, track.name);
}

Get it here:
http://github.com/romanbsd/musiXmatch

String#include? vs. String#match

November 7th, 2008 No Comments »

Interesting phenomenon; for finding whenever some string occurs inside other string, String#match is 5 (!) times faster than String#include? for long strings (50k), and 2 times slower for short strings (tens of bytes).
The slowness can be explained by the time it takes to compile the regexp.
But how can it be so slow for long strings? Going to ask this in ruby.core.

Pages

Adsense