RSS
 

Archive for the ‘Uncategorized’ Category

Grooveshark releases our first widget

17 Oct

It’s finally here: the Grooveshark widget! To show it off, here’s a collection of songs by The Bird and the Bee; one of my new favorite bands.

 
 

Headless Camels

18 Jul

One problem we have had at Grooveshark is needing to verbally distinguish between CamelCase and camelCase. As you can see, they have the same name. Well, according to Wikipedia they are called lower camelCase and upper CamelCase, but those names are both clunky and probably not particularly intuitive.

Here at Grooveshark we’ve tried to come up with something better. For a while we tried calling upper CamelCase StudlyCaps while calling lower camelCase just camelCase. That didn’t sit well with everyone since even this spelling of STuDLeYCAps meets the definition, so we decided to invent a new word for upper CamelCase: StudleyCamels while still calling lower camelCase camelCase. Then another problem arose: how do you let people know that when you say camelCase you aren’t just failing to be specific?

Enter: headlessCamels (or decappedCamels). The visualization fits: you still have the hump(s), but the head (the leading uppercase) is missing, so you have a headlessCamel. As for StudleyCamels, I visualize a camel proudly sporting studded leather duds, and he’s holding his head high because he’s proud of his studs. But then again, I’m pretty weird.

 
 

More music on Lite

17 Jul

Tonight we added about 400k files to Grooveshark Lite. If there’s anything you haven’t been able to find on Lite, there’s a good chance that it’s on there now. It should also take significantly less time for newly uploaded content to be added to Lite from now on.

 
 

Search Grooveshark Lite in Firefox

03 Jul

Searching Grooveshark Lite just got even easier. At least if you’re a Firefox user. Get the search extension by going to listen.grooveshark.com, click on the search drop down in the upper right-hand corner in Firefox, and click “Add Grooveshark Lite Search”, and you’re done! Now whenever you want to search for a song or an artist, just select Grooveshark Lite from the search drop down and type in what you’re looking for. Couldn’t be easier.

 
 

Use memcache better

30 Jun

I believe I have already mentioned a couple of times how memcache makes Grooveshark Lite possible.

Well, while implementing memcache for Grooveshark Lite, I ended up making a wrapper class called GMemcache for lack of a better name, which inherits from the PHP Memcache class, adding on just a few cool enhancements:

1. Singleton. Has static variable $instance that is set in the constructor and is also available in a getInstance() method.
2. Disable-able. Integrating with memcache can involve writing a lot of memcache-specific code, which means it can be quite a pain if you then need to temporarily disable memcache for some reason, such as testing. We define MEMCACHE_DISABLED to true when we wish to have our code bypass memcache altogether. The class wraps get, set, etc., and if memcache is disabled returns false for get (equivalent of saying “I couldn’t find it”) and doesn’t do anything when set is called. otherwise it calls parent::get etc.
3. Version-able. We also define an app version, which is then automatically appended to all keys. That way new releases never get stale data (or worse, data in a different structure from what it expects!). For situations where versioning does not make sense, set, get, etc all take an extra boolean parameter which indicates whether versioning should be skipped (defaults to false).

The nice thing about inheriting from Memcache this way (as opposed to having a Memcache instance as a member variable) is that we don’t have to rewrite all of the functionality. Whatever parts we do not need to change or do not care about, do not have to be written and they will continue to work when accessed via GMemcache.

 
 

How not to do SOAP

24 May

If you are not already familiar with SOAP, this note will mean very little to you, and I don’t feel like explaining it so please feel free to ignore.

We are in the middle of adding a new payment processor to GS, and this particular payment processor, who shall remain unnamed, decided to implement their API in SOAP. I am not a huge fan of SOAP, but it certainly does have some level of usefulness: the entire backend API for GSLite is written in SOAP, after all. Anyway, their implementation of SOAP is the silliest I have seen so far. Every method takes a single parameter. It’s a string named ixml.

Can you guess yet what they are doing?

Yes, every parameter is a piece of xml. The actual structure of the xml message is not defined in the WSDL. In other words, the Web Service Description Language does not describe the web service. Good job, guys.

 
 

Linux: run script as a different user

22 May

In all the years I’ve been using Linux just enough to get by, I’ve never stumbled across this handy tip. If you have a script that, say, needs root access, but must be executable by users who do not have root access, rather than setting up sudo and then making everyone have to remember to type sudo before they type the path to the script, you can do this:

chmod +s filename

The script will run as the owner, and the permissions for executing the script will be determined by group membership. If you have a script that must be executable by users in the ‘devs’ group, but it must run as root, all you have to do is:
chown root.devs filename
chmod +s filename
(assuming your file is already group executable)

Obviously this file should not be group writable or you’re giving everyone in that group the power to run anything as root, simply by modifying the script and then running it.

 
 

Bad design

09 May

Bad design is everywhere, and it doesn’t have to be that way. I suppose that’s why I make such a fuss when one of our products or features seems to be poorly designed. I want to do better!

Here’s an example of bad design that isn’t our fault:
Everyone in the office has trouble using the coffee pot at one time or another. People get grounds in the water reservoir, overflow the basket, or get burned by steam when they open the lid. I have witnessed people do all of these things, and I have studied the design of the coffee pot. I understand how it works, but I still managed to overflow the basket myself, creating a horrible mess and (worse) delaying my caffeine intake. Why is this coffee pot so hard to use? My cheap coffee pot at home works just fine. I had no difficulties with the coffee pot at my previous job.

