Archive for the ‘grooveshark’ Category

Quick searching in Google Chrome

02 Sep

Google released their Chrome Browser today. I’ll refrain from giving it a full review as many others have already manged to do so.

I want to comment on the ease of adding search engines and some minor tweaks you can do to make the search functionality more powerful, specifically in regards to Grooveshark Lite and TinySong.

To add a search engine to Chrome, just visit the site. If they have properly implemented their search extensions by embedding information about them in the page (and we have), then all you have to do is visit the site and Google will add it to its list of search engines. Each search engine has a “keyword” that you type before your search term to indicate which search engine you wish to use. The default keyword is the domain of the search engine, but you can change it by clicking on the wrench icon, and then Options | Basics | Default Search | Manage

I changed mine so that I can search lite by typing in “listen artistname” so if I want to listen to Soltero I type “listen Soltero.”
Likewise I modified the keyword for TinySong to be ts. So if I want to search for Camera Obscura, I type “ts Camera Obscura”

Another thing about Google Chrome that is really cool as it relates to Grooveshark Lite is the built in support for making any website an application. I installed Grooveshark Lite on my start menu, and now it runs as an independent application with the lite Favicon showing up in the taskbar. Very cool.


On being a DJ

18 Aug

When I was in college (oh so long ago…) I was a DJ for our radio station, and then I was a music director. I loved being a DJ: having lots of new, interesting and unreleased music on tap, from Smashing Pumpkins to Underwater Boxer; having a channel to share that music with other people; being able to make a small band’s day by playing their stuff and reporting it to CMJ. Well, there was one part I didn’t care for so much: talking on the radio. I’m a bit shy, which is why although I loved being a DJ and music director at Eckerd College, I knew it wasn’t ever going to be a career path for me.

It’s interesting, then, that I work at Grooveshark where much of that dream is being fulfilled by participating in this movement. The one piece that is missing is having a channel to share music with other people and subsequently helping small bands by making them more discoverable. Well, now with the release of Autoplay in Grooveshark Lite, it’s kind of like I get to be everybody’s DJ. Of course a computer scientist would write a DJing program rather than doing the manual labor of DJing.

As Professor Fishman, the best professor who ever lived, was fond of saying in our classes, a computer scientist isn’t satisfied with just using computers to put other people out of a job, they won’t settle until they manage to put themselves out of a job too. To be fair, he usually talked about that in the context of AI and specifically programming languages such as LISP, where the program can rewrite itself, but I think it applies here as well.

Now I get to be everyone’s DJ, but with everyone’s help too. If the system is currently a bad DJ, keep giving it feedback and it will learn. Imagine if you got to call up your local radio station and yell at them every time they played something you didn’t like, and congratulate them every time they played something you liked. If they didn’t block your phone number, you’d end up with the ultimate radio station for you, and that’s what Grooveshark aims to be, although we admit it will take some time to get there.

Check out Autoplay, and let me know what you think.


Making it easy

16 Aug

There is an effort underway at GS to modify our framework to make writing code easier than ever before (for the second time). It’s a great idea in theory and the results of what I have seen so far certainly make doing certain things more convenient, which is great when you’re writing code.

But I can’t help but feel that we are perhaps barking up the wrong tree a bit.

Peter Hallam points out that programmers spend most of their time reading code, not writing it. So rather than focusing on making code easier to write, we should be sure that we are making it easy to read, understand and modify. Peter surmises that a 10% reduction in the time it takes to understand code is equivalent to a 100% reduction in the time that it takes to write code. That’s very significant.

One of the mantras I have heard a bit too much is “always favor composition over inheritance.” As Phil Haack points out, composition is great sometimes, but it’s not a perfect design either (because there isn’t one). Personally, I think it’s best to keep composition and inheritance in mind and always prefer whichever one going to lead to easy-to-understand code. Many times I find that to be inheritance. Sometimes the solution is even minor code duplication, such as having each page requiring authentication to do an explicit auth check rather than having the framework infer whether or not an auth check is required based on the name or, and I shudder at the thought, comments in the code.


Be careful what you return

05 Aug

(and how you handle what has been returned)

Things have been busy at Grooveshark, as usual. These past couple of days I have been hunting a bug both cthulu-like in its scary-strangeness and ninja-like in its stealthy manner. I went through all my code related to this particular project several times with a fine-toothed comb and didn’t catch it until today.

Turns out it wasn’t so strange after all. The fault was definitely mine, but PHP’s quirks certainly didn’t help matters any.
I was using array_search in a straightforward manner, not to find the particular position of an item but to find whether or not the item was in the array at all. The one thing about array_search, especially in the context of PHP’s loose typing, is that if it finds nothing it returns false. Of course, php happily treats false as zero, so how do you check to see if array_search is saying that it wasn’t found, or is saying that it’s the first element in the array? You have to check using strict equivalency, which I remembered, so I wrote my code like this:

