Archive for the ‘Development’ Category

Automagically tagging releases in github

(update: now available as a gem for capistrano)

Today at work we were discussing branching and tagging etc. to keep track of the currently deployed release on various servers. We’re working with Capistrano to do deploys.

This is a script I came up with:

Edit: refactored some errors out of it

Ralf: S3 logfile downloader and merger

Today we released a new gem called Ralf, it stands for Retreive Amazon LogFiles

Download the gem at http://gemcutter.org/gems/ralf or browse the source at http://github.com/kjwierenga/ralf

Usage

Prerequirements:

  • An S3 account (duh)
  • Enable logging on S3 (use cyberduck for example)

Execution:

r = Ralf.new(:config => '/my/config.yaml', :date => '2010-02-01')
r.run

Or run it in one go:

Ralf.run(:config => '/my/config.yaml', :date => '2010-02-01')

Parameters:

:config   a YAML config file, if none given it tries to open /etc/ralf.yaml or ~/.ralf.yaml
:date     the date to parse

:aws_access_key_id      (required in config)
:aws_secret_access_key  (required in config)
:out_path               (required in config)
:out_prefix             (optional, defaults to 's3_combined') Prefix the output file

You can ommit a configuration file when you supply the required parameters :aws_access_key_id_, :aws_secret_access_key and :out_path
They take precedence over the config file

Caveats

  • There is no logrotation as we know it like on regular unix machines

More info: S3 Server Access Logging

TODO

  • CLI executable
  • Grouping/combinig on week/month

Credits:

This plugin is created for kerkdienstgemist.nl for processing the logfiles generated by S3.

Authors: Leon Berenschot and K.J. Wierenga

Sending prawn documents with ActionMailer

Problem: How to send a prawn pdf wich normally is generated by a controller.

and keeping it DRY

Required: Prawn & prawnto

(more…)

RER2009 Rumble

We (@kjw and @leipeleon) participated in the RubyEnRails Rumble last weekend. It was a blast!

Using github on the mac for non-programmers

A quick and dirty tutorial for some friends of mine.

Needed software:

Nice to have:

  • Textmate: text editor.
  • GitHub account (for push rights).
  • GitX: Grapichal tool for commiting to local repo (OSX 10.5+).

Create account on github

Go to http://github.com for an account.

Optional: Provide an SSH key for pushing changes.

Clone a Repo


My advice is to generate a special dir for the projects (mine is Rails).

Fire up the terminal and type:

    # Goto the dir
cd ~/Rails
    # if the repo is read only:
git clone git://github.com/LeipeLeon/facebooker.git
    # if you have push rights:
git clone git@github.com:LeipeLeon/facebooker.git
    # if you installed GitX (as mentioned above)
gitx

Adding changes

With the gitx program it’s easy to commit thanges to your local repo. When these are ready to commit to the master you sync it first with the HEAD and then push your changes.

    # get changes from the master repo to your local repo
git pull
    # push your changes
git push

Additional info:

If it’s a rails application you’re cloning, startup the server with

    # Copy database credentials, uses sqlite3 as default
cp config/database.yml.example config/database.yml
    # install required gems
rake gems:install
    # make tables
rake db:migrate
    # startup server at http://localhost:3000
script/server

and you will be able to use the application at http://localhost:3000

Burgerweeshuis Evenementen Kalender

Bij het gebrek aan een RSS feed van de burgerweeshuis agenda heb ik zelf een (ruby) tooltje gebouwd om alle nieuwe evenementen in google calender te plaatsen.

Tevens wordt elk nieuw evenement automatisch geplaats in het twitter account @burgerweeshuis. Via @nuinhetbw alle evenementen een uur van te voren aangekondigd.

Get yours here:

Dit tooltje heeft de aandacht getrokken van diverse andere organisaties en ben dan ook van plan om hier iets meer mee te gaan doen. I’ll keep you posted!

Textmate Comments doesn’t work anymore!

I like to stay on the edge of development so I’ve installed all the bundles available for TextMate in http://svn.textmate.org/trunk to my ~/Library/Application Support/TextMate.

But then you get a lot of bundles you don’t need like Active4D and ASP, so I disabled all the bundles who’s name didn’t ring a bell to me. The menu is readable again! Little did I know it was going to bite me in the foot the next day.

I performed this action late at night, just before getting some shut-eye. The next morning I was happily coding away until I discovered the Comment (command + /) feature didn’t work anymore!

Damn!

At first I thought it was a corrupted bundle, so I disabled all bundles to no avail. Then I reinstalled TextMate, nothing….

I have this plugin called Project+, updated it: nope, reinstall it: nope, disable it: nope.

With AppZapper I deleted the caches: no joy.

So I was already an hour away and I got frustrated….. So I enabled all plugins and Tada! IT WORKED AGAIN! By trail and error I found out:

It’s all in the bundle called “Source”.

Re-enabling this plugin restores all functionality! Whoohoo!!

So, here we go again, coding happily away….

Create a Facebook app with Rails

In the beginning of this year I scored a programming gig for Wakoopa to spice up their Facebook app.

The original app was created in .NET by a third party and was buggy as hell. The goal was to recreate the app in Rails and have at least the same functionality.

Some befriended (PHP) developers warned me that facebook has some serious pitfalls so before I made an estimate for the project I bought a PDF called Developing Facebook Platform Applications with Rails from The Pragmatic Programmers and a PDF book from Peepcode.

Thanks to this PDF and the Facebooker plugin it was doable. I made the sample application as described in the PDF and so I had enough knowledge to create the WakoopaFacebook app. My advice: buy it!

(more…)

Time Tracking: In Analog Style

IMG_0228.JPGAs a freelancer you need to keep track of your time spend on a account. Blech! Not my favorite task, but it has to be done. I tried several web and desktop tools, but it didn’t satisfy me.

Reading David Allan’s ‘Getting Things Done’ persueded me to follow a style of tracking items with OmniFocus but it doesn’t include any timetracking capabilities.

Searching around the web brought me to the website of David Seah and specificaly the Emergent Time Tracker.

(more…)

Target Priced Contracts.

Found on Freelancing Tips via Rails Camp 4 in the comments an other way to calculate/estimate the costs to keep it fair.

Derek Winter said:

Anyway, last year when looking into how best to structure commerical agreements for Agile Development work, I came across the idea of Target Priced Contracts.

The concept is that fixed price contracts mean the developer wears all the risk and therefore will need to add a buffer to mitigate the risk (ie. 30% on top, or the other multipliers described above).

Rather than take that approach, this method shares the risk between the client and the developer

Once the work is scoped and an agreed set of deliverables defined, a price is set based on your reasonable estimate of durations (the target price, based on your daily rate). This price is signed off on by the customer. For the example, lets say 10 days, $750 per day, target price $7500.

During the project, rather than pay your full rate, they pay your “cost” along the way. In our situation, thats the salary of the developer plus a little to cover overheads. For freelancers, its the rent plus enough to feed yourself and cover general expenses. (for the example, lets say $300 per day)

This will naturally leave a gap between what you’re paid and what the target price is (10 x $300 = $3,000 :- final payment is $4,500). If the contract finishes on time, then this is the amount the client pays you at the end and we’re all happy.

If you are outstanding and find faster ways of completing the work and finish ahead of time (say 8 days), the client still pays that amount. They’re happy because they paid less overall for the project (8×300 + 4,500 = $6,900) and you’re happy because you made the same amount of profit for less work ($4,500 for 8 days work instead of 10) and can get onto the next project

If however there is scope creep, things get tricky, something goes wrong and it takes longer than 10 days (say 12 days) then the client continues to pay your costs until you’re finished (an additional 2×300), but only pays the same final payment ($4,500).

So, they pay more (12×300 + 4,500 = 8,100) and your profit margin goes down (4,500 profit out of 8,100 total payment instead of 4,500 out of 7,500). So, you both feel some pain, but its not unfairly felt by either party.

This means that both parties are focussed on getting a good result – clear requirements, efficient delivery.