Developer Rehab
My unemployment is over! Last week I started as a developer with Rehab Studio. Code on!
My unemployment is over! Last week I started as a developer with Rehab Studio. Code on!
At the moment I’m in between paid work and have been using my time to generally enjoy life but to also improve my skills. I’m all about the skills.
As an act of deliberate practice to hone my skills with web-application development and to deepen my understanding of the Rails framework I’ve been adding to my collection of nano-apps.
A while back I had an idea to develop a URL shortener just to see how little code would be required but decided the world really didn’t need another one. With time on my hands over Easter & the curiosity of a technology entusiast I just started hacking and had a functioning prototype within a short time-frame.
I wasn’t keen on parting with my shiny pennies for a domain name considering my lack of income but I’d written the code and thought I’d may as well go the whole hog and get my work into the wild.
So, without further ado, I present io.gd . As usual, code is available on GitHub.
Well, it only took me 2 and a half years but I finally used Rails to develop a catalogue for my DVD collection.
The catalogue loosely fits in with my series of nano-apps and is hosted on movies.stevenwilkin.com. The code is publicly available on GitHub for anyone who’s interested.
All’s left now is to actually use the system and fill in the details of my collection!
In my last post I considered transforming stevenwilkin.com into a Sinatra app.
Well, I did it, although I’m only mentioning it now.
Not only was this my first experience with Sinatra but I also decided to try using HAML for the markup and Blueprint CSS to help with the styling. If I’m going to play with a new technology why not play with a few new technologies?
I found Sinatra quite straight forward: you match up a HTTP verb (eg ‘GET’) and a url (eg ‘/’) with a block of Ruby and the results can be sent directly to the browser or an optional view template can be rendered. Simple!
Instead of a Model-View-Controller pattern like many of us are accustomed to, Sinatra provides more of a Controller-View setup which I believe would make it more suited to smaller apps which don’t necessarily make use of a database or where a full-stack framework like Rails would be overkill. If I create any more nano-apps in the future I’ll more than likely use it again.
What really struck me during this experiment and made the whole thing worthwhile was HAML. The simplicity and clarity of it’s syntax was super refreshing and meant I had to do a lot less typing and didn’t have to remember to close divs etc, never mind it being white-space sensitive! All Ruby-based web development I’ve done since has used it.
I wasn’t fussed on Blueprint. I found having a grid background during the *ahem* design phase to be great but I probably didn’t make enough use of it’s features for it to really shine through. In terms of styling and CSS I didn’t take much time to look at SASS and didn’t use it, but I’ve since reread the documentation and may well make use of it in the future.
The app was deployed onto Passenger, like my previous experiments. It took a small bit of google-fu to get the Capfile and Rack configuration tweaked correctly but once this was done pushing the code into production with Capistrano was a breeze. How did I ever survive without Capistrano?
The deeper I get into Ruby the cruder PHP seems, not to mention C#. The future seems exciting.
I released my first production Rails application, hugagoth.com, last night.
I first started playing with Rails over 2 years ago and it has taken me until now to take an app through from conception to initial deployment. And an interesting journey it has been.
When I first started investigating Rails I had never used a web framework before and the Ruby language really confused me, but there were a few things I liked. I liked the idea of convention over configuration, opinionated software and the amazing community that has built up around this set of technologies.
Not long after this, I started work on another project and considered using it as the motivation to fully get to grips with Rails, but getting the job done was more important so I headed down the PHP route, having had a bit of experience with it over the years. I’m amazed that I now have 2 years of CakePHP development experience. It gets a bad rep concerning it’s performance speed but if I’m doing any bespoke PHP work, Cake is never far away.
Deploying Rails apps a couple of years ago seemed like quite an involved process, what with application servers, web servers, proxies and clusters but now with Passenger, getting a production environment up and running is a breeze. I’ve also developed a great love for Capistrano, using it with non-Rails apps.
Calling hugagoth.com my first Rails app in the wild is a bit of a lie. When I discovered Passenger I wanted to see just how easy deployment now was so I converted my static, single-page professional site into a Rails app. A bit overkill I know as it doesn’t even do anything, but a worthwhile experiment none-the-less.
It’s unlikely I’ll ever use Rails in my current day job so I’m unsure what I’ll be doing with this framework in the future. I’ll probably convert stevenwilkin.com to run on Sinatra just for kicks and if any interesting ideas come to mind, you never know!
Last month Giles Bowkett in the trawls of his hypergraphia wrote a post on Nano-Apps, quirky one page apps which serve up a piece of trivia or answer a question like is George W. Bush still president?
Previously I had put together hometi.me, a little AJAX-y app to let me know how much longer I had to go until I could leave work for the day and when a new nano-app reporting Belfast’s goodonpaper’s coffee drinking habits surfaced the bug bit me and I wanted to do something and do it quick.
I had the embryo of an idea on a Sunday and had production code on the following Saturday morning.
The app attempts to answer the question is it raining in Belfast? by scraping the MET office forecast for Belfast and sometimes gets it right. It has a Ruby back-end and PHP front-end and is available on GitHub for anyone interested. The graphics need tweaked and it would no doubt be better displaying the weather that was previously forecast for the current time period, but it’s out there doing it’s thing which was the point in the exercise.
During this process something that caught my eye is Sinatra, a Ruby framework suited to creating web-apps with minimal code. Now all I need is a idea to implement with it…
To date, a lot of interesting applications have been built on top of the Twitter service with new apps being released almost daily, each one more ingenious than the last.
In my spare time I’ve been tinkering with Ruby, my motivation being to learn something new and to see if Ruby lives up the hype that has been surrounding it in recent years. In conjunction with this I’ve also been experimenting with obtaining content from existing web sites and services, content being king after all.
On my list of software development goals I’ve wanted to do something with Twitter but have been lacking the all important idea of which problem to solve. Considering my learning objectives I decided to just get stuck in and see what basic task I could accomplish that involved:
After looking at the API retrieving the list of followers for a given account seemed doable.
If I were to undertake a non-trivial Twitter application I’d consider using Twitter4R rather than writing all the REST interaction from the ground up. Another possibility would be to request JSON rather than parsing XML with Hpricot. The luxury of decisions.
The result of my tinkering is followers.rb which lists the followers of the account accessed with USERNAME:PASSWORD credentials:
#!/usr/bin/env ruby # followers.rb # retrieve list of followers from Twitter # SJW require 'net/http' require 'base64' require 'rubygems' require 'hpricot' user = 'USERNAME' pass = 'PASSWORD' host = 'twitter.com'; path = '/statuses/followers.xml' auth = 'Basic ' + Base64.encode64("#{user}:#{pass}").delete("\n") # authenicate and retrieve XML, feeding it into Hpricot doc = '' Net::HTTP.start(host) do |http| res = http.get(path, 'Authorization' => auth) unless res.code == '200' puts "An error occured" exit end doc = Hpricot(res.body) end # each follower is within a <user /> users = doc/:user # count the number of followers count = "#{users.length} followers:" puts count count.length.times {print '-'} puts "\n\n" # output each name and corresponding twitter account name users.each do |u| name = (u/:name).text screen_name = (u/:screen_name).text puts "#{name} | @#{screen_name}" end
My friend John Devlin, also know as “Tripper J,” is dead 2 years today. He was 29 when he finally lost his battle against an incurable, progress and fatal disease. As a memorial I’ve setup tripperj.com.
We all still miss you John.
A couple of months ago I decided to add some variety to my strength training program.
The main change has been to alternate between front and back squats. The higher frequency with the back squat has brought some much needed practice to an exercise I find mechanically more difficult to perform, quite possibly due to difficulties with my right knee I had when I was a teenager.
Through the influence of stronglifts.com I’ve developed an interest in the olympic-style lifts and have been practicing the power clean twice a week. This has brought an extra dimension of power, speed and technique to my training and proved a “tonic,” bouying my enthusiasm for lifting.
The final change has been to train all the different pull-up/chin-up grips: neutral, supinated and pronated. The pull-up has been quite a challenge and I’ve really had to focus on progress, not perfection, leaving my ego at the weights-room door and emphasising strict form at all times.