My Two Shoes Weekend

Why?

When I decided to have the Two Shoes Weekend, it started as a personal goal. I was going to take a stab at using Shoes, which I had earmarked a long time ago as something I’d like to play with, and I was going to start and finish two projects within the span of the weekend.

I’m not sure how exactly, but telling someone that I was doing it turned into telling everyone that they should also do it. There was a bit of grumbling from people about my choice of toolkit, but I knew that the best way to make the goal attainable for me was to pick something that would end up feeling limiting— if the goal was “make as many things as possible using whatever you want to”, I would only half-finish one thing.

Why Two?

So why two? Well, basically because it wasn’t one and it wasn’t too much bigger than one. I wanted to push myself to see what I would do when I finished making something out of the first idea and had to move on to something else, but I wanted to make sure that I would reach my goal and was hoping to avoid feeling rushed to move on to other things before I was done with one idea just to meet my goal.

It worked pretty well! My first idea was something that I’m fairly used to— querying a website, pulling down some data, and formatting it. My second project involved implementing a physics equation, which is definitely not something I’m used to doing, as much as I’ve always liked the idea of making games and as much as “collision detection” is a basic concept within that world.

My Projects

As promised, I made two things! One fetches data from Twitter to make you laugh and the other is a graphical tech demo.

Big Fan

Big Fan loads the last 50 tweets that I’ve starred on Twitter. I follow a lot of funny people— some are professional comedians, some self-styled funny internet personalities, and some are just my really funny friends. When I see something that makes me laugh, I star it, and sometimes by myself or with my wife I review the jokes that I’ve starred recently just to laugh again. I think Twitter is a really great platform for joke delivery.

When Big Fan loads, it shows the most recent tweet that I starred. You can use page down or the down arrow key to view the tweets before the currently displayed tweet, and page up/the up arrow key to view the tweet after it. The Home and End keys go to the first and last tweets respectively.

Dots

Dots puts a bouncing dot on the screen. You can press the ‘a’ key to add another dot, and another, and another. After that, any dots you add will cause the oldest one to fade away and disappear forever. It’s a metaphor for life (right?) and a proof of concept for modeling perfect inelastic collision across two dimensions using Shoes’ basic “Shape” objects.

Dots also comes with dot.rb, a set of classes that does the heavy lifting with regards to wrapping up the Shoes shapes and handling collision detection. dot.rb could be expanded and re-used for other projects involving modeling 2D objects in a Shoes app.

P.S.: Shoes from Vim

After working on my first project for a few hours, I got tired of saving in vim, then dragging my .rb file from Finder to the Shoes dock icon. I took a moment to write a keybinding in vim to make open the currently open .rb file in Shoes based on the default install location in Mac OS X. On Sunday afternoon I realized that it might be helpful to other people to have the same thing, so I put it up on Github, at which point [inky] suggested that using open -a would make it even better. So I present to you the addition to your vimrc that will open the current .rb file in Shoes on Mac OS X:

How it Went

Pretty well; thanks for asking! I worked on this stuff for a decent chunk of the weekend, but I also saw a movie, went out for a few meals, hung out with my friend, drank some beers, talked to one of my college roommates, read a chapter of a book, and watched some TV with my wife, so it by no means dominated my weekend. Two things started and finished in that time! That’s pretty cool, right?

Gems & Shoes, Shoes & Gems

When I started on Friday night, I thought that I would just start using Ruby gems with wild abandon. Ruby has a wonderful community that has written a lot of code to make your life easier, so I was hoping to make use of that to make some really cool things. Unfortunately, I discovered that Shoes’ compatibility with gems is pretty limited.

The most obvious problem is that since Shoes is built with the purpose of packaging cross-platform applications in mind, you can’t use any gems that require “native extensions”, which is to say that installing the gems involves compiling any code for your specific platform (frequently it’s something that’s been written in pure C). This is regrettable, but it makes sense, and technically you can make it work on your own system at least if you’re familiar with the underpinnings of the Ruby environment and just copy gems into the right location for Shoes to find them.

Unfortunately, copying a gem into the right location isn’t enough— gems can have dependencies on other gems, which can obviously have dependencies of OTHER gems, and before you know it one pure-Ruby gem that you want to use requires getting 8 other gems set up within your Shoes environment, and 5 of those have native extensions, which means you can no longer package your app for other platforms.

