About Us

Bulletpoint StarImulus® is a technology focused design + interactive agency.

In addition to our client services we also have a few products in the works. Our office is always filled with chatter and this blog is an outlet for our creative energy, rants and ideas.

Podium

Stacks!
Imulus built a task management solution that finally works for teams. It's a life saver, learn more at usestacks.com.

Featured Project

Category: development

Jan5

Support Details on Rails

We here at Imulus have spread our wings a bit and decided to get into the Rails game. I have had a crush on Ruby for a long time, causing me to jump on the Rails bandwagon when version 1.0 was in beta. I fell off the wagon before Rails 2 came out, being consumed by development work that wasn’t on the web. When Rails 3 and then Rails 3.1 came out with great support for unobtrusive javascript as well as the asset pipeline, several of us started to get involved again.

We’ve been wanting to continue work on Support Details for some time now. Since it was in .NET sitting on top of a homegrown CMS that it really didn’t need to be coupled to, our frontend developers had trouble moving forward on it. As a lark, I decided to port over the site to Rails. The main functionality was done in a couple of hours and we managed to iron out most of the other main points in spare hours over the next few days. We decided to update some of our detection to be way more accurate, and that took a few more days, but we can now tell if you are on Windows 3.1 running NCSA Mosaic

We didn’t want to stop there though. We were very excited about using CoffeeScript and Sass in the new Rails 3.1 asset pipeline to create readable code that could generate our Javascript and CSS. Taylor and Casey jumped onto migrating the existing Javascript and CSS over to using CoffeeScript and Sass. After running through the asset pipeline which would combine and minify our Javascript and CSS we had significantly reduced our asset download size.

While that was a great first step, we wanted to go further and make Support Details even faster. We started by using Delayed Job to send e-mails on a background queue, rather than tying up the main web thread. Then we decided that we wanted to take advantage of a CDN and so we used the excellent Asset Sync gem to compile and deploy our assets to Amazon S3/Cloudfront when we pushed to Heroku. After all of these changes our initial page load time was cut by more that half.

But wait, there’s more. We’ve had many requests to localize Support Details for different languages. Thanks to the support of various friends of Imulus, we are pleased to offer Support Details in Japanese, Russian, Italian and Portuguese. We plan on adding more languages in the future, and if you want to help in translation please feel free to give us a holler and we can send you a list of phrases we need for the translation.

We have a lot more planned for Support Details, and we have some more great Rails applications in the pipeline which we should be releasing for your viewing pleasure in the near future.

Jun18

CoffeeScript: Namespaces, Modules and Inheritance

First, some JavaScript background.

Skip to the good stuff

Here at Imulus, we like to namespace our JavaScript by wrapping our classes in static modules. We accomplish this by simply creating an object literal with a variety of members: classes (constructors), constants, variables and static methods.

Here is a pared down example of a simple module:

var Application = {           // the module, a static wrapper

 FXSPEED : 500,               // a constant (sort of)

 user : {                     // a nested static object
   id : 123
 },

 toggle : function(){ ... },  // a static method

 Interface : function(){      // a class

   this.initialize = function(){
     this.active = true;
     this.build();
     return this;
   }

   this.build = function(){
     ...
   }

   this.doSomething = function(){
     return "did something";
   }

   return this.initialize();
 }  

}

The benefits of this technique are obvious; it allows us to have loosely-coupled, modular code that is nicely organized, available without instantiation and protects the global namespace from pollution.

Application.active // true

Application.user.id // 123

var interface = new Application.Interface()
interface.doSomething() // 'did something'

In reality, however, one mammoth object literal in a single file is a lousy way to structure your code. Instead, what we do is organize module members into separate files in a logical fashion, å la Ruby. The module and all of its static members exist in a single file named after the module, and all of the module’s classes exist in a directory named after the module with each class file named after itself without the namespace. By using this structure, files are much easier to find because the naming convention mirrors the the module namespace.

The directory structure ends up looking like this:

|-- scripts
    |-- application.js
    |-- application
        |-- controller.js
        |-- data.js
        |-- interface.js

And the module above would be structured like this:

// scripts/application.js
// creates the wrapper module and contains all static members

var Application = Application || {
  FXSPEED : 500,
  user : {
    id : 123
  },
 toggle : function(){ ... },
}
// scripts/application/interface.js

Application.Interface = function(){
  this.initialize = function(){
    this.active = true;
    this.build();
    return this;
  }

  this.build = function(){
    ...
  }

  this.doSomething = function(){
    return "did something";
  }

  return this.initialize();
}
// scripts/application/controller.js

Application.Controller = function(){
  ...
}

