Able Technology Sign

March 10th, 2010

Able Tech

Make your own sign here

Country and Currency Code Mappings

February 15th, 2010

I 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

Recurring billing of expired credit cards

January 13th, 2010

At Sharesight [www.sharesight.co.nz] we operate an online, subscription based portfolio management for DIY share market investors. For convenience, most of our customers choose to pay by credit card, and we bill them on a recurring basis, either monthly or annually. When customers subscribe, we make it clear to them that we will bill their card on a recurring basis (and, most importantly, we also make it easy for customers to cancel their subscription whenever they want).

We use the ActiveMerchant plugin (Ruby on Rails) to connect to the DPS Payment Express payment gateway. DPS connects to our BNZ Buyline merchant account which allows us to bill customers in both NZD and AUD. When we pass through a customer’s card details to DPS they return a billing token, and when we need to bill the card in the future, we simply send through the appropriate billing token to DPS along with the amount to be billed (this amount may change if customers upgrade or downgrade their accounts). This saves us from having to store our customers’ credit card details, and worry about the security issues that this entails.

Expired Credit Cards

Until now, the only real issue that we faced was the problem of expiring credit cards. Credit cards generally expire every two years (sometimes more frequently), primarily due to the fact that this is the life expectancy of the magnetic strip on the back of the card. When a customer’s credit card expired, they needed to provide us with the updated card details, otherwise when we tried to charge their card, we would receive a ‘card expired’ error back from DPS. Clearly this somewhat limits the convenience factor for our customers, in fact many customers told us so, pointing out that their card number hadn’t changed.

The solution, as it turns out, is a little known feature called the recurring billing flag. Essentially when a payment is sent through to the bank with the recurring billing flag set, they will (generally) ignore the expiry date when processing the transaction. I came across this feature via this blog post, but could not find it documented anywhere in the technical documentation provided by either the bank or DPS. A quick call to a knowledgeable staff member at DPS, confirmed that they could in fact set this flag for us provided that we obtained written permission from the bank. Luckily we had no problem in obtaining prompt approval from the BNZ, and we were able to have the recurring billing flag enabled on our transactions within a couple of days.

I hope this knowledge is useful for other SaaS vendors who bill customers on a recurring basis. From what I understand, the banks may have different policies on allowing the recurring flag to be set.

Please let us know your experiences.

Special guest post by Scott Ryburn.

Oauth presentation

December 2nd, 2009

He is a copy of my Oauth presentation [806 kB] from tonight's WellRailed group. I discussed Oauth from both a client and a server perspective. Plenty of examples from Sharesight, where we are building an API.

Here is the example test.rb

I also discussed LoadStorm.com, which has a free plan that allows up to 50 simultaneous users. I recommend you check them out.

Korimako (Bellbird) iPhone ringtone

November 27th, 2009

bellbird
I’ve been enjoying listening to New Zealand native birds as ringtones on my iPhone. Here is one of my favourites – the Korimako, or Bellbird [164 kB].

You are welcome to share this with your friends and redistribute – as long as you retain the copyright information contained within the file.

To add it to your iPhone, just download the file and then double click it. It should open iTunes and import itself. It will be copied to your iPhone next time to connect it to your computer.

Let me know in the comments if you like it, and I’ll create some more. Any requests?

Recession Busting Free Offer

October 1st, 2009

special-offer
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 – taken
  • 12 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

Macbook Pro Speed Test

September 11th, 2009

With the Sharesight test suite (ruby/rails/mysql && rake test), i tested the performance of my the new MBP on Snow Leopard.

I save 16 seconds per run – its going to take a while to pay for itself…. But about 22% faster, which is not too bad.

Macbook Pro (March 06) 1.83GHz 2G Ram
real 1m29.464s
user 0m50.348s
sys 0m5.812s

Macbook Pro (Sep 09) 2.53 GHz 4G Ram
real 1m13.450s
user 0m43.662s
sys 0m3.280s

Installing Centos on VMWare Fusion

August 5th, 2009

I recently created a couple of Centos virtual machines, and took notes of all the steps. You can use these notes for both installing another VM, or for building a production server.

We used these VMs for running staging and production instances of a Ruby on Rails deployment.

Install Centos 5.3 64 bit

VM configuration settings

- Redhat Linux Enterprise 5 64 bit
- 30 GB drive
- 2 CPU
- 1 GB memory
- Network: bridged

Server install settings:

- use default settings for drive partitions
- set network address to: IP_ADDRESS_GOES_HERE IP version 4
- hostname: HOSTNAME
- gateway: GATEWAY
- primary dns: DNS1
- disable IP version 6
- net mask: 255.255.255.0
- timezone: Pacific/Auckland
- System clock uses UTC: tick
- set root password to PASSWORD_YEAH_RIGHT
- Additional tasks: none

