Archive for October, 2008

Completely custom routes

Thursday, October 30th, 2008

In a recent project for the New Zealand business community, we were required to have some really custom routes. An example of such routes would be geographical routes, e.g. /china, or /china/beijing.

We could try something like this:

map.country ':country', :controller => :locations, :action => :show,
  :country => Regexp.new(Country.all.map(&:name).join('|'))
map.region ':country/:region', :controller => :locations, :action  => :show,
  :country => Regexp.new(Country.all.each{|c| "^#{c.name}" }.join('|'))

However we get this error “Regexp anchor characters are not allowed in routing requirements”. So we can’t use requirements. However, we can use route conditions instead. With inspiration from Jamis Buck’s route monkeypatch :

# /lib/routing_extensions.rb
module ThongKuah
module Routing

  module RouteExtensions
    def self.included(base)
      base.alias_method_chain :recognition_conditions, :path_regexp
    end

    # allows recognition for paths only matching the given regexp (conditions[:path])
    # allows recognition for paths not matching the given regexp (conditions[:not_path])
    def recognition_conditions_with_path_regexp
      result = recognition_conditions_without_path_regexp
      result << "conditions[:path] =~ path" if conditions[:path]
      result << "(conditions[:not_path]=~path).nil?" if conditions[:not_path]
      result
    end
  end

end
end

# /config.environment.rb
require 'route_extension'
ActionController::Routing::Route.send :include, ThongKuah::Routing::RouteExtensions

So now we can go :

map.country ':country', :controller => :locations, :action => :show,
  :conditions => {:path => Regexp.new(Country.all.map(&:name).join('|'))}
map.region ':country/:region', :controller => :locations, :action => :show,
  :conditions => {:path => Regexp.new(Country.all.each{|c| "^#{c.name}" }.join('|')) }

Note we can have negative matches as well. I’m sure the Regular expressions gods can do a negative match use Regexp only, but hey.

We found this rails idiom to be quite useful as this allows us full customisation of routing, if we need it. We have used it successfully for Made from New Zealand, so you check it out on pages such as www.madefromnewzealand.com/new-zealand and www.madefromnewzealand.com/new-zealand/auckland.

Pastie of the code here.

Happy Birthday ZoomIn – 3 today

Wednesday, October 29th, 2008



ZoomIn is 3 years today ! October 29th in 2005, ZoomIn was launched to the world. Currently we have 78734 places and 11558 users on ZoomIn ! Thanks to everyone who has contributed to ZoomIn.

ZoomIn has come a long way since that date, here’s a look at some the changes that have happened over the last 3 years.






Made from New Zealand is launching soon

Sunday, October 19th, 2008

The ProjectX team have been busy bees… We’ve been working on the Made from New Zealand project. Its launching soon…

Want to know more ??? Be watching NZ TV any channel at 8:20pm – all will be revealed.

We’re helping take New Zealand to the World!

Webpage test now in New Zealand

Tuesday, October 14th, 2008

The RPO team have released the AOL Webpagetest for New Zealand. Finally, we have a local content test frame work for testing the speed of a page.

Webpage Test is Awesome as it creates pageload waterfalls and average load times over a number of test iterations.


No there is no excuse for slow pages. Get to work NZ, we have a lot of internet to speed up !

Xlinks Digest – 06 / 10 / 2008

Monday, October 6th, 2008

Xlinks is a collection of interesting links as discovered by the ProjectX team.

    Warren Buffett to invest 3B in GE
    Added on 10/06/2008 at 02:11PM

    Using memcache to address more than 4Gb
    Added on 10/06/2008 at 02:10PM

    Stephen Fry on Cloud computing
    Added on 10/06/2008 at 02:09PM

    Mark Cuban – How to get Rich
    Added on 10/06/2008 at 02:08PM

    45 Rules for Creating a Great Logo Design: Hat tip to James from Bandit Design
    Added on 10/06/2008 at 01:57PM

    Added on 10/05/2008 at 07:21PM

    Earth Atlas – Google Earth data visualiser
    Added on 10/04/2008 at 10:07AM

    25 ways to be more productive as a designer
    Added on 10/02/2008 at 10:30PM

    YUI release 2.6.0
    Added on 10/02/2008 at 10:17PM

Xlinks digest – 02 / 10 / 2008

Thursday, October 2nd, 2008

