Monthly Archives: October 2008

Supercharge your irb

Posted in Code, Websites or Tools

I’ve been spending some time in the Rails console lately, and remembered hearing the Rails Envy guys talk about getting more out of irb on a recent podcast. I tracked down the episode and followed the link to Extending Your irb.

Zach gives you a bunch of great tips and provided a .irbrc file, which I used as the base for mine:

#!/usr/bin/ruby
IRB.conf[:AUTO_INDENT]  = true
IRB.conf[:USE_READLINE] = true
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
IRB.conf[:PROMPT_MODE]  = :SIMPLE

require 'irb/completion'
require 'irb/ext/save-history'
require 'pp'

# add ~/.ruby to the library search path
$LOAD_PATH << File.expand_path('~/.ruby')

# load rubygems, wirble and utility belt
require 'rubygems' rescue nil
require 'wirble'
require 'utility_belt'

# load wirble
Wirble.init
Wirble.colorize

class Object
  # print documentation
  #
  # ri 'Array#pop'
  # Array.ri
  # Array.ri :pop
  # arr.ri :pop
  def ri(method = nil)
    unless method && method =~ /^[A-Z]/ # if class isn't specified
      klass = self.kind_of?(Class) ? name : self.class.name
      method = [klass, method].compact.join('#')
    end
    puts `ri '#{method}'`
  end

  def own_methods
    (self.methods - Class.methods).sort
  end
end

I really like the own_methods method.

I also find it useful to string together some methods to display the object in a more readable format, like puts object.to_yaml or puts object.methods.sort.

Advanced Javascript

Posted in Industry Trends, Websites or Tools

When I started writing web applications I spent the vast majority of my time writing server side presentation code. As I progressed and people found out I knew a little bit about databases I shifted towards spending most of my time between designing and implementing data code and server side presentation code.

Now I would say I spend the majority of my time between writing server and client side presentation code, in other words I write a lot more time writing Javascript now than I ever have before and things don’t look like changing.

The majority of my work is with jQuery, but we have projects deployed using standard Javascript and Prototype as well so it pays to have as good an understanding of Javascript as possible. With that in mind I found a great site aimed at teaching some advanced uses of the language. It was written by John Resig who is one of the real leaders in using Javascript in interesting ways, he’s well known for developing the jQuery library but also has his finger in other pies most notable of which is probalby Firebug.

I remember when I started writing web applications that Javascript was almost laughed at, but now I absolutely enjoy writing it and is a massively important player on the web. I think people stopped expecting the user interaction of a web application to naturally lack that of a desktop application a little while ago and Javascript and frameworks like jQuery and Prototype allowed that to happen.

What Can You Make in 48 Hours?

Posted in Ruby on Rails, Websites or Tools

A typical work day is about eight hours give or take. How much time you’re really working inside that eight hours varies from person to person and the quality of work and amount of work definitely varies hugely. The question is, given 48 continuous hours and an idea you wanted to work on what could you achieve?

Taking an application from inception to release inside 48 hours is a laughable proposition to most but this year that’s exactly what a number of people did using Ruby on Rails. It’s an annual event these days called Rails Rumble where teams get together for a weekend and plan, develop and deploy their ideas as applications. The main rules are that it’s developed in it’s entirety onsite, inside the 48 hour period and is done in Ruby on Rails. Teams are small with four being the upper limit allowed.

A list of applications by category was posted here and to be honest there are some truly great ideas. The websites range from comical to serious in style and meet the needs of people, persons and businesses in a wide variety of areas.

Winners that I’ve checked out are :

WantNom – fun site aimed at making getting your friends together for dinner simpler.

Redminutes – a pretty basic site, but the idea is about making collaboration on small notes much simpler.

Couldya – basically using social networking to ask people to do things and track how the task is going. It’s an example of what I think is a reasonable idea that has a lot of implementation to go.

HikedIt – a social networking site dedicated to people that hike and get around outside. It looks very polished and I have a friend who’s been talking about a site kind of like this for ages. Done in 48 hours.

That’s just four of the apparently 200+ applications that were developed to some extent, whether partially or completely finished.

