Category Archives: development

The Reverse Stockholm Paste Design Pattern

The Reverse Stockholm Paste Design Pattern describes projects where a programmer takes the stance, “I’m awesome doing ****loads of crazy copy and paste”, and a later programmer takes the stance, “F*** this, and the people asking me to do this.”

Named, but not implemented, by Logan Barnett.

Advertisements

Back to rails after 6 months

I haven’t done any programming in Rails since about June, most of my time has been spent on the perl innards of Quest Atlantis where I’ve been changing a lot of the code in preparation for my dissertation, and to handle some performance issues that were killing us.

Getting back to rails hasn’t been easy, its a different way of thinking for me than perl–which is good. But with rails I always want to be principled. So I started out writing tests, trying to use them to help me work through a very incomplete design I was handed. But the upgrade to rails 3.0.3 hasn’t been smooth, in part because a lot of bits are rapidly changing given the relative newness of rails 3 and the libraries I’m using in this project.

But the big thing is that I just figured out the way to have nginx-passenger serve the new app I’m working on via a base_uri and still pass through all the other non-static requests to the apache instance running mod_perl. Since the passenger documentation contains errors and was unclear for me, I’m sharing this here in case someone else needs it.

The config I ended up with is:

server {
  listen 8000;
  server_name rails.crlt.indiana.edu qaperl.crlt.indiana.edu;
  root /var/www/www_home;
  location ^~ /foo_bar {
    passenger_enabled on;
    rails_env development;
    # for this config to work:
    # ln -s /path/to/foo_bar/public /var/www/www_home/foo_bar
    root /var/www/www_home;
    passenger_base_uri /foo_bar;
    # break is not necessary because of the ^~ match
  }

  # If a specified static file type exists as named, serve it up directly
  location ~* \.(jpg|jpeg|gif|png|css|js|zip|)$ {
    root /var/www/www_home;
    if (-f $request_filename) {
      break;
    }
  }

  location / {
    proxy_pass http://127.0.0.1:8010;
    break;
  }
}
passenger_pre_start http://127.0.0.1:8000/;

Tools and projects to date, part 1.

I finally realized what I should start posting about: all the tools I generate. I’ve done a terrible job documenting and ultimately getting credit and recognition for what I’ve spent my time on, and a large part of that is, in my current thinking, the result of my not talking about it. So to start addressing that I’m going to review some of my history here. Overtime I’ll add links to the code and published projects as well.

The most recent tool is what has evolved into workedexamples.org . Originally I sat down and built this tool with my friend and colleague Shah. My inspiration was because my advisor kept pulling Shah to do simple edits on the static html files that were the original Quest Atlantis worked examples, and I wanted Shah’s time to be freed up to help me do more interesting things. My advisor, Shah’s boss, had gone to Hawaii for a few weeks, and so I sat down and started developing the first version of the tool.

Over the next 4.5 days Shah banged out the upload management parts of the system, styled much of the site, while I worked out the core functionality, and ported the original static files over to the new tool. It was a good few days, and at the end I let my advisor know what we’d done. This back in January 2009, and I’m only writing it up now. At this point the worked examples tool has taken on a life of its own, and gone in a lot of directions I’m not particularly a fan of because they are at odds with my original design intent. But that is also the nice thing about open sourcing your work: you get to see how those that come later take up the work and change it.

The next personal project I took on was a ruby binding library for the Activeworlds, Inc. bot SDK. The first version was done using hand-crafted ruby bindings, and never fully covered the portions of the SDK I didn’t directly need or want to use. My motivation for doing all this was to replace the C based bots I’d written for the Quest Atlantis project over the last few years for managing 3D world changes and avatars. I also wanted to write a new version of our management bot so we could avoid paying 20k$ for something we might not end up with full control over.

Ultimately I replaced that binding library with one based on the ruby-ffi bindings in late July 2009. In 4 days I wrote a replacement user management bot (OTAK), a 3D game element management bot, a new avatar management bot, and 4 versions of a map bot. We’ve been running these bots with few changes other than some unicode string management stuff for handling international chat since then with few problems.

Since that time I’ve been mostly working on my dissertation project. My project requires building a new scripting system for the Quest Atlantis game engine, and in particular making the programming tools accessible to elementary aged children. The work is funded by a Creative IT grant from the NSF, and I’m getting to collaborate with some great folks: Eric Klopfer, Daniel Wendel, David Lam, and (previously) Angel Izzary at MIT from the OpenBlocks & Star Logo:TNG projects; Kylie Peppler at IU, from using Scratch with Computer Clubhouse members; and of course my advisor Sasha Barab of Quest Atlantis.

The work on that project started in May 2008, but due to various performance and scaling issues with the existing system, much of that year was lost to sysadmin work to support the general operations of QA. The projects discussed above were how I chose to balance the work when I need a break from the grind of the grant and sysadmin work. Ultimately this has led to where I am this last week. I’m almost ready to release the adult version of my new scripting system, and have been slowly eliminating performance problems with our existing perl system.