A Django site.
August 19, 2010

Learning and Corporate Development - Entries
Learning and Corporate Development - Entries
Learning and Corporate Development - Home is about »
» SCRUM (Agile Methodology)


To succeed in software development in today’s environment we must deliver with speed and flexibility, old methods of developing are beginning to fail due to customer’s requirements and priorities frequently changing.

Scrum’d up

Scrum is an agile process that enables us to deliver the best possible product in the shortest time.
Scrum promotes rapid software development that is inspected every 2-4 weeks.

The business sets the priorities. Teams self organize and find best ways to deliver.

Software is demonstrated every 2-4 weeks, decisions are made to release, continue or refine.


•    Self-organizing teams
•    Product progresses in a series of sprints (Fortnightly in our case)
•    Requirements are stored in a “Product Backlog” (Pivotal Tracker)
•    Full specification unknown

Agile Manifesto


An iteration of work, functionality is implemented during a sprint.  

The sprint starts with a one-day sprint planning meeting. Many daily Scrum meetings occur during the sprint (one per day). At the end of the sprint there should be a sprint review meeting, followed by a sprint retrospective meeting.

During a sprint the product is designed, coded and tested. Traditional methods of developing would separate these techniques, scrum teams do a little of everything all of the time.

During a sprint is not the time to make changes!

Scrum Framework


  • •    Product owner
  • •    Scrum Master
  • •    Team


  • •    Sprint planning
  • •    Sprint review
  • •    Sprint retrospective
  • •    Daily scrum reporting


  • •    Product backlog
  • •    Sprint backlog
  • <u>Roles</u>

    Product owner
    •    Define product features
    •    Decide release date and content
    •    Responsible for profitability of the product
    •    Prioritise features according to value
    •    Adjust features and priorities, at every iteration if needed
    •    Accept/reject work

    •    Represents management to the project
    •    Enacts Scrum values and practices
    •    Removes barriers
    •    Ensure team is productive/functional
    •    Enable close co-operation across roles and functions
    •    Remove external interferences

    •    Cross-functional (Programmers, testers, user experience designers)
    •    Should be full time
    •    Self organizing
    •    Membership should not change mid sprint


    Sprint planning

    The Sprint planning meeting is a negotiation between the team and the product owner about what the team will do during the next sprint.

    The product owner and all team members agree on a set of sprint goals, which is used to determine which product backlog items to commit from the uncommitted backlog to the sprint.

    Typically the team will then excuse the product owner from the room and break the backlog Items down into tasks. The product owner is expected to be on call during this phase (previously called the sprint definition meeting) for renegotiation or to answer questions that affect the time estimates. This portion of the sprint planning meeting is time-boxed to four hours. Sometimes teams insert placeholder tasks (with rough estimates) for the product backlog items they don't expect to start working until later in the sprint.

    Sprint review

    Team shows what the sprint has accomplished; this is often a quick demo of new or refined features. If no visible changes have been made it may be worth explaining that time has been spent refactoring code.

    This is an informal meeting that needs minimal preparation, invite the whole team and others.

    Sprint retrospective

    The sprint retrospective meeting is held at the end of every sprint after the sprint review meeting. The team and ScrumMaster meet to discuss what went well and what to improve in the next sprint.

    The product owner does not attend this meeting.

    The team should take time to reflect on what is working and what is failing.

    What should the team:
    •    Start doing
    •    Stop doing
    •    Continue doing

    Daily scrum reporting

    •    Daily
    •    Short (15 minutes)
    •    Can be stand up

    This is not a time for solving problems.
    Helps to avoid further meetings.

    Each team member should answer 3 questions:

    1.    What have I done since the last scrum?
    2.    What will I do before the next scrum?
    3.    What may stop my progress?


    Product backlog

    •    The requirements
    •    A list of all desired work on the project
    •    Ideally expressed such that each item has value to the users or customers of the product
    •    Prioritised by the product owner
    •    Reprioritised at the start of each sprint

    The requirements of the system are held in a backlog, this is a prioritised list of work to be completed.  These jobs/tasks are made up features, chores and bugs.

    The product owner should take responsibility to prioritize the product backlog. During a Sprint planning meeting, backlog items are moved from the product backlog into a sprint.

August 11, 2010

Learning and Corporate Development - Entries
Learning and Corporate Development - Entries
Learning and Corporate Development - Home is about »
» Rails... Staying on 'track' with partials

