Homepage Albums — Hi, I’m Sam
source link: https://soffes.blog/homepage-albums
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Homepage Albums — Hi, I’m Sam
Homepage Albums — Hi, I’m Sam
Hi, I’m Sam
This is my blog. I also have a website thing.
Homepage Albums
Posted on April 1, 2010
I recently added an albums I've been enjoying this week section to my homepage. It's still a major work in progress. For some reason, tons of people have commented about it on Twitter asking how I made it, so I thought I'd write a quick post about the tech behind it.
The first thing your probably noticed is the sexy vinyl look. I got this from Komodo Media (all of their stuff is awesome, you should check it out). Some simple CSS plus their images and it looks dang sexy.
I'm using the Last.fm API to get my listening history. The call to get your top albums for the week doesn't return the album art for that album, so I have to get all of the albums and then get the art for each one. This whole process is pretty slow (source here) so I shove it in memcached on Heroku using the memcached gem so rendering is fast on my homepage.
I setup a cron to nightly rerun the lastfm:update
rake task from above and update the cache with the new data. Pretty simple.
Anyway, I was proud. Nothing complex, just cool. Feel free to rip off anything I wrote. It's all on GitHub.
Archiving NSManagedObject with NSCoding
Posted on February 28, 2010
Several of the apps I have been working on lately have been using Core Data. Core Data is pretty sweet. So far, I really like it.
I needed to persist an array of NSManagedObjects to NSUserDefaults to persist the state of the application between launches. Obviously, I could have done this with another attribute on the Core Data entity, but this approach seemed a lot simpler. I was surprised that NSManagedObject didn't conform to NSCoding. I guess that makes sense because if you store any custom types in your entity, it wouldn't know how to archive them. In my case, (and I would assume most others) I didn't want to archive the entire object since it was already store in Core Data. I just needed to store the object ID.
This was actually really easy. See:
© 2006-2022 Sam Soffes
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK