Articles tagged 'eldiablo'

Rename Oct 23

So I’ve decided to rename my GitHub account, from to If you’re using or working against feather-plugins or merb-manage then you’ll need to reset your remote location for doing a git pull or whatever. Not sure if you’ve forked whether that’ll continue to work, probably best to check and rebase against the repo at the new url. Any questions let me know and I’ll try to help you out if it’s screwed something up.

And just for fun, here is a video of me scoring a great free kick with the brilliant Jimmy Bullard for Fulham against Arsenal.


rsync Jan 14

Switched to using rsync to deploy this blog now. Since I re-wrote the blogging software to generate a simple static html site, I needed an easy way to deploy. I was using a Capistrano-esque method of deploying the entire site to dated directories (‘200801142252’, for example), and then I was simply symlinking the public web directory to the most recent release. This has the benefit of being able to quickly roll-back to previous releases (handy when doing major template changes etc), but having to re-deploy the entire site every time I wrote a post wasn’t really very efficient. So I’ve changed it to use the rather brilliant rsync to maintain the site on the webserver now. From my ruby code, I just shell out to rsync as follows:

`rsync -avzr -e ssh #{LOCAL_PATH}/* #{REMOTE_USER}@#{REMOTE_HOST}:#{REMOTE_PATH}`

This runs rsync in verbose, archive mode, using compression, and runs recursively. It specifies the local path, and the remote path for use over ssh (I was using scp over ssh before anyway). It’ll prompt for the password on the command line (although you could setup and specify a key to use with the ssh connection to avoid that). This solution will then keep the local and remote paths in sync, and will mean I can update the blog much more easily and quickly. Hopefully that’ll mean a few more regular posts coming soon… :-)


Updates Dec 21

