Archive for the ‘Uncategorized’ Category

Memcached status like APC status

15 Apr

Just a quick note to point out a cool little utility I discovered recently even though it’s been around for a while:

memcache.php stats like apc.php

If you are at all familiar with the apc status page, you know its nothing fancy but it is a very usable way to gett a quick overview of what is going on, and much prettier than the cli options.

Here is a screenshot from the author’s post:

It literally requires virtually no setup, it’s quite amazing. Optionally change the user/pass combo and add info about your buckets to an array, and boom you’re done. This let’s you easily see how much memory a bucket is using, and you can even see the contents of a slab. It does have one very dangerous feature that I’m tempted to strip out entirely: the ability to flush the contents of a bucket, seemingly with the click of a mouse (I haven’t tested it to find out). Some things should be hard.

Anyway, I highly recommend checking it out, it takes virtually no time and might actually be useful!


Grooveshark Loves Spain

12 Apr

Alternate title: Why is the flag for Spanish the Mexican flag?

As you have probably already noticed, Grooveshark is translated into a couple of different languages now. The language selection dropdown contains the name of the language (in that language), and a tiny icon of a flag. The main purpose of the flag is to be eye-catching, in the hopes that it will be more obvious to non-English speakers that there might be a language that would work better for them. The secondary purpose of the flag, is to indicate the locale. This is where it fails miserably.

The people of Spain are, apparently, quite proud of their country. We frequently receive the complaint that we are Wrong to use the Mexican flag for Spanish. The good people of Argentina, Chile and Colombia don’t seem to mind, but the Spanish, they want to see their flag up there. I guess I can’t really blame them, I mean it is sort of the native home of the language, after all.

The observant will also notice that English shows the American flag, even though English really belongs to the English (that is to say, by that definition, English should have the UK flag next to it). In both cases, the country flags indicate the variant of the language being used. English has the US flag because it’s the US dialect. In the case of Spanish, the translations were done by our very own Carlos Perez whom by now you may have deduced, is from Mexico! Grooveshark uses the Mexican flag for our translation of Spanish because it is written in Mexican Spanish. For that reason, it would be disingenuous for us to use the Spanish flag.

Grooveshark doesn’t have anything against Spain. In fact, Spain is the only Spanish speaking country I have visited, and I found it to be quite nice. Grooveshark has nothing against Britain either, though I have never been there so I can’t speak to the niceness of said country. In any case, as soon as we have the chance, you can bet we’ll be getting the site translated into Spain-Spanish and UK-English, although as you can imagine there are lots and lots of other languages that we need a bit more urgently, such as French, Germain and Russian. Although it might hurt a little bit to see the “wrong” country up there, at least Spaniards can read the site in their native language, aside from the little idiosyncrasies that arise from it being a different dialect.


Attn Hackers: Opening up Grooveshark

21 Dec

At Grooveshark, we get a lot of requests for features that aren’t possible to create in Adobe Flash/Flex/Air or that we just plain don’t have time to do.

In that vein, we’re working on opening up Grooveshark to make it a bit more extensible.

The first thing we’re doing is making the player status really easy to get to. People want their chat clients to be able to reflect what’s playing in the status when they are listening to the desktop app. We can’t do that through AIR directly, and we’re not going to have time to learn about and write special code for each chat client out there, but now anyone who already knows about that stuff or just really wants to put the time into it can do it.
There is a file that we are storing in documentsDirectory\Grooveshark\currentSong.txt
documentsDirectory is defined by Adobe to be the current users’ documents directory. In windows that’s %HOMEPATH%\Documents\Grooveshark\currentSong.txt

The format of the file is pretty obvious if you open it up, but I’ll spell it out here:
where \t is a hard tab (note: names are guaranteed not to have tabs in them)
Valid statuses are “playing,” “paused” and “stopped” – we may add others later if it makes sense to do so. Note that if a user clears their queue or quits Grooveshark, the last song to play will still be listed with a status of “stopped”.

