Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Saturday, March 7, 2009

The Music Anywhere Project

Thought I would post about my 'Music Anywhere' project... I've been thinking for a long time that I would get jungle disk or something similar working, and maybe setup backups, but primarily just upload all my music, and use it as my music repository. Well, last weekend I decided to take the plunge.

JungleDisk is pretty impressive. I tried it out shortly after S3 launched, and it wasn't too great back then. In fact, I couldn't get it working on either my Mac laptop or my windows pc at home. I abandoned the project at that point... Last weekend, though I just downloaded jungledisk and was off and running.

Getting jungle disk up and running (even with automated, versioned, backups) was very very easy, jungle disk is well worth the $20 (+ $1/month for "plus" service that lets you access your files via the web). The hard part was actually getting all the data uploaded. Evidently my modem or comcast or something destroys my connection with very much upload at all. I was able to get some of it uploaded, but it was basically powercycling my modem every hour to do that. So I just waited until monday and started the very long process of uploading 32gigs of music/video to s3.

Following the advice of another blog post, I actually used the "consolidate library" feature of iTunes to move the files... Which would theoretically allow me to upload files and have itunes change their location in its database to the network drive location. This was a bad idea... iTunes frequently crashed, I had to restart the laptop about twice a day to keep the upload going, and at the end of it, though all my music was uploaded (I wrote a couple of scripts to check that), itunes only had the right location for about half of it.

I tried modifying the itunes library files to point to the correct location (there are XML files sitting in the base directory), but taht didn't work. It turns out that iTunes actually uses a binary flat file for its db, and those XML files just get re-written about every time anything changes (more on that later). Eventually I gave up, started a new library (which lived on the network drive itself, so that I would have a backup) and just re-imported my old library + playlists.

This worked, to an extent. Unfrotunately iTunes still felt like re-writing its db quite a bit, and it caused jungle disk to re-pull every single file, since itunes had to analyze each file for gapless playback. This ate through a good chunk of outgoing bandwidth. Additionally, I still had the crashing issues, though that was old hat by this point.

The final tweak to the setup came when I tried to get my phone to sync to my "new" itunes library... evidently iTunes doesn't deal well with slow I/O (like a s3 network drive) and mobile applications for the iPhone. So I moved the library files back to the harddrive, and things are working well now. (BTW, hold down the 'option' key to select a different library from your default startup library).

Most of this would've been able to be avoided if iTunes let me fix up its DB manually, or if I used something other than iTunes for playback (but I'm still tied to iTunes' DRM until this summer at least). But, I did get backups for my home computer, which will ensure that I won't loose a passel of RPG notes, characters, and systems like I did about a year or so ago, again, which is a great thing.