You get the picture. This probably looks familiar to a Rubyist. Here’s the analog:

|-- lib
    |-- application.rb
    |-- application
        |-- interface.rb
# application.rb

module Application
 FXSPEED : 500,             

 def self.user
  { 'id' => 123 }
 end

 def self.toggle
  ...
 end
end
# application/interface.rb

module Application
  class Interface

    attr_accessor :active

    def initialize
      @active = true
      build
    end

    def build
      ...
    end

    def do_something
      'did something'
    end
  end
end

Snakes on a Train

By now it’s probably evident how much we obsess over code structure, organization and namespacing. While experimenting with CoffeeScript, this has been an ongoing concern.

This is the example from the CoffeeScript demo page:

class Animal
  constructor: (@name) ->

  move: (meters) ->
    alert @name + " moved " + meters + "m."

class Snake extends Animal
  move: ->
    alert "Slithering..."
    super 5

class Horse extends Animal
  move: ->
    alert "Galloping..."
    super 45

sam = new Snake "Sammy the Python"
tom = new Horse "Tommy the Palomino"

sam.move()
tom.move()

I love that Coffee has made dealing with prototypes much easier with the ‘class’ and ‘extends’ keywords. This is great, and by itself works like a charm for singular, somewhat global classes. However, for any application with a sizeable codebase this simply isn’t practical without ending up with insane class names.

The ideal solution would be to introduce a ‘module’ keyword similar to Ruby’s.

module Zoo
  class Animal
    constructor: (@name) ->

    move: (meters) ->
      alert @name + " moved " + meters + "m."

bob = new Zoo::Animal "Bob the Bird"
bob.move()

Other people agree. But there are a number of JS limitations that prevent this from being a viable solution in CoffeeScript.

The Really Good Stuff

By its own golden rule, CoffeeScript is: “It’s just JavaScript”. So, we can namespace our CoffeeScript classes in the same manner we organize our modules in vanilla JS.

Extending on the example above (ha-ha, get it?), I’ll demonstrate how to namespace your Coffee classes in a simple, elegant way.

Focusing only on the snakes for now, lets set up our basic classes.

class Animal
  constructor: (@name) ->

  move: (meters) ->
    console.log @name + " moved " + meters + "m."

class Snake extends Animal
  move: ->
    super 5

george = new Snake "George"
george.move() // George moved 5m

Now, we want to create ‘Forest’ and ‘Savanna’ modules that have a habitat and snakes of their own.

animal-diagram

Just like JavaScript, we could wrap all of the module members in an object literal:

Forest =
  habitat: "dense highland dotted with lakes and streams"
  Snake: class extends Snake
    move: ->
      super 10

george = new Forest.Snake "George"
george.move() // George moved 5m.

But we would run into the same problem when the codebase reaches any kind of scale: enormous, single-file object literals. So let’s introduce a new function for creating module members.

module = (name) ->
  global[name] = global[name] or {}

(Yes, I am aware that this is attaching the objects to the global namespace. This is what we want. It allows us to add members to the module later.)

Now we can use the ‘module’ function like this:

module 'Forest'

Forest.habitat = "dense highland dotted with lakes and streams"

Forest.Snake = class extends Snake
 move: ->
   super 10

george = new Forest.Snake "George"
george.move() // George moved 10m.

Pretty elegant, right? Additionally, by using the ‘module’ function we can now organize our code into multiple files:

module = (name) ->
  global[name] = global[name] or {}

# src/animals.coffee
class Animal
  constructor: (@name) ->

  move: (meters) ->
    console.log @name + " moved " + meters + "m."

class Snake extends Animal
  move: (meters) ->
    super meters

# src/forest/snake.coffee
module 'Forest'

Forest.habitat = "dense highland dotted with lakes and streams"

Forest.Snake = class extends Snake
  move: (meters)->
    @distance = meters || 5
    super @distance

# src/savanna/snake.coffee
module 'Savanna'

Savanna.habitat = "grassy woodland small or widely spaced trees"

Savanna.Snake = class extends Snake
  move: (meters)->
    @distance = meters || 10
    super @distance

george = new Forest.Snake "George"
george.move() // George moved 5m

scott = new Savanna.Snake "Scott"
scott.move() // Scott moved 10m

We can also extend standalone classes with module classes:

class Python extends Savanna.Snake
  constructor: ->
    super
    console.log "I am #{@name} the python."
    console.log "I live in the savanna,
    where it is #{Savanna.habitat}."

class Cobra extends Forest.Snake
  constructor: ->
    super
    console.log "I am #{@name} the cobra."
    console.log "I live in the Forest,
      where it is #{Forest.habitat}."

