<?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>crazed monkey &#187; programming</title>
	<atom:link href="http://crazedmonkey.com/blog/category/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://crazedmonkey.com/blog</link>
	<description>Ian Stevens&#039; weblog</description>
	<lastBuildDate>Fri, 18 May 2012 15:30:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>What I really want: A command-line preflight tool for PDFs</title>
		<link>http://crazedmonkey.com/blog/programming/command-line-pdf-preflight-needed.html</link>
		<comments>http://crazedmonkey.com/blog/programming/command-line-pdf-preflight-needed.html#comments</comments>
		<pubDate>Wed, 27 Feb 2008 17:28:39 +0000</pubDate>
		<dc:creator>Ian Stevens</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://crazedmonkey.com/blog/programming/command-line-pdf-preflight-needed.html</guid>
		<description><![CDATA[<p>Creating PDFs is difficult. Creating PDFs for print is even more difficult. <a href="http://reportlab.org/">Reportlab</a> does a great job, but it defaults to RGB in most cases. This necessitates some tweaking of both Reportlab code and the code using Reportlab. Testing the result is difficult, mostly because I don&#8217;t know of any command-line tools to do&#160;&#8230;&#160;<a class="read_more" href="http://crazedmonkey.com/blog/programming/command-line-pdf-preflight-needed.html" rel="bookmark" title="Continue reading &#8220;What I really want: A command-line preflight tool for PDFs&#8221;"><span>Read more</span></a>]]></description>
			<content:encoded><![CDATA[<p>Creating PDFs is difficult.  Creating PDFs for print is even more difficult.  <a href="http://reportlab.org/">Reportlab</a> does a great job, but it defaults to RGB in most cases.  This necessitates some tweaking of both Reportlab code and the code using Reportlab.  Testing the result is difficult, mostly because I don&#8217;t know of any command-line tools to do preflight testing for RGB and CMYK elements.</p>
<p>What I need is a command-line tool to do some basic PDF preflighting (eg. non-CMYK elements, non-embedded fonts, images below 300dpi, characters which may cause difficulties in printing, etc.).  Is that so much to ask?  When <a href="http://www.adobe.com/devnet/acrobat/pdfs/pdf_reference_1-7.pdf" title="PDF Reference, Sixth Edition" type="application/pdf">the PDF spec</a> is 1300 pages long, it is.  Still, don&#8217;t think I won&#8217;t try and take a stab at it.</p>
]]></content:encoded>
			<wfw:commentRss>http://crazedmonkey.com/blog/programming/command-line-pdf-preflight-needed.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How not to specify requirements</title>
		<link>http://crazedmonkey.com/blog/programming/how-not-to-specify-requirements.html</link>
		<comments>http://crazedmonkey.com/blog/programming/how-not-to-specify-requirements.html#comments</comments>
		<pubDate>Thu, 25 Jan 2007 00:08:14 +0000</pubDate>
		<dc:creator>Ian Stevens</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ttc]]></category>

		<guid isPermaLink="false">http://crazedmonkey.com/blog/internet/how-not-to-specify-requirements.html</guid>
		<description><![CDATA[<p>On Monday individuals from the four websites who collected TTC website suggestions from the Toronto community through their weblogs <a href="http://www.torontoist.com/archives/2007/01/an_open_letter_2.php" title="Torontoist: An Open Letter to the TTC">released their findings to the TTC and the general public</a>. They did so in the worst way possible; using a spreadsheet. These are four fairly successful websites, all&#160;&#8230;&#160;<a class="read_more" href="http://crazedmonkey.com/blog/programming/how-not-to-specify-requirements.html" rel="bookmark" title="Continue reading &#8220;How not to specify requirements&#8221;"><span>Read more</span></a>]]></description>
			<content:encoded><![CDATA[<p>On Monday individuals from the four websites who collected TTC website suggestions from the Toronto community through their weblogs <a href="http://www.torontoist.com/archives/2007/01/an_open_letter_2.php" title="Torontoist: An Open Letter to the TTC">released their findings to the TTC and the general public</a>.  They did so in the worst way possible; using a spreadsheet.  These are four fairly successful <em>web</em>sites, all running popular <em>web</em>logs and collecting their suggestions from local <em>web</em> users in their comments sections, also on the <em>web</em>.  Wouldn&#8217;t it have made sense to also release their findings on, oh I don&#8217;t know, a <em>web</em> page?  Apparently that would have made way too much sense.</p>
<p>Let&#8217;s ignore that not everyone has Microsoft Excel on their machines.  (I don&#8217;t and instead had to wait for that ugly behemoth, <a href="http://www.neooffice.org/">NeoOffice</a>, to sputter to life and display the data.)  Let&#8217;s also ignore that if a spreadsheet was the answer, it could have been released in <acronym title="Comma-separated value">CSV</acronym> format.  Instead, let&#8217;s look at the data.  (Those of you without Microsoft Excel will have to follow along using the image below.)</p>
<p><img style="margin: auto; float: none" src="http://crazedmonkey.com/blog/wp-content/uploads/2007/01/ttc_suggestion_spreadsheet_excerpt.png" title="TTC suggestion spreadsheet excerpt" alt="TTC suggestion spreadsheet excerpt"/></p>
<p><a href="http://www.torontoist.com/archives/2007/01/an_open_letter_2.php" title="Torontoist: An Open Letter to the TTC">The open letter to Adam Giambrone</a> describes the spreadsheet as &#8220;easy to use&#8221;.  When you say something is easy to use, it had damn well better be.  Personally, I had to stare at the spreadsheet for a few minutes before I could make heads or tails of it.  Describing something as easy to use when it isn&#8217;t has the adverse effect of making anyone who doesn&#8217;t find it intuitive feel like an idiot.</p>
<p>First, the data is not a table and the first column seems to have absolutely no relation to the matching rows in the other columns.  I have no idea what that first column is supposed to represent.  Is it the cities from which the comments originated?  Who knows.</p>
<p>Second, the acronyms and numbers you see (SPC 3, RT 4, etc.) are supposed to describe the website and comment number which made the suggestion in that column.  There&#8217;s no legend, so I can only assume that &#8220;TI&#8221; means <a href="http://torontoist.com/">Torontoist.com</a> and &#8220;RT&#8221; means <a href="http://readingt.readingcities.com/">Reading Toronto</a>, &#8220;SPC&#8221; means <a href="http://spacing.ca/">Spacing</a> and &#8220;BT&#8221; means <a href="http://blogto.com/">blogTO</a>.  No website addresses or comment URLs are given so when this spreadsheet is printed or passed around the internals of the TTC, nobody will know what the heck those letters and numbers mean and won&#8217;t know where to go for more information.</p>
<p>Third, the spreadsheet isn&#8217;t even using spreadsheet functionality.  It&#8217;s a table, but it&#8217;s not.  The comment references are comma-separated across multiple rows, so there&#8217;s no way to do anything meaningful with this data such as sum the columns and graph the results, which is what everyone wants to do with spreadsheets.  To find comment totals, you will have to manually count the references.</p>
<p>Fourth, you can&#8217;t see it from the image but my website is misspelled in row 22.  It&#8217;s crazedmonkey.com, not crazymonkey.com. Thanks, guys.</p>
<p><ins datetime="20070125T1321EST5EDT">Fifth, many of the comments referenced do not match the feature under which they appear (eg. <a href="http://www.torontoist.com/archives/2007/01/help_toronto_bl.php#comment-874532">TI 23</a> under the independent server suggestion).  Also, <a href="http://www.readingt.readingcities.com/index.php/toronto/comments/4703/">RT 14 does not exist</a>.</ins></p>
<p>How would I have captured the website findings?  First, I wouldn&#8217;t have made the mistake to release it in spreadsheet form.  Instead, a simple HTML page would do the trick.  The data can be expressed as a list using CSS styling wherever appropriate:</p>
<pre><samp title="Proper way to display the list of TTC website suggestions with comment links">&lt;ol&gt;
  &lt;li&gt;Suggestion 1
    &lt;ul&gt;
      &lt;li&gt;&lt;a href="link to comment"&gt;website and comment author or number&lt;/a&gt;&lt;/li&gt;
      &hellip;
    &lt;/ul&gt;
  &lt;/li&gt;
  &hellip;
&lt;/ol&gt;</samp></pre>
<p>With the above format, every comment has a link to check.  The file or link can still be passed around with no loss of information.</p>
<p>All of this begs the question, why even bother with a findings document at all?  The comments are in an open forum which everyone can read and from which they can draw their own conclusions.  Releasing a difficult to understand requirements document does nothing to help, but actually serves to inhibit.  Who is going to take seriously anyone who creates a spreadsheet like that and passes it off as helpful?  It&#8217;s well-intentioned but there&#8217;s a reason why the requirements gathering process, particularly in the software and usability fields, is left to the experts, or at least those with domain experience.</p>
<p><ins datetime="20070125T1252EST5EDT"><strong>Update:</strong> I have since remixed the suggestion matrix into <a href="http://crazedmonkey.com/ttc_website_suggestions.html" title="TTC website redesign suggestions (remix)">a HTML page as described above</a>.</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://crazedmonkey.com/blog/programming/how-not-to-specify-requirements.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Unix command-line tile cutter for Google Maps</title>
		<link>http://crazedmonkey.com/blog/programming/google-tile-cutter.html</link>
		<comments>http://crazedmonkey.com/blog/programming/google-tile-cutter.html#comments</comments>
		<pubDate>Wed, 24 Jan 2007 05:08:36 +0000</pubDate>
		<dc:creator>Ian Stevens</dc:creator>
				<category><![CDATA[googletilecutter]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://crazedmonkey.com/blog/programming/unix-command-line-image-tiler-for-google-maps.html</guid>
		<description><![CDATA[<p>When I released my new <a href="http://crazedmonkey.com/toronto-transit-map/" title="Toronto transit map - TTC, GO Transit, VIVA, etc. all on one Google map!">Toronto transit map</a> I promised to release some of the tools I used to create it. Possibly the most useful tool I created is my command-line tile cutter. True, there are other image tilers, such&#160;&#8230;&#160;<a class="read_more" href="http://crazedmonkey.com/blog/programming/google-tile-cutter.html" rel="bookmark" title="Continue reading &#8220;Unix command-line tile cutter for Google Maps&#8221;"><span>Read more</span></a>]]></description>
			<content:encoded><![CDATA[<p>When I released my new <a href="http://crazedmonkey.com/toronto-transit-map/" title="Toronto transit map - TTC, GO Transit, VIVA, etc. all on one Google map!">Toronto transit map</a> I promised to release some of the tools I used to create it.  Possibly the most useful tool I created is my command-line tile cutter.  True, there are other image tilers, such as <a href="http://mapki.com/wiki/Automatic_Tile_Cutter" title="Automatic Tile Cutter - Google Mapki">a Photoshop script</a> and a <a href="http://open.atlas.free.fr/GMapsTransparenciesImgOver.php">web-based tool which uses Google Maps</a>.  I don&#8217;t have Photoshop and find it slow, and the web-based tool is difficult to use even with small files, so I created my own tile cutter.</p>
<p>My image tiler uses Free Software, is released under the GPL, and has the following features:</p>
<ul>
<li>Tiles most image formats, including GIF, JPEG, PNG and TIFF.</li>
<li>Works on most flavours of Unix, including Mac OS X.</li>
<li>Supports version 1 and version 2 zoom levels.</li>
<li>Automatically calculates offsets for all zoom levels.</li>
<li>Supports padding from the upper-left as output by the <a href="http://open.atlas.free.fr/GMapsTransparenciesImgOver.php">web-based tiling helper</a>.</li>
<li>Automatically pads image to size appropriate to Google Maps (ie. multiple of 256).</li>
<li>Optionally discards empty transparent tiles to save space.</li>
<li>Optional prefix for each tile.</li>
<li>Outputs tiles in PNG format.</li>
<li>Compresses tiles with either <a href="http://advancemame.sourceforge.net/comp-readme.html">advpng</a> or <a href="http://pmt.sourceforge.net/pngcrush/">pngcrush</a>.</li>
</ul>
<p>The tiler requires <a href="http://www.imagemagick.org/">ImageMagick</a> and <a href="http://advancemame.sourceforge.net/comp-readme.html">advpng</a> or <a href="http://pmt.sourceforge.net/pngcrush/">pngcrush</a> for PNG compression. (I recommend advpng as it is faster and compresses smaller in most situations.) Tiled image size is restricted only by disk space and ImageMagick limitations.</p>
<p>To use the tile cutter, one need only specify the image being tiled, the Google tile coordinates of the top-left tile, the zoom level for which those coordinates are valid and the zoom level the tile represents.  For example, suppose we have three images (<code>img15.png</code>, <code>img16.png</code> and <code>img17.png</code>) for zoom levels 15 through 17 (in version 2 zoom levels), respectively.  The top-left corner of the image at level 15 is 1812,1924.  You would then run the following commands to generate the tiles:</p>
<pre><code title="Example using googletile to tile three images of differing zoom levels">% googletilecutter -o 15 -t 1812,1924 -z 15 img15.png
% googletilecutter -o 15 -t 1812,1924 -z 16 img16.png
% googletilecutter -o 15 -t 1812,1924 -z 17 img17.png</code></pre>
<p>Note that the only options which need to be changed from image to image are the zoom level of the image and the image itself.  Compression and discarding of empty tiles is performed automatically.  For more command-line options execute the script with the <code>-h</code> option.</p>
<p><a href="http://crazedmonkey.com/googletilecutter/googletilecutter.sh">Download the Unix command-line tile cutter for Google Maps</a>.  If you have any problems or experience any unexpected behaviour, please leave a comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://crazedmonkey.com/blog/programming/google-tile-cutter.html/feed</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Multiple expression if statement in BASH</title>
		<link>http://crazedmonkey.com/blog/programming/multiple-expression-if-statement-in-bash.html</link>
		<comments>http://crazedmonkey.com/blog/programming/multiple-expression-if-statement-in-bash.html#comments</comments>
		<pubDate>Tue, 21 Nov 2006 05:34:15 +0000</pubDate>
		<dc:creator>Ian Stevens</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://crazedmonkey.com/blog/programming/multiple-expression-if-statement-in-bash.html</guid>
		<description><![CDATA[<p>It&#8217;s not very well documented, but it&#8217;s possible to include multiple conditional expressions in a single if statement in <a href="http://www.gnu.org/software/bash/" title="BASH - GNU Project - Free Software Foundation">BASH</a>. By multiple conditional expressions, I mean something like:</p> if foo = 1 or bar = 3 or abc = 4 then print Hello World end if&#160;&#8230;&#160;<a class="read_more" href="http://crazedmonkey.com/blog/programming/multiple-expression-if-statement-in-bash.html" rel="bookmark" title="Continue reading &#8220;Multiple expression if statement in BASH&#8221;"><span>Read more</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not very well documented, but it&#8217;s possible to include multiple conditional expressions in a single if statement in <a href="http://www.gnu.org/software/bash/" title="BASH - GNU Project - Free Software Foundation">BASH</a>.  By multiple conditional expressions, I mean something like:</p>
<pre><code>if foo = 1 or bar = 3 or abc = 4 then
    print Hello World
end if</code></pre>
<p>You can do boolean OR in BASH by using the <code>-o</code> operator.  The following is the above code written in BASH:</p>
<pre><code>if [ $foo -eq 1 -o $bar -eq 3 -o $abc -eq 4 ]; then
    echo Hello World
fi</code></pre>
<p>For boolean AND, use the <code>-a</code> operator.  You can also intermix the two.</p>
]]></content:encoded>
			<wfw:commentRss>http://crazedmonkey.com/blog/programming/multiple-expression-if-statement-in-bash.html/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>A lesson in properly closing &lt;script&gt; tags</title>
		<link>http://crazedmonkey.com/blog/programming/properly-closed-script-tags.html</link>
		<comments>http://crazedmonkey.com/blog/programming/properly-closed-script-tags.html#comments</comments>
		<pubDate>Tue, 14 Nov 2006 03:47:49 +0000</pubDate>
		<dc:creator>Ian Stevens</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[site]]></category>

		<guid isPermaLink="false">http://crazedmonkey.com/blog/programming/properly-closed-script-tags.html</guid>
		<description><![CDATA[<p>Here I was thinking that my old TTC map was only helping a few dozen people a day. In goes <a title="Toronto transit map - TTC, GO Transit, VIVA, etc. all on one Google map!" href="http://crazedmonkey.com/toronto-transit-map/">my updated map</a> and up go my visits by several hundred per day. It turns out that I was closing&#160;&#8230;&#160;<a class="read_more" href="http://crazedmonkey.com/blog/programming/properly-closed-script-tags.html" rel="bookmark" title="Continue reading &#8220;A lesson in properly closing &#60;script&#62; tags&#8221;"><span>Read more</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here I was thinking that my old TTC map was only helping a few dozen people a day.  In goes <a title="Toronto transit map - TTC, GO Transit, VIVA, etc. all on one Google map!" href="http://crazedmonkey.com/toronto-transit-map/">my updated map</a> and up go my visits by several hundred per day.  It turns out that I was closing the Google Analytics script tag in the XML style (ie. <code>&lt;script .../&gt;</code>) and not as <code>&lt;script ...&gt;&lt;/script&gt;</code>.  The culprit?  IE, of course, <a title="phpied.com: IE script tag problem" href="http://www.phpied.com/ie-script-tag-problem/">which doesn&#8217;t support the former</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://crazedmonkey.com/blog/programming/properly-closed-script-tags.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Five common mistakes in unit-testing</title>
		<link>http://crazedmonkey.com/blog/programming/common-mistakes-in-unit-testing.html</link>
		<comments>http://crazedmonkey.com/blog/programming/common-mistakes-in-unit-testing.html#comments</comments>
		<pubDate>Tue, 07 Feb 2006 01:31:00 +0000</pubDate>
		<dc:creator>Ian Stevens</dc:creator>
				<category><![CDATA[computers]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://crazedmonkey.com/blog/uncategorised/common-mistakes-in-unit-testing.html</guid>
		<description><![CDATA[<p>Having worked with unit-testing and test-driven development <a href="http://crazedmonkey.com/blog/computers/programming/java/junit.html" title="JUnit changed my life">for the past three years</a>, I repeatedly see people making the same common mistakes. These mistakes don&#8217;t necessarily undermine the benefits of unit-testing but they do serve to make the process less than ideal:</p> Writing monolithic tests. More often than not, I see&#160;&#8230;&#160;<a class="read_more" href="http://crazedmonkey.com/blog/programming/common-mistakes-in-unit-testing.html" rel="bookmark" title="Continue reading &#8220;Five common mistakes in unit-testing&#8221;"><span>Read more</span></a>]]></description>
			<content:encoded><![CDATA[<p>Having worked with unit-testing and test-driven development <a href="http://crazedmonkey.com/blog/computers/programming/java/junit.html" title="JUnit changed my life">for the past three years</a>, I repeatedly see people making the same common mistakes. These mistakes don&#8217;t necessarily undermine the benefits of unit-testing but they do serve to make the process less than ideal:</p>
<ul>
<li><strong>Writing monolithic tests.</strong> More often than not, I see people writing one test method for each method they are testing with all their asserts contained within that test method. While not incorrect, this will impede testing as most test suites stop at the first failed assert. For example, if a test method has ten asserts and the first one fails, no conclusion can be immediately made regarding the remaining nine asserts. As a result, the first failure must be fixed before the remaining nine can be tested. This is particularly frustrating when tests are automated and run on a regular basis. <em>Consider splitting your tests by requirement and including no more than the minimum asserts necessary inside a test method to test the associated requirement.</em></li>
<li><strong>Not running the tests on a regular basis or altering them as requirements change.</strong> Once tests are written and they pass, many developers do not run those tests again. Months later, changes in requirements and code lead to a drift between the tests and what they are testing. Should someone run the tests again, the tested code will appear to be incorrect and confusion will result. As such, <em>it is important to run tests on a frequent basis, ideally automatically, and to keep tests in line with requirements.</em></li>
<li><strong>Improper description of what test cases are testing.</strong> Unit tests cannot exist in a vacuum. Mislabelled or undescribed tests only serve to confuse which requirements they are testing. Sometimes asserts are self-explanatory but more often they are not and require further output to describe failures. <em>Consider naming your test methods to describe what they are testing (eg. <code>testThatMethodFooResultsInCondition</code>) and/or include a written explanation inside the assert statement to be printed alongside the failure.</em></li>
<li><strong>Noisy test output.</strong> Depending on the testing library you are using, your tests may already be generating needless output. Adding more output will only result in confusing test results. <em>Positive test results should never output data to the test log.</em> Negative test results should make use of the output facilities within the testing framework for uniform formatting.</li>
<li><strong>Improper use of the test case API.</strong> This is a small detail but deserves to be mentioned. I have seen many test cases which do not make good use of the testing framework under which they are running, leading to unhelpful output. For instance, in JUnit <code>assertTrue(foo == 3)</code> is not equivalent to <code>assertEquals(3, foo)</code>. The former will output a generic failure message while the latter will explicitly output the expected and actual results. Pay careful attention to the test framework&#8217;s assert method signatures as order will often matter. For instance, in JUnit, <code>assertEquals(3, foo)</code> is not equivalent to <code>assertEquals(foo, 3)</code> and will result in two different failure messages.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://crazedmonkey.com/blog/programming/common-mistakes-in-unit-testing.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TTC Google Maps for all!</title>
		<link>http://crazedmonkey.com/blog/programming/ttcgooglemap-for-all.html</link>
		<comments>http://crazedmonkey.com/blog/programming/ttcgooglemap-for-all.html#comments</comments>
		<pubDate>Sat, 30 Jul 2005 01:08:00 +0000</pubDate>
		<dc:creator>Ian Stevens</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[transitmap]]></category>
		<category><![CDATA[ttc]]></category>

		<guid isPermaLink="false">http://crazedmonkey.com/blog/uncategorised/ttcgooglemap-for-all.html</guid>
		<description><![CDATA[<p>I just spent a few minutes factoring out my <a href="http://crazedmonkey.com/ttcgooglemap/" title="TTC subway map using Google Maps">TTC subway map</a> Javascript code so that it can be called to insert the TTC subway into any Google Map:</p> &#60;div id="map"&#62; &#60;script src="http://crazedmonkey.com/ttcgooglemap/ttcgooglemaps.js" type="text/javascript"&#62;&#60;/script&#62; &#60;script type="text/javascript"&#62; &#60;!-- var map = new GMap( document.getElementById( "map" ) ); map.addControl( new&#160;&#8230;&#160;<a class="read_more" href="http://crazedmonkey.com/blog/programming/ttcgooglemap-for-all.html" rel="bookmark" title="Continue reading &#8220;TTC Google Maps for all!&#8221;"><span>Read more</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just spent a few minutes factoring out my <a href="http://crazedmonkey.com/ttcgooglemap/" title="TTC subway map using Google Maps">TTC subway map</a> Javascript code so that it can be called to insert the TTC subway into any Google Map:</p>
<pre><code>&lt;div id="map"&gt;
&lt;script src="http://crazedmonkey.com/ttcgooglemap/ttcgooglemaps.js"
type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
&lt;!--
    var map = new GMap( document.getElementById( "map" ) );
    map.addControl( new GSmallMapControl() );
    map.centerAndZoom( new GPoint( -79.386871, 43.660241 ), 4 );

    // Add your own markers and polylines here.

    drawTtcSubwayMap( map );
--&gt;
&lt;/script&gt;
</code></pre>
<p>There are two other additional functions, <code>drawTtcSubwayMapColor()</code> and <code>writeTtcSubwayStations()</code>, which can be used to specify the colors for the different subway lines and to display the colour-coded list in a <code>div</code>, respectively. I might add more helper methods later if there is a demand for them.</p>
<p>You can affect how the stations appear in the info pop-up by styling <code>div</code> elements of the <code>station</code> class.</p>
<p>Originally I had thought to limit access to my Javascript file to those who asked permission to use it. Doing so would make me aware of how people were using the map. For now, people are free to link the Javascript in their pages. All I ask is that you leave a comment on my weblog with a link to your page, and include the following HTML somewhere near the map:</p>
<pre><code>&lt;p&gt;TTC station code and coordinates provided by
&lt;a href="http://crazedmonkey.com/"&gt;Ian Stevens&lt;/a&gt; and his
&lt;a href="http://crazedmonkey.com/ttcgooglemap/"&gt;TTC Subway Google Map&lt;/a&gt;.&lt;/p&gt;
</code></pre>
<p>Linking, not copying, the script has its advantages, namely that any changes or additions that I make will propagate to your map. There are also a few known bugs, all of which have to do with Internet Explorer, that I hope to address soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://crazedmonkey.com/blog/programming/ttcgooglemap-for-all.html/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>TTC subway map using Google Maps, now easier to use</title>
		<link>http://crazedmonkey.com/blog/programming/ttcgooglemap-station-list.html</link>
		<comments>http://crazedmonkey.com/blog/programming/ttcgooglemap-station-list.html#comments</comments>
		<pubDate>Sat, 16 Jul 2005 22:01:33 +0000</pubDate>
		<dc:creator>Ian Stevens</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[transitmap]]></category>
		<category><![CDATA[ttc]]></category>

		<guid isPermaLink="false">http://crazedmonkey.com/blog/uncategorised/ttcgooglemap-station-list.html</guid>
		<description><![CDATA[<p>To make stations on my <a href="http://crazedmonkey.com/ttcgooglemap/" title="TTC subway map using Google Maps">TTC subway map</a> easier to locate, I have added an alphabetical, clickable list of subway stations, colour-coded by subway line. Enjoy.</p>]]></description>
			<content:encoded><![CDATA[<p>To make stations on my <a href="http://crazedmonkey.com/ttcgooglemap/" title="TTC subway map using Google Maps">TTC subway map</a> easier to locate, I have added an alphabetical, clickable list of subway stations, colour-coded by subway line. Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://crazedmonkey.com/blog/programming/ttcgooglemap-station-list.html/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>TTC subway map using Google Maps</title>
		<link>http://crazedmonkey.com/blog/programming/ttcgooglemap.html</link>
		<comments>http://crazedmonkey.com/blog/programming/ttcgooglemap.html#comments</comments>
		<pubDate>Sun, 03 Jul 2005 01:54:00 +0000</pubDate>
		<dc:creator>Ian Stevens</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[transitmap]]></category>
		<category><![CDATA[ttc]]></category>

		<guid isPermaLink="false">http://crazedmonkey.com/blog/uncategorised/ttcgooglemap.html</guid>
		<description><![CDATA[<p>I spent a little time this weekend playing with the <a href="http://www.google.com/apis/maps/">Google Maps API</a> and creating <a href="http://crazedmonkey.com/ttcgooglemap/">an overlay of the TTC subway</a>. Not surprisingly, creating the station markers and route lines was easy. The most difficult part, however, was obtaining a list of subway stations and their addresses in a text format for easy&#160;&#8230;&#160;<a class="read_more" href="http://crazedmonkey.com/blog/programming/ttcgooglemap.html" rel="bookmark" title="Continue reading &#8220;TTC subway map using Google Maps&#8221;"><span>Read more</span></a>]]></description>
			<content:encoded><![CDATA[<p>I spent a little time this weekend playing with the <a href="http://www.google.com/apis/maps/">Google Maps API</a> and creating <a href="http://crazedmonkey.com/ttcgooglemap/">an overlay of the TTC subway</a>. Not surprisingly, creating the station markers and route lines was easy. The most difficult part, however, was obtaining a list of subway stations and their addresses in a text format for easy extraction.</p>
<p>Translating the subway station addresses into <a href="http://www.google.com/apis/maps/documentation/#GPoint_code_"><code>GPoint</code></a> objects was a little difficult given that there appears to be no free geocoding service for Canadian addresses. However, Google Maps can work as a geocoder, albeit a somewhat slow one, sometimes taking several seconds to produce a result. If you have access to a Unix command-line, you can make use of the following script:</p>
<pre><code>#!/bin/sh
wget -q -O- http://maps.google.com?q=\\
`echo $1 | tr " " "+"` | sed -n -e \\
"s/.*&lt;point lat=\"\\([^\"]*\\)\" lng=\"\\([^\"]*\\)\".*/new GPoint( \\2, \\1 )/p"</code></pre>
<p>If I have one beef with the API, it&#8217;s with the <a href="http://www.google.com/apis/maps/documentation/#GIcon_code_"><code>GIcon</code> class</a> and the requirement to set the icon shadow, the icon and shadow sizes and the anchor point. A shadow should not be required and image sizes can be inferred. However, the icon will not display if any of these properties are not set.</p>
<p> <ins datetime="20050716T1756EST5EDT">
<p><strong>Update:</strong> I have since added <a href="http://crazedmonkey.com/blog/computers/programming/ttcgooglemap-station-list.html" title="TTC subway map using Google Maps, now easier to use">a clickable list of subway stations</a> to the map.</p>
<p></ins> <ins datetime="20050730T1400EST5EDT">
<p><strong>Update:</strong> Now <a href="http://crazedmonkey.com/blog/computers/programming/ttcgooglemap-for-all.html" title="TTC Google Maps for all!">any Google Map can contain the TTC subway map</a>.</p>
<p></ins></p>
]]></content:encoded>
			<wfw:commentRss>http://crazedmonkey.com/blog/programming/ttcgooglemap.html/feed</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Toronto Police eCOPS a lesson in how not to manage a software project</title>
		<link>http://crazedmonkey.com/blog/programming/ecops.html</link>
		<comments>http://crazedmonkey.com/blog/programming/ecops.html#comments</comments>
		<pubDate>Wed, 15 Jun 2005 04:37:33 +0000</pubDate>
		<dc:creator>Ian Stevens</dc:creator>
				<category><![CDATA[computers]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://crazedmonkey.com/blog/uncategorised/ecops.html</guid>
		<description><![CDATA[<p>The <a href="http://toronto.cbc.ca/regional/servlet/View?filename=to-ecops20050614" title="auditor">Toronto auditor general&#8217;s report on the failed eCOPS project</a> reads like a list of what not to do with a large software project. To start, the project was handled in-house with no regard for the expertise of existing employees. Probably because of their lack of experience, requirements and use-cases were &#8220;inadequate, incomplete,&#160;&#8230;&#160;<a class="read_more" href="http://crazedmonkey.com/blog/programming/ecops.html" rel="bookmark" title="Continue reading &#8220;Toronto Police eCOPS a lesson in how not to manage a software project&#8221;"><span>Read more</span></a>]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://toronto.cbc.ca/regional/servlet/View?filename=to-ecops20050614" title="auditor">Toronto auditor general&#8217;s report on the failed eCOPS project</a> reads like a list of what not to do with a large software project. To start, the project was handled in-house with no regard for the expertise of existing employees. Probably because of their lack of experience, requirements and use-cases were &#8220;inadequate, incomplete, or in some cases, non-existent.&#8221; Most importantly, development costs were not tracked and quickly got out of hand.</p>
<p>Too often it would seem that project managers and developers forget the old maxim that &#8220;time is money.&#8221; Projects are often started without a proper plan including a time estimate, cost assessment and an analysis of whether the benefits outweigh those costs. This mismanagement of time results in changes of scope over the course of the project with creeping time overruns as &#8220;unforeseen&#8221; difficulties arise and features are tacked on.</p>
<p>Sadly, the Toronto Police eCOPS failure isn&#8217;t an anomaly in the software industry. The only news here is that it has been a colossal waste of <em>public</em> money.</p>
]]></content:encoded>
			<wfw:commentRss>http://crazedmonkey.com/blog/programming/ecops.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

