The following song has infected my brain: Clementine by Washington
Archive for the ‘Uncategorized’ Category
The following song has infected my brain: Clementine by Washington
For a long time now I’ve used xampp for testing my scripts locally before committing to the codebase and testing in our dev environment. Apache for windows, at least in this configuration, was incredibly unstable: major memory leaks, and it crashed if it received two connections at once. It has been good enough for rudimentary testing, but always a bit annoying. The memory leak issue caused me to shut down apache as soon as I was done testing any script.
I recently discovered Portable Ubuntu or pubuntu for short, which allows you to run ubuntu inside of Windows (yes, I still prefer windows as my desktop environment). I set up apache and php inside of pubuntu, and after following this suggestion (with my own hacks to make it work over the network: see thread), and pointing apache to the mount point for my workspace (also living in windows), everything is working quite smoothly. Apache is both more stable and faster. Ironically, pubuntu with apache running inside of it is more lightweight than the Apache for Windows distribution that came with xampp was for me.
What’s especially cool is that because of the way pubuntu mounts drives, pubuntu is seamlessly accessing my workspace to serve up files. That means I can edit a php file in my windows IDE of choice (notably not Vim), and that change is immediately reflected in pubuntu with no effort on my part.
Several of us Grooveshark developers went down to FOWA Miami this year (and Barcamp Miami too!), which was a fun and educational experience. We got to see my personal hero Joel Spolsky, whom Katy and I briefly met after his talk, and we got to learn about some cool new and upcoming technologies.
There were also, of course, some great pre and post conference parties, so we got to meet lots of cool people and network.
Aside from meeting Joel Spolsky, my favorite experience of the entire trip was being accosted by fans of Grooveshark several times over the course of the weekend. It’s really incredibly gratifying to know that Grooveshark has fans, and they’re real people!
Over the next week or so, if I’m not too lazy, I will be posting my thoughts on the FOWA talks, and about some of the conversations I had while I was there, so stay tuned.
I’m currently trying to see if WinXP x64 will meet all of my hardware and software compatability needs so that I can fully utilize the 4GB of RAM I got for Christmas, so I am dual-booting between XP x32 and x64, with each install on a different drive. I set up Firefox and Thunderbird, but wanted access to my settings and more importantly, my saved passwords that I have configured on the x32 install.
I could have just copied the profiles over, but the profiles won’t stay in sync without a considerable amount of effort, if I am constantly switching back and forth. What if I bookmark something in x64? When I run FireFox on x32, I want that to show up in my bookmarks. Same goes for my extensions and any other settings. Turns out, it’s not very difficult to do, but it does take a little bit of work:
First boot into the newer of the two installs. In my case that’s XP x64.
Get ntfslink, a handy shell extension that lets you create and manage hard links and junction points through explorer. What we care about is the ability to create a junction point, which you can read about if you are truly interested. The general idea is that a junction point acts like a sort of shortcut, but it makes it look like the thing your shortcut is pointing to is actually there.
Find your original profile. Something like c:\Documents and Settings\username\Application Data\Mozilla\Firefox\profiles\somestring.default
Your new firefox appdata should be pretty similar. In my case it’s exactly the same except with the drive letter d: instead of c:, because that’s where I installed x64.
In d:\Documents and Settings\username\Application Data\Mozilla\Firefox\profiles\ (or wherever your newer OS install lives) create a NTFS junction point to c:\Documents and Settings\username\Application Data\Mozilla\Firefox\profiles\somestring.default (or wherever your older OS install lives) by navigating to the new profile directory, right-clicking in a blank space, and choosing New | NTFS Junction Point. Ntfslink names your junction “link to somestring.default” by default. Rename that to just somestring.default for simplicity.
For completeness, you should do the same thing between d:\Documents and Settings\username\Local Settings\Application Data\Mozilla\Firefox\profiles\ and c:\Documents and Settings\username\Local Settings\Application Data\Mozilla\Firefox\profiles\somestring.default
In d:\Documents and Settings\username\Application Data\Mozilla\Firefox\profiles\profiles.ini you should see something like this:
Copy that and paste it at the end of the file. Change Profile0 to Profile1 (assuming you only had one profile previously). Change Name=default to something more useful. In my case I went with Name=jay Change Path=Profiles/… to Path=Profiles/somestring.default
Save profiles.ini, and then start firefox from the run menu with firefox -p — this should prompt you for which profile you would like to use. Choose the name that matches what you set in the previous step, in my case “jay.”
If you followed these steps carefully then you should now have the same set of extensions, preferences and bookmarks that was on your old install, and changes made on one OS should carry across to the other.
The steps I spelled out here for Firefox profiles are identical for Thunderbird profiles, just substitute Thunderbird wherever you see the word Firefox.
Here’s a fun issue I ran into a little while ago, while doing DB maintenance at Grooveshark.
MySQL has a handy atomic rename function, where you can do something like this:
RENAME TABLE CurrentTable TO OldTable, NewTable TO CurrentTable
Both renames are done as a single atomic action, so that the table CurrentTable is always there, and Nothing Has To Break*
A few days ago, I took advantage of this feature. I needed to make some schema changes to one table that was being read from but not written to.
CREATE TABLE NewTable LIKE CurrentTable;
ALTER TABLE NewTable DROP COLUMN UnnecessaryColumn;
INSERT INTO NewTable SELECT (...) FROM CurrentTable;
RENAME TABLE CurrentTable TO OldTable, NewTable TO CurrentTable;
That way we have a live, selectable backup of the table in case I really screwed something up, not to mention that moving the tables this way meant we could finally get that huge table into file per table, as that table had been around since before we had turned on the file per table setting in MySQL.
Several other tables have foreign key constraints pointing to CurrentTable, and unfortunately MySQL is smart enough to notice that CurrentTable is being renamed, so it “helpfully” updates all the foreign key constraints in those tables so that they are now pointing at OldTable. Without mentioning it. The problem didn’t become apparent until CurrentTable was being written to again, and then the other tables with the foreign keys were being written to pointing to the new data in CurrentTable, except the updated constraints meant MySQL tried to find the rows in OldTable, causing the inserts to fail.
This is definitely one of those cases where being smart and helpful can sure lead to a lot of misery. I had to hunt down every table that had referenced CurrentTable to change them back by hand. If MySQL had been just a little bit smarter it would have seen that CurrentTable wasn’t *really* going away and it wouldn’t have made those changes for me. If it was a little bit dumber, it would have done nothing and things would have just kept working, or it would have blocked me from doing my rename, forcing me to deal with the constraints before they broke anything.
* except when it does
Sorry about the new ads on Grooveshark Lite, folks. They certainly don’t make me very happy either, but in these tough economic times, we gotta pay the bills somehow!
The good news is that these ads should free up some resources so we can spend more time making Grooveshark Lite even more awesome.
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.
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.
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.