<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Adam St. John</title>
	<atom:link href="http://www.astjohn.ca/feed" rel="self" type="application/rss+xml" />
	<link>http://www.astjohn.ca</link>
	<description>Engineer and Entrepreneur</description>
	<lastBuildDate>Tue, 22 May 2012 14:10:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Remove stale resque workers using bash</title>
		<link>http://www.astjohn.ca/2011/11/18/remove-stale-reqsque-workers-using-bash</link>
		<comments>http://www.astjohn.ca/2011/11/18/remove-stale-reqsque-workers-using-bash#comments</comments>
		<pubDate>Fri, 18 Nov 2011 16:10:00 +0000</pubDate>
		<dc:creator>astjohn</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.astjohn.ca/2011/11/18/remove-stale-resque-workers-using-bash</guid>
		<description><![CDATA[I run a Rails application that uses Resque to manage background jobs. &#160;It works beautifully. &#160;Unfortunately, sometimes resque workers become stuck while working on a task. &#160;This might happen for a number of reasons, but the end result is that &#8230; <a href="http://www.astjohn.ca/2011/11/18/remove-stale-reqsque-workers-using-bash">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I run a Rails application that uses <a href="https://github.com/defunkt/resque" title="https://github.com/defunkt/resque" target="_blank">Resque</a> to manage background jobs. &#160;It works beautifully. &#160;Unfortunately, sometimes resque workers become stuck while working on a task. &#160;This might happen for a number of reasons, but the end result is that you&#8217;re missing a worker and you might not realize it. &#160;</p>
<p>Fortunately, when resque starts a job it forks a child process and places the time it began the job in the process description. &#160;You can tell if your worker is stale by using this timestamp to compare it to the current time. &#160;<a href="http://www.epochconverter.com/" title="http://www.epochconverter.com/" target="_blank">Epoch Converter</a> is one of a number of websites to help you convert the timestamp manually.</p>
<p>If you&#8217;re using <a href="http://god.rubyforge.org/" title="http://god.rubyforge.org/" target="_blank">god</a> to monitor your processes, resque provides an example to eliminate these &#8220;stale&#8221; workers. &#160;I don&#8217;t use god and instead use <a href="http://mmonit.com/monit/" title="http://mmonit.com/monit/" target="_blank">monit</a> to monitor my processes. &#160;Resque comes with a monit example too, but it only handles workers that consume too much memory. &#160;If you happen to find yourself with stale workers, try using the following bash script I made.</p>
<pre class="brush: bash">#!/bin/bash 

# Simple script to kill stale resque workers
# Adam St. John [astjohn] [@] [gmail]
# 2011-06-24

# Timeout set to 10 minutes
TIMEOUT=600

# 21028 resque-1.16.1: Forked 17674 at 1308879414 
output=$(ps -e -o pid,command | grep -e [r]esque.*Forked | awk '{printf "%i#%i#%i\n", $1, $6, $4}')
now=`date +%s`

echo "`date` - Looking for stale workers."
# output should produce something like: 21028#1308879414#17674
if [ -z "$output" ] ; then
  echo "Stale workers were not found."
else
  echo "$output" | while read -r line ; do
  
    pid=$(echo $line | cut -d\# -f1)
    ftime=$(echo $line | cut -d\# -f2)
    fpid=$(echo $line | cut -d\# -f3)

    if ! [[ "$pid" =~ ^[0-9]+$ ]] ; then
      exec &gt;&amp;2; echo "Unable to find PID of stale resque worker"; exit 1
    fi

    if ! [[ "$ftime" =~ ^[0-9]+$ ]] ; then
      exec &gt;&amp;2; echo "Unable to find Forked time for stale resque worker"; exit 1
    fi

    difference=$(($now - $ftime))
    if [ "$difference" -ge "$TIMEOUT" ] ; then
      echo "Found a stale worker!"
      kill -s USR1 $pid
      echo "Kill signal USR1 sent to worker $pid so that it will shut down forked child $fpid"
    fi  
  done
  echo "Finished dealing with stale workers."
fi
exit 0
</pre>
<p>The script checks the timestamp that each worker leaves and kills a worker that has exceeded the <code>TIMEOUT</code> value.  I run this script from a cron job.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.astjohn.ca/2011/11/18/remove-stale-reqsque-workers-using-bash/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3.1 Engines, Rspec, and Cucumber</title>
		<link>http://www.astjohn.ca/2011/11/18/rails-31-engines-rspec-and-cucumber</link>
		<comments>http://www.astjohn.ca/2011/11/18/rails-31-engines-rspec-and-cucumber#comments</comments>
		<pubDate>Fri, 18 Nov 2011 15:18:27 +0000</pubDate>
		<dc:creator>astjohn</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.astjohn.ca/2011/11/18/rails-31-engines-rspec-and-cucumber</guid>
		<description><![CDATA[I thought I&#8217;d make a quick post about my first encounter with Rails 3.1 and with engines in general.  Rails engines are essentially applications or a subset of functionality that can be run in or shared with other applications.  In Rails 3.1, &#8230; <a href="http://www.astjohn.ca/2011/11/18/rails-31-engines-rspec-and-cucumber">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I thought I&#8217;d make a quick post about my first encounter with Rails 3.1 and with engines in general.  Rails engines are essentially applications or a subset of functionality that can be run in or shared with other applications.  In Rails 3.1, creating an engine is as easy as:<br />
<code>rails plugin new engine_name [options]</code></p>
<p>where several options are available, including full and mountable. Run with<br />
<code>--help</code> to find out more.</p>
<p>Generating a new engine produces a file structure similar to a regular rails application, but with a few notable differences which have been explained in <a title="http://coding.smashingmagazine.com/2011/06/23/a-guide-to-starting-your-own-rails-engine-gem/" href="http://coding.smashingmagazine.com/2011/06/23/a-guide-to-starting-your-own-rails-engine-gem/" target="_blank">several</a> <a title="http://www.themodestrubyist.com/2010/03/05/rails-3-plugins---part-2---writing-an-engine/" href="http://www.themodestrubyist.com/2010/03/05/rails-3-plugins---part-2---writing-an-engine/" target="_blank">great</a> <a title="http://www.astjohn.ca/blog/rails-31-engines-mountable-or-full-part-1" href="http://www.astjohn.ca/blog/rails-31-engines-mountable-or-full-part-1" target="_blank">articles</a>.</p>
<h2>Setting up Rspec</h2>
<p>I enjoy using rspec in my testing and instead of using the <em>test</em> folder which was generated automatically, I decided to rename it to <em>spec.</em> Inside this spec folder, I set up the usual rspec environment. For example, inside my spec folder, I have additional folders named <em>models,</em> <em>controllers,</em> <em>views,</em> <em>support,</em> etc. Rspec needs to load the dummy application&#8217;s environment in order to function. To allow it to do so, a few changes are necessary to <em>spec_helper.rb</em>.</p>
<pre class="brush: ruby"># /spec/spec_helper.rb

# This file is copied to spec/ when you
# run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../dummy/config/environment", __FILE__)
require 'rspec/rails'

ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../')

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
#Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }

RSpec.configure do |config|
  # == Mock Framework
  #
  # If you prefer to use mocha, flexmock or RR, uncomment
  # the appropriate line:
  #
  # config.mock_with :mocha
  # config.mock_with :flexmock
  # config.mock_with :rr
  config.mock_with :rspec

  # Remove this line if you're not using ActiveRecord
  # or ActiveRecord fixtures
  config.fixture_path = "#{::Rails.root}/spec/fixtures"

  # If you're not using ActiveRecord, or you'd prefer not to run
  # each of your examples within a transaction, remove
  # the following line or assign false instead of true.
  config.use_transactional_fixtures = true

  config.include Cornerstone::Engine.routes.url_helpers
end</pre>
<p>Of course, renaming the test folder to spec did have some unintended consequences. For one, running rake tasks did not work. In order to fix that, I had to change Rakefile to load the dummy application&#8217;s environment from the new location.</p>
<pre class="brush: ruby"># /Rakefile

#!/usr/bin/env rake
begin
  require 'bundler/setup'
rescue LoadError
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
begin
  require 'rdoc/task'
rescue LoadError
  require 'rdoc/rdoc'
  require 'rake/rdoctask'
  RDoc::Task = Rake::RDocTask
end

RDoc::Task.new(:rdoc) do |rdoc|
  rdoc.rdoc_dir = 'rdoc'
  rdoc.title    = 'EngineName'
  rdoc.options &lt;&lt; '--line-numbers' &lt;&lt; '--inline-source'
  rdoc.rdoc_files.include('README.rdoc')
  rdoc.rdoc_files.include('lib/**/*.rb')
end

# notice the path change in the following line
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'

require 'rake/testtask'

Rake::TestTask.new(:test) do |t|
  t.libs &lt;&lt; 'lib'
  t.libs &lt;&lt; 'test'
  t.pattern = 'test/**/*_test.rb'
  t.verbose = false
end

task :default =&gt; :test

Bundler::GemHelper.install_tasks</pre>
<p>Finally, running <em>rails</em> on the console will not work until you change the dummy application&#8217;s environment reference in the rails script.</p>
<pre class="brush: ruby"># /script/rails

#!/usr/bin/env ruby
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.

ENGINE_PATH = File.expand_path('../..',  __FILE__)
# notice the path change on the following line
load File.expand_path('../../spec/dummy/script/rails',  __FILE__)</pre>
<p>I believe that&#8217;s all it took to get rspec working again after renaming the test folder to spec. Of course, since I&#8217;m using rspec, I no longer needed <em>test_helper.rb</em> and so I removed it. If there&#8217;s something I missed, or if you can&#8217;t get rspec to work, please let me know.</p>
<h2>Preparing Cucumber</h2>
<p>As with Rspec, Cucumber also needs to load the dummy application&#8217;s environment in order to function. After adding cucumber-rails to your gemspec or Gemfile, running <code>rails generate cucumber:install</code> will generate the necessary files and folder structure for cucumber to function properly. Unfortunately, the files generated are geared toward normal rails applications and not rails engines. To make it work for a rails engine, I had to make the following changes to <em>env.rb</em>.</p>
<pre class="brush: ruby"># /features/support/env.rb

# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.

ENV["RAILS_ENV"] = "test" # had to explicity state the test environment (or cucumber env.)
ENV["RAILS_ROOT"] = File.expand_path(File.dirname(__FILE__) + '/../../spec/dummy/')
require File.expand_path(File.dirname(__FILE__) + '/../../spec/dummy/config/environment')

require 'cucumber/rails'

# If you use factory girl, I had to add the following...
require 'factory_girl_rails'
require File.expand_path(File.dirname(__FILE__) + '/../../spec/support/factories')

# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
# order to ease the transition to Capybara we set the default here. If you'd
# prefer to use XPath just remove this line and adjust any selectors in your
# steps to use the XPath syntax.
Capybara.default_selector = :css

# By default, any exception happening in your Rails application will bubble up
# to Cucumber so that your scenario will fail. This is a different from how
# your application behaves in the production environment, where an error page will
# be rendered instead.
#
# Sometimes we want to override this default behaviour and allow Rails to rescue
# exceptions and display an error page (just like when the app is running in production).
# Typical scenarios where you want to do this is when you test your error pages.
# There are two ways to allow Rails to rescue exceptions:
#
# 1) Tag your scenario (or feature) with @allow-rescue
#
# 2) Set the value below to true. Beware that doing this globally is not
# recommended as it will mask a lot of errors for you!
#
ActionController::Base.allow_rescue = false

# Remove/comment out the lines below if your app doesn't have a database.
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
begin
  DatabaseCleaner.strategy = :transaction
rescue NameError
  raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end

# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
# See the DatabaseCleaner documentation for details. Example:
#
#   Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
#     DatabaseCleaner.strategy = :truncation, {:except =&gt; %w[widgets]}
#   end
#
#   Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
#     DatabaseCleaner.strategy = :transaction
#   end
#</pre>
<p>Note the two lines at the top which reference the dummy application. These lines are required because cucumber attempts to boot a rails application from the normal <em>environment.rb</em> which is usually located in the config folder. In a rails engine, this file doesn&#8217;t exist. It only exists within the dummy application. Adding the additional lines at the top of <em>env.rb</em> forces cucumber to bootstrap the dummy application&#8217;s environment. With these changes, cucumber should be fully functional.</p>
<p>One further change that had me stumped for a while was using Cucumber&#8217;s <code>path_to</code> helper located in <em>paths.rb</em>. I just could not make cucumber return the correct path when referencing using a path helper such as <code>some_controller_method_path</code>. In order to use these helpers (thanks Robin &#8211; see below) you can add the engines’ url_helpers to the World object of Cucumber like this:</p>
<pre class="brush: ruby">
module EngineRoutesHelper
  include MyEngine::Engine.routes_url_helper
end
World(EngineRoutesHelper)</pre>
<p>Now, you will be able to rewrite the path_to method like this:</p>
<pre class="brush: ruby">
def path_to(page_name)
  case page_name
    when /^the discussions page$/
      discussions_path
    # etc…
  end
end</pre>
<p>I hope my stumblings have helped others out there. Give me a shout if you run into any problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.astjohn.ca/2011/11/18/rails-31-engines-rspec-and-cucumber/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Converting a MySQL database to PostgreSQL using Rails</title>
		<link>http://www.astjohn.ca/2011/09/11/converting-mysql-database-to-postgresql-using-rails</link>
		<comments>http://www.astjohn.ca/2011/09/11/converting-mysql-database-to-postgresql-using-rails#comments</comments>
		<pubDate>Sun, 11 Sep 2011 14:58:00 +0000</pubDate>
		<dc:creator>astjohn</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.astjohn.ca/2011/09/11/converting-mysql-database-to-postgresql-using-rails</guid>
		<description><![CDATA[I recently decided to move one of my projects from MySQL to PostgreSQL for a number of reasons. I was looking for the easiest and quickest way to migrate the data. However, after playing with a number of solutions and &#8230; <a href="http://www.astjohn.ca/2011/09/11/converting-mysql-database-to-postgresql-using-rails">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I recently decided to move one of my projects from MySQL to PostgreSQL for a number of reasons.  I was looking for the easiest and quickest way to migrate the data.  However, after playing with a <a href="http://pypi.python.org/pypi/py-mysql2pgsql" title="http://pypi.python.org/pypi/py-mysql2pgsql" target="_blank">number</a> of <a href="http://en.wikibooks.org/wiki/Converting_MySQL_to_PostgreSQL" title="http://en.wikibooks.org/wiki/Converting_MySQL_to_PostgreSQL" target="_blank">solutions</a> and <a href="http://vermicel.li/blog/2010/02/04/converting-a-rails-database-from-mysql-to-postgresql.html" title="http://vermicel.li/blog/2010/02/04/converting-a-rails-database-from-mysql-to-postgresql.html" target="_blank">tools</a>, nothing was working well.  Then I found this <a href="https://github.com/face/rails_db_convert_using_adapters" title="https://github.com/face/rails_db_convert_using_adapters" target="_blank">lovely rake task</a>.  The <a href="http://myutil.com/2008/8/31/rake-task-transfer-rails-database-mysql-to-postgres" target="_blank">task</a> uses rails to convert the data.</p>
<p>To convert your data, you will need to set up two databases.  The rake task is designed to move data from the production database to the development database.  To kick start things, download a backup of your production database and move it to your local computer.  Next, establish a production MySQL database and then build the schema. <code>rake db:schema:load RAILS_ENV=production</code>.  After the database is built, import the data to the local production database.  <code>mysql -u USER -p -D data_prod &lt; backup.sql</code>
</p>
<p>Now, because the rake task moves data from a production database to a development database, you must configure your project&#8217;s <em>database.yml</em> file.  This is what it could look like:</p>
<pre class="brush: ruby">production:
  adapter: mysql2
  encoding: utf8
  username: rails_dev
  password: password
  host: localhost
  database: db_prod

development:
  adapter: postgresql
  encoding: utf8
  username: rails_dev
  password: password
  host: localhost
  database: db_dev

</pre>
<p>Note that the development database is set up for PostgreSQL.  Therefore, before running the rake task you must establish this database as well.  Build the database in PostgreSQL and then load the schema as above: <code>rake db:schema:load RAILS_ENV=development</code>.  Also, do not forget to add a PostgreSQL adapter to your project&#8217;s <em>Gemfile</em>.  I prefer the pg gem: <code>gem "pg"</code>
</p>
<p>With the databases all set up, converting your data to the PostgreSQL database is as simple as:</p>
<pre class="brush: ruby">rake db:convert:prod2dev
</pre>
<p>This worked great using ruby 1.9.2 and rails 3.0.8.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.astjohn.ca/2011/09/11/converting-mysql-database-to-postgresql-using-rails/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3.1 Engines &#8211; Mountable or Full? &#8211; Part 2</title>
		<link>http://www.astjohn.ca/2011/08/07/rails-31-engines-mountable-or-full-part-2</link>
		<comments>http://www.astjohn.ca/2011/08/07/rails-31-engines-mountable-or-full-part-2#comments</comments>
		<pubDate>Sun, 07 Aug 2011 17:15:00 +0000</pubDate>
		<dc:creator>astjohn</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.astjohn.ca/2011/08/07/rails-31-engines-mountable-or-full-part-2</guid>
		<description><![CDATA[This is a continuation of my post Rails 3.1 Engines &#8211; Mountable or Full? &#8211; Part 1 which highlights some key features of a full engine. There are a few differences with a mountable engine, which I will try to &#8230; <a href="http://www.astjohn.ca/2011/08/07/rails-31-engines-mountable-or-full-part-2">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>This is a continuation of my post <a href="http://www.astjohn.ca/blog/rails-31-engines-mountable-or-full-part-1" title="http://www.astjohn.ca/blog/rails-31-engines-mountable-or-full-part-1" target="_blank">Rails 3.1 Engines &#8211; Mountable or Full? &#8211; Part 1</a> which highlights some key features of a full engine.  There are a few differences with a mountable engine, which I will try to explain below.</p>
<h2>Mountable Engines</h2>
<h3>Engine Details</h3>
<p>To generate a mountable engine, run <code>rails plugin new MyEngine --mountable</code> on the console.  This will generate the engine&#8217;s basic structure.</p>
<p>The first difference I noted with a mountable engine is that, by default, the engine is namespaced.  The engine&#8217;s starting config is:</p>
<pre class="brush: ruby">module MyEngine
# my_engine/lib/my_engine/engine.rb

  class Engine &lt; Rails::Engine
    isolate_namespace MyEngine
  end
end
</pre>
<p>Since the engine has an isolated namespace, the controllers, models, helpers, etc. are all bundled within the module <em>MyEngine</em>.  The folder structure reflects this change as well.  Unlike a full engine, the mountable engine generated the typical assets that are normally associated with a Rails application, namely <em>application.js</em>, <em>application.css</em>, and <em>application_controller.rb</em>.  Note the namespacing that occurs with the application controller:</p>
<pre class="brush: ruby"># my_engine/app/controllers/my_engine/application_controller.rb

module MyEngine
  class ApplicationController &lt; ActionController::Base
  end
end

</pre>
<p>This namespacing occurs throughout the engine.  There are subtle differences in terms of routing as well.  With a mountable engine, the engine&#8217;s route file looks like this:</p>
<pre class="brush: ruby"># my_engine/config/routes.rb

MyEngine::Engine.routes.draw do
  # route stuff goes here
end
</pre>
<p>Remember, the full application&#8217;s routes start with <code>Rails.application.routes.draw</code>.  The dummy application&#8217;s routes file was generated as:</p>
<pre class="brush: ruby"># my_engine/test/dummy/config/routes.rb

Rails.application.routes.draw do

  mount MyEngine::Engine =&gt; "/my_engine"
end
</pre>
<p>Notice that the engine is bundled under a &#8220;mounted&#8221; route at <em>/my_engine</em>.  This means that all of the engine&#8217;s functionality will be located under the engine&#8217;s root location of <em>/my_engine</em> within the dummy (parent) application.  This type of structure suggests that a mountable engine is best suited for situations when a developer wants the engine to behave as its own application operating in parallel with the parent application.  Most of the engine&#8217;s features are isolated and independent of the parent application.  To test this, I plugged the mountable engine into a test application.</p>
<h3>Routing</h3>
<p>I used a model within the engine called &#8220;Post&#8221;, along with the migration, controller, and helper to match (<code>rails generate scaffold post title:string body:text</code>).  Now my engine&#8217;s routes file looks like this:</p>
<pre class="brush: ruby"># my_engine/config/routes.rb

MyEngine::Engine.routes.draw do
  resources :posts
end

</pre>
<p>With a full engine, the <em>Post</em> routes were included directly into the parent application automatically.  This time, using the mountable engine and running <code>rake routes</code> within the parent application, nothing happened!  That&#8217;s because I did not mount the engine in a similar manner to what the dummy application in our engine is using.  The parent application&#8217;s route file had to be adjusted like so:</p>
<pre class="brush: ruby"># parent_app/config/routes.rb

ParentApp::Application.routes.draw do
 mount MyEngine::Engine =&gt; "/my_engine"
end

</pre>
<p><code>rake routes</code> now produced the following:</p>
<pre class="brush: ruby">my_engine  /my_engine {:to=&gt;MyEngine::Engine}

</pre>
<p>&#8230;and that&#8217;s it.  All of the engine&#8217;s functionality is bundled into the parent application underneath the route <em>/my_engine</em>.</p>
<p>After running <code>rake my_engine:install:migrations</code> and <code>rake db:migrate</code> in the parent application, I was ready to test how the engine&#8217;s controllers and helpers would integrate.  [note: running migrations from an isolated engine will prefix your database tables with the engine name].  As with the full engine, I established a simple view template:</p>
<pre class="brush: ruby"># my_engine/app/views/my_engine/posts/index.html.erb

&lt;p&gt;Hi There!&lt;/p&gt;

</pre>
<p>Of course, navigating to <em>/my_engine/posts</em> in the parent application showed an almost blank page with the words &#8220;Hi There!&#8221;  The controller actions and views from the engine were incorporated into the parent application, but only under the namespaced route <em>/my_engine</em>.</p>
<p>Next, I tested if the view could be overridden by the parent application.  I created a new view template for the <em>Post</em> index action within the parent application that looked like this:</p>
<pre class="brush: ruby"># parent_app/app/views/posts/index.html.erb

&lt;p&gt;Good Bye!&lt;/p&gt;

</pre>
<p>No change and of course not!  Our engine is namespaced, remember?  Instead, I moved the template to <code>parent_app/app/views/my_engine/posts/index.html.erb</code>.  Now visiting <em>/my_engine/posts</em> in the parent application showed &#8220;Good Bye!&#8221;  That&#8217;s better.  Next I decided to test out the engine&#8217;s helpers.  I added a method to the Post helper inside the engine.</p>
<pre class="brush: ruby"># my_engine/app/helpers/my_engine/posts_helper.rb

module MyEngine
  module PostsHelper
    def test
      raw("&lt;p&gt;hello world&lt;/p&gt;")
    end
  end
end

</pre>
<p>I then changed the parent application&#8217;s view template to use the helper.</p>
<pre class="brush: ruby"># parent_app/app/views/posts/index.html.erb

&lt;p&gt;Good Bye!&lt;/p&gt;
&lt;%= test %&gt;

</pre>
<p>Visiting the page resulted in the words &#8220;Good Bye!&#8221; and &#8220;hello world.&#8221;  Therefore, the engine&#8217;s helper methods were directly exposed to the parent application, allowing the parent to use them.&#160;</p>
<p>&#160;To be honest, I did not expect this to work.  There is a section in the <a href="https://github.com/rails/rails/blob/master/railties/lib/rails/engine.rb" target="_blank">Rails comments</a> about sharing an isolated engine&#8217;s helpers with the parent application by using <code>helper MyEngine::Engine.helpers</code> in the application controller of the parent.  It states that in doing so &#8220;[the parent application] will include all of the helpers from engine&#8217;s directory.&#8221;  Perhaps this is a bug in the release candidates of Rails 3.1?  Maybe my interpretation of the instructions is way off?  I&#8217;m not sure.  If this does change by the time you use it, and you can&#8217;t access the engine&#8217;s helpers, I suggest trying the method described.
</p>
<h3>Summary</h3>
<p>It seems as though mountable engines are best suited as complete applications in themselves which run along side a parent application.  The engine routes, controllers, models, helpers, etc. are namespaced and bundled into the mounted route within the parent application, thus avoiding namespace conflicts.  If I&#8217;m way off in my assessment or there are other things which I have missed, drop me a line and I&#8217;ll add them!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.astjohn.ca/2011/08/07/rails-31-engines-mountable-or-full-part-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3.1 Engines &#8211; Mountable or Full? &#8211; Part 1</title>
		<link>http://www.astjohn.ca/2011/08/06/rails-31-engines-mountable-or-full-part-1</link>
		<comments>http://www.astjohn.ca/2011/08/06/rails-31-engines-mountable-or-full-part-1#comments</comments>
		<pubDate>Sat, 06 Aug 2011 17:15:00 +0000</pubDate>
		<dc:creator>astjohn</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.astjohn.ca/2011/11/18/rails-31-engines-mountable-or-full-part-1</guid>
		<description><![CDATA[I decided to create my first rails engine about a week or so ago. &#160;I figured this was a great way to learn Rails 3.1 and the new engine generator; however, I quickly ran into a problem. &#160;Do I want &#8230; <a href="http://www.astjohn.ca/2011/08/06/rails-31-engines-mountable-or-full-part-1">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I decided to create my <a href="https://www.github.com/astjohn/cornerstone" target="_blank">first rails engine</a> about a week or so ago. &#160;I figured this was a great way to learn Rails 3.1 and the new engine generator; however, I quickly ran into a problem. &#160;Do I want a mountable or full engine? &#160;<a href="http://stackoverflow.com/questions/6118905/rails-3-1-engine-vs-mountable-app" title="http://stackoverflow.com/questions/6118905/rails-3-1-engine-vs-mountable-app" target="_blank">What&#8217;s the difference anyway?</a> &#160;At the time, a quick google search showed that not many people really knew.  The Rails <a href="https://github.com/rails/rails/blob/master/railties/lib/rails/engine.rb">code comments</a> are great, but after reading them, I was still a bit confused. &#160;For those of you out there in the same boat, here&#8217;s my attempt at highlighting some of the differences.</p>
<h2>Full Engines</h2>
<h3>Engine Details</h3>
<p>To generate a full engine, run <code>rails plugin new MyEngine --full</code> on the console.  This will generate the engine&#8217;s basic structure.</p>
<p>The first thing I noticed was that the typical assets associated with a normal Rails application were not generated; <em>application.js</em> and <em>application.css</em> were not created.  In fact, the application controller was completely omitted, alluding that perhaps a full engine is feared toward supplementing a parent application only.  As far as routing goes, the engine&#8217;s route looked like this:</p>
<pre class="brush: ruby"># my_engine/config/routes.rb

Rails.application.routes.draw do
end

</pre>
<p>&#8230; and the dummy application&#8217;s routes file looked like this:</p>
<pre class="brush: ruby"># my_engine/test/dummy/config/routes.rb

Dummy::Application.routes.draw
  # route stuff
end

</pre>
<p>Another item that was missing from the basic application structure was the database folder.  For engine configuration, a full engine is not namespaced, so the <em>engine.rb</em> file was essentially blank.</p>
<pre class="brush: ruby"># my_engine/lib/my_engine/engine.rb

module MyEngine
  class Engine &lt; Rails::Engine
  end
end

</pre>
<p>Now, the <a href="https://github.com/rails/rails/blob/master/railties/lib/rails/engine.rb" title="https://github.com/rails/rails/blob/master/railties/lib/rails/engine.rb" target="_blank">rails comments</a> state that engines allow you to add a &#8220;subset of functionality to an existing Rails application.&#8221;  Since the full engine is missing an application controller, it seems that its purpose is to plug into an existing application without namespacing to add functionality to the parent application.  To test this theory, I generated a new application and referenced my engine in the parent application&#8217;s Gemfile.</p>
<h3>Routing</h3>
<p>Since the engine is not namespaced, the engine&#8217;s routes are incorporated into the parent application&#8217;s routes directly.  To test this, I created a model within the engine called &#8220;Post&#8221;, along with the migration, controller, and helper to match. To create the migration, I also had to build the <em>my_engine/db/migrate/</em> folder, which was not created when I generated the engine.  Running <code>rake routes</code> within the parent application resulted in the following:
</p>
<pre class="brush: ruby">    posts GET    /posts(.:format)          {:action=&gt;"index", :controller=&gt;"posts"}
          POST   /posts(.:format)          {:action=&gt;"create", :controller=&gt;"posts"}
 new_post GET    /posts/new(.:format)      {:action=&gt;"new", :controller=&gt;"posts"}
edit_post GET    /posts/:id/edit(.:format) {:action=&gt;"edit", :controller=&gt;"posts"}
     post GET    /posts/:id(.:format)      {:action=&gt;"show", :controller=&gt;"posts"}
          PUT    /posts/:id(.:format)      {:action=&gt;"update", :controller=&gt;"posts"}
          DELETE /posts/:id(.:format)      {:action=&gt;"destroy", :controller=&gt;"posts"}

</pre>
<p>As you can see, the Post routes from the engine were included directly into the parent application.</p>
<p>After running <code>rake my_engine:install:migrations</code> and <code>rake db:migrate</code> in the parent application, I was ready to test how the engine&#8217;s controllers and helpers would integrate.  In my engine, I had a simple view template:</p>
<pre class="brush: ruby"># my_engine/app/views/posts/index.html.erb

&lt;p&gt;Hi There!&lt;/p&gt;

</pre>
<p>Of course, navigating to <em>/posts</em> in the parent application showed an almost blank page with the words &#8220;Hi There!&#8221;  The controller actions and views from the engine were incorporated into the parent application.</p>
<p>One helpful feature of engines is the fact that their controller methods and views can be overridden simply by placing similar files within the parent application.  For example, I created a new view template for the Post index action within the parent application that looked like this:</p>
<pre class="brush: ruby"># parent_app/app/views/posts/index.html.erb

&lt;p&gt;Good Bye!&lt;/p&gt;

</pre>
<p>Now visiting <em>/posts</em> in the parent application shows &#8220;Good Bye!&#8221;  That&#8217;s great, but what about the engine&#8217;s helpers?  I tested that functionality by adding a method to the Post helper back inside the engine.</p>
<pre class="brush: ruby"># my_engine/app/helpers/posts_helper.rb

module PostsHelper

  def test
    raw("&lt;p&gt;hello world&lt;/p&gt;")
  end

end

</pre>
<p>I then changed the parent application&#8217;s view template to use the helper.</p>
<pre class="brush: ruby"># parent_app/app/views/posts/index.html.erb

&lt;p&gt;Good Bye!&lt;/p&gt;
&lt;%= test %&gt;

</pre>
<p>This time, visiting the page again in the parent application resulted in the words &#8220;Good Bye!&#8221; and &#8220;hello world.&#8221;  Therefore, the engine&#8217;s helper methods were directly exposed to the parent application, allowing the parent to use them.</p>
<h3>Summary</h3>
<p>In summary, it seems as though full engines are best suited to augment a parent application.  The engine routes, controllers, models, helpers, etc. are exposed to the parent application which allows for easy access, but could result in namespace conflicts.</p>
<p>It looks like this post is getting a bit lengthy so I&#8217;ll stop it here and talk about mountable engines soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.astjohn.ca/2011/08/06/rails-31-engines-mountable-or-full-part-1/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>San Francisco, USA</title>
		<link>http://www.astjohn.ca/2008/09/15/san-francisco-usa</link>
		<comments>http://www.astjohn.ca/2008/09/15/san-francisco-usa#comments</comments>
		<pubDate>Mon, 15 Sep 2008 19:57:08 +0000</pubDate>
		<dc:creator>astjohn</dc:creator>
				<category><![CDATA[Travel]]></category>

		<guid isPermaLink="false">http://www.astjohn.ca/blog/2008/09/15/san-francisco-usa</guid>
		<description><![CDATA[We arrived in San Francisco late in the evening, and the first taste of North America we received was the customs official yelling at people to fill the immigration lines. There was no please, or thank-you, and he was harsh &#8230; <a href="http://www.astjohn.ca/2008/09/15/san-francisco-usa">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>We arrived in San Francisco late in the evening, and the first taste of North America we received was the customs official yelling at people to fill the immigration lines.  There was no please, or thank-you, and he was harsh and loud.  We quickly figured out how to take the Bay Area Rapid Transit (BART), and took it to downtown.  The BART system was much older, louder and dirtier than what we were used to.  It was also run by an actual person, and not by a computer.  At one point the conductor came on the loudspeaker and started yelling at someone standing in the doorway of one of the cars.  This was a big contrast to the ultra modern system in Hong Kong or Singapore, where everything was fully automated, smooth, silent, and which also used the wind generated from movement for ventilation.  The San Francisco subway lines were stuffy and hot.</p>
<p><span id="more-52"></span></p>
<p>When we arrived at the station, we walked out into the middle of the city.  This moment was the only time in our whole trip that we ever felt nervous walking around.  We walked a few city blocks to our hostel and right away were handed a map.  The guy checking us in proceeded to draw a big circle with the letters DNG on top of it.  This, he explained, is the Do Not Go zone, and is the bad part of the city.</p>
<p>We were tired from the flight, so we went to bed right away.  The next morning, we woke up at 6am from jetlag, and went to the kitchen of the hostel to make some free pancakes.  We decided to explore the city this day.  Walking through China town was not as impressive as it would have been if we had not been to China.  Then, we wandered down rolling roads through the financial district, and onward to <a href="http://en.wikipedia.org/wiki/Fisherman's_Wharf,_San_Francisco,_California">Fishermanâ€™s Wharf</a>.  On the way, we stopped to walk up Telegraph Hill.  On the top of this hill is a building resembling a lighthouse that was built by a rich woman who dedicated it as a memorial for the firemen of San Francisco.  We then walked past <a href="http://en.wikipedia.org/wiki/Lombard_Street_(San_Francisco)">Lombard Street</a> and into the Fishermanâ€™s Wharf area which was packed with buskers, eateries, and plenty of shopping.  We stopped here and split a bowl of San Franciscoâ€™s famous clam chowder in a sourdough bread bowl from one of the many food stalls just outside the seafood restaurants.  The chowder was pretty tasty.  While we ate, we listened to a busker who played synthesized music through a digital clarinet/wind instrument.  It was really cool how he had to learn to play the drums with his mouth and fingers!</p>
<p><center><wpg2>29381</wpg2><wpg2>29378</wpg2></center></p>
<p>After lunch, we followed â€œThe Embaraderoâ€, a wide street that the cable cars run down the middle of, along all the piers.  We stopped at pier 39 to watch the sea lions sprawled out on wooden planks.  When the sea lions are there, no boat traffic is allowed.  Therefore, these sea lions have basically taken over the pier for themselves.  We walked all the way back along the piers to pier 1/2 where the ferry building is located.  The ferry building is a huge building with a clock tower, and is filled with gourmet restaurants and specialty gourmet grocery stores.  One store only sold mushrooms, and must have had at least 50 different types.</p>
<p>It was late afternoon by this time, so we walked back to our hostel through the financial district and through another plaza where a North American market was set up.  People there were selling everything from souvenirs to photographs.  We didnâ€™t try bargaining for anything.  We continued walking and ran into a square that had artwork on display and for sale.  On the stage in the square were some live performances put on by a church group.</p>
<p>By the time we got back it was dinner time, and we found a neat retro 50â€™s/60â€™s diner complete with jukeboxes at each table.  There was a small plane hanging from the ceiling, the waiters all wore aprons with silly looking hats, etc.  We were both so tired that we just ate quickly and then collapsed at the hostel.</p>
<p><center><wpg2>29369</wpg2><wpg2>29384</wpg2><wpg2>29387</wpg2></center></p>
<p>The next morning, we woke up early and had a huge breakfast at a small diner.  Then we walked to the South Of Market Area (SOMA) and stopped at the San Francisco Museum of Modern Art (SFMOMA).  We figured that if we were going to experience San Francisco, we needed to try and appreciate some of the artistic culture that the city is known for.  We spent most of the morning being amused by abstract art such as works by Salvidor Dali, a white paint painting, and a toilet that an artist picked from a hardware store and stated â€œit is art because I say it is artâ€.  Some of the exhibits were crazy, and some were really good.  Luckily, we were fortunate enough to visit the museum at the same time they were having an exhibit on <a href="http://en.wikipedia.org/wiki/Frida_Kahlo">Frida Kahlo</a>, a talented Mexican painter, who was overshadowed by her more famous husband <a href="http://en.wikipedia.org/wiki/Diego_Rivera">Diego Rivera</a>, also a painter.  We were both very impressed with her work.</p>
<p>After the museum, we dared to walk into the DNG zone in order to get a great picture of one of San Franciscoâ€™s infamous rolling roads.  Although we were still on the outskirts of the area, we must have passed at least 10 to 20 crazy people having conversations with themselves.  We couldnâ€™t imagine what the heart of the DNZ zone would be like, but neither of us was willing to find out.  We walked along the edge of the area very quickly, and walked onto Haight Street, which is located in an area lined with private/independent fashion stores, rehab clinics, smoke shops, etc.  The Lonely Planet mentioned that a Gap store opened in this district, and the people living in the district werenâ€™t happy about the commercialism moving into their area.  The store had numerous windows broken, graffiti, etc. and was basically pushed out by the residents.</p>
<p>We stopped for lunch at a store that only sells homemade BBQ/grilled sausages.  There were many types to choose from.  Tara had a beer sausage, and Adam had an Italian sausage with a root beer from a local soda store.  After lunch we walked to Alamo square, which is a small park the size of a city block, set in a neighbourhood of old Victorian houses, called the painted ladies.  Theyâ€™re called this because theyâ€™re all painted different pastel colours.  These painted ladies are a famous San Francisco landmark, and can be seen in the opening credits of â€œFull Houseâ€.  After walking around this area, we wound up at a trolley car stop, and took the â€œFâ€ trolley to pier 33 for the Alcatraz night tour.  Along the way, a woman entered the trolley with crutches and sat down next to a crazy woman.  We eavesdropped on a conversation between the two.  The woman with crutches explained that she had â€œa hip problem and thatâ€™s all they would tell herâ€.  The other crazy woman kept telling her she had to fix it and to just â€œsnap it back in thereâ€, and then just kept repeating that phrase.  The woman with the crutches said â€œI donâ€™t know, just please stop itâ€¦â€ and put her hands on her ears.  It turns out she was crazy too.  Then a third guy started talking about how his femur and hip were replaced with titanium.  All three of these people got off in the DNG zone.  The woman with the crutches stood up and walked off without using them.  This was quite a site to experience.</p>
<p><center><wpg2>29375</wpg2><wpg2>29390</wpg2><wpg2>29393</wpg2><wpg2>29396</wpg2></center></p>
<p>The F trolley curved along the piers and we got off at pier 33.  There was a short wait until we were ferried over to <a href="http://en.wikipedia.org/wiki/Alcatraz">Alcatraz</a> island.  After a short introduction with some anecdotes from a park officer, we were given headphones and an mp3 player for a self guided audio tour through the cell blocks.  The audio guide was actually pretty good with excellent actors and sound effects.  The stories were about life in prison, attempted breakouts, etc.  One of the stories talked about one prisoner who spent his time in solitary confinement playing a game.  He would pull a button off his shirt, and since the cells were pitch dark, he would flip the button and spend time finding it.  It sounded very lonely. There was also a story about how a few of the prisoners managed to overtake the guards and hold them hostage for a few days while they attempted to get off the island.  Eventually, there was a gunfight and most of those prisoners and a few guards were killed.</p>
<p>We wandered up and down the cell blocks and other parts of the buildings listening to all stories.  This whole tour lasted about 2 hours.  Some parts briefly took us outside where it was extremely cold and very windy.  As it got darker, the island took on a whole new look, and started to become more and more creepy.  We took the early ferry back to the mainland before the sun totally set because Tara was extremely cold.  Then we took the cable car over the hills and back to the hostel.</p>
<p><center><wpg2>29399</wpg2><wpg2>29402</wpg2></center></p>
<p>Our last full day in San Francisco, we woke up and had another hearty breakfast at a diner.  Then we walked along the cable car tracks until we reached the cable car museum.  The cable car system in San Francisco now consists of four major lines.  There is one loop of cable that runs the length of the track and ends at the museum where the tension on the lines can be adjusted if they stretch too much.  These cables are in constant motion.  To move the cable car, the driver has two levers: one lever clenches or loosens a clamp on the cable car to adjust traveling speed, and the other applies the breaks to slow the car down.  The system is very similar to a ski lift.  When the car travels around corners, the driver may decide to use the cable to drag it along, or they could decide to drift around the turn.</p>
<p><center><wpg2>29405</wpg2></center></p>
<p>After the cable car museum, we continued walking over the hill and back to fishermanâ€™s wharf.  There, we rented bicycles for ridiculously more compared to anywhere in Asia.  For the same price, we could have lived for 3 days in Thailand.  We followed the path along the cost, up and over the Golden Gate Bridge.  Luckily, we had great weather this day, and the views were fantastic.  It was extremely windy on the bridge.  After we crossed we zig-zagged down the hill into Sausalito, a small neighbourhood across the river from San Francisco.  We stopped there to enjoy a late lunch of fish and chips, then caught the ferry back with almost 200 other tourists on bicycles.  Unfortunately, we ran out of time, and wasnâ€™t able to see the Golden Gate park, or the beach on the west side of the city.  We were so tired from the exercise, that we went to bed early, and got up at 4am just in time to catch the first BART train to the airport.  The rest of the day, we were in transit through Vancouver and then finally back in Ottawa.  </p>
<p><center><wpg2>29411</wpg2><wpg2>29408</wpg2></center></p>
<p>It was a once in a lifetime trip that we wonâ€™t ever forget, and we both sincerely hope that everyone enjoyed the blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.astjohn.ca/2008/09/15/san-francisco-usa/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hong Kong, China</title>
		<link>http://www.astjohn.ca/2008/09/15/hong-kong-china</link>
		<comments>http://www.astjohn.ca/2008/09/15/hong-kong-china#comments</comments>
		<pubDate>Mon, 15 Sep 2008 19:19:29 +0000</pubDate>
		<dc:creator>astjohn</dc:creator>
				<category><![CDATA[Travel]]></category>

		<guid isPermaLink="false">http://www.astjohn.ca/blog/2008/09/15/hong-kong-china</guid>
		<description><![CDATA[Well, it&#8217;s been a while since we&#8217;ve been back, but we never actually finished the story. Here are the last two entries. Hong Kong is a city composed of many islands, mainly Hong Kong Island, and Kowloon Island. It is &#8230; <a href="http://www.astjohn.ca/2008/09/15/hong-kong-china">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Well, it&#8217;s been a while since we&#8217;ve been back, but we never actually finished the story.  Here are the last two entries.</p>
<p>Hong Kong is a city composed of many islands, mainly <a href="http://en.wikipedia.org/wiki/Hong_Kong_Island">Hong Kong Island</a>, and <a href="http://en.wikipedia.org/wiki/Kowloon">Kowloon Island</a>.  It is a financial and architectural metropolis located just off the East cost of mainland China.  We left Singapore early in the afternoon, and arrived in Hong Kong in the evening, just after dusk.  As soon as we arrived at the airport, we picked up our bags, and purchased an airport express ticket and an â€œoctopusâ€ card.  The octopus card is a multi-purpose card that can be used for almost all forms of public transport including the ultra modern MTR subway, buses, tram cars, as well as at stores such as 7-11 and KFC.  It only cost 7HKD (1 USD) with a 50 HKD refundable deposit.  If more money was put on the card and not used before returning the card, there is a full refund issued.  The airport express ticket was good for a single trip into the city on a modern subway/train with few stops.</p>
<p><span id="more-51"></span></p>
<p>During our journey into the downtown area we were concerned about how far the stop was to our hostel, and began to make a plan to take other forms of public transportation.  When we arrived at our destination, we exited the MTR and found that there is a free bus shuttle to the major hotels in the area, one of which was only a block away from ours.  This was a pleasant surprise, as we were loaded down with baggage at this point, and it was also late at night.  We walked to our hostel, located in a massive apartment building, past touts trying to sell us suits and fake goods (watches, purses, etc).  Our building had a tiny mall on the first floor and the rest of the 16 floors had apartments.  It was so busy in this building, that there were multiple elevators serving certain floors to make the ride to the top floors faster.  When we were shown to our floor, we could see that the building was square and hollow in the middle overlooking a courtyard.  As we opened the door to our room, we entered a tiny hallway much cleaner than the rest of the building.  From this hallway, a second door led us to our room, which was actually quite nice.</p>
<p>The following day, we woke up early and decided to do a walking tour recommended in the guidebook through the old central part of Hong Kong Island.  We took the subway there from our hostel on the Kowloon side, and jumped off into some small winding streets.  The Hong Kong MTR system is an efficient way to move around the city.  In addition to this useful traveling network, there is also an underground network of tunnels that have entrance and exits inside buildings, malls or any street intersection corners.  These tunnels can be kmâ€™s long, and at one point link a subway station with a light rail station underground for at least a 15 minute walk.  We never tried, but it might be possible to walk through central downtown without going outside.  If not, itâ€™s certainly possible to walk it with a roof overhead from the covered walkways.</p>
<p>We were still a walk away from the beginning of the tour, so we jumped on the <a href="http://en.wikipedia.org/wiki/Hong_Kong_Tram">tram</a>.  This old, slow and rickety double-decker tram was rammed full of riders, and was pretty fun to take.  We finally jumped off, and began our walk through streets lined with Chinese herbal medicine stores, and small walking streets with cheap souvenirs.  It was just about lunchtime and we were getting very hungry.  Unfortunately we were in a very expensive area, so we started to walk to the SOHO district, known for its many bars and eateries.  On the way there, we stopped by the Graham St. market, which is known for its fresh market filled with fruits and vegetables, and live fish.  According to our Lonely Planet, this is one of the best markets in Hong Kong.  However, compared to other markets we saw in rural China, this market was pretty tame (we didnâ€™t see any fish get beaten over the head in the middle of the walkway).</p>
<p><center><wpg2>28756</wpg2><wpg2>28768</wpg2></center></p>
<p>After lunch in SOHO, we took a ride on the worldâ€™s largest travelator, a horizontal escalator.  This travelator was really just a bunch of escalators up some hills (not all horizontal) lined up between streets.  We then walked to the financial district to 2nd Finance Blvd. which had an exhibit on monetary, etc. which was set up on the 56th floor.  We were only there to see the view.  At first we were nervous walking in the building because we had to show our passports to have official visitor passes printed.  But when we stepped into the elevator which had two floors to choose from: Ground or 56th, we figured that a lot of people probably did the same thing.  This high up, the views of Kowloon bay and the harbour were excellent, as it was a clear and sunny day.  Next, we walked to the Bank of Chinaâ€™s 46th floor for more views of the city.  By this time, it was evening so we went near the water outside the EXPO centre for sunset.  We wanted to enter the EXPO centre, but there was a jewelry conference, so we werenâ€™t allowed to enter.</p>
<p>After a disappointing sunset, we took the MTR back under the harbour and north to the Mong Kok district.  Here we walked through the Temple St. night market, full of fake designer goods, souvenirs, karaoke and fortune tellers (tarot/palm readers).  Halfway through, we stopped at a corner for a cheap dinner of friend noodles with chicken.  The second half of the market was similar to the first.  All in all, it took at least an hour to walk through the whole street.</p>
<p>On our second day in Hong Kong, we woke up and took the <a href="http://en.wikipedia.org/wiki/Star_Ferry">STAR ferry</a> across the harbour from Kowloon to Hong Kong.  The ferry was so old, it might have been the original ferry, complete with wooden seats and interior.  The views from the ferry were fabulous, but the ride was shorter than we expected.  We were visiting Hong Kong this morning to go to an authentic <a href="http://en.wikipedia.org/wiki/Dim_sum">Dim Sum</a> teahouse in the old part of town.  In a Dim Sum restaurant, the eater sits at a table with their plates and cutlery and wait for the food to be brought to the table on a small cart.  In small bamboo baskets are steamed foods, such as dumplings, etc. that are selected.  The cart lady then stamps the card of the eater to show what they had.  At the end of the meal, the card is taken to the cashier to pay the bill.</p>
<p><center><wpg2>28792</wpg2><wpg2>28795</wpg2><center></p>
<p>We arrived at the teahouse just before lunch, and it was a full house.  There was barely enough room to walk through, and we had to wait 20 minutes for an opening at a table before we could sit and eat.  Every table sat 5-6 people, and as soon as there was an opening it was filled regardless if the eater knew anyone at the table.  Fortunately, a nice man saw us standing, and told us to come and eat with him since there were openings at his table.  He was waiting for some friends, but knew that he couldnâ€™t hold the table long due to the number of people standing and waiting.  After we took our seats, our new friend, Nikolas, flagged down the busboy and ordered us a pot of tea, and we received our utensils and our cards.  Along with all this stuff, we also got a bowl of hot water.  We were then instructed to wash our cups and utensils with the hot water to clean them.  The tea that we got was a dark, strong tea.  We assumed that it was one of the more expensive, fermented varieties.</p>
<p>As the food carts wheeled past, we had to ask to look at each item since everyone only spoke Cantonese or mandarin.  One nice, elderly cart lady happily showed us everything as she passed by each time.  We ended up eating steamed shrimp dumplings, flat gelatonous noodles stuffed with pork and drizzled in soy sauce, steamed meat filled buns, and some kind of light yellow cake.  Nikolas helped us to pick the dishes, and was amazed that we could use chopsticks so well.  He was also happy that we got to try the cake, because itâ€™s such a popular dish, itâ€™s usually gone by the time the cart person has traveled 2 feet.</p>
<p>We had no idea how much this meal would cost, and we couldnâ€™t even read the card that was stamped.  Everything was in Chinese characters.  The food was great, and after we were finished, we took the card to the cash register at the front.  The meal cost us less than 10 USD.</p>
<p>After our meal, we had time to kill, so we wandered downtown again, and decided to catch the MTR to see Sik Sik Temple.  This modern Taoist temple always has a constant flow of visitors, although itâ€™s nothing too extraordinary.  Itâ€™s just a large temple in an urban setting with fortune tellers.  After our visit, we went all the way back to the island to get to the Victoria Peak tram in time for sunset at the top.  Unfortunately, many other people had the same idea and the line up was huge!  The wait for the tram was approximately an hour, but we were surrounded by the history of the tram to occupy our time.   At the top of the peak, we enjoyed the scenery and took photos of the city below.  On a clear day, there are good views of the skyscrapers, and luckily we had a great day.  We could also see very expensive mansions/condos dotting the hills surrounding Hong Kong island.  When it was dark, we took some escalators up seven stories to the observation deck at the top of the peak tower.  Like the rest of the peak, the observation deck was rammed full of people.  We had to share or wait patiently for the best spot on the tower to take some photos.</p>
<p>Afterward, there was a massive line up for the tram to get down.  The wait must have been at least two hours, so we decided to take a bus down through the winding road.  The only cars going in the opposite direction (up the hill) were taxis, Porsches, BMWs, Mercedes, etc.  We were dropped off at an MTR station, and we went back to Temple St. for another cheap dinner, and entertainment.</p>
<p><center><wpg2>28780</wpg2><wpg2>28786</wpg2><wpg2>28789</wpg2><wpg2>28801</wpg2><wpg2>28804</wpg2></center></p>
<p>Our final day in Hong Kong we slept in because we were exhausted from the previous two long days.  We spent the afternoon before our flight in the Hong Kong museum of history, a highlight in the LP.  The museum was actually pretty good.  It had everything from fossils to the British opium wars through the Japanese WWII occupation to the present day.  We had just enough time for dinner before heading to the airport.  We caught the airport bus back to the express train station.  The really cool thing about this train service isnâ€™t the almost direct 30 minute train to the airport, but the airline check-in booths located in the station.  Before even stepping onto the train, we checked our baggage and got our boarding passes, saving us a lot of time.  We were just hoping that the system worked well, as our bags had a fair distance to travel.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.astjohn.ca/2008/09/15/hong-kong-china/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kanchanaburi, Thailand and toward Hong Kong, China</title>
		<link>http://www.astjohn.ca/2008/06/17/kanchanaburi-thailand-and-toward-hong-kong-china</link>
		<comments>http://www.astjohn.ca/2008/06/17/kanchanaburi-thailand-and-toward-hong-kong-china#comments</comments>
		<pubDate>Tue, 17 Jun 2008 13:44:12 +0000</pubDate>
		<dc:creator>astjohn</dc:creator>
				<category><![CDATA[Travel]]></category>

		<guid isPermaLink="false">http://www.astjohn.ca/blog/2008/06/17/kanchanaburi-thailand-and-toward-hong-kong-china</guid>
		<description><![CDATA[We pictured Kanchanaburi to be a small village along a river in the middle of some jungle, but it was actually quite a large city since it is the capital of its province. Although it&#8217;s a big city, it does &#8230; <a href="http://www.astjohn.ca/2008/06/17/kanchanaburi-thailand-and-toward-hong-kong-china">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>We pictured Kanchanaburi to be a small village along a river in the middle of some jungle, but it was actually quite a large city since it is the capital of its province.  Although it&#8217;s a big city, it does have close and convenient access to national parks and waterfalls, but we were here mostly to visit the bridge on the river kwai and a tiger temple.</p>
<div class="g2image_float_right"><wpg2>28733</wpg2></div>
<p>The bridge on the river kwai, made famous by the <a href="http://www.imdb.com/title/tt0050212/">movie</a>, was basically the start of what became known as &#8220;<a href="http://en.wikipedia.org/wiki/Death_railway">The Death Railway</a>.&#8221;  The Japanese occupied Thailand and much of South East Asia during WWII, and decided that it was necessary to build a railway into Burma in order to occupy Burma, and cut off important supply routes to China.  The railway was constructed by tens of thousands of POWs, many of which died from disease, malnutrition, fatigue, and the commanding Japanese themselves.</p>
<p>We stepped off the bus and were immediately greeted by the usual touts.  This time we decided to listen to one of them; perhaps because we are at the end of our trip and don&#8217;t really care to hunt for a better bargain.  The woman led us to a driver that was going to take us to the guest house for 80 baht each.  When we started to walk away, he eventually lowered his price to 40 baht total.  He took us to what turned out to be a really nice guest house called &#8220;Jolly Frog.&#8221;  It looked like this place would be quite popular in the busy season since it had nice rooms, a nice courtyard with hammocks, and a massive restaurant with reasonable prices.  After checking into our room, we decided to go for a walk towards the bridge.</p>
<p>Literally 15 minutes into the walk, we made a detour to an air conditioned internet cafe.  The heat was unbearable.  This was the first time in our trip that we had to stop walking, even in the shade, and get out of the heat.  We stayed in the cafe surfing the web for at least two hours until it was around 3pm and the temperature had started to cool down.  At this point, we were able to finish the walk, which turned out to only be a few minutes more to the bridge.  Along the way, we noticed that a woman lost her hat as she drove by on her friend&#8217;s motorbike.  An old man driving the opposite way slowed down and picked up the hat.  Both of us were thinking that it was nice to see such generosity by the old man.  However, instead of turning around and giving the hat  back, he simply dove away slowly as if he would stop if someone complained.  No one complained and he simply puttered down the road after stealing the hat.  We still joke about the &#8220;nice old man.&#8221;</p>
<p><span id="more-49"></span></p>
<div class="g2image_float_left"><wpg2>28729</wpg2></div>
<p>The bridge itself was surrounded by city, but spanned along a picturesque section of the river.  People were free to walk across the bridge &#8220;at their own risk,&#8221; and there were some small safety platforms in the event that a train did need to pass over the bridge.  Looking down the bridge, the tracks seemed to curve into the country side where some of the jungle still remained.  After a few photos, it started to rain gently and we quickly walked back to our guest house.</p>
<p>The second day in Kanchanaburi, we decided to visit the Railway Museum in the morning.  Of the several museums in the city, this one was recommended to be the best, and it did an excellent job of explaining the history behind both the war and the bridge.  It would have been best to visit this exhibit first and then visit the bridge.  We actually managed to spend at least 2 hours absorbing all the history and then caught a quick lunch.  For the afternoon, we had booked a tour to the tiger temple.</p>
<p>The <a href="http://en.wikipedia.org/wiki/Tiger_Temple">tiger temple</a> is located just outside the city, but to visit the temple we had to book transport since no public buses reach the temple itself.  The story is told that the temple was established when a monk took in a orphaned tiger cub and soon the temple was turned into a refugee camp for wild animals.  Both of us imagined the temple to be a fairly exotic looking wat with wild animals scattered throughout the grounds.  Unfortunately, we arrived with about a hundred other tourists, and the entire place was a circus.  We were more or less herded into a fake quarry complete with a tacky waterfall where a line was formed to see the tigers.  A handful of tigers where scattered throughout the area, some laying under planted trees, some on rocks, and all chained to the ground.  In this area, there was only one monk supervising and about 30 employees helping the tourists to the tigers.  We had to wait our turn and then proceed one at a time as one of the employees took our individual photos.  We were not allowed to take the photo ourselves and instead had to give the camera to the employee.  In addition to that, we couldn&#8217;t take a photo with the two of us &#8220;for our own safety.&#8221;  Curiously enough, if we paid an extra 30 US dollars, we could take the &#8220;special&#8221; photo with the two of us together and a tiger in our lap.  The tigers were either really sleepy or heavily sedated since they barely moved at all.  After the photo, we were escorted back to the waiting area which was roped off.  Adam was yelled at by a power hungry American teenager volunteer who told him to step behind the red roped off area.  Since he was two steps to the right of the rope (to have a better angle for photos), Adam said he was in fact behind, but next to the designated area.  The volunteer promptly explained to him that if the tiger was to escape from his chains, it would be a vicious and highly dangerous situation, and that he had better be behind the rope.  Adam simply replied that if that situation did occur, he doubted that a red rope would save him from such a vicious tiger.  The volunteer didn&#8217;t bother Adam anymore.  There was one tiger who had some spunk in him, perhaps because the drugs were wearing off, but the volunteers kept squirting him in the face with water as one would do with a misbehaving house cat.  The entire temple was an overpriced tourist trap that we wouldn&#8217;t recommend to anyone.  After that, we headed back to our guest house, spent the evening reading our books, and took the bus the following morning back to Bangkok.</p>
<p><center><wpg2>28736</wpg2><wpg2>28739</wpg2><wpg2>28742</wpg2><wpg2>28745</wpg2><wpg2>28748</wpg2></center></p>
<p>Our time in Bangkok was fairly nice since we had nothing to worry about.  On one day, we ventured back to <a href="http://www.astjohn.ca/blog/2008/03/09/phetchiburi-to-bankok-thailand">Chatchuchak market</a> to buy a few more souvenirs.  On the next, we went to see the latest <a href="http://www.imdb.com/title/tt0367882/">Indiana Jones</a> movie.  We basically lounged around the city for three full days before catching a plane to Singapore.</p>
<p>Currently, we are in Singapore for the night, and will be catching a plane for Hong Kong tomorrow.  We have three days each in Hong Kong and San Francisco before finally going back to Ottawa.  We are going to try to make the most of each day in the upcoming cities and it is doubtful if we will have time to write again before we are home.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.astjohn.ca/2008/06/17/kanchanaburi-thailand-and-toward-hong-kong-china/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ayutthaya and Lopburi, Thailand</title>
		<link>http://www.astjohn.ca/2008/06/12/ayutthaya-and-lopburi-thailand</link>
		<comments>http://www.astjohn.ca/2008/06/12/ayutthaya-and-lopburi-thailand#comments</comments>
		<pubDate>Thu, 12 Jun 2008 08:01:45 +0000</pubDate>
		<dc:creator>astjohn</dc:creator>
				<category><![CDATA[Travel]]></category>

		<guid isPermaLink="false">http://www.astjohn.ca/blog/2008/06/12/ayutthaya-and-lopburi-thailand</guid>
		<description><![CDATA[We arrived late Friday evening in Chiang Mai and were too late to pick up our Buddha statue from the Fine Arts Department. In order to kill time we decided to visit the zoo on Saturday. We rented a motorbike &#8230; <a href="http://www.astjohn.ca/2008/06/12/ayutthaya-and-lopburi-thailand">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>We arrived late Friday evening in Chiang Mai and were too late to pick up our Buddha statue from the Fine Arts Department.  In order to kill time we decided to visit the zoo on Saturday.  We rented a motorbike and drove through some serious traffic to reach the zoo which was only about 20 minutes from the city centre.  The zoo was pretty small, but somehow we managed to spend the entire afternoon there watching monkeys, lions, tigers, and giant pandas.  On Sunday we slept in and strolled through the city for the day.  In the evening, the Sunday Night market was set-up along a long walking street.  The market stretched for about a kilometer along a cobbled stone street with vendors along either side, some even spilling into side streets and open wats.  Buskers in the middle of the street kept everything entertaining, and there were plenty of food stalls.  There was even a live performance of dancers and breakdancers.  Although the market was very touristy, it seemed as though a large number of local people frequented it as well.  It was easily one of the best market experiences out of the hundreds that we have had.</p>
<p><center><wpg2>28679</wpg2><wpg2>28682</wpg2><wpg2>28676</wpg2></center></p>
<p><span id="more-48"></span></p>
<p>On Monday morning, we were finally able to reach the Fine Arts Department over the phone.  It had been 5 working days, and they told us that it still wasn&#8217;t ready.  We explained to them that we had a train to catch that evening and we had to have the Buddha back whether the documents were ready or not.  That seemed to get their attention, and the papers were ready by the late afternoon.  We got the impression that the department never even bothered to process the documents until that day.  We picked up our Buddha, with official export documents in hand, and caught the night train south to Ayutthaya.</p>
<div class="g2image_float_left"><wpg2>28687</wpg2></div>
<p>Ayutthaya was the capital of Thailand in the 14th century until it was conquered by the Burmese in 1767.  Eventually, it was re-captured by the Thai people and now ruins lay scattered throughout the city.  We arrived, with very little sleep thanks to the brightly lit sleeping train, at 5:30 in the morning.  The only people awake were those running the train station, some tuk-tuk drivers, and people setting up stalls for the morning market.  Instead of paying a tuk-tuk 60 baht to drive us to our guesthouse in the inner city, we chose to walk only 100m to the pier and took a boat across a river for only 6 baht total.  From there, it was only a 5 or 10 minute walk to the main cluster of guest houses.  Unfortunately, nothing was open, and we sat inside a bar / guest house eating mangosteens until the city came alive.  After checking into our room, we decided to yet again rent a motorbike and explore the city.</p>
<div class="g2image_float_right"><wpg2>28694</wpg2></div>
<p>Most of the ruins in Ayutthaya are situated in the inner portion of the city which is surrounded by a moat and some small rivers.  We wandered around several sights and tried to comprehend what they would have looked like before the Burmese ransaked them so long ago.  One wat used to house a 16m tall Buddha covered in 340kg worth of gold, but the entire building was set on fire so that the gold would melt and could then easily be transported back to Burma.  The ruins reminded us of Sukhothai, but more touristy because of how close the city is to Bangkok.  At one point, we saw a long string of brightly decorated elephants carrying tourists along a loop through several of the temples.</p>
<p>We motorbiked around town well into the evening when several of the main wats were beautifully lit.  We didn&#8217;t have much time to hang around though.  Just before the sun had completely set, a massive thunderstorm hit us.  We had to quickly motorbike to our guesthouse, return the bike, and find some dinner.  As Tara was reading in bed back at our guesthouse, she noticed that dirt had fallen from the ceiling right onto her lap.  She looked up and saw a massive spider staring back at her, suspended from the ceiling.  This spider had a belly the size of a large grape, but a leg span of about as wide as you can spread your hand, and the sucker moved fast!  We also think it may have been pregnant because it seemed to carry a white sack underneath its belly.  After 5 minutes of chasing, Adam finally caught the beast in a trashcan which was then left outside in the rain.  Despite Adam duct-taping all of the cracks in the walls and ceiling, Tara didn&#8217;t sleep well that night.</p>
<p><center><wpg2>28691</wpg2><wpg2>28700</wpg2><wpg2>28703</wpg2></center></p>
<p>The next morning we woke up early and took a train to Lopburi, a town dominated by monkeys.  The people who live in Lopburi undoubtably put up with the mischief makers for two main reasons: buddhists believe in treating animals with respect since they are people that have been reborn into that form, and more importantly to keep the flow of tourist dollars rolling in.  Lopburi was also a former capital of Thailand, after Ayutthaya, and as in Ayutthaya there are old ruins scattered throughout the inner portion of the city.  After stepping off the train, we wandered around town and visited several wats and shrines.  Aside from a restored palace which at one point in time was used to receive foreign dignitaries, most of the temples were left untouched and in ruins.  What was more interesting about the ruins and the town itself were the gangs of monkeys.  Phra Kahn Shrine, a small shrine in the middle of a roundabout, seemed to be the home to most of the monkeys, and even had several rope ladders and a pool for their entertainment.  Here, tourists purchased food to feed the monkeys, and there were many good photo opportunities.  We had to watch our backs though because both of us were jumped on from behind by two of the little devils.  We think they liked to see our reaction when caught by surprise.  The thai grounds people had slingshots which they only had to hold up and fake a shot to keep the monkeys at bay.</p>
<p><center><wpg2>28706</wpg2><wpg2>28710</wpg2><wpg2>28713</wpg2><wpg2>28719</wpg2><wpg2>28722</wpg2><wpg2>28725</wpg2></center></p>
<p>We spent the whole day wandering the old portion of the city and keeping an eye out for monkeys running across roof tops.  Most of them used the telephone and electrical wires as a sort of monkey highway with the poles serving as the on and off ramps.  After an entire day of watching monkey mischief, we caught a train back to Ayutthaya.</p>
<p>We&#8217;re now in Kanchanaburi, which was a smooth and short three hour bus ride from Ayutthaya.  Kanchanaburi is about 2 hours west of Bangkok and is the site of the bridge over the river Kwai.  It is our last stop before heading to Bangkok and catching a plane to Hong Kong.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.astjohn.ca/2008/06/12/ayutthaya-and-lopburi-thailand/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pai, Soppong, and Mae Hong Son, Thailand</title>
		<link>http://www.astjohn.ca/2008/06/08/pai-soppong-and-mae-hong-son-thailand</link>
		<comments>http://www.astjohn.ca/2008/06/08/pai-soppong-and-mae-hong-son-thailand#comments</comments>
		<pubDate>Sun, 08 Jun 2008 08:15:50 +0000</pubDate>
		<dc:creator>astjohn</dc:creator>
				<category><![CDATA[Travel]]></category>

		<guid isPermaLink="false">http://www.astjohn.ca/blog/2008/06/08/pai-soppong-and-mae-hong-son-thailand</guid>
		<description><![CDATA[28633 The bus ride to Pai was one of the most scenic rides in all of Thailand. The roads winded through the mountains, and it felt like we were back in Laos again. As we pulled into the bus station, &#8230; <a href="http://www.astjohn.ca/2008/06/08/pai-soppong-and-mae-hong-son-thailand">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div class="g2image_float_left"><wpg2>28633</wpg2></div>
<p>The bus ride to Pai was one of the most scenic rides in all of Thailand.  The roads winded through the mountains, and it felt like we were back in Laos again.  As we pulled into the bus station, a man was walking across the street with a shirt that said &#8220;Do nothing in Pai.&#8221;  This pretty much explains the town in a nutshell.  Pai is a small little tourist town in the North-West area of Thailand which for some reason has turned into a backpacker hangout.  There are no real attractions, except for the scenery, which can include riding elephants through the jungle to view numerous caves and waterfalls.  The town itself is relatively calm, with Western style restaurants everywhere you turn.  There are also plenty of motorbike rental places lining the small, narrow streets.</p>
<p>We decided to take a hint from the hordes of westerners riding motorbikes, and rent one ourselves the next day.  We began the day riding a few kilometers outside the town to a wat located at the top of a small hill.  This wat was not spectacular by itself, but the view from the hill was great.  Unfortunately, since it is almost the rainy season, most of the farmers were burning their fields to create fertilizer.  While this may be great for future crops, the haze in the sky blocks the beautiful scenery.  </p>
<p>We continued our tour past a few of the elephants used for trekking in the area, but decided not to stop to ride one.  Most of the elephants looked very old and tired.  We did stop further down the road at a hot springs site.  It was relatively expensive to get in, so we were expecting huge pools of heated spring water to bathe in.  However, when we got in, all there was to see were a few 80 degree Celsius pools.  A small stream ran across the pools, but it wasn&#8217;t too much fun to wade only up to our ankles in the hot water.  We suspect that this spring is much better during the rainy season when the stream probably turns into a river, and the cold rain water would make the heated water bearable.  The rest of the day, we spent riding around the area taking in the scenery and enjoying our time in what felt like the middle of nowhere, surrounded by jungle, and just us and a motorbike.</p>
<p><span id="more-47"></span></p>
<p>Luckily enough, our motorbike rental came with 6 free hours, so the next day, we decided that instead of heading South like the previous day, we would head North for a quick bike.  One suggested itinerary was to head to a Chinese village nearby, as well as a local waterfall.  The village was rather dull, in that the only evidence that it was a Chinese village were red banners hanging above the doorways of houses.  <a href="http://maow59.multiply.com/photos/album/176/PAI_Mo_Paeng_Waterfall">Mo Paeng</a>, the waterfall, was actually pretty neat.  We had heard that in the dry season, it&#8217;s possible to slide down the smooth rocks into the water below, but due to the rains the night before, the water looked a little too strong to do it safely.  Before going back to town, we toured the rest of the countryside, and fortunately for us, it was finally sunny!  However, before we knew it, we were back in Pai, and getting on a bus bound for Soppong (Pangmapha).</p>
<p>Our reason for visiting Soppong was to see <a href="http://en.wikipedia.org/wiki/Tham_Lot">Cave Lot</a>, a cave known for it&#8217;s various chambers and coffins.  The bus stopped in the small town, and we jumped off and got a room.  The town itself was a single road bordered on either side by a few shops.  You could drive through it in about 10 seconds, and it seemed as if we were the only westerners in the place.  It was still early by this time, so we decided to walk the town to see if there was anything to do.  Five minutes later, we were back at our starting point.  That&#8217;s how exciting the town was.  We spent the rest of the evening relaxing by the river in our bungalow, and eating different kinds of fruit including <a href="http://en.wikipedia.org/wiki/Mangosteen">mangosteen</a> and <a href="http://en.wikipedia.org/wiki/Rambutan">rambutan</a> that we bought from the vendors.  We both decided that mangosteen is now our favourite fruit.  Too bad we can&#8217;t get it in North America.</p>
<p>In order to get to Cave Lod, we had to rent a motorbike.  This seems like a re-occurring theme in the Mae Hong Son province.  &#8220;Mama&#8221; from our guest house told us that we could rent a bike no problem, so we waited about 45 minutes before she told us that it wasn&#8217;t possible.  Undaunted, we walked to the nicer guest house in the area, and they made some calls for us, but told us that there were no bikes for us and that the only place we could get one was in Pai.  It looked as if we had definitely arrived in the slow season.  After asking even more people, and getting turned down, we returned to our guest house, where Mama&#8217;s daughter offered us her bike.  We were relieved, because visiting the cave was our only reason for stopping here.  What we didn&#8217;t know, but learned quickly, was that this was a real motorbike, complete with a clutch.  All previous motorbikes that we had used were either automatic or were manual &#8220;step-throughs&#8221; without a clutch.  All you have to do to drive a step-through is step on a pedal to shift up or down.  Thankfully, Adam is a quick learner, so off we went to the cave.</p>
<div class="g2image_float_right"><wpg2>28639</wpg2></div>
<p>About 10 km into the jungle, we came across Cave Lot, a huge cave with a wide river running through it.  After paying the entrance and guide fee, we set out with our guide carrying a huge gas powered lamp.  As we approached the cave, we could hear thousands of <a href="http://en.wikipedia.org/wiki/Bat">bats</a> and <a href="http://en.wikipedia.org/wiki/Swiftlet">swifts</a> flying in and around the opening of the cave.  The opening itself was probably 8 stories high, and just as wide.  Our guide signaled for one of the men to come with us, and he prepared a bamboo raft for us to sit on to take us through the cave.  The water isn&#8217;t that deep in the cave, probably as deep as 2-3 feet in some spots, so the man just jumped in the water, and pushed us along.  As we entered the cave, the bats and swifts were circling above us, going about their daily business.  It was a really cool feeling, almost like we were in a Batman movie.</p>
<p>We visited three different huge caverns inside the cave complex.  Because of the huge torch and lack of lighting in the caves, it really felt like we were exploring something just discovered.  The caves were full of huge columns, <a href="http://en.wikipedia.org/wiki/Stalactite">stalactites</a> and <a href="http://en.wikipedia.org/wiki/Stalagmite">stalagmites</a>, and gigantic <a href="http://en.wikipedia.org/wiki/Sinkhole">sinkholes</a>.  The second of the caves even had a pre-historic drawing of an animal with an arrow and a sun.  However, due to people touching the picture, it&#8217;s been reduced to light shading.  The last cave had a bunch of <a href="http://www.soppong.com/tlot/tlot.html">teakwood coffins</a> made from hollowed out trees.  According to researchers, these coffins are from 2000-3000 years old (about the same age as the drawing).  This last cavern was situated at the other end of the cave, right where many of the bats and swifts live.  There was crap everywhere, and as we were pushed through the water, we were barely missing their bombs as they fell above us.  Somehow, Tara managed to escape the wrath, but Adam definitely got hit.  At the end of the cave, our raft pusher turned into a raft puller, and pulled us back to the entrance of the cave.  This must have been a tough job, because we were going upstream.  After finishing our visit of the cave, we jumped back on our motorbike and headed back to Soppong.  We arrived just in time to catch the next bus to Mae Hong Son, the capital of the province.</p>
<p>When we arrived in Mae Hong Son, we got caught in the bus scam that was prevalent in Laos.  The new bus station had been built just outside the city, and we were forced to take an expensive tuk-tuk ride into the city.  When we arrived at our chosen guest house, the girls running the place were very helpful and gave us a map of the area, including distances, and what they recommend to see.  After reading about the sites, we decided to rent another motorbike (surprise, surprise) for two days.  </p>
<p>The first day we rode as far North as we could to Mae Aw, a small town right beside the Myanmar border originating from remnants of <a href="http://en.wikipedia.org/wiki/Kuomintang">Kuomintang (KMT)</a> supporters that had fled Yunnan, China.  The scenery along the roads up there was breathtaking, although at times a bit chilly.  We left for this trip early in the morning, and ended up motorbiking through some clouds in the mountains.  We didn&#8217;t stay long in Mae Aw, as we had heard that fighting sometimes breaks out around the border, and so we backtracked to Pha Sua waterfall.  This waterfall is about 20 meters high and 30 meters wide, and has a little pool at the bottom, although it looked too murky for swimming when we were there.  They also encourage you to feed the fish in the pool with a sign that read &#8220;Food Fo Fish&#8221;.  These fish were pretty big; they definitely weren&#8217;t starving.</p>
<div class="g2image_float_left"><wpg2>28649</wpg2></div>
<p>After a rest at the waterfall, we were off to see some more huge fish, at <a href="http://thailandforvisitors.com/north/maehongson/fish/index.html">Fish Cave</a>.  This cave, set in a beautifully manicured park, is home to thousands of huge &#8220;Pluang-Hin&#8221; fish.  These fish can grow up to one meter long, and for unknown reasons are continuously swimming into this cave.  Unfortunately, we can&#8217;t see what is in the cave, but we did end up feeding the fish insects and plants.  We&#8217;ve never seen fish that voluntarily eat veggies.  When we threw the food into the water, they all jumped for it and went crazy.  They even followed us in the water because they know they were going to get fed.</p>
<div class="g2image_float_right"><wpg2>28661</wpg2></div>
<p>Our final stop for the day was a village that was also close to the Myanmar border.  This village is regarded by the Thai as a self-sustaining refugee village, and there is an army base right beside it that also takes in refugees from Myanmar.  As we were driving on the road to the village, we saw a variety of NGO trucks filled with workers.  There are also permanent offices in Mae Hong Son, and so the refugee flow is probably constant, not just due to the cyclone last month.  The reason we wanted to visit the village was due to the <a href="http://en.wikipedia.org/wiki/Kayan_%28Myanmar%29">long-necked women</a>.  From an early age, these Kayan women wear rings of metal around their necks to suppress their bone and muscle structure, and &#8220;elongate&#8221; their necks.  This is an illusion, because their necks aren&#8217;t actually elongated.  The pressure on their collarbone and rib cages actually cause the ribs to slant downward, and the muscles just follow suit.  We spoke with one women who said that it didn&#8217;t hurt, but it was obvious just from speaking with her that her speech is slightly impaired, and she might also not be able to eat very well because her jaw was restricted.  </p>
<div class="g2image_float_left"><wpg2>28642</wpg2></div>
<p>After a long day of touring around the countryside, we took it easy at night and walked around the lake in town to see the small night market.  On our last day in Mae Hong Son, we decided to motorbike pretty far to a waterfall called <a href="http://freegenius.multiply.com/photos/album/32#11">Mae Surin</a>.  Our trusty yellow guidebook suggested visiting it, and our guest house didn&#8217;t, so we definitely wanted to go.  After motorbiking for almost three hours along the windy roads, through clouds and rain, we finally arrived at the spectacular waterfall.  This waterfall must be hundreds of meters high, and surrounded by lush green forest.  It really was a sight to see.  Unfortunately, it wasn&#8217;t sunny, or the pictures would have been unbelievable.  We spent a bit of time here just admiring the falls, and before we knew it, it was almost time to head back.  It seems to rain every afternoon around 3-4pm in this region of Thailand, and so we weren&#8217;t sure if we were going to make it back dry.  Thanks to Adam&#8217;s great driving, we beat the rain by about 15 minutes.</p>
<p><center><wpg2>28667</wpg2><wpg2>28670</wpg2><wpg2>28673</wpg2></center></p>
<p>To complete our time in the Northern part of Thailand, we took the bus back to Chiang Mai along the southern route, through the <a href="http://www.dnp.go.th/parkreserve/asp/style1/default.asp?npid=1&#038;lg=2">Doi Inthanon National Park</a>.  We&#8217;re now back in Chiang Mai to try and pick up our Buddha, and head toward Bangkok for the final portion of our trip.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.astjohn.ca/2008/06/08/pai-soppong-and-mae-hong-son-thailand/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