Xlink is a collection of interesting links as discovered by the ProjectX Team.

    The relationship between latency and throughput
    Added on 10/02/2008 at 09:13AM

    Apple drops NDA on released software
    Added on 10/02/2008 at 09:12AM

    Smushit – Firefox image optimisation plugin
    Added on 10/01/2008 at 09:38AM

    Crickey -Xero moves into Australia
    Added on 10/01/2008 at 09:07AM

    Telecom slashes broadband tariffs
    Added on 10/01/2008 at 09:07AM

    Jakob Nielsen: ‘About Us’ Information on Websites
    Added on 10/01/2008 at 07:57AM

    How Flickr polices 2.8 billion photos
    Added on 10/01/2008 at 07:56AM

    Web 2.0 = make friends Web 3.0 = make money
    Added on 09/30/2008 at 04:51PM

    Stanford Entrepreneur videos
    Added on 09/30/2008 at 04:50PM

    Making money in 1880 vs now
    Added on 09/30/2008 at 04:49PM

    300 director signs with EA to make 3 new titles: Cool
    Added on 09/30/2008 at 04:05PM

    Analysts: Google Maps wins rivals ‘stagnate’
    Added on 09/30/2008 at 10:18AM

    Microsoft and Nokia start supporting jQuery
    Added on 09/29/2008 at 09:40PM

    An overview of Megaphone – a demo of their cool product and some of the design insights
    Added on 09/28/2008 at 09:00PM

    Spherical Effect via Canvas: Super Shiny is back
    Added on 09/24/2008 at 12:31PM

    Cisco acquires Jabber Inc. the company
    Added on 09/20/2008 at 01:24PM

Hammerhead – Measure pageload time in Firefox and export your findings to CSV

Wednesday, October 1st, 2008

A big day in the web optimisation space tool, we have a second new tool to help web developers in the quest for faster web pages. Mr YSlow Steve Sounders has just released a new tool – Hammerhead.

Here is Steve’s explanation behind the rational for the tool

* real user data – I love real user metrics. JavaScript frameworks like Jiffy measure page load times from real traffic. When your site is used by a large, diverse audience, data from real page views is ground-truth.
* bucket testing – When you’re getting ready to push a new release, if you’re lucky you can do bucket testing to gather performance metrics. You release the new code to a subset of users while maintaining another set of users on the old code (the “control”). If you sample your user population correctly and gather enough data, comparing the before and after timing information gives you a preview of the latency impact of your next release.
* synthetic or simulated testing – In some situations, it’s not possible to gather real user data. You might not have the infrastructure to do bucket testing and real user instrumentation. Your new build isn’t ready for release, but you still want to gauge where you are with regard to performance. Or perhaps you’re measuring your competitors’ performance. In these situations, the typical solution is to do scripted testing on some machine in your computer lab, or perhaps through a service like Keynote or Gomez.
* dev box – The first place performance testing happens (or should happen) is on the developer’s box. As she finishes her code changes, the developer can see if she made things better or worse. What was the impact of that JavaScript rewrite? What happens if I add another stylesheet, or split my images across two domains?

I’ve done a quick test of ZoomIn from our crimped broadband at home. And I can already see that we have some work to sort out page load time.





I’ve been after a tool that will measure page loadtime and exports out to a data file. A big thanks to Steve for the tool.

Smush it – Image optimisation tool

Wednesday, October 1st, 2008




Stoyan Stefanov and Nicole Sullivan of the Yahoo exceptional performance team have built a image optimisation tool. Its amazingly easy to run.

1 Install the firefox plugin and press on the little face on the bottom of the browser.

2 Smushit will open a new tab and run the optimisation  process on the fly.

3 Download the optimised images in a zip file!

Here’s the result summary




And here’s the image optimisation report





A quick review of some of the tops NZ sites.

Trade Me could save 8K
TV3 could save 9k
Stuff could save 49K

Now there’s no excuse for having bloated images. Every web developer should have this plugin installed !


http://www.canakkaleruhu.org http://www.vergimevzuati.org http://www.finansaldenetci.com http://www.securityweb.org http://www.siyamiozkan.org http://www.fatmaozkan.com http://www.sgk.biz.tr http://www.denetci.gen.tr http://www.bagimsizdenetim.biz.tr http://www.mevzuat.biz.tr http://www.security.biz.tr http://www.sorgulatr.com http://www.kanunlar.biz http://www.prsorgu.net http://www.sirabul.com http://www.emekliol.org http://www.coklupagerank.com http://www.coklupagerank.net http://www.coklupagerank.org http://www.prsorgu.org http://www.scriptencode.com http://www.sirabul.net http://www.sirabul.org http://www.sitenizanaliz.com http://www.seoisko.com http://www.seomavi.com http://www.scriptencode.net http://www.scriptencode.org