Versioned Taste in Music

October 31st, 2006

Some people can’t tolerate music during work, and I can vary. When I am in the music-with-work groove, then it’s great. But, let’s face it, getting work done is the goal and any time spent on looking for, organizing, remembering, etc music is a distraction.

Enter “RadioBlogClub”:http://radioblogclub.com/ , a website distributing a Flash application that streams music in its player. You can get complicated with it, and use similar services such as “Pandora”:http://www.pandora.com/ , but I prefer the speed and simplicity of RadioBlogClub (I call it radioblog among friends for brevity, and I will adopt that for the rest of this article =p ). What this entails is going to the website, searching for any song you like (many people host the player so a lot of songs are on there), and picking one. After the song ends, the “blog” will continue to the next song in the playlist, and the one after that, etc.

So…you get free songs that usually have a similar style that you’re looking for. You end up getting tons of new and old songs that come to you! No work required, you just keep developing and new songs appear before your very ears. So…you may be asking yourself, “Where does versioning come in?” Like I said before, I don’t like to waste time using the service’s features and building “bookmarks” of popular playlists. I don’t get interested in just one song from a particular blog either. Instead, with radioblog you get unique attachments to songs because they bring up several blogs, each with different styles of music…and you get attached to that as a whole.

“Yeah, yeah, so what’s the solution?” Well, as many of you probably know “37signals”:http://www.37signals.com/ has these neat little wiki-like editable pages called “Writeboards”:http://www.writeboard.com/ . They use a great markup language, “textile”:http://www.textism.com/tools/textile/ , that I also use in this blog (try it in the comments!) Like wiki history entries, writeboards have revisions. They also have this nice little ability that lets you compare two revisions (think the unix @diff@ command formatted nicely and with color), something that tailors to Writeboard’s collaborative writing audience. Finally, here comes the elegant solution: use writeboards to store a simple collection of songs that you currently enjoy. At any time, pull up your writeboard and radioblog the song and/or artist combo. If you find a new song/artist combo that pulls interesting results in radioblog, edit your writeboard to include it.

The key is to only keep the combos that you currently like in your writeboard. That way, the board isn’t cluttered…but even better, now try to compare two revisions. Alright! Versioned taste in music! At any time you can look at what you liked in the past, and start radioblogging those combos again. Talk about simple, fast, and productive…now get on to coding and Happy Halloween!

As my treat to you, here is a very simple example of the textile markup to keep your combos in. This can be made more pretty, but I like it because it keeps the textile markup I edit easy to read and manage too:

bq.
|*Song*|*Artist*|
|Perfume|Sparks|
|Zombie Remix|Cranberries|
|*|Richard Cheese|
|*|Daft Punk|

Which ends up looking something like this:

|*Song*|*Artist*|
|Perfume|Sparks|
|Zombie Remix|Cranberries|
|*|Richard Cheese|
|*|Daft Punk|


Ruby’esque Method Caching

October 30th, 2006

I am in love with how dynamic Ruby is… Whenever I talk about that aspect of Ruby I always bring up this example, which I heard about from someone that read it on the Ruby-talk mailing list. Nevertheless, doing it always amuses me.

So here we go. What I am going to do is make a Ruby class with an instance method and instance variable. The method first assigns the current time to an instance variable. Simple enough…but then I reopen the method and define it to just return that instance variable. What this ends up being is a simple form of caching:

class Cacher
def cache
@time=Time.now
def cache
‘Succesfully cached at: ‘ + @time.to_s
end
end
end

So now I can do this:

larry-diehls-computer:~ larrytheliquid$ irb
irb(main):001:0> require ‘cacher’
=> true
irb(main):002:0> c=Cacher.new
=> #
irb(main):003:0> c.cache
=> nil
irb(main):004:0> c.cache
=> “Succesfully cached at: Mon Oct 30 23:31:26 EST 2006″
irb(main):005:0> c.cache
=> “Succesfully cached at: Mon Oct 30 23:31:26 EST 2006″
irb(main):006:0> c.cache
=> “Succesfully cached at: Mon Oct 30 23:31:26 EST 2006″
irb(main):007:0> c.cache
=> “Succesfully cached at: Mon Oct 30 23:31:26 EST 2006″
irb(main):008:0>