Other ways we plan to open up Grooveshark to 3rd party developers includes creating an external interface through javascript for the web client so people can make Firefox or Chromium extensions to control playback, and creating something similar that can allow the desktop app to accept connections from 3rd party apps running on the desktop alongside, so for example someone could write a plugin that registers global keybaord shortcuts for play/pause, back and next. Again, AIR will not allow us to register those shortcuts directly.


Bugzilla error

23 Sep

Setting up Bugzilla for a friend on a slicehost account running RHEL5, I ran into issues following the official installation guide.
After running:
./ --check-modules
/usr/bin/perl --all

The error message I received was:

Can’t exec “–decompress”: No such file or directory

Amazingly, I found no exact matches for this in Google (my google-fu is generally weak, however). It turns out that in order for the module installer to be able to install the modules it needs, there’s a certain module it needs!

yum install perl-Compress-Zlib.x86_64
yum install perl-Archive-Tar.noarch

makes everything happy again.

Nothing earth shattering, but maybe now Google will have an answer if anyone else runs into this.


Free eBook for VIP users

01 Sep


It looks like there was a mix up and a bunch of our VIP users received the following email:

Andrew Wise
to me

show details 2:10 PM (3 minutes ago)


Thanks for purchasing our eBook, please download the eBook from this email.

Having not actually purchased an eBook, some of our users thought this was a weird form of spam or phishing, or even that their accounts might have been compromised. It’s nothing as sinister as all that, however, just a flub.

Here’s the official explanation from BWC, sent to one of our users who originally pointed out the issue:

Hey [redacted],

Thanks for letting me know, and sorry for the confusion!

Looks like our business guy (Andrew) who handles all our PayPal and such had a little mixup between Grooveshark and one of his side-projects. I just yelled at him, and everything is sorted out now.


Let me know if there’s anything else I can do to help out. Oh, and I guess enjoy being a triplets mommy! ;)


Ben Westermann-Clark


Manage Your Library

21 Aug

Coming to Grooveshark 2.0 is the ability for users to add music to their library without uploading, and without even scanning in their library.

That’s right, if you find a song on Grooveshark that you like, you can add it to your library with the simple click of a button. If you have a song in your library that you wish would just go away, you can also remove it from your library with the simple click of a button.


You can click this button on any song row to add it to your library (note: icon subject to change)

You can also drag as many songs to your library at once as you’d like.

If you toggle this button (icon subject to change) when it is highlighted, the song will be removed from your library.

Reminder: We will be releasing a preview (in other words, still buggy) version of Grooveshark 2.0 to VIP subscribers on the 24th, this upcoming Monday. Subsequent changes to Grooveshark 2.0 will depend on feedback we get from the VIP community, so we can’t predict when 2.0 will be available to the general public.


New RPC Server

20 Aug

Among the many backend enhancements coming together for Grooveshark 2.0 is a brand new RPC Server that I wrote. The format it follows is the same as the last incarnation, JSON, but it’s considerably more efficient.

First, a history lesson. Our first stab at RPC (codename tambourine) was SOAP. We chose SOAP because it did what we needed (theoretically), it was XML (so super easy for Flash to use), and it’s also super enterprisey, which appeals to certain people here, myself not included. We used NuSOAP because it supports WSDL generation, which is so annoying we did not ever, ever want to have to do that by hand. Using SOAP turned out to be a huge mistake (anyone familiar with SOAP probably could have told us that). Because it’s XML, it was super easy to break the service by returning data with, say, an unsupported character in it, or by having PHP accidentally output a newline character (say, by following the PEAR standard and having an extra newline at the end of every PHP file). Further, because browsers eat most error codes and don’t pass the codes or the accompanying data on to plugins, we had to hack NuSOAP to violate SOAP standards and return a 200 OK when generating SOAP Faults. On top of all that, and most importantly, it turns out that generating all of that XML is very expensive. So expensive that I could not test code locally on my machine before putting it on a server. So expensive that we actually got a huge performance boost by caching the generated XML in memcache.