It’s the design. The basket and water reservoir are in the same “compartment”, covered by the same lid, and the component that stops the flow of coffee if the carafe has been removed (so you can pour a cup before it’s finished) is a mechanism that is half in the basket (spring loaded stopper) and half in the lid of the carafe (the shape of the lid pushes up the spring, allowing water to flow).

Every element of the design of this coffee pot is directly related to the ways that people manage to mess up their coffee:
If they are not careful about adding coffee to the basket, they will get grounds in the reservoir. The proper way to avoid that problem is to remove the basket, add the coffee and put it back in. The basket does not sit evenly on the counter because of the spring loaded mechanism on the bottom, so it discourages people from adding grounds this way.
Having one lid that covers the reservoir and the basket causes steam to be trapped in the coffee maker, so if people open the lid during the brewing process (say, because something else is messing up) or shortly afterwards (say, to clean up), they will have their fingers burned.
The spring loaded stopper does not stop the brewing process, only the dripping into the carafe process. If the stopper remains closed, water and grounds will eventually overflow the basket into the reservoir, into the carafe, and all over the place. The stopper remains closed whenever it is not in contact with the lid, so if someone accidentally leaves the lid off, or leaves the lid open “to make sure nothing gets in the way” (as one of our interns did), it’s an instant mess complete with ruined coffee.

Compare this to my coffee maker at home, the water reservoir is completely separate from the basket, which swings out on a hinge so that any spilled coffee grounds end up on the counter, not in the water. The mechanism that stops the drip process when the carafe is removed is a small lever that is depressed when the carafe is placed in the coffee maker. It stops the flow of hot water into the basket, thereby halting the brewing process whenever the carafe is removed.

This is an ideal design in every way, especially the lever to stop the brewing process. The only component required to let the water flow is the carafe, which catches the brew. If the carafe is not present, no coffee is brewed and no disaster ensues. Use of a lid is entirely optional.

So why is our coffee pot so horribly designed? It’s not like coffee pots are a new technology, and it’s not like they’ve just been this lousy all along, my coffee pot is older! They could have just copied the design if they couldn’t think of their own. I don’t see how the manufacture of my coffee pot style would be any more expensive than the one we have at Grooveshark. Mine was under $10, after all.

The only thing I can think of is that manufacturers just plain and simply do not care about usability for these essentially disposable appliances. Customers do not pay attention to these details until it’s too late, or they blame themselves for their inability to use them, so good design just does not matter.

But design does matter if your company is not satisfied with mediocrity. One need not look any further than Apple to see the result of putting a heavy emphasis on design and usability. The success of the iPod and iPhone are the direct result of that emphasis. If the iPod worked like a Sansa and the iPhone worked like my old Motorola phone, where would Apple be right now?

 
 

Digsby

06 May

This is just a quick plug for an chat client I’ve just recently discovered: Digsby.

Digsby is a chat client that works with every network they can get their grubby little hands on. AIM, ICQ, Y!, MSN, Google Talk, Jabber, even Facebook chat. But there’s more, they also support email and Facebook, MySpace and Twitter. Twitter has always seemed well, rather useless and annoying to me, but having it integrated into a desktop client and on my phone means I might actually use it.

I know what you’re thinking: Trillian does a lot of that. Well, yes, but digsby seems well designed, less clunky and annoying, and ironically more stable, even though it’s far newer and does more.

Another bonus with Digsby is that you create a profile on their site, so when you sign in on another computer, you don’t have to set up all of your accounts again.

 
 

Meet Grooveshark Lite

15 Apr

Well, for better or worse, Grooveshark Lite is up live and running.

Things are a bit buggy because someone thought it would be a great idea to exponentially increase the complexity of our web setup at the exact same time, and it’s already generated a lot of attention, so don’t be surprised if things just stop working intermittently.
All that said, Grooveshark Lite makes listening to music online super easy, you should definitely check it out.

Here’s a more formal description of GS Lite:

What Grooveshark Lite is:
A flash program written with flex that lets you listen to any MP3s we have in our system.
You can search for music or you can navigate through the heirarchy to find music, browsing songs, artists, albums, playlists or genres.
You can play any of the music you find by clicking the play button, the add to queue button, or by dragging it to the queue.
You can save your queue as a playlist.
You can browse your own music and playlists (even if it’s on another computer) by going to My Music.

What Grooveshark Lite is not:
Grooveshark Lite does not have any social networking components, and will not.

What Grooveshark Lite isn’t yet but will be soon:
Some features that didn’t make it into the initial release (tambourine), but will be added very soon:
Playlist editing: We have a slick interface for managing your playlists; in addition to creating playlists you’ll be able to add & remove songs, delete playlists, rename them, add descriptions, etc.
Auto-DJ: build a queue and our recommendation will add new songs to the queue that it thinks you will like.
Share your music: When you make a playlist, you can get embed code to put our player on your site. There’s a tiny version you can stick in a sidebar or a less compact version to fit in a blog post. The widget pulls the songs based on a playlist, so if you want to change the songs on your site, for example, all you have to do is edit the playlist.
Share your music part 2: If you don’t want to embed the player or don’t have somewhere to do so, you can get a link to your playlist that takes your friends to a page with the playlist loaded in the player. For example, my cake playlist will be accessible via: http://{gslite URL}/boxmonkey/cake or you can send your friends to http://{gslite URL}/{username} and they can browse all of your playlists.

Apologies if any of this is incoherent: I’ve been up since 1pm yesterday. AWESOME.