As you can see, the @cache@ method gets redefined and always outputs the same thing. This works great for any method that takes a long time to execute but needs to be called multiple times. Say, maybe a Google Map API call, an intensive SQL statement, etc…

I love how simple this example is and plan to post plenty other such examples that illustrate the elegance of Ruby in the future, so stay tuned. Have something short and similar? You are most welcome to post it, or a link to your blog post about it, etc in the comments!


JRuby of Second Life Recap

October 29th, 2006

I came across “an interesting message”:http://www.ruby-forum.com/topic/83839 on the ruby talk mailing list a month ago. “Second Life”:http://secondlife.com/ is a 3d, online virtual world with no specific purpose. I heard about it from a good friend that was planning a business within it, selling virtual goods and services (the game lets you exchange real money for “Linden dollars”.) Although the concept appealed to me, I was never interested in it enough to install it and give it a try.

I had also heard of the “recent hiring”:http://headius.blogspot.com/2006/09/jruby-steps-into-sun.html of JRuby developers (Charles Nutter and Thomas Enebo) by Sun. I knew that “JRuby”:http://jruby.org/ was some sort of Ruby integration with Java (like Jython), and was happy as a Rails developer that Sun was giving Ruby some love. But again, I was satisfied with Rails enough to not dig deeper into it.

I love web development and try to stay in touch with local scenes such as the “Orlando Ruby Users Group”:http://www.orug.org/ , “Refresh Orlando”:http://www.refreshorlando.org/ , the upcoming “Refresh06 conference”:http://refresh06.com/ , and have attended “BarCamp Jacksonville”:http://barcamp.org/BarCampJacksonville and “Refresh Jacksonville”:http://www.refreshjacksonville.org/ in the past. Needless to say, being able to meet up with a virtual locality of “Rubyists of Second Life”:http://rosl.iandb.net/ AND learn about JRuby seemed like an amazing opportunity to indulge in the kind of fun that makes the internet so great.

“[click here to see all the screenshots I took]”:http://flickr.com/photos/larrytheliquid/sets/72157594350925388/ !

@On my trips to the meeting before it started, in my Eastern time zone, I had fun playing with interactive billboards that had pages like the RoR website, some Ruby sites, etc. The coolest thing was this little red cube on the middle of the giant ruby…it was a module that let you use IRB in Second Life! That’s right, IRB right there in the game…so cool.@

Then came the presentation, a format I found to be very entertaining. Headius started off the projector with some introductory slides, to the sweet tunes of Daft Punk that someone in the audience was streaming. You could see his avatar move his eyes and body to change slides, look around at people, and gestures were performed during chat to make the whole thing eerily lifelike. As you can see in the “presentation and chat log”:http://rosl.iandb.net/presentations/jruby/JRuby%20Presentation%2018%20Oct%2006.html , discussion during and between slides ensued…the air was electric and the format for this kind of meeting definitely works.

!

!

So to sum this all up, Second Life is a fun and exciting presentation medium. I encourage anyone interested enough in Ruby to read this article, to join the Rubyists of Second Life group (refer to “install and setup instructions here”:http://www.ruby-forum.com/topic/83839 .) JRuby has great and friendly developers that have that oh-so-good open source concern for community needs, and now has the backing of Sun. Anything that gives the dark side of Rails (deployment) another alternative is fantastic in my book, and access to probably the best libraries ever (Java’s) is also very sweet. Plus…possible better performance…sign me up! I’ll definitely be playing with JRuby, and am glad to have found out more about something I initially neglected. And finally, in case anyone cared, my in-game name is “Liquid Lunardi”.


My first post

October 28th, 2006

My goal with this blog will be to make exactly one post per day, always learning or reflecting on something new.