If anyone wants to attempt this here are my suggestions:


  1. Have a high-speed uplink, doing this at work still took 3 or so days, and they have a fantastic uplink
  2. Just copy the files over, use rsync or something so you can resume easily (don't let it md5 sum the files)
  3. Export your current playlists using itunes, then start a new library and import the file, after using sed or something to fix up all of the file locations.
  4. Give jungle disk a file cache size large enough for your entire collection, its a lot better when jungle disk doesn't have to re-pull files from s3


BTW, as of right now, this whole project has cost me about $16 in s3 fees, and about $21 dollars for jungledisk, I estimated about $5 per month in storage / bandwidth fees for s3, we'll see how accurate that is!

Tuesday, May 13, 2008

The Art of Being a Nerd

I was just reading Tim's blog, when I came to this great article, which describes, in painstaking detail, the thought processes of a nerd. As a confessed member of that group, I had an intense desire to read it, and it was great. Its a little too late for me to get really excited about this topic, but I thought I would pass it along to others encase they missed it.

In roleplaying news, we've been trying some more character-focused roleplaying with immersion rather than stunt platform style games. I think its been working out fairly well, at least for me. I got to play a completely evil character last game, which is always fun. I think I've been hitting the evil a little hard recently, though, so I'm planning on a happiness and light character for the next time I get to play.

A brief glimpse into our last two games: 1. Steve ran a game of human diaspora with the earth being destroyed and us eventually discovering alien life. 2. Keith ran a game of Amber where we started with founding our own new Amber (I was this universe's Oberon)... That character was well an truely evil and sadistic (I really tried to give it that Oberon feel), which worked in some respects but I think in others it was a little too much, which is why I'm planning on going the other way in the future.

We've also gotten up to session 2 of my new Saturday game Devils of Royalty and Divinity, which I think is going well (though you would have to ask my players, really). Last session saw the creation of a new god of logrus and pattern and the promise of much havoc to come.

Saturday, February 2, 2008

The Super Nun Killing Clan of Cyber-Programmers

Mike has an interesting post up over on his blog which is a response to Josh which is itself a response to Bruce Eckel. After seeing that long line of discussion, how could I refrain from adding my own brilliant thoughts to the conversation??

On the whole 5% thing... I don't know. Its a widely held belief in programming circles, one I've heard numerous times (certainly as Mike says, the number is made up, but the sentiments are there). I used to believe this idea with all my heart. Now? I don't know. I certainly used to not only believe it, but was absolutely convinced I and my close friends were a member of that elite group. I still think I'm a great programmer, one of the best, and my friends as well. But, I've started to doubt the other side of the equation the 20x as productive.

I've just going to skip over Mike's arguments of measurement. They are valid, and well put, but I'm not interested in that side of the discussion. In my career as a programmer (yes, all 5 years of it!) I have seen a lot of productive people and a number of non-productive people. My consensus is that people who want to be productive are, and people who just want to not get fired aren't. Are you excited about your space? Are you committing yourself to the successful completion of the project? There are a dozen ways (ok, way more) to waste time on the job, without looking particiularly unproductive. Everything from reading email, attending all the optional meetings, to things like reading web comics and even coding, but not tackling the hard parts of the project. It seems to me that those who want to succeed move those obstacles and distractions out of the way and those who don't embrace them.

So, I guess it is possible for the top programmers to be 20x more effective, becuase of the effort they put in. If you spend 5 mins an hour checking email, and another doesn't, he's already 40mins ahead of you at the end of the day. Add in some meetings that he skips, and some of the other stuff, and its easy to see how even similarly skilled people differentiate themselves.

I will agree with Bruce Eckel that programmers can really differentiate themselves with continual learning. Its really important in any technical fields (look at surgeons or scientists) to continually learn, and it's no less true in programming.

Maybe with all these factors together you get up to something like 2x... But most of the times these numbers are bandied around its always something like 20x. I think 2x is already waay awesome. Additionally, Josh's comments on letting less skilled programmers write until the heat death of the stars is also a good point. Its definitely true that less skilled people just can't produce the same code as others, and in many cases could never implement the same feature jumps that the masters can.

Hmm... that is a little long and rambling, but I still have something else to address. Mike's question of taking 50 cs students and getting them into the top 5%. Well, I think there are a couple of important pieces to this puzzle. First of all: screw traditional curriculum. As my dad has told me a couple of times, Colleges don't want to teach practical skills anyway. Is it any real surprise that they aren't very good at it? You want to know who the best new hires at Amazon are? They aren't traditional undergraduate students. They aren't any students from the US even. They are Waterloo students. You want to know why? Its very simple. Waterloo students spend (I believe) 5 tri-mesters working in Co-Ops at companies. They quickly get exposed to a number of languages, design methodologies, companies, etc. Most importantly... They know what source control is. They know how to really write code for re-use. THey have some idea of how to work with others to get projects done.

So, if you want 50 people to be the best, how do you do that? You could just emulate waterloo, but I think you'd need to go farther. Start a startup with them. Teach them datastructures and algorithms while you're under pressure to get a website up. Let them learn about file size limits when their logs grow larger than 2GB. Learn by doing. In the world of software, there is little cost to screwing up. Its not like bridge building or even auto repair where you might be hurting others. I think the heart of learning in CS is related to doing and figuring out for yourself what works and what doesn't.

But even that is not enough. You must must must get people excited about the act of programming itself. How can this be done? For one, I think you pick projects to tackle that are exciting to people. One of the most time-consuming applications I've written was a character generator that was written over the summer. I would work all day as an intern, come back to the apartment, and code until it was time to go to bed. Why did I do this? I saw real use for this program and I wanted to make an awesome program I and others would really use. You want to know what I did in my programming languages and compilers class at UIUC? I implemented half of a lisp compiler. Who wants a lisp compiler? I'm sure there are those that do, but I didn't. Wouldn't it be immeasurably better to have projects your excited about?

I think there are other, more gimmicky things you could do as well. Give monetary awards to those who do well. College students will do a whole lot for some money. Really do a start-up, let the students really feel like they're a part of something worth working hard for. Have people teach topics as they come up, and make sure that anyone who teachs is really excited about what their teaching. When I give tech talks about Amazon, I see people light up and get interested. Why? Because when I speak I put a lot of emphasis on how much I like Amazon and how exciting and interesting it is to work there. My material is normally less exciting than others (Build tools vs. awesome Kindle or Scalable Storage for the Internet, etc), but people take notice because I am excited about it. Make sure you provide the tools for those studnets to be productive both in and out of class. Make sure teachers are available one on one. And most of all be focused on projects, not on chapters in a book.

If it were possible, I would find the 50 most excited, talented and teacher-y programmers in the world, and have the 50 students apprentice to them for 4 years, maybe on a rotating basis.

I don't know if any of this is possible in the reality of the collegiate environment. But I know it would be cool to try.

Monday, December 17, 2007

Programming and Christmas

So, someone complained to me that my blog hadn't been updated in a while. I admit that that is correct. I've been extremely busy at work. I'm on a big project that keeps sucking all of my time. Also, I've been waiting for a hordes of loyal fans (yes all 2 of you) to comment on Chrome Dawn. Given that no one has, I'm guess no one will. I know a couple of you have definitely given it a look, so tell me what you think!

In other news, Keith and I have finally gotten our Record Stream project up on the web. Check out the project site here. If you want submit access to the project, let me know! For those of you who don't know, RecordStream is a project that takes input (like from log files, configuration files, etc), creates JSON hashes with them, and then gives you a set of tools to slice and dice on the command line. One good example is havn't you ever wanted to grep for a column where the column value is > 5? Well, I have... and RecordStream lets you do that. It also lets you produce some very awesome statistics using recs-collate, like what is the average connect time for each url people access on my site (this would be analyzing apache access logs). Anyway, I'm sure I'll post more about record stream later.

The first version of the code is up on Google Code, we're currently in the middle of re-writing all of the scripts to be modules and adding tests. This is all driven by the recs-chain idea, which is that we'll turn shell pipe chains into in-memory chains, avoiding JSON serialization/deserialization costs. I'm also hoping to get Josh's fast-as-hell collate integrated into RecordStream proper in a manner that all of us can appreciate.

On another note... Unfortunately I won't be making it back to Oklahoma for Christmas. This big project at work is too important for me to be missing around this critical time. I also have extremely few vacation days, what with the 2 emergency trips to Oklahoma back in October and driving Mike to Atlanta back in August. I'm hoping to get back to OK-land this spring or summer though.

Thursday, September 27, 2007

Amazon MP3: w00t!

Amazon finally launched our Digital Music Store, and get this: the music is plain old MP3s. No DRM, no nonsense. I've already switched to using it as my primary source of music, going there first before iTunes. So far, I've been impressed with its selection. It has a bunch of independent artists as well as some of the more popular musicians I look for. In particular it seems to have a very good folk selection and I've already been able to discover several pieces I probably wouldn't've found otherwise (iTunes discoverability is abysmal, IMO, and its just the sort of thing we're (Amazon) is good at).

I'm super excited about possibly no longer having Apple's vendor lock in. For a long time I've had some ideas about a sort of programmable playlist program that could really let you tweak what songs get played. For instance... Most of the time I have about 2-4 songs that I want played a lot. These are songs I've generally just added to my collection, that I'm trying to memorize and enjoy. But, I really don't want to listen to just those 2-4 songs. What I'd really like is for half of the time to pick a song from that small set and the other half, choose from my regular playlist (of about 3k songs). Whats more is that I want to be able to do this for a play list or for a set of songs. Even more, maybe what I want is for from that 1/2 time playlist, 1/2 the time for songs to come from one set of songs, and the other half from another. And so on. You should also be able to apply specific percentages as well as timing "17% or every 5th time should both be valid. Also, I want to have the ability to easily "link songs" together. For instance, if you play one of these tracks you then must go on to the next song. These linked songs should be able to say whether or not you can play the second song without the first one as well. All of these rules should apply to playlists (which can contain other playlists) as well as individual songs. There are a couple of other ideas involving track splitting and track management, as well as volume management (tweak a song to be higher or lower volume all the time), but I think you get the gist. I've been wanting to do this for a while, but ever since I've been locked into iTunes, such a thing has been essentially beyond my control (yes, you can probably do it through AppleScript or some such, but the documentation for application interface with iTunes doesn't seem that good).