After the SOAP fiasco, we wanted to try using JSON, because it’s much more terse and far less expensive to generate than XML, while still being human readable, which we value for debugging purposes. We looked at official JSON-RPC stuff, but we were spoiled by SOAP in one regard: support for headers. We got used to using headers to pass around status information that didn’t exactly belong to the method calls, and we didn’t want to give that up so I wrote my own JSON-RPC server (codenamed cowbell) modeled largely after how SOAP worked, but more efficient. My custom JSON server class was only 275 lines long to NuSOAP’s 7,994 lines for just the core file. We gave up the elaborate data type declarations (we just verbally communicated what type everything would be), but beyond that method registration worked the same way as SOAP and every other RPC implementation I’ve seen: you need a service file which registers all available methods with the RPC server, and then invokes the RPC class, passing through the raw POST data. Although I did not save benchmark information, the speed difference between my custom RPC class and NuSOAP was astronomical, so we left the RPC optimizations at that.

I recently came back and did some profiling out of curiosity to see how much overhead our current RPC implementation was creating, and it turned out to be about 15% plus about an extra 1.5MB of memory used. I thought about how things were working with the current implementation and realized that it’s a bit silly to be registering hundreds of methods every time the client makes a request, when you really only need information about whatever method is currently being requested. All the other information is superfluous. So in our new JSON-RPC implementation (codename more because it’s still cowbell in a way), 162 lines long, there is no ‘registration’ of methods. Instead, the service class that would normally do the registration simply has a collection of “meta methods” which return information about the methods that make up the service when called. So the RPC server parses the request, does a little bit of reflection magic to determine which meta method to call, and calls that method to get all the information it needs in order to handle the request. What’s the overhead of this approach? Well, it hardly even registers in the profiling I’ve done. :)

In summary, Grooveshark 2.0 method calls should be nearly 15% faster on average than Grooveshark 1.0 calls. :)

P.S. On the topic of cowbell, there’s an old easter egg that we added and never got around to telling anyone about. Before Grooveshark 2.0 is lost and it’s forgotten forever, you can get to it by typing about:cowbell into the search bar.


All /sorts/ of Improvements

19 Aug

I mentioned in Bypassing Magic that Grooveshark 2.0 will be loading much larger data sets, and one consequence of this is that the application can do more with that data.

As you might have guessed from the punny title of this post, one of those cool things is sorting! When looking at a list of songs, artists, albums, etc., in Grooveshark 2.0, you will be able to sort that data however you like.

Yes, this is another excuse for me to leak a screenshot. ;)

Grooveshark 2.0 Sorting

Another feature it enables which won’t make it into the VIP release of the 24th, but will be available to VIP users shortly thereafter, is live search. You’ll be able to narrow down any list of songs you’re looking at by searching within the result set.


Ghost Glacier

18 Aug

Some of my favorite music also happens to be made by some of my friends. :) Please enjoy Ghost Glacier.


Better Playlist Editing

16 Aug

Ugh, we know, in Grooveshark 1.0 it is a royal pain in the ass to edit playlists. For various reasons the playlist editing system in 1.0 is a hack on top of a hack. For Grooveshark 2.0 the playlist editing system has finally been rewritten. Aside from a brand new, far less annoying interface, the actual mechanisms for modifying a playlist are vastly improved.

In Grooveshark 1.0, the way most people edit a playlist is to load it up into their queue, most songs around in the queue, add new songs to the queue, etc., and then save the queue, overwriting their existing playlist. If you just want to change the order of your playlist, technically you can do so by opening the playlist page, and clicking the up or down arrow to move a song up or down one position at a time. That means if you have a song in position 10 and you want it to be the first song on the list, you have to click up 9 times.

In Grooveshark 2.0, playlists fully support drag and drop actions. You can still save your queue as a playlist if you like, but you can also edit a playlist by dragging songs into it, dragging songs to the trash to delete them, and moving songs up and down on the list by, you guessed it, dragging them!

Here’s a screenshot with drag and drop in action.
Grooveshark 2.0 Drag and Drop playlists
Click to see full size