Upgrading Spree From 1.1.2 to 1.1.3

If you upgraded Spree from 1.1.2 to 1.1.3 and found that the checkout didn’t work with some error about zones

1
2
3
4
ActiveRecord::StatementInvalid (PG::Error: ERROR:  column "zone_members_count" does not exist
LINE 1: ...LECT "spree_zones".* FROM "spree_zones"  ORDER BY zone_membe...
                                                             ^
: SELECT "spree_zones".* FROM "spree_zones"  ORDER BY zone_members_count, created_at):

Then perhaps you missed that you needed to run some migrations

1
2
rake railties:install:migrations
rake db:migrate

Google Analytics Funnel Setup for Spree Commerce

During the setup of any new ecommerce system you will need to monitor your checkout for cart abandonment to find the drop off points and carefully fix them, here is how I setup analytics for Spree Commerce 1.1.x.

  • Goal Type: URL Destination
  • Goal URL: /orders/R[0-9]{1,8}
  • Use funnel: Ticked
  • Required Step: Ticked
  • Step 1: /checkout
  • Step 2: /checkout/delivery
  • Step 3: /checkout/payment

Thanks to Ryan for the RegEx

Non-www to Www Nginx Redirect

Add this small block of code into your server{} block to redirect all non-www to the www version of your website.

1
2
3
if ($host != 'www.samhamilton.co.uk' ) {
  rewrite  ^/(.*)$  http://www.samhamilton.co.uk/$1  permanent;
 }

Migrating to Octopress

So migrated from Wordpress to Octopress. Most of the migration was automated by using exitwp but to get slideshare I had to use Oembed, also found a great list of themes on github.

So far so good, writing posts in markdown is great and also now not having to worry about keeping up with Wordpress security updates is nice but for me is about finally being free of MySQL databases and Wordpress was the last thing running on it, weird in this day and age of easy multiple database support Wordpress still forces you to use MySQL.

Internet Speed

Well the internet speed in Hangzhou is much better than Shanghai. I am paying the same amount of money as in Shanghai but getting a better connection!

Small Script to Remove a List of Directories

1
2
cat list-of-directories.txt|while read f; do
if [ -e "$f" ]; then rm -rf "$f"; fi; done```

thanks unSpawn!

Amazing Himalayas Photos

Just ran across this guys photos from the Himalayas

NILGIRI SOUTH (6839 m)

Crappy Internet

Alex, a good friend of mine here in Shanghai, recently vented his frustration about working and living in China when your work relies on a good quality internet connection and I can’t agree more.

For the last couple of weeks Google has been once again targeted by the censors but in a truly frustrating way, you can search for something and get back the first page of results (most of the time) but then if you refine your search or do another search straight after the great firewall blocks Google and you end up with an error page. I am very ashamed to say that I have had to resort to using Bing to find some things over the past couple of weeks but the Bing results are just of a poorer quality which then frustrates me even more as I know Google would have found what I was looking for after a couple of refinements.

There are a couple of points where our view diverge:

He brings up the point that a US company will need good internet to the USA to use their tools (ERP, CRM etc etc) but this is not what the majority of the companies who are here need to use, the government regulations have restricted the truely massive corporations coming into China in one way or another and so far the largest companies in China probably are mostly Chinese in origin and probably most of them are government owned.

Alex ponders if bad internet will have a knock on economic effect and I think it will but not in the way that he expects. Instead of China becoming the next India where you can outsource your “services”, bad international internet will localise people and already has, just look at the Chinese Twitter and Facebook clones. China will become more introverted and that is a bad thing because a country so large and a people so proud should be sharing with the rest of the world not looking inwards.

What you have to remember is that local internet, i.e. internet within China is OK - you can perfectly stream videos, watch tv, search the internet, tweet on the local twitter clone and not hit a single problem. I have had 2M internet for nearly seven years and ok the upgrade to 10M+ is well overdue if you compare internet speeds to Hong Kong, Korea or even the UK but compared to the USA it seems just about on a par.

Companies who want to expand into China need to remember that China is almost like a sparate zone of the internet where the normal rule dont apply, sticking a CDN box in Hong Kong does not mean people in Shanghai or Beijing will have good speeds even if the normal rules about proximity would mean that it would. If you truly want fast local access to your services in China then get a CDN with local Chinese nodes and no Hong Kong does not count.

Here is the China network diagram from a decent CDN who truly understand China - show me another CDN that has that network in China? Akamai perhaps but they won’t show.

One last thing to throw on the fire - Shanghai has plenty of submarine cables and also China has Hong Kong one of the greatest gathering of submarine cables in the world, if they wanted international internet to work they could, the trouble is that they dont.

Data-Driven Startups

Data-Driven Startups from David Cancel

Startup Metrics for Pirates

Startup Metrics for Pirates from Dave McClure