Anyway, now that there seems to be a good alternative, I may be embarking on this project in my spare time. Especially if I can convince someone else (like Keith) to help me out on the project.

So check out the new store, I think its pretty kickass. There is both a Windows and Mac downloader program (though you don't need it to download individual tracks), and a Linux version is said to be coming soon.

Tuesday, September 25, 2007

Palantir - To the Future and Beyond?

Recently, my good friend John Carrino stopped by Seattle to do some recruiting for Palantir, his new company (John used to work for Amazon, even on the team that I recently joined, but left this last June). It was really great to see John again, and evidently Palo Alto is treating him and Robin (his girlfriend) well. While he was in Seattle, he mentioned that his company was doing a recruiting event, so I decided to attend.

I've never been to a startup recruiting event before, but this one was pretty jazzy. It sorta felt like like dot-com late 90s. The event was held at an expensive downtown hotel (Hotel 1000), and it was very posh. The event was catered and had an open bar (I think they won over about half the people with just that fact). Josh (another former Amazonian) was also there, and it was great to have a very nice meal with both of them (as well as Catherine, one of Josh's BillMonk colleges). The niceness of the setting aside, the presentation was extremely compelling.

They started by talking about the development of one of their two products, the government application (I believe called simply Palantir). This is a program for government analysts, to try to make sense of large amounts of data to spot suspicious behavior. Very big brother, but awesome nonetheless. Just the interface alone was extremely cool. Evidently its all done in swing (java), but you really can't tell by looking at it. Everything was done up with images, slick opening and closing. But the real meat of the presentation was how powerfully they are able to work with the data. Every time we thought we had seen everything, they blew our minds again with a whole additional set of functionality, with a clear and compelling interface. The collaboration tools and the abstraction of work with metaphors familiar to the user is a really really powerful concept. It was extremely exciting, compelling.