$found = array_search('something', $arr);
if ($found === false) {
//handle what you do when it's not in there

then, a little while ago, specs changed and there was another case that had to be handled the exact same way as when ‘something’ wasn’t in $arr. So I did this:

$found = array_search('something', $arr);
$found = $found || (SOME_OTHER_CASE);
if ($found === false) {
//handle what you do when it's not in there

So in other words, when I went back and looked at that code later, I didn’t notice the triple equals instead of the double, so without much thought I assumed that $found was already a boolean, when it was really only a sometimes-boolean. In a strictly typed language this mistake would, of course, not have been possible. More practically, if array_search returned something other than practically-zero, I would have been able to explicitly handle that special case and store the result of that explicit handling as a boolean. If you read the documentation you will see that array_search actually returned NULL before version 4.2.0. I have to wonder why they decided to change it.

The reason this bug was so hard to find was because it was only a bug when the item being searched was the first item in the array, which it turns out is not that often. By the time I found that bug, there were hundreds of newer lines of code to check first.

Now that the bug is solved and now that I am far into this very technical post I think it’s safe to leak a tiny bit of information about what you, dear user, can expect to see in Grooveshark Lite in the near future: autoplay. We have decided that we want to be your personal DJ. Our tack on this feature aims to get around the chicken and egg problem: how do you build recommendations without user feedback, and how do you get user feedback if you don’t have recommendations to make them want to use the system? I’m not going to answer that question directly, but we hope that you will find the autoplay sessions to be enjoyable, and as you provide feedback to the system, we’ll take that data and make it even better.


Search TinySong in Firefox

05 Jul

I have gone ahead and added the same technology that I recently blogged about to allow quick searches of TinySong from Firefox as well.

For those of you not familiar, TinySong is a service that Grooveshark launched a little while ago geared towards being “the fastest way to search for music” – really it’s a quick way to get tinyURL style links for sharing on sites like Twitter. Now you can get those links with one less step, if you use Firefox.


The pain of project management

30 May

For the second time now, Grooveshark is making a serious effort to utilize project management software.

I don’t like the new project management solution, even though it is a vast improvement over the old one, and I think I’ve discovered why: I don’t like project management. I don’t like project management because project management is not for me; it’s for managers. Managers and developers have vastly different interests. Developers want to know what bugs are in their code, what features they need to develop, a way to view dependencies, and a way to see which bugs/features are most important. Bugzilla fits those needs perfectly. Managers, on the other hand, need to make sure that they are maximizing productivity by making sure devs are never sitting idle, they need to know what is going to happen when; they need ship dates.

The thing about bug tracking is that the people who benefit from it are the same people who have to do the work. If you want to see a bug get fixed, you file it. If you want to find bugs to fix, use the bug tracker. Project management tools, on the other hand, require a vast amount of work from the people who don’t need them: developers. That drastically decreases the chances that they will be used consistently. It also means that project managers end up working against their own goal: they reduce productivity. This is consistent with Le Chatelier’s Principle: Complex systems tend to oppose their own proper function.

It’s actually a more pronounced effect than just wasting dev time on project management. At least for me, having multiple people assign tasks to me with various arbitrary deadlines tends to make me feel like I am being micromanaged, which increases stress and also keeps me from being able to focus on any one thing for long enough to accomplish much. (“I’ve been working on this thing for 3 hours and I have all these other things to do, I should put it on the back burner and move on…”)

What’s the solution? I don’t know, but a good start would be to combine project management with bug tracking, ala FogBugz, set overarching deadlines for projects, let your devs work out the details, and be flexible. Plan for other things coming up, because new and very important bugs will pop up all the time, servers will break, and meetings will happen (sadly). If your developers are good, hardworking employees (and Grooveshark devs are), they will strive to meet or exceed the goals you set for them, without being micromanaged.


Grooveshark Loves Twitter

27 May

Largely due to the fact that so many Grooveshark employees use twitter, we have made a special site geared towards twitter users. (you have no idea how hard that was)

Anyway, we made Tiny Song: a simple way to get a short link to any song on Grooveshark. Just go there, type in the name of the song and the artist or album if you happen to remember it, hit enter and you’ll get a list of songs that match your search query. Click the song that you were looking for and get a short URL that links right in to Grooveshark Lite.

Here’s an example URL:


Grooveshark Lite updates: More music, Better Popular List

10 May

Grooveshark Lite now has more music available for listening. I don’t know if I’m allowed to disclose totals, so I’ll just discuss the delta: about 400,000 more songs than previously available, all of them very high quality (> 256kbps). We were excluding them previously due to technical limitations, but those issues have now been solved. Enjoy!

Tired of seeing the same old crap on the Grooveshark Lite popular list? Well now you don’t have to. Previously, the popular list showed only the all-time popular music which was interesting, but obviously didn’t change much over time.

Our new algorithm calculates a normalized weight based on how many times the song has been played today, how many times it was played yesterday, and the total number of plays of all songs for both of those days. Songs that have a lower normalized weight than they did yesterday are penalized slightly. The net effect is that it’s easier for new songs to get on the popular list, and songs that are gaining popularity will be pushed higher up the list than songs that are becoming less popular.

If you take a look at the list of popular songs on Grooveshark Lite, you’ll see that our users have very eclectic tastes, which makes sense since our goal is to have a bit of everything, and that’s exactly what people are listening to. You’ll find just about every genre, new music and old music on there. At the time of writing, the second song on the list is a Katamari song!


Grooveshark Lite Credits

16 Apr

Grooveshark Lite is up and the backend seems to be relatively stable now. I’ve been playing music seamlessly for a couple of hours. I noticed that we don’t have any specific information about the GSLite Team, so I thought I’d put up something quick:



John Ashenden


Katy Richard

Katy is our flex/flash guru. Many perceive her powers to be magical, despite her protestations to the contrary.


Jay Paroline (me!)

I created a SOAP interface using NuSOAP to allow Katy’s front end to communicate with the API that I wrote, which does a combination of DB work and communicating with the existing Grooveshark framework.

Streaming media server

Qiu Yuanzong, Paulo Dasilva, Edwin Fuquen

None of these guys appear on the about page right now, so I can’t include their pictures. They got Red5 up and running on 3 amazon ec2 servers in preparation for launch.


Colin Hostert

Colin set up the ec2 service, put up a bunch of front-end web nodes to load balance across, and made sure we had access to memcached.

Oh shit, stuff is broken

Travis Whitton, Chris Suter, Douglas Bell

When Red5 started crashing hardcore on our ec2 servers once hundreds of people tried to use it at the same time while the red5 team was out, Travis and Chris jumped in to debug the problem and hack together some temporary solutions. Meanwhile, Douglas got us hooked up with a few more ec2 instances to help balance the load.


Amazon S3 and EC2
Cloud computing FTW! While long-term this is an expensive solution, when you need instant scalability, that’s what these services are for. Once we have time we’ll have in-house solutions for both hosting cached MP3s (currently on S3) and streaming them (currently on EC2).
MySQL (InnoDB)
All of our data exists in a massive MySQL database. It took about 6 hours worth of UPDATEs and ALTERs to the schema to get the DB in shape for Grooveshark Lite.
SOAP is a bulky way to communicate, and we ran into limitations both in NuSOAP, PHP SOAP and Flash in terms of implementations, but we got it working anyway. In the next iteration of GS Lite we will most likely forgo SOAP in favor of JSON-RPC or some other lightweight protocol.
The highest levels of navigation all reside in memcached, which give us the massive benefit of removing a huge amount of load from the MySQL DB. I was also able to decrease the load on our web servers (building XML in an interpreted language is very expensive!) by adding some hacks to NuSOAP so that any message that contains non-volatile information is cached after it is built. I believe that memcached deserves the bulk of the credit for why the back end was able to withstand the massive amounts of load we were under even when red5 couldn’t handle the strain.
Red5 is an open source clone of flash media server written in Java. Despite the problems we’ve had with it, without Red5, GS Lite would not be possible.
All of our in-house servers are Sun boxes.
Backend programming language of choice for Grooveshark. It may not be as sexy as Ruby or Python, but it’s hellaciously powerful.
Goold ol’ Apache, what would we do without you?
Flex is an incredibly powerful open source framework for creating complex flash apps easily. From what I gather from Katy, Flex’s default behavior is both a blessing and a curse; often making things pretty by default, but a horrible pain to override if you need it to do something different.


It goes without saying that GS Lite would not be at all possible without the existing Grooveshark infrastructure, so really the whole Grooveshark development team deserves credit.


What’s been keeping me busy

14 Apr

Katy and I have been hard at work this past month on a top-secret project, code-named tambourine. It will be known to the public as Grooveshark Lite.

We’re nearing the end and we’ve been given permission to leak a tiny little bit. There’s other big news coming down the pipe very soon, but this is pretty big to us too. Teaser screenshots:

Grooveshark Lite:


Listen to any song cached on Grooveshark:

Unlike the current Grooveshark website, Grooveshark Lite doesn’t require the sharkbyte client, and doesn’t require a user account to listen, search or browse.