This is a messy problem. I’m not sure that there’s a WHOLE lot that can be done about this, but I have a few ideas:

  • Shoes should be better at reporting errors with the Shoes.setup process. A Shoes.setup block is how you tell Shoes to install gems, but if you try to install Gems with native extensions on Snow Leopard it thinks for a very long time before giving you a confusing error message. The process is even more broken if the problem lies within a DEPENDENCY of a gem that you are trying to install. It would be nice if Shoes could be upfront about what went wrong.
  • We need some way to search for gems that are pure ruby and only depend on gems that are also pure ruby all the way through their dependency tree. This may exist somewhere already, but I don’t know how it works and I would really like this. That way you know which gems are safe to put in a Shoes.setup block if you’re trying to write a Shoes app with cross-platform packaging in mind.
  • It would be nice if you could somehow install gems with native extensions anyway if you’re only planning on targeting one platform. It’s possible that this still wouldn’t work, since I don’t know a whole lot about the Shoes code itself, but I’d like to investigate that as a possibility.
  • Last resort: make a script that, if you have a gem installed within your native Ruby environment, will copy it and all gems in its dependency tree into your Shoes environment so that you can use those gems on your computer (and give an easy way for other people to get their Shoes environment ready to run your app on their computers).

Shoes Error Logging

The error console in Shoes is really confusing. You frequently end up with no line number telling you where a problem is, and sometimes the program execution just seems to halt without ANY kind of error in the console. It took me half an hour to figure out that I was missing an “end” in one of my methods this afternoon because the method was being included from a different file via a ‘require’ directive. This is something that would have taken 60 seconds running a ruby program via the command line. The error console always reads “Debug in line 0” at the top even though the line number is sometimes mentioned within the error message below that— I’m not sure if that’s a problem with the MacOS X version or something I’m doing wrong, but it’s totally useless and needs to be fixed.

Teaching From Scratch

I was really happy that a few people took me up on the whole idea and spent part of their weekend working on making some things too. One was a veteran of doing creative things with computer science, one was a programmer who hasn’t coded outside of work in a long time, and a couple were people who had never written a line of code. These last two were tricky— the more I ran across weird issues in Shoes, the more worried I got that this was going to make it too difficult for them to accomplish anything. I spent a decent amount of time answering questions about syntax and trying to teach concepts like Arrays, Hashes, and how to make use of method calls returning a value. And it was great! I’m not sure if the non-programmers will ever program again, but I hope that amid the frustrations of “Shoes.app, not shoes.app” and “make sure all your do/ends match up” there were some flashes of “wow, I made that button do that!” I also got a few bug reports for the Windows version of Shoes that I managed to confirm on my work laptop that I’ll be reporting to the Shoes issue tracker on Github, and I’m glad that just within the scope of my friends’ learning about Shoes they managed to find some concrete ways we can improve Shoes.

What’s Next

I have some ideas for where to go from here based on what happened to me this weekend. I had never really played with Shoes before beyond stepping through a couple tutorials and filing it away as something I wanted to play with more later. Now I have played with it, and while I think it’s got some problems, I also think that what it DOES do right is pretty cool.

dot.rb

Dots!, my second project, wasn’t meant to take as long as it did. I had never written a collision detection engine before, let alone the physics of what to do when a collision does occur, and it took me longer to write that part than I would have liked. On Sunday I decided to spend some time refactoring the code to make it stand separate from any particular Shoes app and then did a little bit more work to pull common functionality into dot.rb so that more than one app could use it. Dots!, therefore, is just a tech demo, and I’d like to improve on dot.rb and play around with making games using it. I decided that rather than stress myself out this weekend with trying to make an entire game and have it in fully working order by Monday morning, I’d rather stick with something clean and polished that’s ready to be improved upon in the future.

Shoes Contributions

The reason I’m so blunt about the problems I saw with Shoes in this post isn’t because I’m a jerk. Well, it’s not JUST because I’m a jerk. I really do think Shoes is a neat idea and there are things about it that work really great right now, and I want it to get better and be totally awesome. When it comes to Ruby specifics, I’m still learning, but I’m hoping to spend some time now that I’ve seen particular pain points in Shoes working on fixing them. If I want them to work, what better way to ensure that they get done than to do them myself?