After that they talked a little bit about the company life. They definitely have the excitement factor down. They also seem to be playing to the creature comfort desires of programmers. Two catered meals a day, great office space, a game room.. All the hallmarks of a fun startup.

After this they went on to the financial software. It used similar abstraction techniques to the government application, but was fairly obviously a less polished product. That's not a real knock, I believe its been in development for a lot less time, and the functionality looked incredible, once again, it was just that the shine wasn't quite there.

One thing that became quite clear to me was that their software was extremely focused. It seems obvious to me that without experience in the two target demographics, I would not be able to make the best use of the software, not even close. This lead me to wondering about the future of programming. Are we all going to have an extremely targeted application custom built for our field of work? I think we might, because a really compelling interface can be the greatest thing ever for productivity and general happiness.

I'm convinced that both products, and the company in general, is going to make it fairly big. If they can parley all their great talent into software useful for other areas (programming?? please!), I think they could be huge. John is in for an exciting ride :).

Sunday, September 23, 2007

Late Night Programming

I've just concluded a session of late night programming. I've gotta say, its one of the best coding experiences I regularly participate in. Its just so awesome to sit down and tackle a problem that can be completed in one night. I'm not always sure it results in the best code (and I try to never submit code that I've done at night until I can get a code review), but the feeling of accomplishment is awesome. Also the amount of work you can do in one go is just incredible. Day to day, I think its difficult to see how much the rest of your job interferes with you actually coding. Rather it be talking with teammates (something I think is strictly a good thing), going to meetings (bad), going to lunch (good), or just being distracted by incoming email (bad and good), my day life is pretty interrupt driven. When you have all these distractions, it can be difficult to really hunker down and get in the zone.

