Building Clouds

I’ve spent this year building networks using Amazon Web Services and teaching people how to do it. So I’d like to share the code that I’ve used as teaching examples and as seeds for the creation of some pretty cool environments. AWS PY was my first published attempt at interacting with AWS in python & Puppet to instantiate, provision and control EC2 instances, as well as the seed for an incredibly cool project at the start of this year....

Kramdown and Webby

A number of the sites that I manage for fun are simply static web pages. The dynamic nature is handled by javascript classes and plugins. This means that I really don’t need or want an application server to serve these sites, but I do want to still use some of the practices that I apply to web application development. Enter webby - it works by combining the contents of a page with a layout to produce HTML....

RubyGems in a JAR

On a few projects now I’ve used jruby with rake. I know that I can use rvm and just fetch the gems per project, but for developers stuck on windows that way is a little more than difficult. So here’s how I package up rubygems in a JAR. mkdir gemjar java -jar jruby-complete-1.6.3.jar -S gem install -i ./gemjar haml --version 3.1.2 --no-rdoc --no-ri java -jar jruby-complete-1.6.3.jar -S gem install -i ....

JRuby Rake and Ivy

Here’s a neat way of using ivy with jruby, rake & ant. task :ivy_retrieve do ant.taskdef :resource => "org/apache/ivy/ant/antlib.xml" do classpath :location => "ivy/ivy-2.2.0.jar" end ant.configure :file => "ivy/ivysettings.xml" ant.resolve :file => "ivy/ivy.xml" ant.retrieve :pattern => "lib/[conf]/[type]/[artifact]-[revision].[ext]", :sync => "true" puts end Still using ant, still angle bracket free (except for ivy, sigh). Read my previous post if you want to know more about jruby, rake and ant....

JRuby Rake Vs Ant

For the longest time I’ve been writing Java build files in XML and I’ve always felt a little dirty. Not too long ago I was re-introduced to rake by a colleague (thanks Fabio) and how nicely it integrates with ant. This means that you can now turn this: <project name="spring-conversations" default="build" basedir="."> <property name="src.dir" location="src/main" /> <property name="test.dir" location="src/test" /> <property name="build.dir" location="build" /> <property name="dist.dir" location="${build.dir}/dist" /> <property name="report.dir" location="${build....

Post-Redirect-Get in Rails

For a while now I've been flying the flag for using a post-redirect-get design pattern when writing web applications. In my opinion the current crop of web frameworks still make it very easy to do the "bad" thing since to do PRG properly you need to think what kind of an interaction you want with users and not cop out saying its technically very difficult in . If you resort to ActiveX controls, popups without navigation bars and/or weird javascript hacks to stop users from clicking refresh or back buttons then perhaps you should have written a better web application....

UUID as an ActiveRecord primary key

I like non-sequential identifiers for resources. Easy to do in Java (with java.util.UUID) and in Python (using the uuid module). This has been a bit of a pain in Rails, until now - check out Ariejan de Vroom's post. I especially like his solution as it plays well with RSpec, although to be picky I would have chosen UUID.random_create rather than UUID.timestamp_create....

svn2cvs

I am currently working with a team that uses subversion for day-to-day development but needs to use cvs due to a corporate policy. So I suggested that we create a build on our continuous integration server to automatically merge changes from a subversion working copy to a cvs checkout. I had a quick look on the internet for something to do the merging and managed to find and play with a perl script to merge from svn to cvs, and with a java application that was supposed to do the same....

Timesheets and Ruby

Timesheets are the bane of all software developers and consultants. Nobody does them on time, and I for one have difficulty remembering what I did during the week. I know I could simply fill in the timesheet each day, but heck, I am lazy. Over a few years, I've been writing and rewriting scripts to keep a timesheet in a CSV file, so that I can query it at the end of the week to see what I have been up to....