Ivan Storck at University of Washington

Notes on entrepreneurship and developing software for the Center for Commercialization

Making MacVim Pretty

The holy editor wars. Almost everyone has their favorite, and your colleague, conference mate, or cellmate will rabidly talk your ear off about one editor versus another. I have to admit, I bounce back and forth between TextMate and MacVim, and am closely watching my new up and coming favorite, Vico.

Lately I’ve been favoring MacVim. Especially with these modifications I’m about to show you that make it… pretty!

First, there is Alloy’s MacVim fork. It gives you a nice Mac-like sidebar, project drawer - just like TextMate. The easiest way I found to install Alloy’s fork is to use the normal homebrew recipe for macvim, but edit it, and point it to a new tarball that you’ve created.

  • install homebrew if you haven’t already
  • git clone https://github.com/alloy/macvim.git
  • tar -cvzf macvim-7.3-63.tgz macvim/
  • brew edit macvim
  • change the line with the URL to something like file:///Users/ivan/dev/macvim-7.3-63.tgz. Make sure to use your own file path
  • you can either delete the md5 line or calculate the md5 of your tgz file with: md5 macvim-7.3-63.tgz
  • you may need to update the version if it has changed
  • brew uninstall macvim if you already had it installed
  • brew install macvim
  • launch MacVim and press command-, to get the preferences window. You should now have the option to show the sidebar

Secondly, there is Geoffrey Grosenbach’s PeepOpen. It gives you an improvement over TextMate’s Command-T file picker. There are Vim plugins that duplicate and improve on Command-T’s functionality already, like Ctrl-P but none of them are a pretty Cocoa GUI like PeepOpen. It is a paid product, but it’s worth the cost if you like to make your environment worth to look at it.

Other reasons I am preferring Vim over TextMate lately are Tim Pope’s excellent plugins: Rails.vim, and Fugitive.com (for Git).

Testing Ruby on Rails Obfuscated Email Addresses With RSpec

You may have known that Ruby on Rails can protect email addresses that you have on your web pages with the mail_to view helper. But how do you test email obfuscation in your RSpec view tests?

To obfuscate an email address in a rails view, you can simply add encode: “javascript” to your mail_to helper.

obfuscate and protect an email address
1
mail_to "you@example.com","email me", encode: "javascript"

To test this, I created a method in my spec/spec_helper.rb file. This method goes through each character (byte) of the string containing the email address, and calls the sprintf method to format the character in the way that the javascript decoder in rails can read.

email encoder to include in spec_helper.rb
1
2
3
4
5
6
7
def encode_email(email)
# copied escape method from:
#http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-mail_to
escaped = ""
email.each_byte { |c| escaped << sprintf("%%%x",c) }
return escaped
end

Having that method available makes my example very easy to read:

email encoding example
1
2
3
it "should obfuscate and display the contact email" do
render.should have_content(encode_email("contact@example.com"))
end

Do you know a better way? For example, hooking directly into the view helper code from ActionView::Helpers::UrlHelper#mail_to? Let me know in the comments.

DRY Up Your Factory Girl Factories With RSpec and Cucumber

factory girlWhen I first set up the fixture replacement gem Factory_Girl in my current Ruby on Rails project, I had two files with the same code in each one, creating the same factory twice. One in RSpec’s spec/factories directory, and another in Cucumber’s features/support directory. According to the Don’t Repeat Yourself (DRY) principle, this was not ideal. How to fix?

I asked the question in the #rspec channel on IRC, and lucky me, David Chelimisky, the lead developer/maintainer of RSpec, answered. Simply require the factory file from RSpec in Cucumber’s features/support/env.rb file. Like this:

require one model factory
1
require_relative("../../spec/factories/model_name.rb")

But this could get quite tedious, if you have more than one model. Which of course, you probably do. So, here’s a snippet that will load all of your factories:

require all factories
1
Dir["../../spec/factories/*.rb"].each {|file| require_relative file }

I put this in my features/support/env.rb file. If you use Spork, I put it in my Spork.each_run section.

Are you using factory_girl, machinist, or another fixture replacement library? Let me know in the comments if you know a better way to do it.

Vico Editor Combines Best of TextMate and Vim

I’m in love with a new text editor. It’s called Vico. For Vim fans, you have all your comon keybindings for blazingly fast editing. For TextMate fans, you’ve got all your bundles and snippets. It really is the best of both worlds.

Here’s a screen shot showing a vertical split between the view and the view spec, with RSpec results in a Rails app:

screenshot

There is a link on Vico’s site for a free trial app - go try it!

How Do You Do Rapid Project Deploys? Babushka and Chef!

How do I support web infrastructure for many sites at a time?

At the UW center for commercialization there are lots and lots of projects to work on. The mission is encouraging new companies, and each one may need a website. There are also many internal projects. We need to spin up sites and servers rapidly, and provide each project with a standard environment and good base system. While we have had success with hosting multiple sites on a VMWare CloudFoundry server for simple sites, for others we need to have an environment that supports SSL and other more uniquely customizable configuration options. The challenge is how to do this process well, and make it easily repeatable.