I’ve decided to stick with the static html for this blog, as it has made the site nice and quick, and let’s face it, the content doesn’t change all that often :-p Seriously however, I will be attempting to post a little more often that I have recently, and I’ve now finished a simple command line publishing tool to enable me to blog and push out changes to the site. I’ve made a few changes already, and re-implemented comments using the Disqus comment system (, so we’ll see how that goes. I’ll be using Twitter for more regular, shorter updates (, and am hoping to stick more technical articles up here over the coming months, time allowing.


Hot Routes Feb 10

Last day or so I’ve come up against a couple of intriguing Rails problems while trying to knock up some plugins for an app I’m writing. I’ll write up the second of the two problems later, but here goes the first…

Put simply, I wanted to define a route within my plugin. My plugin implemented a controller (and also contained a view for that controller, see one of the latest features to hit edge Rails ahead of Rails 2.0).

I searched to try and see if anyone had come up against a similar task, but didn’t see any concrete answers. My testing led me to realise that every time a call to ActionController::Routing::Routes.draw is made, it completely clears and re-generates routes based on the block passed to that method. So simply calling draw with a new block containing my required route wouldn’t work; it’d overwrite other routes, or end up getting overwritten by other routes later in the chain.

I then figured it was time to get cracking with some meta-programming, and that I was going to have to re-define and extend the draw method in order to be able to map the routes I want, and do it in a way that’d be flexible and fair to the original Rails routes file, and other plugins that wanted to toy around with routing. I came up with the following:

module ActionController
    module Routing
        class RouteSet
            alias draw_old draw
            def draw
                draw_old do |map|
                    map.connect "controller/action", :controller => "mycontroller", :action => "myaction"
                    yield map

Let’s give this a quick run-through… I’m re-opening the ActionController::Routing module, and specifically the RouteSet class where the draw method exists. I’m using alias to copy the existing draw method to a method name “draw_old”, before re-defining the draw method itself. Within my version of the draw method, I’m calling the old one and passing it a block that firstly defines the routes I wanted to add to the application, and that then yields the appropriate mapper object back to any block passed in to the draw method itself. Dependent on where you want your route to appear in the scheme of things, you could always map your plugins custom routes after you yield the mapper to the calling block, so that they appear after any other routes. Another tweak would be to alias the existing draw method to something like “draw_old_APPNAME”, where APPNAME is the name of your application. This would ensure that if multiple plugins implemented something similar, that they then wouldn’t clash.

There may be a better way to tackle the problem, but after half an hour of working the problem over (mad props to my boy Mike for helping me tweak the solution into something useful and re-usable), I think I came up with a pretty solid answer, and with a bit more time, something that could probably be wrapped up into a module or plugin all of its very own. Bottom line? Ruby as a language rocks, the dynamic nature and meta-programming features opens whole new doors of functional programming to me, and I’m having to really think outside of the box to see some of the amazing things you can do with it.


Mmm... sandwich Sep 29

This is genius.


Blogging His Ass Off Sep 24

My boy Mike is blogging his ass off apparently, in his all new blog. He’s got a couple of decent posts up there to start, and I’d keep your eyes peeled for some more to follow. Welcome back, dude!


Welcome To The El Parade Sep 24

So you didn’t really think I’d be able to go the entire of September without posting right? I’ve been hella busy since returning to the UK after my vacation to Atlanta in the US of A. I’ve meant to post numerous times but this is the first time where I’ve had chance to grab some words together and form a post.

Getting back into the swing of things has been pretty hard - after spending seventeen non-stop days with my soulmate, it’s pretty tricky to get used to the work routine again, and I’m not sure I’m even there yet. All day every day at work I miss my girl, but work is a part of life (actually, it’s the part that pays the bills). No date yet set for the wedding, as we are still planning and deliberating at the minute…

Plenty more to come as a shitload has happened since I last posted, keep the dial tuned here folks.


Mac Daddy Sep 24

So I’ve recently got a MacBook Pro, and it’s fucking awesome. For a start, it’s quick, and secondly, I’m finally, after numerous attempts in the past, enjoying the Mac OS X experience. I’m not sure what it is this time around, but I think working on a Mac just feels right in laptop form. I’m running Parallels for all my Windows needs (damn you, VS2005 and C#), and while I’m tempted to also give Boot Camp a go for the gaming aspects (have you seen Company of Heroes? and apparently HL2 runs real nice on the MBP too!), for now I’m sticking with the virtualisation solution.

But I’m also learning TextMate, and man oh man is that a sweet program to use. I’m a little overwhelmed by all the add-ins (sorry, bundles) and shortcuts there are, but at least it’s prettier than emacs :-)


21 Today Aug 23

So, another year, another birthday. As I was getting older, the day itself was feeling less and less special, just a fact of life I guess. But I was wrong! Today so far has been amazing, and I’ve only been up a few hours!

My amazing girlfriend is making the day so special, we both have the day off work, so this morning I got my presents, now I’m just relaxing. In a little while we are heading over to my parents to have some lunch, and then we are all going into London to have a nice meal, and watch the mighty Fulham take on Bolton at Craven Cottage.

Between this post made on my birthday last year, and today, so much has happened, so much has changed in my life, all for the better. I now am living with the woman of my dreams, own my own home, and am enjoying every single day. With all that I’ve done, I have to keep reminding myself I’m only 21 - but I feel like I’ve grown up more in the last year than I did in the previous 20.

I’m off to enjoy the rest of my day, peace out.

Technorati Tags: , , ,


RubySharp Aug 22

Recently I’ve been toying with John Lam’s pet project, RubyCLR. The very notion of Ruby and C# interaction interests me, as there are around a billion different situations in which I’d like to combine the two, to get the best of both worlds.

Now, I notice in a post today, that he has spotted that Tim Ng, a guy who works on the Visual Basic compiler team, has been playing with his creation. Only, the way he went about it seemed a little complex, and wasn’t using RubyCLR’s compatibility with interfaces to the max. So, I thought I’d outline a little test scenario I knocked up when I first started playing with it.

I’ll assume that you’ve followed the instructions, and are setup with the latest version of RubyCLR (I was using the code straight from the source tree).

Firstly, the code for the C# side of things (the “host”). This defines the interface, and provides a class for executing implementations of the interface:


using System;

public interface IAddIn
string Name { get; }
string Author { get; }
void Work();

public class Host
public static void Execute(IAddIn addin)
Console.WriteLine("[{0}] : {1} by {2}",

We can simply compile this into a standalone assembly:

csc -t:library Host.cs

This will output Host.dll, which we will now consume in our super-duper Ruby script, empowered by the magic RubyCLR. I won’t stick the entire contents of the client Ruby script here, however the full thing is available from here (the full C# source file from above is available here). For now, lets just look at the implementation of our C# written interface within Ruby:

class MyAddIn
implements IAddIn

def get__name
return "My first Ruby/.Net add-in!"

def get__author
return "El Draper"

def work
puts "This is coming straight from my Ruby written add-in!"

As you can see, in order to implement the Name and Author properties, we define Ruby methods called get__name and get__author (note the double underscore).

This is all useless unless within my Ruby script I actually call my C# host and pass an instance of my Ruby written add-in. After referencing the Host.dll assembly:

reference_file ‘Host.dll’

I’m able to make the call to the host:


Running this is then easy - once you’ve executed the “setenv.cmd” batch file within the root of the RubyCLR project, simply execute:

ruby Client.rb

(ensuring that Client.rb and Host.dll reside in the same directory).

This then outputs:

[T32dda3e3] : My first Ruby/.Net add-in! by El Draper

This is coming straight from my Ruby written add-in!

(N.B. the type name changes each and every time the script is run, as the concrete wrapper type created around the Ruby code and passed through onto the CLR is dynamically generated at run-time using System.Reflection.Emit).

The above shows that we can define an object that implements a .Net interface within Ruby, and then pass an instance of this into a .Net written host class. It then executes methods directly on the object that itself then executes Ruby code. Pretty snazzy eh!

Like Tim, I have a number of things I’d like to be able to extend this with. For one, I’d like to be able to “compile up” the concrete CLR types representing Ruby objects, and then execute this from within a .Net host, namely a C# application. My work on tweaking the RubyCLR code so far has resulted in being able to correctly output the dynamically generated assemblies, however these types when executed within a C# host application result in memory errors, presumably because it is lacking the reference to the Ruby host context and the original Ruby source file. So I need to be able to instantiate a Ruby object from my compiled emitted assembly, and then somehow build a Ruby context back to the original source file so it can correctly execute the code, but all from within a .Net host. This is really a reverse of the main scenario that RubyCLR I think was probably invented for, but none-the-less I think it should be possible. Any ideas, John? ;-)

Technorati Tags: , , , , , , ,


Sweet deal Aug 17

Hmm, check this out. Seems like a pretty interesting opportunity, in an amazing city…

Technorati Tags: , , , ,


Dirty Bird Aug 14

Good start to the season for the Falcon’s, start as we mean to go on. I’ll be there in a few weeks time, cheering them on as they take on the Jacksonville Jaguars at the Georgia Dome.

Technorati Tags: , , , , ,


Page 1 of 7 | Next page