In any past time, this would be made more daunting, but I feel lucky that in this day and age we have the tools we do to streamline the work of contributing to a communal codebase and discussing it efficiently. With things like git and the community that’s out there on Github, it should be much easier to make changes and have them reviewed by people who can catch my mistakes.

Everyone Else

I know that at least 4 other people participated in the Two Shoes Weekend. I’ll be collecting their projects and will share as much information as they’re willing to let me share (definitely summaries, hopefully screenshots, maybe source code!) here on my blog. If you participated and you want to share, please email me.

Bukkit => Splash => Soaked

Bukkit is a custom server implementation for playing the multiplayer mode of Minecraft. It supports plugins, and I had need of a very particular plugin for a new project I’m working on: I needed Bukkit to be able to send HTTP requests to a remote server when certain events happen, like when a player joins or quits the server or when they die in the game.

Last week I wrote Splash, a plugin to do just that. You specify the URLs to send different events to and they’ll hit those URLs, presumably some sort of POST-based API, and it will essentially ping the server with that bit of information (what happened and who it happened to).

Before I start on my slightly more ambitious project, I decided that it would be good to have a simple web application so that I could test modifications to Splash. It also presented me with a chance to play with Sinatra, SQLite, DataMapper, and Heroku. That demo became Soaked, which is a barebones Sinatra app to receive and store server events and display them to anyone who visits.

I set up a demo of Soaked on Heroku with some sample data that I inserted while testing. You can load older events, and if you’re lucky enough to be visiting the page while I’m testing my local Minecraft server, you might notice new events pop in at the top of the list.

