XSLT using Ruby
January 31st, 2008
Short Story
libxsl-ruby is a nightmare to install. If you can indeed get it to install at all. I couldnt get the bloody thing to install at all on my 10.5 OSX box; and thats with ALL the required libs installed. I get the impression that its not very well maintained anymore and the project following has dropped off.
I turned to ruby-xslt – based on REXML, so yes, its slower. If your looking for speed then persist with the libxsl ruby path, but otherwise, save yourself a lot of time and just use this. Its vastly simpler!
Long(er) Story
Libxsl sucks. Strong statment I know. I would say im a fairly techincal chap, and ive just spent, nay, wasted, the last 3 – 4 hours trying to work out why libxsl-ruby wont install. Thats a bit of a bugger indeed. Who knows what the problem is, but ultimately its less portable due to reliance of the Gnome XML parsing libs. Granted there very fast, but thats no help at all if you cant even install them.
REXML vs Libxml is a non-contest. We all know libxml is significantly faster – if you need that speed then i strongly advise you to continue with libxml; it will pay dividends in the end. If however your not going to need very fast parsing, then really, save yourself a lot of wasted time and use REXML.
REXML is bundled with the ruby distribution, so its also a lot more portable that libxml2. Anyway, if your even still reading, stop now, and bosh this into your terminal:
sudo gem install ruby-xslt
Job done.
Flash: Go To And Learn
January 29th, 2008
I stumbled upon this the other day; it looks to be a really really great resource if your wanting to get up to date with all the latest flash goings on!
For the rubber band flicking child in us all
January 20th, 2008
Santa, this Christmas I would like a rubber band gatling gun….
Deploying Ruby WebGen with Capistrano
January 11th, 2008
WebGen is a groovy little tool that makes building HTML sites a lot simpler, and makes maintenance a lot more efficient via clever templating. I wont labour the pro’s and con’s of the project here, I’ll just get on with explaining how to deploy version webgen sites using our good friend Capistrano.
First off, install Capistrano:
$ sudo gem install capistrano -y
Next, we need to prepar our webgen dir with all the relevant deployment information. All these commands presume you have ‘cd’ to the webgen project directory Capistrano provides a simple way to do this
$ mkdir config
$ capify .
Next we need to setup our new deploy.rb file, mine looks a little something like this:
set :application, "yourapplication.com"
set :repository, "svn://yourhost/path/to/webgen/site/output"
# If you aren't deploying to /u/apps/#{application} on the
# target servers (which is the default), you can specify
# the actual location via the :deploy_to variable:
set :deploy_to, "/var/www/sites/#{application}"
# If you aren't using Subversion to manage your
# source code, specify your SCM below:
# set :scm, :subversion
set :user, "deploy"
set :svn_user, "badger"
role :app, "yourapplication.com"
role :web, "yourapplication.com"
role :db, "yourapplication.com", :primary => true
# Overrides the default task supplied by cap, as this
# is a static site there are no mongrel's et al
# that need restarting
desc "Deploy webgen site"
deploy.task :restart do
puts "Using webgen, so nothing to restart"
end
# also, because we have configured logging via our HTTP
# server (e.g. nginx, apache etc) we have no need for this
# part of the deployment phase to we again, just override it
# with an arbitrary message
desc "Override default cap behavior for finalize_update"
deploy.task :finalize_update do
puts "We dont need no stinking logs..."
end
Now, all being well, we need to setup the server to respond to cap:
$ cap deploy:setup
Then we should be able to deploy our project with no problems!
$ cap deploy
I hope this was of use to someone, somewhere, sometime :)
Intergrated support for text messaging from merb
January 5th, 2008
Well, I got board – what can I say!
If you have a signup.to account you can enjoy really seamless intergration with merb for sending messages :)
All you need to to send a SMS is write something like this in one of your controllers:
send_sms(ExampleMessenger,
:some_method,
{ :from => "02UK",
:to => "44123456789" })
Thats pretty dang sweet; its also all very MVC, using its own messaging controllers (complete with generators) and ERB files for the message content. Lovely.
If anyone gets use out of it, I would really love to hear about it – download the gems here
Is Rails no longer the flavor of the month?
January 5th, 2008
Firstly, I read this blog post by Zed Shaw. Quite frankly I was disgusted that someone who has given so much to our community has been treated so poorly by prominent figures within our very inner circles and the major vendors. I must point out I do not know Zed, Ive never met him, nor will I likely ever meet him, but yet he helped me many times way back in the early days of mongrel, as im sure he did with countless others – and for that, he gets my respects and applause.
His blog posts about the problems with Rails echoed conversations I have had multiple times of late with various other developers and architects. People feel rails is bloated and has a lot of inefficiencies – which is true, and whilst 2.1 is leaner, it could still do with a good going over at fat camp… That sounds bad I admit, but I am not ignorant of the fact that we do have an awful lot to thank Rails (and DHH especially) for – the ideas behind Rails have changed the way the whole development community look at there working practices from start to finish. The shear magnitude of that is mind-blowing.
Personally, Rails has changed the way I look at code, the way I think and more – this blog is even powered by rails. Despite all that, when I build a Rails project now, I cant help but feel, well, a little bit dirty. Initially in my Rails career I loved the way that the bulk of the complexity was abstracted far far away down the rabbit hole – thats not because I was an incompetent coder – it was just new and exciting, and seemed like such a great idea at the time (like so many other things…). Now however, I feel like we need more; more control, more transparency in our frameworks and tools. Less black boxes and more turner-prize type glass ones!
I ask you the reader one thing: Is it time we said farewell to Rails? Or is it a case of the grass is greener on the other side?
Some of you reading this might be thinking that this is all well and good, but what the hell are we going to use to build our projects. Well, I have been putting a lot of time into the Merb framework recently, and it is, categorically, awesome, not to mention thread safe ;) Working with it feels just, well, better. Ezra has crafted a great framework that has taken heed of Rails’ shortcomings, that my friends can only be a good thing…
Anyway, I’ll be posting some Merb tutorials up here soon, so I hope you will give it a try and let me know how you get on.
Happy coding guys, and farewell Rails, its been emotional!