I think the main thing to see here is that all of these applications were developed inside 48 hours by up to four people and to be honest the ones I’ve clicked around that interested me were all more than useable and solved a problem I wanted solved. Could you do this with other languages? Perhaps, but having used a few frameworks myself (ASP, ASP.NET, PHP, Rails) I don’t think any of them come close for rapid development like this.

It makes me excited that we have rolled out a major application recently using Ruby on Rails and that there are still parts of the industry that are fun right now.

Inaugural Management Planning Retreat

Posted in Inside TFG

This weekend marked the start of what will hopefully become an annual event at The Frontier Group. Friday afternoon saw the management team and their partners escape the hustle and bustle of the city, to the much more relaxed and stress free environment of Windmills Break in Yallingup.

Windmills Break is a luxury boutique hotel located in the Margaret River region of Western Australia. It took a lot of searching to find somewhere with respectable internet access, and this turned out to be it. Free WiFi all throughout the hotel, and surrounds (within sight). A perfect place for meetings. The surroundings also meant our partners could keep themselves occupied throughout the day, and after work we could all enjoy the facilities. The hotel was enjoyed by all, the facilities were excellent and the staff were very friendly. 

What really became apparent though, is how clear your headspace becomes when you remove yourself from familiar surroundings. There was no:

  • checking the phone
  • checking emails
  • managing employees
  • thinking about an upcoming appointment
  • worrying about what work needed to be completed after the meeting

This meant that we could stick to our schedule (each agenda item was held to a time limit), and make progress. We managed to successfully tackle every item on our agenda, and come to firm and achievable decisions.

I always find that getting away for a while freshens me up for the weeks ahead. In this case it was working while away, but being able to achieve so much in a short space of time makes this a worthwhile event.

Looking forward to implementing numerous changes and improvements and seeing the company develop as we had towards MPR 2009.

Using screen with multiple tabs in Apple’s Terminal.app

Posted in Code, Websites or Tools

I’ve explored this topic in the past, and even tried my hand at writing some AppleScript when we moved to OS X Leopard. I found a solution way-back-then, and with all the new servers in place I wanted to replicate my setup for these new machines.

My current configuration is like this: I have a dock stack which opens a list of pre-configured Terminal settings. Clicking on a Transformer icon opens a Terminal with four tabs. Inside each tab I SSH to the appropriate machine and reconnect to a named screen session.

Transformer Icons

Sounds complicated, right? It’s not, really.

I thought I’d be able to edit an existing .terminal file and change the necessary settings for a new machine, but that didn’t work. What I need to do is create four seperate Window configurations and wrap them in a single Window Group. Here’s how you do that.

Firstly, open Terminal. Get to the Window menu through Terminal > Preferences... > Settings. Make a new setting and configure all the details as you like. You can also copy an existing setting to use as the base (which is what I did). I called my Window setting “Jazz 1″. Choose the Shell tab and click the “Run command” checkbox. Enter ssh -t jazz 'screen -d -R tfg_1' as the command, and check “Run inside shell.” This means when you open this Window you’ll ssh to jazz (change your server details here) and execute screen.

Now I copy this to Jazz 2, Jazz 3, and Jazz 4. For each Window you’ll need to change the name of the screen session to tfg_2, tfg_3 or tfg_4. You might name your screen sessions differently.

Open a new Terminal and open the Jazz 1 Window by choosing Shell > New Window > Jazz 1. Repeat the same process for Jazz 2, 3 and 4 but choose Shell > New Tab instead. Now you’ll have your four-tabbed Terminal with each tab logged into the remote server. We save this configuration by choosing Window > Save Window as Group... from the menu. Open your Window Group and drag the newly created configuration onto your desktop. You’ll now have a .terminal file on your filesystem which you can use to open this exact configuration in the future.

Change the icon and drag it into the dock and you’re all done!

Twitter

Great web stats at @petrescue , the driving force behind the rebuild of their systems by @frontiergroup . http://t.co/MTvfoxnU

@frontiergroup about 2 weeks ago #

Search Posts

Featured Posts

Categories

Archives

View more archives