SETUP TASKS

- yum update
- yum install sudo
- adduser nigeluser
- passwd nigeluser
- adduser marcususer
- passwd marcususer

visudo

- add lines at bottom of file:
nigeluser ALL=(ALL) ALL
marcususer ALL=(ALL) ALL

PACKAGES

- sudo yum install ruby
- wget http://rubyforge.org/frs/download.php/58677/ruby-enterprise-1.8.6-20090610.tar.gz
- tar xvfz ruby-enterprise-1.8.6-20090610.tar.gz
- sudo yum install httpd
- sudo yum install gcc-c++
- sudo yum install zlib-devel
- sudo yum install openssl-devel
- sudo yum install readline-devel
- sudo ./installer (ruby tar directory)
- sudo ln -s /opt/ruby-enterprise/bin/cap /usr/bin/cap
- sudo ln -s /opt/ruby-enterprise/bin/capify /usr/bin/capify
- sudo ln -s /opt/ruby-enterprise/bin/erb /usr/bin/erb
- sudo ln -s /opt/ruby-enterprise/bin/gem /usr/bin/gem
- sudo ln -s /opt/ruby-enterprise/bin/integrity /usr/bin/integrity
- sudo ln -s /opt/ruby-enterprise/bin/irb /usr/bin/irb
- sudo ln -s /opt/ruby-enterprise/bin/rails /usr/bin/rails
- sudo ln -s /opt/ruby-enterprise/bin/rake /usr/bin/rake
- sudo ln -s /opt/ruby-enterprise/bin/rdoc /usr/bin/rdoc
- sudo ln -s /opt/ruby-enterprise/bin/ruby /usr/bin/ruby
- sudo yum remove ruby
- sudo yum install httpd-devel apr-devel
- sudo yum install mysql-devel
- sudo /opt/ruby-enterprise/bin/passenger-install-apache2-module
- sudo yum install mysql-server
- sudo /sbin/chkconfig httpd on
- sudo /sbin/chkconfig mysqld on
- sudo yum install ncurses-devel
- wget http://downloads.sourceforge.net/sourceforge/htop/htop-0.8.3.tar.gz?use_mirror=transact
- tar xcfz htop-0.8.3.tar.gz
- cd htop-0.8.3
- ./configure
- make
- sudo make install
- wget http://kernel.org/pub/software/scm/git/git-1.6.3.3.tar.bz2
- bunzip2 files/git-1.6.3.3.tar.bz2
- tar xvf files/git-1.6.3.3.tar
- ./configure
- make
- sudo make install
- sudo gem install mysql –no-rdoc –no-ri — –with-mysql-config=/usr/bin/mysql_config

START APPS

- copy /system/mysql/my.cnf to /etc/my.cnf
- sudo /sbin/service mysqld start
- /usr/bin/mysqladmin -u root password ‘PASSWORD_GOES_HERE’
- sudo /sbin/service httpd start

CAPISTRANO

- cap staging deploy:setup
- cap staging deploy:cold
- cap staging deploy

CONFIGURE

- sudo /usr/sbin/adduser deploy
- sudo passwd deploy

VMWARE TOOLS

- Login as root
- Select from VMware Workstation: go to VM> Install VMware Tools
- mkdir /root/mn
- From the VM: mount the virtual cd drive , this should be done with the guest OS (CentOS ) command line:
mount /dev/cdrom /root/mn
- From the CDROM extract VMware Tools into /tmp/ directory
tar -C /tmp -zxvf /root/mn/VMwareTools-5.5.3-34685.tar.gz
- Running VMware Tools installation/setup script
cd /tmp/vmware-tools-distrib
./vmware-install.pl
- This is VMware Tools installation/setup script, it will ask for confirmation to begin the installation
answer the defaults for each question
- when done, restart the VM (shutdown -r now)

using git submodules for plugins

July 15th, 2009

# first remove your copy and paste plugin….

git rm -r vendor/plugins/xxxxxx
git commit

now you are ready to add the submodule

git submodule add git://your_git_repo/xxxxx.git vendor/plugins/xxxxx
git commit

To load the submodule, you need to

git submodule init
git submodule update

To deploy submodules using capistrano, capistrano needs to also do the submodule init and update.

# in deploy.rb
set :git_enable_submodules,1

if you want to update the version of the submodule – or the branch
cd into the plugin, git pull or git checkout branch
then cd back to the containing project and git commit

serving php from a rails app with passenger

June 21st, 2009
We have a situation where we want one domain which serves a rails app at root and also has a wordpress blog served within the main site.
yours.com/  --> served by rails
yours.com/blog --> served by php
To configure this in apache, The key is the PassengerEnabled – else passenger will try and serve the php content.