john = new Python "John"
// I am John the python.
// I live in the savanna,
// where it is grassy woodland small or widely spaced trees.

bruce = new Cobra "Bruce"
// I am Bruce the cobra.
// I live in the forest,
// where it is dense highland dotted with lakes and streams.

May26

Starting Fresh

After patiently waiting for their arrival, Taylor and I received our new SSDs yesterday. Rather than migrating our data over from our old disks and potentially cheapening the solid-state experience, we both opted to start with a fresh slate. (By all accounts, he’s a glutton for reformatting his system. It’s a hobby of his.)

I was reluctant, mostly in anticipation that I’ll want to start fresh again in a few months when OS X Lion is released. Having just started on this machine a few months ago, I’m also keenly aware of how long it takes to get a system up and running and configured to my tastes.

Out of both curiosity and to make it easier on myself in the future, I decided to keep track of my installation and configuration process.

In roughly the right order:

Jan8

Using Microsoft’s Web Deployment Tool to automate backups

Recently here at Imulus we had a production server go down, meaning all of our clients’ websites on that box were unreachable.  Thankfully, we had the proper precautions taken and backups were restored in hours.  Yet it was a very stressful time for all of us and it led me to wonder what else was out there and how much better we could have responded in an emergency.

After a bit of research I found Microsoft’s Web Deployment Tool, also sometimes referred to as MSDeploy.  Of course it only applies to Windows Servers with IIS, so if you are looking for another OS/web server solution this article is not for you.

I was somewhat skeptical at first because, well, I’m skeptical of everything.  They even call me the skeptic here at work.  It also seemed a lot of people that were writing about it were fanboys and it was a very new product (I started testing when this product was still a release candidate).  After reading about it thought I should give it a shot since it sounded very powerful.  Here is a short version of what we were looking for:

  • Able to take all manual steps out of recovery
  • Backup all files and code that made up the website
  • Include all settings, SSL Certificates, Bindings etc.

After playing with it and doing some tests I was very impressed.  The tool does deployment/backups per site, so if you host multiple sites on a server and want to customize depending on site you are able to do that.  You can view code dependencies, backup databases – do almost anything you want.  You can choose to use the GUI from IIS Manager or go command line.  You can choose to export the package to another server immediately or create a folder with an archive of all necessary files for restoration later.

If you are interested in using it for deploying, go get it,  check out this overview page or visit their forums.

If you are interested in seeing how we created a fully automated solution, read on.

Since we wanted something that had little or no human interaction, and therefore not error prone with a high degree of reliability, I came up with a solution that took all human involvement out of the backup and recovery process.  The solution we came up with is broken into 3 parts.

1) Backups of all sites in IIS needs to occur in case of a server failure.

2) Replicate backups to other available live servers as well as offsite automatically.

3) The ability to recover our site(s) needs to be easily and quickly available with fewest manual steps as possible.

To address all these I wrote a small, simple program to help the Web Deployment Tool with this process.  The program has two purposes and can easily be scheduled through the task manager in order to create a repetitive and up-to-date solution.  The program writes two files.  The first .bat file should be run nightly, or however often you want, and contains commands for msdeploy that create an archive backup for each site in IIS.  The second bat file contains all commands for msdeploy to install/restore each website that has been archived.  This second file should only be run if a server goes down and you need to restore sites on your standby server.

To take care of our first step we must schedule an execution of our custom application to generate our archival and restore bat files.  We must also schedule an execution of the archival .bat file our program generates to be run afterwards.  The bat file execution results in the creation of an archive for each site.

Now that all sites are backed up with step #1, we need to take care of step #2.  To do this, just use your favorite sync tool to copy all necessary files to other server(s) and offsite.  If you don’t know what I am talking about, check out Super Flexible File Synchronizer or Microsoft’s Sync Toy.  Using a program to move files on an automatic basis allows us to be ready to execute step three if we ever need to.

Step #3 is the only manual step in this whole process and is quite easy.  First, bind the new server you are recovering to with all necessary IPs, or do whatever network voodoo you need to.  Secondly, run the recovery .bat file.  The file will install your site(s), application pool, certs and restore all settings.  One click recovery?  Yes please!

If you think this code could be used in your environment you may grab a generic version here – I hope it helps.  Obviously, I make no warranty about any of this process or code.  If you do use the code, please read the readme as well as the code comments.  The code is a Visual Studio 2008 C# solution licensed under GPL.  Use your heads and do your testing people!

If you come up with anything different feel free to comment and let us know how you have improved upon the process.  If you modify the code please send me what you have done.  Enjoy!

Sep3

Who is Imulus?: Interview With Taylor Smith. Interface Developer