I've recently started developing in Ruby on Rails and I just thought I'd dump some of my new found knowledge somewhere, so that maybe it would help me again in the future.

Before using rails I was well into my ASP.NET and the move is obviously very different. I feel myself trying to think of how to do things in rails the way I would have done it in .NET... this is BAD! Each time I ask a question in the office about doing something, the first response is normally "why do you want to do it". Most of the time, my answer is "this is how I did it before" :)

Anyway, I will learn, in time, to leave the .NET methods behind me and embrace this so well renowned language.

During my learning process there is one aspect of Rails which did make me quite excited, this part is partials.

Partials make cleaning up your code insanely simple and just make the programming experience far more enjoyable. I've used a similar idea in .NET before, using UserControls, but partials are just so much simpler.

Below I talk about a couple of things I've found out today, I'll try and make this more comprehensive and more factual (!) as time gores on and I start using partials in more scenarios.

My Environment

Ruby: 1.8.7 Rails: 2.3.2

Using a single partial

Lots of the examples on partials I've read online all discuss the various ways they can be called..

Example uses 'user' controller to manipulate users of a system.

I've found the following statements online and all should work when your partial file is called '_user.html.erb'

render :partial => @user
render :partial => "user", :object => @user
render :partial => "user", :user => @user
render :partial => "user", :locals => { :user => @user }

If you have a partial that is called the same as your controller, e.g. '_user', then you might aswell go with the first example as I believe this is the latest implementation and rails does a lot of the work for you. You don't have to worry about passing :object or :collection, it just works out which it is and gives you the correct instance variable 'user' in the partial file.

But what if you want more than one partial?

The above methods would be fine to use for a form or a list, but you wouldn't really want to use the same one for both, as the list will have a different structure to a form.

I did go down the road of having some conditions in the one partial to identify whether the form should be rendered or the table (for the list). But this just over complicates things for no reason.

When I seperated the functionality into two partials: '_userForm' and '_userList', I started having problems with the instance variable that is generated for me.

It turns out, that the following code creates an instance variable called 'userForm' rather than 'user' inside the partial

Example - Code to render the form partial

render :partial "userForm", :object => @user

So I then wrote the following code, thinking it was the new way to cope with this, but it just seemed to break the functionality.. When using 'user', you get 'user' is undefined and when you use 'userForm' as the instance variable, you get invalid use of nil.

render :partial "userForm", :user => @user

So to get around this I used the '_user' partial for the form / details page and the '_userList' partial for the listing of data.

Example - Calling the form partial ('_user')

render :partial => @user

Example - Calling the list partial ('_userList')

render :partial => "userList", @collection => @users, :as => :user

Now that I've finished my first ever blog post I've realised that I will need to edit this and break it down to actually get to a point!! Please take anything I've said in this post with a pinch of salt as I've posted examples from memory :). To be continued... / refactored! If you want a very good reference to partials, the best one I've found is this: http://guides.rubyonrails.org/layouts_and_rendering.html

» Rails Console SQL Output

It is sometimes useful when in Rails Console to see the SQL produced when testing model relationships.

So you start up "Rails C" or for people on older versions of Rails "script/console"

First run this line:

<quote>ActiveRecord::Base.logger = Logger.new(STDOUT)</quote>

Lookup some record and you will see the SQL (If you are using a SQL database) that was produced:

May 21, 2010

Learning and Corporate Development - Entries
Learning and Corporate Development - Entries
Learning and Corporate Development - Home is about »
» Rails 3 Beta and RVM

Rails Version Management (RVM) and Ruby 1.9.1

Run this in terminal:

mkdir -p ~/.rvm/src/ && cd ~/.rvm/src && rm -rf ./rvm/ && git clone git://github.com/wayneeseguin/rvm.git && cd rvm && ./install

Read the output, it will tell you to add a line of code to your bash_profile.

Then run:

rvm install 1.9.1

this will install ruby 1.9.1, may take some time.

As long as this is successful then run:

rvm 1.9.1 --default

This will set ruby version to 1.9.1 and make it the default for new terminal screens.

To Change version type:

rvm system
To view all versions type:

rvm list

Installing Rails 3 beta

To install Rails 3 Beta run these two lines of code:

gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
gem install rails --pre

If you want to use SQL Lite for your app:

gem install sqlite3-ruby

MAKE SURE not to use "SUDO", this is no longer required when installing gem!

Create a new Rails application:

rails beta
cd beta

To run the server you will need to type:

rails server

No more script/server!

