<?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>Gary Smith</title>
	<atom:link href="http://garysmith.ca/feed/" rel="self" type="application/rss+xml" />
	<link>http://garysmith.ca</link>
	<description>Toronto Web Developer</description>
	<lastBuildDate>Mon, 02 Apr 2012 23:26:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
<meta xmlns="http://www.w3.org/1999/xhtml" name="robots" content="noindex,follow" />
		<item>
		<title>HTML5 Game: Air Raid Defender</title>
		<link>http://garysmith.ca/2012/04/html5-game-air-raid-defender/</link>
		<comments>http://garysmith.ca/2012/04/html5-game-air-raid-defender/#comments</comments>
		<pubDate>Mon, 02 Apr 2012 02:05:40 +0000</pubDate>
		<dc:creator>wpadmin</dc:creator>
				<category><![CDATA[Blog Entry]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[hide-thumb-in-full-entry]]></category>

		<guid isPermaLink="false">http://garysmith.ca/?p=781</guid>
		<description><![CDATA[Welcome to my second attempt at an HTML5 game: Air Raid Defender! This game was coded in HTML5 Canvas and JavaScript with the Paper.js library. I&#8217;ve only used a few of the library&#8217;s many features (and pretty much ignored its &#8230; <a href="http://garysmith.ca/2012/04/html5-game-air-raid-defender/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Welcome to my second attempt at an HTML5 game: <strong>Air Raid Defender</strong>!</p>
<p><iframe src="http://garysmith.ca/air-raid-defender/" width="600" height="392" scrolling="no" frameborder="0" style="border: 1px solid black; margin: -5px 0 0 0;"></iframe></p>
<p><!-- AddThis Button BEGIN --></p>
<div class="addthis_toolbox addthis_default_style" style="margin-top: -15px; margin-bottom: 15px;">
    <a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_google_plusone"></a><a class="addthis_button_compact"></a><a class="addthis_counter addthis_bubble_style"></a>
</div>
<p>This game was coded in HTML5 Canvas and JavaScript with the <a href="http://paperjs.org/" target="_blank">Paper.js</a> library.  I&#8217;ve only used a few of the library&#8217;s many features (and pretty much ignored its focus on vector-based graphics in favour of bitmaps) but I found the library vastly simplified basic tasks such as placing image objects on the screen, rotating them, and refreshing and redrawing the canvas with every frame.  In this respect it feels like progress over my more rudimentary <a href="/my-first-html5-game-rodent-race/" title="Rodent Race">first HTML5 game</a>.</p>
<p>The gameplay itself is straightforward:  use the mouse to aim the anti-aircraft gun, and click to shoot.  It takes three hits to bring down a plane. Once the planes have bombed the city into destruction, your game is over.  Aid parachutes drop occassionally to rebuild individual towers.  Between levels, the city regenerates based on how accurate your shooting was in the previous level, so make every bullet count.</p>
<p>While the game is playable in all modern browsers, the experience differs drastically between them.  On Safari the overall frame rate is slow, causing the frequency of timer related events like bomb dropping to be relatively fast, making it almost impossible to survive the first level.  FireFox behaves better, but slows down noticeably whenever things get intense.  Chrome and Internet Explorer 9 (surprise!) offer the smoothest and most playable overall experiences.</p>
<p>I have attempted to optimize my code as much as possible, through basic things like reusing assets and freeing objects when no longer needed, so I&#8217;m not sure what I could do to improve these issues.  It&#8217;s possible I&#8217;m not using paper.js in the way it was originally intended, with so many bitmap images.  Still, I think it&#8217;s fairly exciting as another proof-of-concept to see what&#8217;s now possible in a post-Flash world.</p>
<p>Things I would add or fix if I had infinite time and energy:</p>
<ul style="margin-top: -15px;">
<li>Add some sound:  I had some basic gunshots and explosions roughed in, but browser variations and delays between when a sound&#8217;s play() method was called and when it was audible made it more distracting than anything, so I removed it.</li>
<li>Add different types of planes, including ones that drop &#8220;super bombs&#8221; to destroy entire towers.</li>
<li>Add different building types and different skylines.</li>
<li>Make it mobile-friendly (currently it is not playable on a touch interface).</li>
<li>Integrate a high score board.</li>
<li>Make it overall more fun and less boring.</li>
</ul>
<p>Lesson learned:  if HTML5 is the platform, next time I&#8217;ll make a strategy game, not an arcade game.</p>
<p><script type="text/javascript"> 
$(document).ready( function() {
  setInterval(function() {
     stopAutoInterval();
  }, 500);
});
</script><br />
<script type="text/javascript">
  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://garysmith.ca/2012/04/html5-game-air-raid-defender/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Future Possibilities for Kids</title>
		<link>http://garysmith.ca/2011/12/future-possibilities-for-kids/</link>
		<comments>http://garysmith.ca/2011/12/future-possibilities-for-kids/#comments</comments>
		<pubDate>Sun, 18 Dec 2011 14:21:24 +0000</pubDate>
		<dc:creator>wpadmin</dc:creator>
				<category><![CDATA[Portfolio Project]]></category>

		<guid isPermaLink="false">http://garysmith.ca/?p=732</guid>
		<description><![CDATA[Future Possibilities for Kids provides community leadership and life skills development programs for 8 to 14 year olds in Toronto and surrounding regions  <a href="http://garysmith.ca/2011/12/future-possibilities-for-kids/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Future Possibilities for Kids</strong> provides community leadership and life skills development programs for 8 to 14-year-old children in the Toronto area.  </p>
<p>Working with <a href="http://designforgood.ca" title="Design for Good" target="_blank">Design for Good</a>, I implemented the provided graphic design concepts and requirements as a custom WordPress theme, and enhanced it with customized plugins that help create a friendly, contemporary and easy-to-maintain website to showcase the organization&#8217;s work for potential donors, volunteers and participants.</p>
]]></content:encoded>
			<wfw:commentRss>http://garysmith.ca/2011/12/future-possibilities-for-kids/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My First HTML5 Game:  Rodent Race</title>
		<link>http://garysmith.ca/2011/11/my-first-html5-game-rodent-race/</link>
		<comments>http://garysmith.ca/2011/11/my-first-html5-game-rodent-race/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 04:48:45 +0000</pubDate>
		<dc:creator>wpadmin</dc:creator>
				<category><![CDATA[Blog Entry]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[hide-thumb-in-full-entry]]></category>

		<guid isPermaLink="false">http://garysmith.ca/?p=593</guid>
		<description><![CDATA[Here it is! Rodent Race is my first attempt at a casual game coded with HTML5, Canvas, CSS3, and jQuery. This game contains no Flash and works pretty well in recent versions of all modern browsers (IE8/9, FireFox, Safari, Chrome). &#8230; <a href="http://garysmith.ca/2011/11/my-first-html5-game-rodent-race/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><iframe src="http://garysmith.ca/rodent-race/" width="322" height="358" frameborder="0" scrolling="no" style="float: left; margin: 10px 15px 0 0;"></iframe>Here it is!  <strong>Rodent Race</strong> is my first attempt at a casual game coded with HTML5, Canvas, CSS3, and jQuery. This game contains no Flash and works pretty well in recent versions of all modern browsers (IE8/9, FireFox, Safari, Chrome). The game is also playable &mdash; though much more difficult &mdash; on mobile devices including the iPad, iPod and Android 2.3 phones.</p>
<p>Building an arcade game with these tools was challenging, but the results are promising.  This game is mostly a proof-of-concept to see what&#8217;s possible; it wasn&#8217;t really planned out in advance, hence the silly concept.  </p>
<h3>Game Play</h3>
<p>Control your grey mouse with your keyboard arrow keys, or by touching the arrow key graphics on a touch device.  Avoid the evil red mice, who kill you on contact with bloody results.  Collect all the cheese, then escape through the unlocked exit.  There are 6 distinct level maps.  Once you complete all level maps, they start over and the game gets a little faster.  Repeat until dead.</p>
<h3>Code Structure</h3>
<p>To get my hands dirty I intentionally coded everything from scratch without using any third party game libraries or frameworks.  This seat-of-pants development resulted in code that&#8217;s not particularly well structured, with a lot of global variables and arrays.  I look forward to attempting a second game with a more coherent, scalable Object Oriented structure, but for now this jumble o&#8217; functions will have to do the job.  The <a href="https://github.com/garyesmith/RodentRace/blob/master/includes/game.js" target="_blank">main game file</a> is about 1000 lines of Javascript.</p>
<p>The core of the game is a basic state machine to control the primary phases, such as &#8220;title page&#8221;, &#8220;playing&#8221;, &#8220;player dead&#8221;, &#8220;new level&#8221;, and &#8220;game over&#8221;.  The game loop is a timeout event that fires every 100ms for the first pass through the levels, and then 5ms faster each pass after that.  This is a relatively slow fire rate, so on each timer tick I move the player 15 pixels, and the enemies 5 pixels.  The movement is slightly jerky, but I think it mimics the darting motion of real mice.  </p>
<p>Everything in the game is Canvas-based except for some of the opening and closing game buttons and rollovers, which I found easier to implement as regular HTML elements layered on top of the canvas, shown or hidden as needed using jQuery and CSS.</p>
<h3>Canvas</h3>
<p>The new Canvas element is at the core of HTML5, and it&#8217;s what finally makes playable games feasible without Flash.  However, having used Flash and ActionScript in the past, Canvas seemed quite crude and low-level at first glance.  I took me some time to learn that the Canvas is exactly that:  a surface to draw on.  Once you draw an image or text to the canvas, you cannot modify or move it.  There is no built-in concept of a &#8220;sprite&#8221; or &#8220;image object&#8221; that can float atop a background and be animated separately.  Instead, drawing on the Canvas is more like stamping a piece of paper with a rubber stamp:  you can stamp repeatedly, but your old impressions remain visible unless you turn to a blank page.  </p>
<p>That means my game code needs to manually manage the clearing of the canvas on each update timer tick. I handled this at the beginning of each refresh cycle by simply re-drawing the current game board background image to clear everything in the top portion of the canvas.  Then I recalculate and redraw the player, enemy, cheese, and exit in their appropriate states in the right places.</p>
<h3>Tiles</h3>
<p>Rodent Race is essentially a <a href="http://en.wikipedia.org/wiki/Tile-based_video_game" target="_blank">tile based game</a>, meaning that the gameplay area is a grid divided into square tiles, in this case, 30 by 30 pixels.  The game mazes are then represented internally by simple two-dimensional arrays, with numbers representing open space, walls, or cheese.  The information for the levels is defined in an <a href="https://github.com/garyesmith/RodentRace/blob/master/includes/levels.xml" target="_blank">external XML file</a> that&#8217;s loaded and parsed dynamically. Here&#8217;s an example of the definition of the maze for level 1:</p>
<pre>
1,1,1,1,1,1,1,1,1,1,1,
1,5,0,0,0,0,0,0,0,5,1,
1,0,1,0,1,1,1,0,1,0,1,
1,0,1,0,0,0,0,0,1,0,1,
1,0,1,0,0,1,0,0,1,0,1,
1,0,1,1,0,1,0,1,1,0,1,
1,5,0,0,0,1,0,0,0,5,1,
1,1,1,1,1,1,1,1,1,1,1
</pre>
<p>In a tile based game, it is very easy to do some simple math during each timer tick to determine which tile the player and the enemies currently reside on.  From there, it&#8217;s easy to determine if there&#8217;s a collision between the player and enemy, or to consult the array to see if the player is on top of a piece of delicious cheese.  This is helpful since Canvas has no built-in low level collision detection like hitTest() in Flash ActionScript.</p>
<h3>Graphics</h3>
<p>The graphics are all simple PNGs and JPGs created in Photoshop, loaded dynamically at the initiation of the game.  I made some effort to optimize the images, however, for a future game I would aim to use more &#8220;sprite&#8221; images to reduce the number of different assets that need to be loaded. I did use sprites for images that have have multiple positions, such as the mice, which face in four directions. For example, here&#8217;s the player sprite image:</p>
<p><img src="http://s151471163.onlinehome.us/html5game/images/player.png" alt="Player" style="border: 1px solid black;" /></p>
<h3>Sound</h3>
<p>Audio in HTML5 is probably the most poorly supported aspect, with many cross-browser and cross-platform challenges.  About 50% of the time I spent on this game was eaten up by experimenting with sound, experiments that were only partially successful.  On desktop browsers, the support is quite decent.  I was able to loop a simple (annoying) theme song in the background, and then simultaneously play other game sounds (like mouse &#8220;squeaks&#8221; and cheese &#8220;chomping&#8221; sounds) as needed without much difficulty.  On these browsers, the delay between calling a sound and when it is played is negligible.  The song loops reasonably smoothly, though that varies from browser to browser, so sometimes there is a noticeable glitch in the song when it starts over.</p>
<p>Mobile devices, on the other hand, are way behind in HTML5 audio support.  The iOS devices such as iPad, iPod (and I presume iPhone, which I don&#8217;t have) do support audio, but only in a very restricted way &#8212; audio can only be played immediately after a user interaction such as a click, two sounds cannot play simultaneously, and there is sometimes a painful delay between when a call to play a sound is initiated and when it is actually heard.  On my Android phone, the song would not play at all; the shorter sound effects would play, but only after an unacceptable delay, and after a half-dozen sound calls the browser would crash.  As a result of these struggles, I concluded that mobile HTML5 isn&#8217;t yet ready for the sort of real-time audio an arcade game demands, so I implemented a simple user agent check and then disabled sound entirely on those devices.  Sniff.  (I read with interest <a href="http://remysharp.com/2010/12/23/audio-sprites/" target="_blank">Remy Sharp&#8217;s post on &#8220;audio sprites&#8221; for iOS</a> which sounds like a great theory, but I didn&#8217;t feel like investing that much time here. Something for the future.)</p>
<p>The theme song was &#8220;recorded&#8221; in Garage Band using the keyboard piano tool, the notes sounded out by my semi-musical ear.  The other effects were downloaded from free sound effect sites, and then heavily cropped and munged in Adobe Soundbooth.  Each sound file had to be uploaded in three formats:  .mp3, .ogg, and .aac, since different browsers and platforms use different formats, though all can be encapsulated within a standard HTML audio element.</p>
<h3>Artificial Intelligence</h3>
<p>The &#8220;intelligence&#8221; of the enemies is fairly rudimentary, but because of the small size of the mazes, it&#8217;s more than enough to keep things challenging. Essentially, the enemy rodents will always keep moving in their current direction until they hit a wall.  At that time a new direction is chosen.  This direction will always be towards the player; however, when the player is in a different position both horizontally and vertically, only one of the two directions is chosen randomly.  This adds a little bit of unpredictability to the enemies&#8217; movement, and also helps reduce the number of times they stop moving entirely behind a wall while waiting for the player to move, though this still happens occasionally.  After a bit of practice playing, you can learn to predict certain patterns of enemy movement and find &#8220;safe&#8221; squares where you can wait until the coast clears.</p>
<h3>High Scores</h3>
<p>Against my better judgment, I have implemented a high score board.  The scores are stored in an external XML file, which is read and parsed by jQuery.  Only the actual score updating is handled by Ajax calls to PHP, which is required to write to the server. I say &#8220;against my better judgment&#8221; because I know that it is pretty much impossible to create a secure high score board in client-side Javascript. I am fully aware that hacking this scoreboard to blast it with artificial high scores would be trivial for the right person.  However, if you do this, I will be impressed only by the amount of free time you have to waste: please volunteer at an animal shelter instead.  There are probably some mice-loving cats that need saving.</p>
<h3>Lessons Learned</h3>
<p>As I mentioned, this game was really intended as a personal proof-of-concept and a learning experience.  And I am pleased to report I did learn a few things.  In no particular order, here are some notes to my future self:</p>
<ul>
<li>This game is technically playable on touch mobile devices, but pretty much impossible.  If you&#8217;re going to make a game for mobile, make sure the controls are super easy: a four-direction arrow pad is just not feasible in a fast-paced game.  Two touch points, widely separated on the screen, would be much more reasonable.</li>
<li>The canvas is pretty flexible once you get the hang of it, and modern browsers can seem to handle a lot of graphic updates on a single timer tick.  This bodes well.  But manually handling the drawing and refreshing of multiple elements quickly leads to spaghetti code.  A nicely abstracted object model that allows sprites to be created, assigned parameters, and then &#8220;forgotten&#8221; as they are automatically managed on each tick will be mandatory for anything more ambitious.</li>
<li>HTML5 Audio in desktop browsers is surprising well implemented now:  only a year or two ago Flash add-ons were still needed to play sounds in HTML5, so this is a great advance.  There are not too many limitations to worry about here. (Mobile is another story entirely for now.)</li>
</ul>
<h3>The Code</h3>
<p>All the game code, minus that related to high scores, is available on GitHub at this URL:<br />
<a href="https://github.com/garyesmith/RodentRace" target="_blank">https://github.com/garyesmith/RodentRace</a></p>
<p>Please feel free to download the game code, check it out, play with it, laugh at my coding blunders, use code snippets in your own projects, and so on.  However, please don&#8217;t redistribute the game in its entirety, and if you are re-using the vast majority of the code base for some reason, please give me credit and a link back to garysmith.ca.</p>
<p>And finally, credit where credit is due:  any resemblance to an old Commodore 64 game called <a href="http://www.youtube.com/watch?v=qwnzsIH_1Uk" target="_blank">Radar Rat Race</a> is entirely intentional.</p>
<p>Feedback or suggestions about this game is welcome, either in the comments or via my <a href="/contact">contact form</a>.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://garysmith.ca/2011/11/my-first-html5-game-rodent-race/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Moving a Website to a New Domain &#8212; Safely</title>
		<link>http://garysmith.ca/2011/10/moving-a-website-to-a-new-domain-safely/</link>
		<comments>http://garysmith.ca/2011/10/moving-a-website-to-a-new-domain-safely/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 02:40:27 +0000</pubDate>
		<dc:creator>wpadmin</dc:creator>
				<category><![CDATA[Blog Entry]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://garysmith.ca/?p=471</guid>
		<description><![CDATA[When I launched this new portfolio site, I faced the task of seamlessly forwarding existing URLs for my old gesmith.ca domain to my new garysmith.ca domain, while also accounting for the slightly different path names on the new domain. My &#8230; <a href="http://garysmith.ca/2011/10/moving-a-website-to-a-new-domain-safely/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When I launched this new portfolio site, I faced the task of seamlessly forwarding existing URLs for my old <strong>gesmith.ca</strong> domain to my new <strong>garysmith.ca</strong> domain, while also accounting for the slightly different path names on the new domain.  My old portfolio had been around for years and enjoyed excellent Google indexing, and I was terrified of losing that asset.  However, the process of safely moving a full site from one domain to another was not as straightforward as you might think, so I thought I&#8217;d document it in detail.</p>
<h3>Only One Site at a Time</h3>
<p>First, I had to be careful to develop and test my new website on a server that was not accessible to the world at large.  If my work-in-progress was exposed publically for even a day or two, the <a href="http://www.google.com/support/webmasters/bin/answer.py?answer=182072">Googlebot</a> might have found it and indexed it.  I really didn&#8217;t want two distinct copies of my portfolio indexed separately:  in addition to being confusing, that might also cause Google to downgrade my search result rankings because sites with cloned content can be penalized to discourage <a href="http://en.wikipedia.org/wiki/Content_farm">content farming</a>.</p>
<p>My quick solution for this was to use a password-protection WordPress plugin called <a href="http://plugins.x-blogs.org/plugins/private-wordpress-access-control-manager/">Private!</a> that ensured I had to be logged in to view my site.  It also let me create multiple users, so if I wanted to solicit feedback from trusted friends or colleagues I could give them a username and password.  But bots and spiders from Google and other search engines were blocked.  </p>
<aside>Without WordPress, similar protection could have been implemented by directly configuring my webserver to add <a href="http://httpd.apache.org/docs/2.0/howto/auth.html">authentication</a> to my site&#8217;s root folder. And of course, I could have installed and configured a local Apache/PHP/MySQL environment to work in, but I prefer to test and debug in the actual server environment under the real domain, to weed out as many problems as possible before launch.</aside>
<h3>Create 301 Permanent Redirects</h3>
<p>When it finally came time to launch, I ensured that my new domain was pointing to my new site and then removed the password protection.  Then, since my site host runs on an Apache server, I created an <strong>.htaccess</strong> server configuration file in the root of my old <strong>gesmith.ca</strong> site to map all the existing URLs from that domain to my new one. Other types of web servers implement this differently, but the idea is the same.  </p>
<p>It took me some time to create this redirection file, as I had to carefully comb through my old site to determine exactly what pages needed forwarding, and find their equivalent URLs on my new site.  I also did some common Google searches on my own content to make sure that any pages in the search results were forwarded correctly.  </p>
<p>In the <strong>.htaccess</strong> file, I mapped each URL from the old to the new site using a permanent redirect with the status code of 301, which informs clients like the Googlebot that the requested URL has been moved permanently to a new URL.</p>
<aside>Quick background: There&#8217;s an invisible header returned with all HTTP requests, and these headers all include a three-digit numeric status code.  Even casual web users are probably familiar with the status code 404, which means &#8220;Page Not Found&#8221;, but there are in fact <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">many other status codes</a> that web clients and servers can use to interpret requested pages.</aside>
<p>To define a 301 permanent redirect in an Apache <strong>.htaccess</strong> file, I used this syntax:</p>
<p><span class="sourcecode">redirect 301 /contact.html http://garysmith.ca/contact/</span></p>
<p>Here, <strong>301</strong> is the code to indicate this is a permanent redirect, <strong>/contact.html</strong> is the path requested on the old server relative to the domain, and <strong>http://garysmith.ca/contact/</strong> is the full destination path to redirect to.  This same syntax applies to all redirect lines in the file; my small site has several dozen.</p>
<p>This redirection happens silently, so casual web users might not even notice that the page they&#8217;re reading is actually on a different domain than was shown in the link they originally clicked.   But that&#8217;s okay&#8230; it beats a dead link!  The important thing is that no traffic is lost, and the search engines now know that the original link is obsolete and what its replacement should be.</p>
<p>After all my specific pages had been redirected as above, I added a final generic redirect to the bottom of my <strong>.htaccess</strong> file to catch any other attempts to hit files on my old domain.  Since I don&#8217;t know exactly what these unknown paths might be or they were meant to go, I just send them to the home page of my new domain:</p>
<p><span class="sourcecode">redirect 301 / http://garysmith.ca/</span></p>
<p>The &#8220;from&#8221; path in this line is simply a &#8220;/&#8221;, which refers to the root of the domain.  This also catches attempts to hit any file or path on the old domain that hasn&#8217;t already been redirected:  even something nonsensical like <strong>http://gesmith.ca/blah/blah.html</strong> will now redirect to my new new site, even if it is in turn redirected to my &#8220;Not Found&#8221; page.  That&#8217;s fine, because it gives visitors a chance to find what they&#8217;re looking for on my new site.</p>
<h3>Letting Google Know</h3>
<p>If I had done nothing more than the steps above, Google would have eventually figured out that my site had moved.  Old references to <strong>gesmith.ca</strong> would have gradually fallen out of the search results index, and new references to <strong>garysmith.ca</strong> would have been added.  But that process could take weeks or months, and I&#8217;m an impatient modern man.  So I wanted to hurry things along a little.</p>
<p>Luckily, Google is staffed by fellow impatient people, so they have kindly provided a set of <a href="https://www.google.com/webmasters/tools/home?hl=en">Webmaster Tools</a> for just these sorts of tasks.  After my account was activated, I added both my old <strong>gesmith.ca</strong> and my new <strong>garysmith.ca</strong> domain into the tools, both with and without the <strong>www</strong> prefix.  For each domain, I had to upload a special HTML file provided by Google into the site root, to prove I actually owned the site &#8212; imagine the chaos if anyone could manage any site on the Internet.</p>
<aside>In order for the Google Webmaster Tools to hit that special HTML file on my old site, I had to temporarily disable my .htaccess redirects &#8212; otherwise the verification would have failed!  It only took a moment.</aside>
<p>Once the domains were added and confirmed, I clicked on my old <strong>gesmith.ca</strong> domain in the tools.  Under the <strong>Site Configuration</strong> section I chose <strong>Change of Address</strong>.  From there I was able to specify the new domain for the site by selecting <strong>garysmith.ca</strong> from a dropdown list of all my previously added sites.  I submitted the request, and that was it: Google had now been explicitly informed that both these domains hosted versions of the same site, and that one was moving to the other.  </p>
<h3>The Waiting Game</h3>
<p>Of course, since I was dealing with Google&#8217;s enormous index of data, nothing happened instantaneously.  After a day or so, links to my new site began showing up in certain very specific Google queries, but most of the results were still pointing to my old site (though of course when clicked they were redirecting to the new site).  It was only after about 10 days that my new domain became the default result for most of the search terms that regularly generate my traffic.  Mission accomplished!  Eventually.</p>
]]></content:encoded>
			<wfw:commentRss>http://garysmith.ca/2011/10/moving-a-website-to-a-new-domain-safely/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Portfolio 4.0</title>
		<link>http://garysmith.ca/2011/10/a-new-portfolio-is-born/</link>
		<comments>http://garysmith.ca/2011/10/a-new-portfolio-is-born/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 02:36:50 +0000</pubDate>
		<dc:creator>wpadmin</dc:creator>
				<category><![CDATA[Administrative]]></category>
		<category><![CDATA[Blog Entry]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://garysmith.ca/?p=1</guid>
		<description><![CDATA[As the middle of 2011 arrived, my existing portfolio site started to feel pretty clunky.  Having worked recently with newer technologies like HTML5, CSS 3 and mobile-friendly web pages, my circa-2008 site suddenly seemed archaic. <a href="http://garysmith.ca/2011/10/a-new-portfolio-is-born/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As the middle of 2011 arrived, my existing portfolio site started to feel pretty clunky.  Having worked recently with newer technologies like HTML5, CSS 3 and mobile-friendly web pages, my circa-2008 site suddenly seemed archaic.  Besides, I never much liked the design. So when I noticed that the domain <em>garysmith.ca</em> was finally available for registration I knew that the time had come for change.  <span id="more-1"></span>And I am delighted to say farewell to the awkward <em>gesmith.ca</em> domain &#8212; it was always just a byproduct of my common name.</p>
<p>This new portfolio site, its fourth incarnation since 2003, is a total overhaul.  The site now runs on <nobr>WordPress 3</nobr> with a custom theme I heavily adapted from ElmaStudio&#8217;s nifty <a href="http://www.elmastudio.de/wordpress-themes/yoko/" title="Yoko WordPress Theme">Yoko</a> theme.  It&#8217;s in HTML5 and uses some CSS 3 style effects that degrade gracefully in older browsers.  This site was also a chance to indulge my new addiction to <a href="http://www.google.com/webfonts" title="Google Web Fonts">Google Web Fonts</a>, a great tool that finally frees us from the oppressive shackles of Arial.</p>
<p>In addition, this theme adopts Yoko&#8217;s use of stylesheet @media queries to create a fluid layout that adjusts automatically for various screen resolutions, all the way down to mobile devices such as iPhones. This ability to create content once and have it display nicely on a multitude of different devices is fantastic for both the content maintainer and the end user. That said, it definitely takes extra development effort to consider all the possible layout scenarios that might result from a smaller screen resolution.</p>
<p>My job gets more interesting every year, but it definitely doesn&#8217;t get simpler.</p>
]]></content:encoded>
			<wfw:commentRss>http://garysmith.ca/2011/10/a-new-portfolio-is-born/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Messinger Consultants</title>
		<link>http://garysmith.ca/2011/09/messinger-consultants/</link>
		<comments>http://garysmith.ca/2011/09/messinger-consultants/#comments</comments>
		<pubDate>Sun, 25 Sep 2011 17:20:47 +0000</pubDate>
		<dc:creator>wpadmin</dc:creator>
				<category><![CDATA[Portfolio Project]]></category>

		<guid isPermaLink="false">http://garysmith.ca/?p=237</guid>
		<description><![CDATA[Messinger Consultants provides marketing, communications and branding services. For their website, I was responsible for converting the clean, professional design created by S+P Design into functional, standards-compliant code. As the site content will remain fairly static, no CMS was required. &#8230; <a href="http://garysmith.ca/2011/09/messinger-consultants/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Messinger Consultants</strong> provides marketing, communications and branding services.  For their website, I was responsible for converting the clean, professional design created by <nobr><a href="http://spdesign.ca/" title="S+P Design" target="_blank">S+P Design</a></nobr> into functional, standards-compliant code.</p>
<p>As the site content will remain fairly static, no CMS was required.  However, I did create some custom functionality for a jQuery-powered animated client logo slider which dynamically parses data from an XML definition file, allowing for easy modification of client logos at a later date.</p>
]]></content:encoded>
			<wfw:commentRss>http://garysmith.ca/2011/09/messinger-consultants/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Electricana Group</title>
		<link>http://garysmith.ca/2011/09/electricana-group/</link>
		<comments>http://garysmith.ca/2011/09/electricana-group/#comments</comments>
		<pubDate>Fri, 23 Sep 2011 08:20:35 +0000</pubDate>
		<dc:creator>wpadmin</dc:creator>
				<category><![CDATA[Portfolio Project]]></category>

		<guid isPermaLink="false">http://garysmith.ca/?p=344</guid>
		<description><![CDATA[Electricana Group</strong> is an Electrical Contractor located in Aurora, Ontario,. <a href="http://garysmith.ca/2011/09/electricana-group/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Electricana Group</strong> is an Electrical Contractor located in Aurora, Ontario, accredited by the Electrical Safety authority (ECRA/ESA).</p>
<p>Working with the designs provided by <a href="http://spdesign.ca" title="S+P Design" target="_blank">S+P Design</a>, I was responsible for coding the XHTML, JavaScript, CSS, and PHP required to create a clean, search-engine-friendly website.</p>
]]></content:encoded>
			<wfw:commentRss>http://garysmith.ca/2011/09/electricana-group/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Federation of Ontario Public Libraries</title>
		<link>http://garysmith.ca/2011/08/federation-of-ontario-public-libraries/</link>
		<comments>http://garysmith.ca/2011/08/federation-of-ontario-public-libraries/#comments</comments>
		<pubDate>Sat, 13 Aug 2011 12:04:46 +0000</pubDate>
		<dc:creator>wpadmin</dc:creator>
				<category><![CDATA[Portfolio Project]]></category>

		<guid isPermaLink="false">http://garysmith.ca/?p=254</guid>
		<description><![CDATA[The Federation of Ontario Public Libraries is a non-profit organization that advocates for public libraries in Ontario. <a href="http://garysmith.ca/2011/08/federation-of-ontario-public-libraries/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The <strong>Federation of Ontario Public Libraries</strong> is a non-profit organization that advocates for Ontario public libraries.  The website is a resource that provides information about the federation to the public, and a community hub for members to share news.  </p>
<p>I created a custom WordPress theme to implement the design provided by <a href="http://swervedesign.com" title="Swerve Design" target="_blank">Swerve Design</a>, and used a combination of third-party and custom plugins to create members-only site sections.  Other custom features include a jQuery-based home page feature rotator and a content font-sizing widget.</p>
]]></content:encoded>
			<wfw:commentRss>http://garysmith.ca/2011/08/federation-of-ontario-public-libraries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Active Communities Pledge</title>
		<link>http://garysmith.ca/2011/08/active-communities-pledge/</link>
		<comments>http://garysmith.ca/2011/08/active-communities-pledge/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 02:48:49 +0000</pubDate>
		<dc:creator>wpadmin</dc:creator>
				<category><![CDATA[Portfolio Project]]></category>

		<guid isPermaLink="false">http://garysmith.ca/?p=212</guid>
		<description><![CDATA[The Active Communities Pledge microsite provided information about the Share the Road Cycling Coalition and enables both candidates for office and voters to pledge their support for the cause. <a href="http://garysmith.ca/2011/08/active-communities-pledge/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The <strong>Active Communities Pledge</strong> microsite provides information about the <em>Share the Road Cycling Coalition</em> and enables both candidates for office and voters to pledge their support for the cause.  Site visitors may also share information about the cause via email and social media.</p>
<p>Working with the designs and concepts created by <a href="http://designforgood.ca" title="Design for Good" target="_blank">Design for Good</a>, I coded custom PHP and MySQL to handle the pledge submissions, validation, data exporting, and email sending functionality.</p>
]]></content:encoded>
			<wfw:commentRss>http://garysmith.ca/2011/08/active-communities-pledge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protect Your Share</title>
		<link>http://garysmith.ca/2011/07/protect-your-share/</link>
		<comments>http://garysmith.ca/2011/07/protect-your-share/#comments</comments>
		<pubDate>Sat, 30 Jul 2011 14:37:48 +0000</pubDate>
		<dc:creator>wpadmin</dc:creator>
				<category><![CDATA[Portfolio Project]]></category>

		<guid isPermaLink="false">http://garysmith.ca/?p=744</guid>
		<description><![CDATA[Protect Your Share is an online initiative by Ontario Nature to promote the protect of the Malcolm Bluff Shores area of the Niagara Escarpment from development. <a href="http://garysmith.ca/2011/07/protect-your-share/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Protect Your Share</strong> is an online initiative by Ontario Nature to promote the protection of the Malcolm Bluff Shores area of the Niagara Escarpment in Ontario.</p>
<p>I worked with <a href="http://designforgood.ca" title="Design for Good" target="_blank">Design for Good</a> to build this custom PHP/MySQL website.  Integrated with an existing donation system, the Protect Your Share site enables donors to make a donation to protect a share of the Malcolm Bluff Shores, and then see that share represented visually as a part of a forest along with supportive messages.  The site also includes information and galleries showcasing the natural resources being protected.</p>
]]></content:encoded>
			<wfw:commentRss>http://garysmith.ca/2011/07/protect-your-share/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