So, sometimes (especially when I'm excited about some project), I just come in on the weekend or late at night. Everything is quiet. There are no emails, no teammates, and no Air Conditioning (they turn it off). Just you and the code (and music, if you're me). For me, it all comes together when you get done and you send your victory email. For me this normally takes the form of a code review request. Once I've decided I'm ready, I switch over to the email client for the first time in many hours, and I get to enumerate what I've been able to accomplish to someone. Its great.

Recently, I've been starting to obsess about these interrupt issues during the day. I've unsubscribed from several high-traffic email lists, and I try to force myself to not even look at the email client more than once every 10-20 minutes. But given what I feel like now, even that is not enough, so sometimes I work at night :).

Working at night can also lead to some bad things. For instance, you don't have the resources you do during the day. You can't ask your CSS master officemate questions, you have to look up answers. While this can make you better (much better) at solving your own problems or working around them (you quickly start ignoring things that touch other teams, for instance), it can waste an enormous amount of time. You sorta have to know when you've ratholled too long, and start thinking about ways of skipping that part of the problem until you can discuss it with others.

I'm not going to stop this behavior anytime soon, though... Its quite a rush.

Tuesday, September 18, 2007

Programming and Arrogance

When you live and work in a culture of programmers (as almost any unmarried Amazon programmer seems to), its easy to see some trends emerge that are both interesting, cool, and/or troubling. The trend I was really forced to notice is a culture of Arrogance that seems to permeate the culture at Amazon. This culture is really not limited to Amazon, Google practically oozes arrogance, and it is much the same with every company that believes in itself that I've talked to. Part of this is the difficultly in hiring good programmers, exemplified here Why Can't Programmers... Program. Everyone has this problem, and most people do reject 199 out of 200 applicants (as the article mentions), but as that discussion indicates (follow some of the links), rejecting 199 people doesn't mean you're hiring the top 0.5%, just the top 0.5% of the applicant pool. Most programmers aren't looking for jobs, and companies try to keep the good ones anyway.

I think a fair amount of the arrogance comes from the art itself. When you sit down to code, normally you have some idea of the shape of the solution you want to implement, and it seems to me that a large portion of getting that solution written is being so stubborn and unable to give up on that idea that your willpower literally bends the electrons in the computer to your will making little slaves of them. How can you not be arrogant when every day you're conquering your computer all over again, programming something that (at least most of the time) no one has written before.

Another portion of the equation is the attitude of other programmers. Whatever you might say, about nature or nuture or genes making a person's profession, something attracts a lot of smart but socially challenging individuals to programing. These people are used to being right (see the previous paragraph), and are not ready for you or even Linus Torvald himself to tell them they are wrong.

I think most good or great programmers (at least in a commercial setting) have to learn to put away this arrogance, but its not something that comes easy (at least for me). Admitting that you might be wrong about a proposed solution is extremely difficult. Paradoxically, I find that once a solution is implemented, most programmers are willing (and even eager) to admit to the solutions failings or even to start over and reimplement everything differently (this happens a lot during development and is called refactoring, at least in some way). Being a decent company programmer I think also means learning to work around these foibles in others (in addition to suppressing your own instincts).

Thats all I have for now, but I have some more thoughts for later... How does aggression fit in? What about the programmers that seem to be naturally immune to these kinds of feelings? How does this affect the gender inequality in the profession?