<?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>Gaslight &#38; Steam Dev Blog</title>
	<atom:link href="http://www.gaslightandsteam.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gaslightandsteam.com/blog</link>
	<description>My most recent thoughts and ideas</description>
	<lastBuildDate>Sun, 07 Feb 2010 06:22:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Populares Et Optimates, A Game Of Rome Part 2</title>
		<link>http://www.gaslightandsteam.com/blog/2010/02/populares-et-optimates-a-game-of-rome-part-2/</link>
		<comments>http://www.gaslightandsteam.com/blog/2010/02/populares-et-optimates-a-game-of-rome-part-2/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 06:22:44 +0000</pubDate>
		<dc:creator>David Bennett</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.gaslightandsteam.com/blog/?p=231</guid>
		<description><![CDATA[Watching card manipulation by Dan and Dave Buck including those on their site like the demo video of the Akira flourish got me thinking quite a bit about card shuffling.  After seeing some of the false shuffles and other manipulations and having read about games where the shuffling algorithm was only pseudo-random, I wanted [...]]]></description>
			<content:encoded><![CDATA[<p>Watching card manipulation by Dan and Dave Buck including those on their site like the demo video of the <a href="http://store.dananddave.com/flourishes/">Akira flourish</a> got me thinking quite a bit about card shuffling.  After seeing some of the false shuffles and other manipulations and having read about games where the shuffling algorithm was only pseudo-random, I wanted to make sure that the card shuffling for my game was at least adequate enough to make the game work.</p>
<p>If you&#8217;re not familiar with Dave and Dan, check out this video advertisement for their set of DVDs over at Theory 11:</p>
<p><embed src="http://cdn.theory11.com/embed-player.swf" type="application/x-shockwave-flash" width="480" height="395" allowfullscreen="true" allowscriptaccess="always" flashvars="vn=/previews/Trilogy_Preview_Final.flv&#038;vt=http://www.theory11.com/tricks/img/trilogy_videothumb.jpg&#038;rp=/tricks/trilogy.php"></embed></p>
<p>Wikipedia has a good article discussing <A href="http://en.wikipedia.org/wiki/Shuffling">shuffling cards and computer algorithms for shuffling</a>.</p>
<p>An example shuffle algorithm in Javascript would be this <a href="http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle">implementation of Durstenfeld&#8217;s algorithm, a modern version of Fisher-Yates</a> that looks like this:</p>
<pre lang-"javascript">
function array_shuffle (aArray)
{
    var i, j, mTemp;
    for (i = aArray.length; i;) {
        // mTemp, j initialized here for shorter code.
        j = parseInt (Math.random () * i);
        mTemp = aArray [--i];
        aArray [i] = aArray [j];
        aArray [j] = mTemp;
    }
}
</pre>
<p>For the random number generation, I prefer this, but I haven&#8217;t exercised it in order to see if it makes a difference, though seeing parseInt in the above makes me wonder about its presence.</p>
<pre lang-"javascript">
j = 1 + Math.floor(Math.random() * i);
</pre>
<p>As for the cards in the game, they are represented in the Javascript as objects and can be either people or actions.  People cards are members of one or the other faction or a third group of loosely-aligned Romans who may be swayed to one side or the other.  They have attributes including the side they belong to, whether their side may be changed, their name and current rank.  Action cards represent the cards that are used during play.  Actions include ranks and positions that may be assigned to People and events like riots, assassinations, and plagues.  Action cards often have negative or side-effects, sometimes costing the player who uses it as much as his opponent.  Other cards require votes from the Senate such as Exile or the appointment of Generals.</p>
<p>There are a variety of collections that I&#8217;ll refer to as decks.  There are two decks of people, one for each player.  Event decks include one hand for each player, the drawing deck and the discard deck.  Additionally, there may be individual cards in play that belong to no particular deck.</p>
<p>I considered a number of names for the game including <em>Optimates et Populares</em>, but that doesn&#8217;t roll off the tongue.  The working title that I came up with is <en>Marius and Sulla</em> after the two men who fought together in the Social War and then became bitter enemies.  The game centers around the time where partisans identified themselves less with the espoused philosophies each represented and more with the personalities themselves.  The short version of the game covers the six years following the Social War (88 BC &#8211; 82 BC).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gaslightandsteam.com/blog/2010/02/populares-et-optimates-a-game-of-rome-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SPQR Or Pontifex Maximus, A Game Of Rome Part 1</title>
		<link>http://www.gaslightandsteam.com/blog/2010/01/spqr-or-pontifex-maximus-a-game-of-rome-part-1/</link>
		<comments>http://www.gaslightandsteam.com/blog/2010/01/spqr-or-pontifex-maximus-a-game-of-rome-part-1/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 18:59:05 +0000</pubDate>
		<dc:creator>David Bennett</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[History]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.gaslightandsteam.com/blog/?p=228</guid>
		<description><![CDATA[I&#8217;ve decided to create a web-based game set in early Rome.  It&#8217;s intended to be about the leaders of the time with an emphasis on politics rather than military strategy.  I want the latter to happen &#8220;off-screen&#8221; as it were, but with the option for legions to show up at the gates of [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve decided to create a web-based game set in early Rome.  It&#8217;s intended to be about the leaders of the time with an emphasis on politics rather than military strategy.  I want the latter to happen &#8220;off-screen&#8221; as it were, but with the option for legions to show up at the gates of Rome when needed to influence political events.</p>
<p>The biggest difficulty was selecting a time period that provided the right amount of variety, particularly political in-fighting and manuevering without too much military action (such as the wars with Carthage).  In that regard, the early and late periods of the Republic offered some interesting options, as did the time of the First Triumvirate and the period following the death of Caligula, to name but a few points in the turbulent history of the Romans.</p>
<p>I&#8217;m particularly fond of the political manueverings described in <em>Imperium</em> by Robert Harris and in the BBC production of <em>I, CLaudius</em> (for which I must confess that I haven&#8217;t read the book by Robert Graves).  There&#8217;s an immediacy to the politics combined with a certain degree of brutality that keeps one from longing overmuch for the good old days.  So the more I thought about it, the less Imperial Rome appealed to me and the more I wanted to go back a little further in time.  At the same time, <em>Lavinia</em> by Ursula Leguin brings the events of Virgil&#8217;s Aeneid to life brilliantly with the interplay between the tribes of the area and the followers of Aeneas.</p>
<p>Out of all the time periods that I think would make for an worthwhile game, the period immediately following the <a href="http://en.wikipedia.org/wiki/Social_War_%2891%E2%80%9388_BC%29">Social War</a>, a crisis point in Roman history, sounded extremely interesting.  <a href="http://en.wikipedia.org/wiki/Sulla%27s_first_civil_war">Sulla&#8217;s First Civil War</a> with the struggle between the optimates and populares (and I&#8217;m simplifying matters greatly since it wasn&#8217;t that black and white) made for some turbulent times with lots of political and military manuevering.  Throw in assassinations, exiles, plagues, riots and external threats like Mithridates of Pontus, and you have a good deal of elements to work with.</p>
<p>As they say, <em>plus ça change, plus c&#8217;est la même chose</em>.  The politics of the Roman Republic and the Roman Empire have much in common with the infighting during the War of the Roses and the gangland warfare of the Roaring Twenties.  For that reason, I wanted to capture some of the feel of the Avalon Hill game <em>Kingmaker</em>, minus the board and tediousnous of moving armies around, with the fast-paced play of <em>Family Business</em>, but with a more historical feel and slightly more elaborate mechanics.</p>
<p>Before starting work, I did some research on already existing games that covered both the time period I was interested in with the politics in a card game or simple board game version.  I was positive there&#8217;d be a plethora of games of all stripes, some very similar to what I had in mind.  Surprisingly, the list wasn&#8217;t nearly as long as I expected, though I&#8217;m sure I missed  more than a couple.  My short list of games that aren&#8217;t strategy games and that otherwise capture some of the elements I was looking for are as follows:</p>
<ul>
<li><a href="http://www.psgiochi.com/en/US/caligula">Caligula</a> from Post Scriptum/Elfinwerks</li>
<li><a href="http://valleygames.ca/our-games/classic-line/republic-of-rome/">Republic of Rome</a> from Valley Games Boardgame</li>
<li><a href="http://www.pixelpark.co.nz/2_player_games/roma.htm">Roma</a> from Queen Games</li>
<li><a href="http://www.pixelpark.co.nz/2_player_games/caesar.htm">Caesar &#038; Cleopatra</a> from Kosmos/Rio Grande</li>
<li><a href="http://www.cambridgegames.com/games.html">Glory to Rome</a> from Cambridge Games Factory</li>
<li><a href="http://www.gmtgames.com/p-20-sword-of-rome.aspx">Sword of Rome</a> from GMT Games</li>
<li><a href="http://www.mayfairgames.com/shop/product/0480-0499/pages/0490.htm">Quo Vadis</a> from Mayfair Games</li>
<li><a href="http://www.angelfire.com/games2/warpspawn/RIB.html">Rome is Burning</a> from Warp Spawn Games</li>
<li><a href="http://www.ystari.com/wpe/?cat=10">Sylla</a> from Ystari Games</li>
<li><a href="http://www.fantasyflightgames.com/edge_minisite.asp?eidm=17">Tribune: Primus Inter Pares</a> from Fantasy Flight Games</li>
<li><a href="http://www.indieboardsandcards.com/triumvirate.php">Triumvirate</a> from Indie Boards and Cards</li>
</ul>
<p>Certainly, some of these games are ones that I&#8217;d really like to play, particularly <em>Triumvirate</em>.  But before I do that, I&#8217;d like to get my game up and running.  First up, a paper prototype.  Much like website usability testing with paper mockups and wireframes, I plan to make some cards and to try some mechanics so I can see how they play out.  I&#8217;ll discuss that in my next on this subject.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gaslightandsteam.com/blog/2010/01/spqr-or-pontifex-maximus-a-game-of-rome-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>You&#8217;re More Skilled Than You Think</title>
		<link>http://www.gaslightandsteam.com/blog/2010/01/youre-more-skilled-than-you-think/</link>
		<comments>http://www.gaslightandsteam.com/blog/2010/01/youre-more-skilled-than-you-think/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 21:40:11 +0000</pubDate>
		<dc:creator>David Bennett</dc:creator>
				<category><![CDATA[Professional]]></category>

		<guid isPermaLink="false">http://www.gaslightandsteam.com/blog/?p=224</guid>
		<description><![CDATA[When you&#8217;re in the trenches slinging code, it&#8217;s very easy to become disillusioned about your skills.  Without a frame of reference, tasks you think should be easy become mind-bendingly difficult and there&#8217;s no light at the end of the tunnel.  That&#8217;s certainly been my experience developing for the web and also in designing [...]]]></description>
			<content:encoded><![CDATA[<p>When you&#8217;re in the trenches slinging code, it&#8217;s very easy to become disillusioned about your skills.  Without a frame of reference, tasks you think should be easy become mind-bendingly difficult and there&#8217;s no light at the end of the tunnel.  That&#8217;s certainly been my experience developing for the web and also in designing games.  In the latter case, it&#8217;s even harder because you can easily convince yourself that no one in their right mind will ever enjoy the gameplay you&#8217;ve devoted yourself to for months.  I read a post today John Nunemaker that he succinctly titled, &#8220;<a href="http://railstips.org/blog/archives/2010/01/12/i-have-no-talent/">I Have No Talent</a>&#8220;.  He says:</p>
<blockquote><p>
I am sick of hearing people say, “Oh, I love your code, I wish I could do that.” You can. The only reason you can’t is because you don’t practice enough. I used to think that I wasn’t smart enough. I was jealous of those that did crazy code stuff that I couldn’t even comprehend. Then, one day, I ran into something I did not understand and instead of giving up, I pushed through.
</p></blockquote>
<p>His blog post reminds me of a discussion I had with one of the programmers on Forza Motorsport.  At one point, I made an off-hand coment about the complexity and difficulty of what he did in working with the Cambridge Research Center.  His response was much the same as Mr. Nunemaker&#8217;s, albeit a bit more curmudgeonly.  In short, where I perceived this baffling artifice of dazzlingly complex code, he saw it as something that anyone could learn to do with enough time and effort.  His insight helped me to keep slugging away at writing my first C# application and not becoming discourage at the intricacies of serializing and deserializing XML.</p>
<p>Working with senior developers has given me insight into how to do some pretty amazing things with computers.  Seeing the frustrations of junior developers has taught me how aptitude is different from knowledge.  In some cases, things never click, but in the vast majority of instances, it&#8217;s just a matter of experience and learning.  When I taught basic computer classes through the King County Library System (for those in the Puget Sound region, the <a href="http://www.kcls.org/usingthelibrary/computers_internet/computerlabs.cfm">KCLS computer classes</a> are a great introduction for novices and they&#8217;re free), I got see many people who had never used a computer before gradually come to the realization that surfing the web or using Microsft Word wasn&#8217;t nearly as difficult as they feared it would be.</p>
<p>So if you want a more objective appraisal of your development skills, try teaching someone else what you know.  And if you want to know whether your game is actually any fun, let someone else play it.  But that&#8217;s a post for another time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gaslightandsteam.com/blog/2010/01/youre-more-skilled-than-you-think/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Process Buzzwords and Gemba Walks</title>
		<link>http://www.gaslightandsteam.com/blog/2010/01/process-buzzwords-and-gemba-walks/</link>
		<comments>http://www.gaslightandsteam.com/blog/2010/01/process-buzzwords-and-gemba-walks/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 19:50:07 +0000</pubDate>
		<dc:creator>David Bennett</dc:creator>
				<category><![CDATA[Lean]]></category>
		<category><![CDATA[Processes]]></category>
		<category><![CDATA[Professional]]></category>

		<guid isPermaLink="false">http://www.gaslightandsteam.com/blog/?p=218</guid>
		<description><![CDATA[Looking out the window where I work, my co-workers and I can see the steady progress on the construction of Amazon.com&#8217;s new buildings in the South Lake Union neighborhood.  Today, safety-vested and hard-hatted troop of people came parading through in the rain, presumably on a tour to see the progress being made.  Since [...]]]></description>
			<content:encoded><![CDATA[<p>Looking out the window where I work, my co-workers and I can see the steady progress on the construction of Amazon.com&#8217;s new buildings in the South Lake Union neighborhood.  Today, safety-vested and hard-hatted troop of people came parading through in the rain, presumably on a tour to see the progress being made.  Since we use Lean processes, it seemed analogous to a &#8220;<a href="http://www.leanlibrary.com/gemba_walk.htm">gemba walk</a>&#8221; that our managers are supposed to conduct regularly.</p>
<p>But why use a term like gemba walk when the Japanese word <em>gemba</em> has a literal meaning of &#8220;factory floor&#8221; and applies to an industrial process rather than the development of software?  Further, for non-Japanese speakers, why use the specific Japanese word when there are plenty of English words that are more immediately understandable to outsiders (those not engaged in applying Lean methodology in the workplace)?  It&#8217;s not even so much that using this word jars the ear of an English speaker, but that other words to refer to other parts of the process are not used or are, in fact, translated.  In a workplace that also embraces <em>kaizen</em> (lit. &#8220;improvement&#8221;), why are terms like <em>muda</em> (waste) and <em>seiketsu</em> (standardization) not used?  When Lean practitioners do recognize waste, they often fail to recognize the differentiation that would be captured by proper use of the Japanese terms (specifically, <em>muda</em>, <em>muri</em>, and <em>mura</em>, the latter two being distinct from more general <a href="http://en.wikipedia.org/wiki/Muda_%28Japanese_term%29">waste</a> that comes from an inexact translation of <em>muda</em>).  To me, as an occasional speaker of Japanese, the reason to use the foreign word is so that the specific nuance of that word isn&#8217;t lost or because the translation is too inexact.</p>
<p>To my mind, using the term <em>gemba</em> smacks of putting a new coat of paint on the idea of <a href="http://www.brianbabcock.com/management-by-walking-around.shtml">management by walking around</a>, albeit with a formally defined set of goals and methods.  However, I think the formality of the process, typified by the use of ill-defined buzz words, becomes a waste all its own.  The danger is that <a href="http://joeelylean.blogspot.com/2007/08/shallow-gemba-deep-gemba.html">the process becomes a meaningless exercise</a>: &#8220;It’s a &#8216;drive-by&#8217; gemba. No matter how sincere, it is shallow.&#8221;</p>
<p>On a related note, the term <em>kaizen</em> rolls off the tongue easier than <em>Kontinuierlicher Verbesserungspozess</em> (such as that employed by Volkswagen), the latter being more in the nature of <a href="http://www.focusedmanagement.com/knowledge_base/articles/fmi_articles/middle/volsaga.htm">focussed improvement on a specific process</a> and being more punctuated than the Japanese process.</p>
<p><strong>Addendum:</strong> Regarding the use of Japanese terms, <a href="http://gotboondoggle.blogspot.com/2010/01/english-speaking-lean.html">Mike Wroblewski</a> has some excellent points and links to arguments both pro and con.  In case it&#8217;s not clear, I agree with him and don&#8217;t think that the Japanese terms should be abolished, but rather that practitioners shouldn&#8217;t let the term obscure the intent.  By all means use the appropriate terminology to effect the changes the organization wishes to see.  If the changes aren&#8217;t occurring, then perhaps the managers performing their gemba walk has gotten bogged down in the terminology or process and need to spend more time listening to what is actually being said.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gaslightandsteam.com/blog/2010/01/process-buzzwords-and-gemba-walks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript Sorting</title>
		<link>http://www.gaslightandsteam.com/blog/2009/12/javascript-sorting/</link>
		<comments>http://www.gaslightandsteam.com/blog/2009/12/javascript-sorting/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 21:11:28 +0000</pubDate>
		<dc:creator>David Bennett</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Vignette]]></category>

		<guid isPermaLink="false">http://www.gaslightandsteam.com/blog/?p=216</guid>
		<description><![CDATA[Not too long ago, I was asked, as a theoretical question, how I might take a string of random alphabetical characters and sort them in order using Javascript.  Thus, given NFARAKDMSLSJDQKJKCXLK, find a simple way to turn it into AACDDFJJKKKKLLMNQRSSX.  It&#8217;s a pretty basic question for anyone who uses Javascript and I immediately [...]]]></description>
			<content:encoded><![CDATA[<p>Not too long ago, I was asked, as a theoretical question, how I might take a string of random alphabetical characters and sort them in order using Javascript.  Thus, given NFARAKDMSLSJDQKJKCXLK, find a simple way to turn it into AACDDFJJKKKKLLMNQRSSX.  It&#8217;s a pretty basic question for anyone who uses Javascript and I immediately thought of splitting and joining the string as an array (a quick and easy way to tokenize the string).  However, for some reason, I completely forgot about the Array.sort() function that&#8217;s pretty much a universal across languages.</p>
<p>Instead, the first thing that came to mind was the last time I had to sort a collection and started thinking of Java sorting.  In the work I&#8217;ve done, such sorting usually requires the use of comparators because the default sort order is often not the one that&#8217;s desired.  As a case in point, we have a set of JSP pages for rendering content including archive and list pages that display in posting date or sequence order derived from the content.  For example, here&#8217;s some code to sort by a custom &#8220;sequence&#8221; attribute using the Vignette Content Management API (this particular snippet is the work of the inimitable <a href="http://www.linkedin.com/in/chenyong">Yong Chen</a>):</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">Comparator</span> aComparator <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Comparator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> compare<span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> obj1, <span style="color: #003399;">Object</span> obj2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">int</span> result<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">Integer</span> s1 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>ContentInstance<span style="color: #009900;">&#41;</span> obj1<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getRelations</span><span style="color: #009900;">&#40;</span>CT_RELATION_HEALTH_PLAN<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sequence&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">Integer</span> s2 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>ContentInstance<span style="color: #009900;">&#41;</span> obj2<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getRelations</span><span style="color: #009900;">&#40;</span>CT_RELATION_HEALTH_PLAN<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sequence&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			result<span style="color: #339933;">=</span>s1.<span style="color: #006633;">compareTo</span><span style="color: #009900;">&#40;</span>s2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>com.<span style="color: #006633;">vignette</span>.<span style="color: #006633;">as</span>.<span style="color: #006633;">client</span>.<span style="color: #006633;">exception</span>.<span style="color: #003399;">ApplicationException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>For debugging, I might break it out a little differently to avoid the multiple casts in a single line.  I think the Vignette API is fairly robust, but I would still split the ContentInstance cast apart from the Java native Integer cast in this case.  But that might just be me.</p>
<p>In any event, while Javascript can also use comparators without much loss of speed, for a task like the one delineated initially, a simple sort will do the job and the whole can even be condensed to a single line function like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> order<span style="color: #009900;">&#40;</span>unsortedString<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> unsortedString.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">sort</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">join</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Depending on the browser, the sort function will be some variation on a quick sort or a <a href="http://www.codecodex.com/wiki/Merge_sort" class="broken_link" >merge sort</a>.  It depends on whether the browser architects chose a stable algorithm or opted for some other version based on various considerations.  Mozilla used to use a quicksort prior to Firefox 3.5, but they opted for a merge sort instead in more recent versions.  In the course of reading about sort implementations, I came across notes on <a href="http://svn.python.org/projects/python/trunk/Objects/listsort.txt">timsort, Python&#8217;s default sort implementation</a>, that I found particularly intriguing.</p>
<p>As an aside the return value for a comparator that works in Firefox may fail with Webkit (Chrome and Safari) since you need to return -1 instead of zero (and a boolean false will also fail).  You can <a href="http://bits.beckism.com/post/201275648/custom-javascript-sort-safari">read more about Webkit&#8217;s Array.sort() handling</a>.</p>
<p>With Java, it looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">String</span> unsorted <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;xzya&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">char</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> content <span style="color: #339933;">=</span> unsorted.<span style="color: #006633;">toCharArray</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
java.<span style="color: #006633;">util</span>.<span style="color: #003399;">Arrays</span>.<span style="color: #006633;">sort</span><span style="color: #009900;">&#40;</span>content<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">String</span> sorted <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span>content<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>With Perl, you can do something like:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000066;">print</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">join</span> “”<span style="color: #339933;">,</span> <span style="color: #000066;">sort</span> <span style="color: #000066;">split</span> <span style="color: #339933;">//,</span><span style="color: #0000ff;">$_</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>In bash, this will do the same job:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> “teststring” <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-o</span> . <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-n</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #660033;">-d</span> ‘\n’; <span style="color: #7a0874; font-weight: bold;">echo</span></pre></div></div>

<p>All in all, not only did I refresh my memory about good ways to sort strings and arrays in Javascript, I also learned some new things about sort algorithms and implementations of those algorithms.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gaslightandsteam.com/blog/2009/12/javascript-sorting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Computer Science Education Week (December 6-12)</title>
		<link>http://www.gaslightandsteam.com/blog/2009/12/computer-science-education-week-december-6-12/</link>
		<comments>http://www.gaslightandsteam.com/blog/2009/12/computer-science-education-week-december-6-12/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 19:12:10 +0000</pubDate>
		<dc:creator>David Bennett</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.gaslightandsteam.com/blog/?p=208</guid>
		<description><![CDATA[ As a current computer science major, I&#8217;m glad to see the ACM in a joint effort to help organize Computer Science Education Week (CSEdWeek), which started December 7th.  The week was chosen specifically in honor of Rear Admiral Dr. Grace Murray Hopper, also known as &#8220;Amazing Grace&#8221;, or &#8220;a little old lady who [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.csedweek.org/"><img src="http://www.gaslightandsteam.com/blog/wp-content/uploads/2009/12/SCEdwk_square100.png" alt="Computer Science Education Week" title="SCEdwk_square100" width="100" height="100" class="size-full wp-image-207" align="right" style="margin-left: 15px;"/></a> As a current computer science major, I&#8217;m glad to see the <a href="http://www.acm.org/">ACM</a> in a joint effort to help organize <a href="http://www.csedweek.org/">Computer Science Education Week (CSEdWeek)</a>, which started December 7th.  The week was chosen specifically in honor of <a href="http://cs-www.cs.yale.edu/homes/tap/Files/hopper-story.html">Rear Admiral Dr. Grace Murray Hopper</a>, also known as &#8220;Amazing Grace&#8221;, or &#8220;a little old lady who talks to computers,&#8221; who was born on December 9, 1906. She was a computer science pioneer and her work, spanning computer languages, compiler verification, software development concepts, and much more, has served to inspire a generation of computer scientists.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gaslightandsteam.com/blog/2009/12/computer-science-education-week-december-6-12/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Idioms and Economy of Language</title>
		<link>http://www.gaslightandsteam.com/blog/2009/12/idioms-and-economy-of-language/</link>
		<comments>http://www.gaslightandsteam.com/blog/2009/12/idioms-and-economy-of-language/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 17:30:26 +0000</pubDate>
		<dc:creator>David Bennett</dc:creator>
				<category><![CDATA[Language]]></category>

		<guid isPermaLink="false">http://www.gaslightandsteam.com/blog/?p=203</guid>
		<description><![CDATA[I was talking with a co-worker about my limited facility with Japanese and my interest in improving my facility with that language.  During the course of our conversation, she mentioned a fascinating aspect of Japanese for expressing certain idioms or proverbs.  That&#8217;s were I learned about yoji-jukugo (四字熟語), which are idiomatic expressions made [...]]]></description>
			<content:encoded><![CDATA[<p>I was talking with a co-worker about my limited facility with Japanese and my interest in improving my facility with that language.  During the course of our conversation, she mentioned a fascinating aspect of Japanese for expressing certain idioms or proverbs.  That&#8217;s were I learned about yoji-jukugo (四字熟語), which are idiomatic expressions made up of four kanji characters. These idioms are written only in kanji only and have no kana between them.</p>
<p>One such example would be the Japanese equivalent of the idiom, &#8220;two birds with one stone.&#8221;  This is rendered as isseki nichou (一石二鳥) (literally, &#8220;one stone, two birds&#8221;). There are <a href="http://japanese.about.com/library/weekly/aa101400.htm">many more yoji-jukugo</a>, many of which have similar versions in English (and many other languages besides).</p>
<p>The Chinese equivalent from which yoji-jukugo originate are called chengyu (成语).  The same idiom above has a similar chengyu that translates as, &#8220;two birds, one arrow&#8221; (yī jiàn shuāng diāo, written 一箭双雕).  Another one I like is sān rén chéng hǔ (三人成虎) (literally, &#8220;<a href="http://en.wikipedia.org/wiki/Three_men_make_a_tiger">three men make a tiger</a>&#8220;), which refers to how a repeated rumor may be erroneously accepted as truth.</p>
<p>There are lots of examples of these idioms including a <a href="http://www.oneaday.org/">chengyu of the day</a>.  You learn something new every day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gaslightandsteam.com/blog/2009/12/idioms-and-economy-of-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Language Impressions</title>
		<link>http://www.gaslightandsteam.com/blog/2009/12/language-impressions/</link>
		<comments>http://www.gaslightandsteam.com/blog/2009/12/language-impressions/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 06:17:35 +0000</pubDate>
		<dc:creator>David Bennett</dc:creator>
				<category><![CDATA[Language]]></category>

		<guid isPermaLink="false">http://www.gaslightandsteam.com/blog/?p=199</guid>
		<description><![CDATA[Today I read an interesting perspective on Dutch language, particularly the rather unique &#8216;ij&#8217; sound in that language.  But more than that, it&#8217;s a poetic take on the way language seems to feel. (via Snarkmarket)
&#8220;There’s something slightly disturbing about the visual scan of the language (I don’t even know what the term is for [...]]]></description>
			<content:encoded><![CDATA[<p>Today I read an interesting perspective on Dutch language, particularly the rather unique &#8216;ij&#8217; sound in that language.  But more than that, it&#8217;s <a href="http://nicomuhly.com/news/2009/dutch-is/">a poetic take on the way language seems to feel</a>. (via Snarkmarket)</p>
<blockquote><p>&#8220;There’s something slightly disturbing about the visual scan of the language (I don’t even know what the term is for that: you know when you see a page, or a sign, written in a language and you have an immediate impression of the content of the text? This works also in your native language: look at a page from, like, Dickens, and you can sort of get the Shudder of the Text, or whatever, anyway, what I mean is that some languages, like French, always seem to bear a melismatic philosophy behind the page; German, an authority, Amharic, a crooked delight&#8230;) &#8230; with Dutch what I get is a sort of childlike pornography: hoog, sneeuwt, poesje, standplaats. But I’m obsessed with it: there’s nothing better than having an old school diagraph still kicking around like an appendix.&#8221;
</p></blockquote>
<p>I like the word melismatic in this context, as though the words on the page were the notes and the meaning of the page was the word or  <a href="http://en.wikipedia.org/wiki/Melisma">melisma</a>.  It&#8217;s a new one on me even though I subscribe to <a href="http://wordsmith.org/awad/">A.Word.A.Day</a> and occasionally test my vocabulary at <a href="http://www.freerice.com/">FreeRice</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gaslightandsteam.com/blog/2009/12/language-impressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What&#8217;s the Definition of a Game?</title>
		<link>http://www.gaslightandsteam.com/blog/2009/09/whats-the-definition-of-a-game/</link>
		<comments>http://www.gaslightandsteam.com/blog/2009/09/whats-the-definition-of-a-game/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 16:48:17 +0000</pubDate>
		<dc:creator>David Bennett</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.gaslightandsteam.com/blog/?p=194</guid>
		<description><![CDATA[A month ago, I updated my LinkedIn profile to say I was, &#8220;&#8230;playing and making some games.&#8221;  I&#8217;ve had a few game ideas kicking around and the games I&#8217;ve been playing lately have gotten me a bit more motivated to work on my own ideas.  My thought was that this small declaration would [...]]]></description>
			<content:encoded><![CDATA[<p>A month ago, I updated my LinkedIn profile to say I was, &#8220;&#8230;playing and making some games.&#8221;  I&#8217;ve had a few game ideas kicking around and the games I&#8217;ve been playing lately have gotten me a bit more motivated to work on my own ideas.  My thought was that this small declaration would keep me moving forward and I would actually make some headway on at least one project.  As others have noted, ideas are cheap, but seeing a project through to completion is considerably more difficult.</p>
<p>What I hadn&#8217;t anticipated was a co-worker asking me what kind of games I was working on.  Since my day job is in web development for an HMO, my co-worker was unaware of my background in game design and my continuing interest in doing that kind of work.  However, the reason I&#8217;m not employed full-time doing game design has more to do with the nature of industry, particularly the crazy hours and my daughter being of an age where she started to think daddy lived in the phone.  At the time, people were beginning to take a hard look at some of practices and work environment that went with game development, the most visible being the story of <a href="http://ea-spouse.livejournal.com/">EA Spouse</a>.  Just as a case in point, the agency I contracted through gave me vacation time that accrued at a rate of 2 weeks per year based on hours worked.  In my first contract, between overtime and the occasional all-nighter, I accrued four weeks of vacation.</p>
<p>So, though I&#8217;m not working in the game industry as my day job, I&#8217;m still very much interested in games.  But my co-worker&#8217;s question raised an interesting point: What is the definition of game?  Her assumption was that, as a computer guy, I would be turning my energies toward some form of computer game.  But even that&#8217;s a pretty broad range, given the proliferation of <a href="http://en.wikipedia.org/wiki/Casual_game">casual games</a>, many of them web-based, <a href="http://en.wikipedia.org/wiki/Alternate_reality_game">alternative reality games</a>, that incorporate many forms of technology including web pages and other technology, and <a href="http://en.wikipedia.org/wiki/Console_game">console games</a>, developed on computers despite the hardware being rather specialized.</p>
<p>However, I also play pen-and-paper roleplaying games (Dungeons and Dragons and Ars Magica, among myriad others), I am guilty of having played live-action roleplaying, and I play boardgames, given the opportunity.  In fact, about the only thing I don&#8217;t play is fantasy football and its real-world team sports analogues.</p>
<p>So, while I&#8217;m not planning on creating something like <a href="http://www.imdb.com/title/tt0131857/">BASEketball</a> any time soon, I&#8217;m casting my net considerably wider than trying to develop the next version of <a href="http://en.wikipedia.org/wiki/Duke_Nukem_Forever">Duke Nukem Forever</a> (figuring whatever game I work on still probably has a better chance of seeing the light of day).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gaslightandsteam.com/blog/2009/09/whats-the-definition-of-a-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mapping Early Manhattan</title>
		<link>http://www.gaslightandsteam.com/blog/2009/08/mapping-early-manhattan/</link>
		<comments>http://www.gaslightandsteam.com/blog/2009/08/mapping-early-manhattan/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 05:25:59 +0000</pubDate>
		<dc:creator>David Bennett</dc:creator>
				<category><![CDATA[Data Visualization]]></category>
		<category><![CDATA[Genealogy]]></category>
		<category><![CDATA[Mapping]]></category>

		<guid isPermaLink="false">http://www.gaslightandsteam.com/blog/?p=184</guid>
		<description><![CDATA[The September 2009 issue of National Geographic Magazine had a fascinating article about Manhattan before it was settled.  The article is based on the work of the Manahatta Project, an endeavor to match the current city to the terrain as it existed prior to settlement by Europeans and to then add the ecosystem that [...]]]></description>
			<content:encoded><![CDATA[<p>The September 2009 issue of National Geographic Magazine had <a href="http://ngm.nationalgeographic.com/2009/09/manhattan/miller-text">a fascinating article about Manhattan before it was settled</a>.  The article is based on the work of the <a href="http://themannahattaproject.org/">Manahatta Project</a>, an endeavor to match the current city to the terrain as it existed prior to settlement by Europeans and to then add the ecosystem that went with the land.  The science of landscape ecology and the visualization of biosystem relations that the project has dubbed &#8220;Muir Webs&#8221; both appear to me to be narratives that go beyond single dimensions and instead look at the patterns formed.</p>
<p>For much the same reason, there is a similar narrative about the early settlers of New Amsterdam, among them is the story of my ancestor Jan Jansen van Flensburg.  As a baker who came to the New Netherlands and raised his children in New Amsterdam, the records are far more extensive than for many other immigrants of that time and the maps well detailed (such as this <a href="http://www.genealogy-sh.com/timm/map.htm">1656 map of the New Netherlands</a>).</p>
<p>Seeing new ways of combining various data the way the Manahatta Project has done inspires me to look at new ways to bring together historical data and maps such that they tell a story that&#8217;s richer than the sum of their parts.  A good start in this way of looking at information is the software from TimeGlider, which is useful in putting together historical events in sequence such as this <a href="http://timeglider.com/app/viewer.php?uid=line_ww1">history of World War I</a>.</p>
<p><img src="/blog/wp-content/uploads/2009/08/nieuwamsterdam.jpg" alt="nieuwamsterdam" title="nieuwamsterdam" width="650" height="204" class="aligncenter size-full wp-image-187" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gaslightandsteam.com/blog/2009/08/mapping-early-manhattan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
