Make your own sign here
Archive for the ‘Uncategorized’ Category
Able Technology Sign
Wednesday, March 10th, 2010Country and Currency Code Mappings
Monday, February 15th, 2010I have had a to load a list of valid country and currency mappings for sharesight. It proved difficult to find a current correct list with the mapping between currency and country on the internet that is easily extractable.
wikipedia has a good source of current and obsolete codes – currency codes ISO 4217, country codes ISO 3166.
Here is what we came up with. If anyone knows of a reliable up to date source then please comment.
And to load into your rails app
Recession Busting Free Offer
Thursday, October 1st, 2009

There’s a recession on at the moment, and we’re doing our bit to help ease the pain.
Able Technology is offering a free half-day session with one of our technical consultants. You can use us for any of our usual services during this time.
We have up to four slots available – one for each week in October. The weeks are:
5 October– taken12 October– taken- 19 October
- 26 October
To apply, speak to Nigel on 0800 14-ABLE (0800 142-253).
Small print
- First-come, first-served
- No strings attached
- For new customers only
- Not available to our competitors
Wanted: office space in Te Aro
Tuesday, March 3rd, 2009We’re on the lookout for some office space in Te Aro. Somewhere between 75 and 125 square meters.
Our wish list includes:
- Character
- Earthquake safe
- Showers
- Cycle parking
Would appreciate a call if you’re aware of anything like this.
Sharesight article in the Herald
Saturday, May 24th, 2008There was a great article in the Herald about Sharesight today. Shame it didn’t mention me or Marcus, but it did explain what we’ve been up to.
Check out Kiwi-made online share trading system hits the market.
2008 Budget Calculators
Thursday, May 22nd, 2008We’ve just put together a calculator to work out your savings from Michael Cullen’s Budget 2008. It’s on the Sharesight website here:
Increment Ruby on Rails migration number
Thursday, May 1st, 2008We recently needed to create a new database migration, and needed to insert it into at certain position. Normally what I have done in the past is to alter the migration index of an existing file or two.
But this time, it needed to go in at 003. I was going to have to manually increment about 30 or 40 migration scripts. So, it was time to apply my Ruby skills to do it automatically.
Here is the result:
case ARGV.size
when 1, 2
from_index = ARGV[0].to_i
dir = Dir.new(’.')
file_list = dir.to_a.sort
file_list.each do |fn|
if fn =~ /(\d{3})(.*\.rb)/
index = $1.to_i
if index >= from_index
index += 1
new_name = case index.to_s.length
when 1
“00#{index}#{$2}”
when 2
“0#{index}#{$2}”
else
“#{index}#{$2}”
end
puts “Converting ‘#{fn}’ to ‘#{new_name}’”
File.rename fn, new_name if ARGV[1] == “RUN”
else
puts “Skipping ‘#{fn}’”
end
else
puts “Ignoring ‘#{fn}’”
end
end
else
puts “Usage: #{$0}
puts ” where”
puts ” number – migration number to start from (mandatory)”
puts ” RUN – add to run to make the changes (default does not rename)”
end
So when you run it, you will get output such as:
Instructions
- Cut and paste the file, or download it from increment_migrations.rb.
- Save it somewhere
- Make it executable
chmod 755 /path/to/increment_migrations.rb - The change directory to ./db/migrations
- then run
/path/to/increment_migrations.rb 3 - and if the output looks as expected
- finally run
/path/to/increment_migrations.rb 3 RUN
Finally, thanks to the client for permission to publish. Thanks for giving back to the community!
Work-around for running Rails/Apache in a subdirectory
Friday, April 11th, 2008I’ve just configured Rails to run in a subfolder on a client’s website. Ran into a few issues, that are worth documenting:
In this configuration, you can visit the Rails site by visiting something like http://www.hostname.com/coolsite/
1. There is a Rails bug (ticket 10913) that effects links to assets. I have a link to our combined stylesheets defined as:
The bug is that Rails looks for all of your stylesheets in /public/coolsite/stylesheets/*.css, where ‘coolsite’ is the name of your subdirectory. Obviously, it should not be including the ‘coolsite’ folder in the path.
The workaround I use, is to create a soft link after capistrano deploys the code to our production server. I added this to my /config/deploy.rb file.
after “deploy:update”, “create_apache_prefix_link”
Now, whenever you do a cap:deploy, a soft link will be created in your public software, and this will allow Rails to resolve the stylesheet (and other asses files) in the faulty path. When the ticket is fixed, just remove the capistrano task.
View YouTube videos in high def
Wednesday, March 26th, 2008YouTube offer a higher definition version of their videos. It doesn’t seem to be available by default. You need to append this string to the end of your URL, and reload the page:
If you have Firefox, you can add this as a Bookmarklet. Then when you are viewing a video on the YouTuby website, click this bookmarklet, and the page will reload in HD.
Here is the bookmarklet
Right-click, and select “Bookmark this link”, or just drag it into your Bookmarks Toolbar.
More details are available on the YouTube blog
spec’ing with BigDecimal
Wednesday, March 26th, 2008If you are creating specs comparing BigDecimals to a hard coded float value, you may find that some comparisons just dont work even when the numbers are supposedly the same (see Floating point accuracy problems)
‘total invoiced amount should be 100.15′ FAILED
expected: 10.15,
got: 10.15 (using ==)
What we are testing is the value and the type, the correct way of achieving this may be…
If you want to round the big decimal to a float with 2 decimal places you could also use