who-you-gunna-call

Name, rank, and occupation soldier!
My name is Taylor Smith and I’m an Interface Developer. I take all the pretty pictures the designers draw all day and turn them into functioning, interactive websites.

What was the first development project you worked on?
The first websites I can remember working on weren’t exactly what I would call “development projects.” They were more like personal sites put together with the limited knowledge of HTML and CSS I had back in the late 90s. At the time I was more into photography and messing around with Photoshop, which sort of naturally led me to web design. From there, it seemed that becoming better at HTML and CSS was the next step I needed to take in order to get my designs online, so that’s what I did.

At six, what did you want to be when you grew up?
I wanted to be a front-end XHTML/CSS/JavScript specialist with an emphasis on user interface design and usability, obviously. I also had a short lived interest in becoming a Ghostbuster.

In this field, who do you look up to?
The people I look up to most in this field are the people who blur the lines between development, design, and interaction. There are a lot of talented people specializing in just one of those fields, but the people who can take a step back and understand the overall experience of a website are the ones I find are creating the most compelling content. People like Dan Cederholm, Jason Santa Maria, Dave Shea, Shaun Inman, and many others are not only actively engaged in furthering their skills as front-end developers, but they make it look damn sexy in the process.

What podcasts do you listen to?
I listen to a lot of podcasts. Taking the bus between Denver and Boulder provides me with about 3 hours a day of downtime, and my commute is only made tolerable by the likes of This Week in Tech, Macbreak Weekly, This American Life, You Look Nice Today, Car Talk, and Diggnation. The nice thing about these podcasts in particular is their length; they usually span the entire length of the commute. I have to say, however, that my favorite podcast is The Moth. These are much shorter, but I have yet to hear a story that hasn’t moved me in one way or another.

What nerdy things do you do outside of work?
I use internet lingo in everyday conversations, apply Twitter hashtags to situations outside of Twitter, and have been known to text in lolspeak. I also go lollersaking, ride in a roflcopter, and have an escape route planned for the impending zomgie apocalypse.

Tell us the funniest thing you saw online?
I spent way too much time “researching” this question and have decided it’s impossible to narrow it down to just one, so I’m going to list five that come to mind. Auto-Tune the News #2, Motherf***ing Parking Ticket (NSFW), Cat vs. Printer, Lazy Town Remix feat. Lil’ Jon (NSFW), and David After Dentist.

If you could take a Delorean back to your freshman year of college but only 10 seconds, what would you say to yourself?
“Go snowboarding. A lot.”

How would you change HTML?
My biggest gripe with HTML is definitely the amount of time it takes for upgrades to be implemented. It is unlike almost every other technology out there. HTML5 includes some amazing advancements, but is slowed down not only by the people creating it, but also by the implementation of all the major browsers, AND the adoption rate of customers. Ian Hickson, the editor of the HTML 5 specification, has estimated that HTML5 will be completed in 2022. That’s right. Thirteen years from now.

What is the best part about working at Imulus?
The best part about working at Imulus is almost certainly knowing that everyday I get to work with a group of immensely talented and passionate people. Not only that, but I get to make a living doing something I genuinely enjoy doing, and something that I can actually see myself improving at everyday.

What’s the problem with radio today?
The biggest problem with radio is that there’s no diversity; every station sounds the same. In their defense, it’s a tough industry to be in these days, but I think they brought a lot of that on themselves. Their attempt to appeal to the lowest common denominator has resulted in there being a lot of stations with zero personality. When a new station emerges that tries to do something different, they are often short-lived. Indie 101.5, for example, had great programming, but has recently brought their broadcast online and been replaced by The Pole: Stripper Radio. Sounds like a winner.

If electronic devices stopped working, how would you cope?
I think I would cope pretty well. I could be wrong, but I feel most people who work very closely with technology have the occasional urge to leave it all behind and disconnect permanently. If I were ever in a scenario where I could no longer do the work I do I’d probably find some remote part of the country to move to and find a job working outside. Although I would certainly miss working on the web.

What’s the first thing you do when approaching a new project?
I do not have one specific thing I do when approaching a new project, but I’m beginning to realize there are many things I should be better at doing during the initial phase of a new project. Specifically I am trying to be better at foreseeing how the finished product will work from all points of view: from the view of Imulus, the client, and the audience. The specific tasks I take to achieve this is constantly evolving.

Name the best prank pulled at Imulus.
Unfortunately, I wasn’t working for Imulus at the time of what many refer to as the best prank, but there have been some good ones since I started. I was particularly fond of the prank I’ve always wanted to pull myself. I think it worked out pretty well.