Post
Pictures of the Flat and Templating Engines

If you ever have the need to make a mini template engine, may I recommend Ruby as the language to make it in? I’ve just spent an hour re-writing the one I wrote a couple of weeks ago in a much nicer way. For those who are curious, here’s an outline of the steps:

  1. Make a Templatable mixin with a single method, generate_from_template
  2. Mix this into a class, populated with some methods and instance variables
  3. In this method, use a regex to parse each # xx var from your template (get the template name from self.class.name, perhaps?)
  4. Take the xx and eval(xx) and sub! back into your line. The eval will, of course, have access to all your variables and methods from your newly Templatable class, as we mixed-in. Make a note of the fact that you can put any ruby code in your eval play around.
  5. Carry on doing this until you’ve run out of # xx to parse.
  6. Write out your fully evaluated template!

Very simple and powerful.

Read More…

Post
Programs will Return

Don’t panic, fair visitors, the programs section will be back once I’ve worked out how to handle static content in The New Ruby Way. I didn’t realise the programs were still used, but I have already received one email asking whether I am going to reinstate them on the site.

In other news, I bought my very first shareware application to help with the site, Panic Software’s Transmit ftp client. They have a synchronise function which will mirror a local directory on the server; in other words, perfect for uploading articles as I can just leave Transmit to synchronise my publish folder, which contains a version of the site ready to publish. It’s even super easy to create an Automator script to do this so it’s just a single click away.

Post
A New Face and Personality (Hello Ruby)

So, you will notice there have been some changes around here. Firstly the site is fairly un-styled right now. The more important change is more hidden. If you glance up at the location bar, you’ll note the extension of the page is now html. That’s correct, old school, non-dynamic hypertext markup language.

You see, I’ve changed how I generate the pages on the site. I now statically generate them on my local computer and upload them. The articles are stored locally in text files which are processed by a ruby script into a publishable set of html files. The script also generates the home page, RSS feed and the archive page (a new feature!). The system isn’t complete or pretty, but I thought I’d get it live sooner rather than later.

Read More…

Post
The View from Melrose Place at Night

The inside of the flat is still too chaotic to photograph and show you, so instead I took some photos of outside the window as it appears under the amber glow of streetlights.

I live just off one of the main streets of Bristol, Whiteladies Road, which is both a fairly major throughfare and the location of quite a few of Bristol’s numerous bars. This is both a benefit and a curse. On the one hand, it feels like you are really in the thick of things, with chatter from the street and cars whooshing up and down. It’s invigorating and feels very lively. In contrast, when you want an early night, it’s not the quietest of places. So far, however, the excitement of being in the thick of things is winning out by a substantial margin.

Read More…

Post
New Abode, Second Day

The second night in the new flat ending, I’ve started to settle in a little. There are still bags and boxes scattered around both the bedroom and the kitchen/living room. I now have three rooms to myself: the living room/kitchen, the bedroom and a squashed up bathroom. Dividing my things between two rooms is proving tricky; previously, having only one room has made the decision moot. I am currently splitting the bags and boxes between each room to see whether each room can fit its allotted bags; if the bags fit, my working assumption is I’ll be able to make the contents of the bags fit too.

Read More…