(update: The Soaked demo is now tracking events from a server some friends of mine from #tumblrs IRC play on, so you might have a better chance of seeing updates appearing on the demo page than you did previously!)

Soaked needs a few things added to it— namely a huge CSS facelift and token-based HTTP auth— but for now I’m moving on to the project I originally wrote Splash for, which I hope to tell you more about soon.

I Was a Freelance Writer

Thanks to my super-cool friend Rob, I was given the chance to write pieces about video games in three issues of Nylon Guys magazine. It looks like we won’t be doing any more, though, so I figured I’d mark the occasion by posting all three of my things.

  • Apply Yourself: My first piece, a triad of iPhone game reviews.
  • Deja Move: A column predicting the future of motion-controlled gaming.
  • Crate Expectations: A review about the addictive arcade platformer Super Crate Box.

It was fun seeing my stuff show up in a real live dead-tree format! Maybe I’ll do it again some day?

    My personal music listening history

    When I was a kid I listened to a lot of music because it was on a lot in my house and I learned if it wasn’t on to put it on myself. So in the living room upstairs we’d have records on like Tori Amos or The Beatles or Joni Mitchell or sometimes my dad would be feeling particularly nostalgic or something and he’d put on a Frank Zappa or Firesign Theater and tell us about how he’d recite the Firesign Theater sketches with his friends in college. In the basement my brother would be listening to tapes or CDs. He exposed me to all kinds of stuff: The B52s, Wilson Philips (sorry Davin), U2, The Doors, Led Zeppelin, David Bowie, Nirvana, Radiohead, Björk, the Breeders, etc. We had tapes in the car, stuff like Indigo Girls and James Taylor and Pink Floyd’s Division Bell (which I super violently hated for some reason, dunno why but this was my only perception of Pink Floyd for a long time and I didn’t hear Dark Side of the Moon even once until I was like 13 and my brother played it on top of The Wizard of Oz in the basement of the second house we lived in in Indiana) and at some point Davin and I had our own Walkmans and so we’d make mixtapes and copy tapes from the library and listen to stuff on headphones while I rolled my eyes at whatever my dad was listening to because I had decided that was what I was supposed to be doing, fuck Emmylou Harris or whatever, I was 10 years old and I was going to listen to this mixtape that had like four songs from the Nightmare Before Christmas soundtrack and Frank Zappa’s “Call Any Vegetable” on it. I still liked to listen to New Moon Shine at night in the car on long rides home though and I have no idea why that was the tape I clung to and not Rites of Passage or Graceland or something I can still listen to without cringing today.

    Then at some point our family friends gave Davin and me a tape and through the magic of 90-minute tapes it had Flood on one side and Apollo 18 on the other and I listened to that tape over and over again, memorizing every moment, totally obsessed with They Might Be Giants. But music was a thing that my family brought to me and I was like 10 or whatever so it’s not like I was going out and seeking music, I just found whatever was in the house that I liked. Somewhere in there we got a CD player and I bought the Cranberries’ “No Need to Argue” from Davin to save it from being sold back to a used CD store and I bought “To the Faithful Departed” right before we moved out of our first house in Indiana and my dad got remarried so that in 1996 my CD collection was basically like two Cranberries albums and the original cast recordings for Grease, Will Rogers Follies, and Once Upon a Mattress which were all the musicals I had seen save “Joseph and the Amazing Technicolor Dreamcoat”. What I am trying to communicate here is that at this point you would basically assume that there was no hope for me.

    It’s also worth noting that at some point I (but really Davin) had the soundtracks to the first two Ninja Turtles movies and they had great stuff by MC Hammer and Technotronic and Ya Kid K and of course of COURSE “Ninja Rap” by Vanilla Ice which is terrible but was so so good. I also really unironically (is this adverb necessary, I was 7) loved “Addams Groove” by MC Hammer and “On Our Own” from Ghostbusters II. But at some point I became that exact midwestern white kid, “I like everything except country and rap”, etc. etc. I’d watch “All That” on Nickelodeon and watch the musical guests at the end but it was always some R&B artist and I was really indignant about that all of a sudden. I’m not sure when that happened but I feel kind of ashamed because I think it was probably a race thing? But despite the fact that I was drifting away from this pop culture thing I would still stay up and listen to the “Top 9 at 9” on the radio because it meant I could stay up until 9:45 or so, as long as I was in bed and ready to go to sleep as soon as it was over. I remember being really frustrated when Joan Osborn (“What if God Were One of Us”) and Alanis Morissette (“Ironic”) ruled the charts for ages and ages and had unseated Presidents of the USA (“Peaches”) but then Ben Folds totally toppled the charts with “Brick” and I was so pumped because I loved that song. “Wonderwall” was another song that was #1 for FOREVER and I listened to it basically every night for a really long time.

    Then middle school rolled around and the fact that I was nerdy became a real thing. In elementary school it was like yeah I played a lot of video games and read all the time and my friends and I made up elaborate backstories based on Lego sets that we had but that was just me doing me so it wasn’t no thing you know? (it’s funny if you imagine me saying this as an 11 year old) but in middle school we were nerds so of course we got way into comic books and making our own and playing Magic: the Gathering and kept doing the video game thing and I started getting way into They Might Be Giants, like super obsessed with the band and I started buying their CDs and playing all of their weirdest tracks for my friends and we would just sit next to a boombox and listen to some weird track off of Miscellaneous T, a CD of b-sides (but I didn’t know what a b-side was at the time), a track which will take way too long to explain but basically at one point before there was an internet TMBG had an answering machine set up that you could call into and hear a song and they would put a different song up every once in a while, so one time someone saw the ad and got on a party line with their friend and listened to the song and then they sat on the line and talked about how weird it was for a while with their thick new jersey accents, unaware that they were being recorded all this time, and it was just incredible to hear this released on a CD! We were flipping our lid over this weird shit where there’s a song in which a murderer gets a creepy phone call from someone he killed and then “the ghost of my dance instructor pushed me down into an open grave and as dirt rained down she played a xylophone” WHAT THE HELL but these guys were obviously the weirdest funniest music ever made and it was also all really peppy sounding but about really sad things and that appealed to me. I also started to find other things through random people like my friend stealing his brother’s CDs of Weezer and Ben Folds and we’d sit and listen to those a lot while we played N64. I also continued to at least try basically everything my brother got into at the time like Blur and a bunch of other British bands (he went and saw The Verve right before they broke up and I think this was probably when he discovered The Fall, who is like his big deal band for sure) but TMBG was the One True Band, you know? I also rode the bus to school; I lived pretty far away from where my school was so we were among the first few people to be picked up. I listened to the radio the whole way and it was just regular pop music and I mostly resented everyone for making me listen to it because I wanted to listen to They Might Be Giants but I did kind of have an affinity for Aaliyah’s “Are You That Somebody?” and Madonna’s “Frozen” that I never would have admitted to anyone.

    Then my brother went off to college and I moved to a new town and my computer was in my bedroom and I started hearing stuff about Napster and downloading MP3s and that sounded AWESOME so I proceeded to download single tracks of basically every genre onto my computer over dialup. It was 1999 and you just had to have a poorly ripped copy of “Paranoid Android” to play next to “Aqualung” and this weird version of NiN’s “Closer” which had been combined with the soundtrack to Super Mario (the first mashup I ever heard) and you could even buy a CD burner to put in your computer for like $180 and burn this stuff to a CD! I couldn’t buy one for a while so until then I would put stuff on a bunch of IOMEGA ZIP DISKS and give them to my classmate so he could burn them to CD for me. I started cultivating this weird playlist of MP3s in Winamp and it was just the strangest assortment of albums of TMBG/Ben Folds/Weezer and then a lot of random songs from artists who I had heard of because that was all I could find on Napster (for the longest time I had like three songs by Frank Zappa). In sophomore year of high school I moved to a new house and got Kid A on a whim when I was out with some friends and saw it in Meijer which is kind of like a nicer Walmart that’s only in the Midwest (I realize the convoluted logic going on in your head trying to understand that but just trust me). I knew I liked OK Computer and this looked similar from the cover. We piled back into my friend’s huge van and there were like 8 people most of whom just listened to whatever was playing on the radio at the time and they were like “well let’s listen to this CD you bought” and I was like “um I don’t think that’s a good idea” and they kind of made fun of me until I opened it up and put it on and “Everything in Its Right Place” starts up and they were just all so confused and angry but I was so amazed. As high school went on I stole a few more of my brother’s CDs; he’d bring them home while he was back on breaks from college and I’d raid his CD wallet, ripping anything that looked interesting. That’s how I found out about Neutral Milk Hotel and The Flaming Lips and Gorillaz and Pavement and Spoon and The Strokes and Super Furry Animals and Sigur Ros and The Postal Service. I went to my first couple non-TMBG rock concerts (And You Will Know Us By The Trail of Dead and Stephen Malkmus, both at the Metro, I know, I’m pretty awesome)

    My senior year of high school I heard a few things that rekindled an appreciation for hip-hop. Being a nerd, I was already kind of on the MC Frontalot/mc chris train because how can you deny dudes who rap about Penny Arcade and Star Wars and release mp3s for free online? That’s pretty cool, you know? And then I discovered MC Paul Barman and Del tha Funkee Homosapien when someone said they were along the same vein and I did really like the Gorillaz and then I discovered that Dan the Automator and Prince Paul were common elements through all of that so I sought out De La Soul’s “Three Feet High and Rising” and Del’s “Deltron 3030” and that led to the Handsome Boy Modeling School album and a bunch of random mp3s by people from Hieroglyphics Imperium and I just kept spinning that out, all this underground goofy rap. Then my brother brought home Def Jux, Mr. Lif and Cannibal Ox and Aesop Rock; Dizzee Rascall and The Streets and I was like “oh okay so I don’t hate rap I just don’t like (insert some horrible racist generalization involving ironic use of the word ‘bling’ and something about shooting people)”. But at some point while driving home late at night from my friend’s house during the summer after my first year of college I heard “All Falls Down” on the radio, and then I heard it the next night, and the next night, and I was like “holy crap what is this” and I got “The College Dropout” and I realized this was basically as mainstream as it came but Kanye West was this genius and he was making me question all my assumptions about hip-hop.

    From there on out my musical experience is basically like that of the average young rich white person who cares about music living in 2005-2015. I figured out how to go to a record store, browse the new releases, go home, look up reviews on pitchfork and cokemachineglow, listen to mp3s online, buy albums, argue with people about the merits of a new Björk album or try to get wrapped up in whatever the new thing is of the moment within the “indie” scene. I spent basically all of 2001-2009 listening to albums and talking about the importance of albums and I think that may have had something to do with my rocky(/rockist) re-acceptance of pop music: because to find a new artist was to find an album and listen to that album and so many of these pop albums are spread thin with tons of awful filler, but sometimes those singles are way better in 3 minutes than a serious rock album will ever get over the course of 60. It’s only within the last year or two that I’ve started to collect single songs again, not viewing that as a failure to keep my iTunes collection “pure” in some way, but rather as a tool to be able to actually appreciate someone who’s best listened to as a collection of singles.