May 18, 2010

Learning and Corporate Development - Entries
Learning and Corporate Development - Entries
Learning and Corporate Development - Home is about »
» GitHub

A great resource for learning Git:


March 29, 2010

Learning and Corporate Development - Entries
Learning and Corporate Development - Entries
Learning and Corporate Development - Home is about »
» JavaScript Loop Checkbox Array

Looping through an array of elements

A list of records in a form required two tick boxes, each an array holding the id of the record. Only one box should be ticked:

The HTML of the Check boxes:

input type="checkbox" value="22" onchange="reject_check(22)" name="confreject_ids[]" id="confreject_ids_"

input type="checkbox" value="22" onchange="accept_check(22)" name="confaccept_ids[]" id="confaccept_ids_"

  • On clicking a check box the function is called and the ID of the record passed, so if an accept checkbox is pressed then the reject_check(id) function is called.
  • The script sets a variable to the array of checkboxes
  • Sets a variable to the number of checkboxes
  • Loops through the check boxes and checks the value it holds.
  • If the value equals what was passed through to the function then it is the check box belonging to that record and it is unchecked.

February 3, 2010

Learning and Corporate Development - Entries
Learning and Corporate Development - Entries
Learning and Corporate Development - Home is about »
» Ruby on Rails - Code Escape

A quick Ruby tip for breaking up a long line of code:

def app_state
if self.title_id != nil and self.title_id != '' \
and self.given_names != nil and self.given_names != ''\
and self.surname != nil and self.surname != '';
return true
return false

Use \ at the break point of each line and ; at the end of the last line.

February 1, 2010

Learning and Corporate Development - Entries
Learning and Corporate Development - Entries
Learning and Corporate Development - Home is about »
» Ruby on Rails Authorising Ownership

Given an application has users and tasks.

A user signs into a website and would like to see their tasks, you define:

def index

@tasks = current_user.tasks.all


This is fine as only the logged in users tasks will be shown.

The problem is usually in the show definition, most show methods will look like this:

def show

@task = Task.find(:params[:id])


The problem with this, a user logs in to the website, and follows a link to a specific task they will see in the URL:


If the user changes the URL to:


They are able to view a task that does not belong to them.

A solution to this is to change the lookup to include the current user:

@task = current_user.tasks.find(params[:id])

This will only return the record if it is owned by the current user, other wise an error is returned.

December 11, 2009

Learning and Corporate Development - Entries
Learning and Corporate Development - Entries
Learning and Corporate Development - Home is about »
» Mounting a Windows Share on Linux


Mounting a Windows Share

In this instance the connection to the Windows share is from a Ubuntu server. Open terminal on your Mac and connect to the server you wish to mount a new drive on:

ssh -p 8888 user@stagingserver.isd.domain.ac.uk

Change Directory to ‘etc’

cd /etc

Then open fstab using the VI editor:

sudo vi fstab

Add a new line to the file:

//servername/share /mnt/share smbfs user,credentials=/etc/samba/cred-file,uid=user,gid=users 0 0

The key values here are:

(server/share) (mount point) (File System) (Options)

The mount point must exist:

cd /mnt

sudo mkdir share

sudo chown user:user share

This will create a new directory named “share” and grant ownership to “user”

Next install Samba and smbfs using aptitude

sudo aptitude install smbfs

sudo aptitude install samba

Change directory to /etc/samba and create the credentials file:

cd /etc/samba

sudo touch cred-file

sudo vi cred-file

Add windows user credentials to the file:

username=domain/user password=blahblah

Now remount all directories in the fstab file using:

sudo mount -a

To view information on the current mount’s run:

df -h

December 9, 2009

Learning and Corporate Development - Entries
Learning and Corporate Development - Entries
Learning and Corporate Development - Home is about »
» Basic UNIX Vi Usage

Using Vi from the terminal window to edit files

Basic Cursor use

  • k Up one line
  • j Down one line
  • h Left one line
  • l Right oen character (or spacebar)
  • w Right one word
  • b Left oen word


  • i Enter text entry mode
  • x Delete one character
  • dd Delete a whole line
  • r Replace a single character
  • R Overwrite text, <esc> to end


* To exit you must be in command mode-press <esc> if you are not in command mode * You must press <return> after commands that begin with a : (colon)
  • ZZ Write (if there were changes), then quit
  • :wq Write, then quit
  • :q Quit (will only work if file has not been changed)
  • :q! Quit without saving changes to file