Enter Babushka and Chef. Actually, Ben Hoskings should have called Babushka “sous-chef”, because it’s extremely helpful to use, to get ready for Chef. Even better, it can also help set up your workstations, such as your mac, as well as your servers.

Quoting Ben about Babushka vs. Chef (or Puppet):

I think they’re both great tools, and I see babushka as being complementary to them. In particular, I think their strengths are complementary. You can discover babushka and be running deps after a single shell command, whereas chef and puppet have much steeper learning curves. But then, babushka has a fairly rigid ceiling (i.e. a single system), and on its own, it doesn’t scale at all. That was a deliberate design decision on my part—chef and puppet are already doing a good job at the job they’re intended for, which I see as managing ecosystems of machines. Babushka is much more focused on the small end of the scale; in fact, one of the things I’ve tried to keep in mind while designing it has been “no job too small”.

Also, and perhaps more importantly, I’m not designing babushka specifically as a deployment automation tool; I’m thinking more generally than that. One example: things like installing TextMate bundles, configuring OS X/Linux preferences, and the like. Things where you can say “I do it this way—you might like it, run my dep and give it a go.”

It was especially helpful to discover Ivan Vanderbyl’s article on Bootstrapping Chef with Babushka. His scripts needed an update for Ubuntu Oneiric (11.10) and I’ve posted them on my GitHub. You should be able to follow the ‘other ruby ivan’s instructions but just sub my github name for his.

Oren Etzioni on Entrepreneurship at UW

Notes from his lecture today. Check out the entire lecture series.

Oren Etzioni

WRF Entrepreneurship Professor

Sponsored by the Center for Commercialization (C4C)

The UW Presidential Entrepreneurial Faculty Fellows lecture series is designed to inspire UW researchers to pursue commercialization of their innovations by showcasing UW Faculty who have succeeded in translating their research into products and therapies, initiated groundbreaking programs for translation, or established model collaborations with industry. Read more

“A variety of personality types can lead to success…You don’t have to study CS at Harvard”

“They were passionately devoted to their day jobs - at the University.” There had to be some way to start a company that didn’t compromise that.

Been kicked out of various business clubs in Seattle for not wearing the proper attire.

Genius Drive Charisma are important, but so are being nosy, and not taking no for an answer. Having the energy and enthusiasm for constantly opening the question.

Inventor of FareCast.

“Does entrepreneurship have any place in the University?” “A bunch of small entrepreneurs joined together by a grievance about parking”

Personal goal: impact

At burning man, wearing a miniskirt, ran into a couple of students who loved his class. Loves teaching does not usually wear mini-skirts.

There are a lot of ways to have an impact beyond writing a research paper or book.

Best answer for VCs: Why are you starting this company? Because I want to make a lot of money.

Researchers are Entrepreneurs:

  1. Start from scratch
  2. Limited resources, but ample vision!
  3. Small teams of talented students
  4. Tremendous uncertainty
  5. Optimisim to defy naysayers

“I eat what I kill” I don’t bring in money, I don’t eat.

Universities breed founders. Google Facebook and Yahoo came out of universities. You don’t have to go to Stanford to start a great company. Many come from UW. UW companies: Visio, Farecast, Webcrawler, Asta networks, illumita, metacrawler, Etch

Why doesn’t everyone do it?

  • many startups fail
  • it’s an emotional rollercoaster
  • you get told “no” a lot
  • the hours? not everyone likes to work hard. Not all the time, but yes, when you have an entrepreneurship

When you have freedom, why not give it a shot?

“What are the pieces of the puzzle? There are fewer pieces than you might think?”

  1. Passion, determination
  2. Value Proposition - real pain point - people have a problem
  3. Secret weapon - people, research
  4. Ecosystem - C4C, WRF, Madrona Ventures
  5. Team
  6. Funding
  7. Validation - response to press release or other prototype

Value proposition - there is a difference between nice to have and must have.

Decide.com - no regrets on technology purchases

Risk

  1. What risk? For software people, a startup is not a risk. Not living life to its fullest is the real risk!
  2. Why not keep money “under a mattress”? It’s guaranteed that inflation will slowly eat at it until it’s worth half of what it is.

First Post

I’ll be blogging here about programming Ruby (and Rails), fixing PHP, and Mac OS X and Ubuntu sysadmin.

One of the first things I’m doing is fixing the express licensing site to accept payments via PayPal instead of FolioDirect.

I also have set up a micro cloud with an Ubuntu VM running CloudFoundry. This box will be used for testing various Ruby on Rails apps. It’s our own private PaaS.

In addition, I am helping the Center for Training set up a test server to prototype a Ruby on Rails based Learning Management System (LMS) called Canvas.