<?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>Green Felt News</title>
	<atom:link href="http://blog.greenfelt.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.greenfelt.net</link>
	<description>Communiqués from the Green Felt developers</description>
	<lastBuildDate>Wed, 28 Jul 2010 02:36:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>New card design</title>
		<link>http://blog.greenfelt.net/2010/07/27/new-card-design/</link>
		<comments>http://blog.greenfelt.net/2010/07/27/new-card-design/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 02:30:00 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.greenfelt.net/?p=64</guid>
		<description><![CDATA[You might have already noticed that we tweaked the cards a little. We think they look better now and as a bonus the numbers should be easier to read. We've been playing with these cards ourselves for a few months and have really grown to like the changes. We hope you do too.]]></description>
			<content:encoded><![CDATA[<p>You might have already noticed that we tweaked the cards a little. We think they look better now and as a bonus the numbers should be easier to read. Just in case you don&#8217;t remember the old cards, here&#8217;s the Jack of Clubs:</p>
<table>
<tbody>
<tr>
<td>Old:</td>
<td>New:</td>
</tr>
<tr>
<td><a href="http://blog.greenfelt.net/wp-content/uploads/2010/07/JC-old.png"><img class="size-full wp-image-66 alignnone" title="Old Jack of Clubs" src="http://blog.greenfelt.net/wp-content/uploads/2010/07/JC-old.png" alt="" width="90" height="131" /></a></td>
<td><a href="http://blog.greenfelt.net/wp-content/uploads/2010/07/JC-new.png"><img class="size-full wp-image-65 alignnone" title="New Jack of Clubs" src="http://blog.greenfelt.net/wp-content/uploads/2010/07/JC-new.png" alt="" width="90" height="131" /></a></td>
</tr>
</tbody>
</table>
<p>The J is more legible now and not stuck into the top of the suit. The corners on the card are correctly rounded now, and the border is cleaner. Here&#8217;s another example:</p>
<table>
<tbody>
<tr>
<td>Old:</td>
<td>New:</td>
</tr>
<tr>
<td><a href="http://blog.greenfelt.net/wp-content/uploads/2010/07/9H-old.png"><img class="size-full wp-image-67 alignnone" title="Old Nine of Hearts" src="http://blog.greenfelt.net/wp-content/uploads/2010/07/9H-old.png" alt="" width="90" height="131" /></a></td>
<td><a href="http://blog.greenfelt.net/wp-content/uploads/2010/07/9H-new.png"><img class="size-full wp-image-68 alignnone" title="New Nine of Hearts" src="http://blog.greenfelt.net/wp-content/uploads/2010/07/9H-new.png" alt="" width="90" height="131" /></a></td>
</tr>
</tbody>
</table>
<p>Again, the rank (&#8220;9&#8243;) is much clearer now.</p>
<p>We&#8217;ve been playing with these cards ourselves for a few months and have really grown to like the changes. We hope you do too.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.greenfelt.net/2010/07/27/new-card-design/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Server Issues</title>
		<link>http://blog.greenfelt.net/2009/10/20/server-issues/</link>
		<comments>http://blog.greenfelt.net/2009/10/20/server-issues/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 02:31:18 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.greenfelt.net/?p=62</guid>
		<description><![CDATA[You might have noticed a 4 hour window where our site wouldn&#8217;t even load today. Our hosting provider moved us to a new computer and, while they warned us ahead of time it was imminent, they didn&#8217;t tell us what day it would happen. And they didn&#8217;t provide any time beforehand to use the new [...]]]></description>
			<content:encoded><![CDATA[<p>You might have noticed a 4 hour window where our site wouldn&#8217;t even load today. Our hosting provider moved us to a new computer and, while they warned us ahead of time it was imminent, they didn&#8217;t tell us what day it would happen. And they didn&#8217;t provide any time beforehand to use the new computer and get it set up for a smooth transition.</p>
<p>So when things suddenly broke today we figured they&#8217;d finally made the switch. We&#8217;ve spent the last few hours trying to get everything back up and running and, for the most part, it seems to be working.</p>
<p>I am still seeing timeouts all the time though, and so I assume everyone else is too. We&#8217;re still trying to clear it up&#8211;the cause of this last issue is not entirely clear yet.</p>
<p>If anything else is wonky, let us know.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.greenfelt.net/2009/10/20/server-issues/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How we hash our Javascript for better caching and less breakage on updates</title>
		<link>http://blog.greenfelt.net/2009/09/01/caching-javascript-safely/</link>
		<comments>http://blog.greenfelt.net/2009/09/01/caching-javascript-safely/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 05:39:50 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://blog.greenfelt.net/?p=31</guid>
		<description><![CDATA[One of the problems we use to see frequently on Green Felt happened when we'd update a Javascript API: We'd add some parameters to some library function and then update some other files so that they called the function with the new parameters. But when we'd push the changes to the site we'd end up with few users that somehow had the old version of one of the files stuck in their cache.]]></description>
			<content:encoded><![CDATA[<p>One of the problems we use to see frequently on <a href="http://greenfelt.net">Green Felt</a> happened when we&#8217;d update a Javascript API: We&#8217;d add some parameters to some library function and then update some other files so that they called the function with the new parameters. But when we&#8217;d push the changes to the site we&#8217;d end up with few users that somehow had the old version of one of the files stuck in their cache. Now their browser is causing old code to call new code or new code to call old code and the site doesn&#8217;t work for them. We&#8217;d then have to explain how to reset their cache (and of course every browser has different instructions) and hope that if they didn&#8217;t write back that everything went OK.</p>
<p>This fragility annoyed us and so we came up with a solution:</p>
<ul>
<li>We replaced all of our <code>&lt;script&gt;</code> tags with calls to a custom &#8220;script&#8221; function in our HTML template system (we use <a href="http://search.cpan.org/dist/Template-Toolkit/lib/Template/Toolkit.pod">Template::Toolkit</a>; <code>[% script("sht.js") %]</code> is what the new calls look like).</li>
<li>The &#8220;script&#8221; function is a native perl function that does a number of things:
<ol>
<li>Reads the Javascript file into memory. While reading it understands C style &#8220;#include&#8221; directives so we can structure the code nicely (though we actually don&#8217;t take advantage of that yet)</li>
<li>Uses <a href="http://search.cpan.org/dist/JavaScript-Minifier-XS/lib/JavaScript/Minifier/XS.pm">JavaScript::Minifier::XS</a> to minify the resulting code.</li>
<li>Calculates the SHA hash of the minified code.</li>
<li>Saves the minified code to a cache directory where it is named based on its hash value which makes the name globally unique (it also keeps it&#8217;s original name as a prefix so debugging is sane).</li>
<li>Keeps track of the original script name, the minified script&#8217;s globally unique name, and the dependencies used to build the image. This is stored in a hash table and also saved to the disk for future runs.</li>
<li>It returns a script tag that refers to the globally unique Javascript file back to the template which ends up going out in the html file. For example,  <code>&lt;script src="js/sht-bfe39ec2e457bd091cb6b680873c4a90.js" type="text/javascript"&gt;&lt;/script&gt;</code></li>
</ol>
</li>
<li>There&#8217;s actually a step 0 in there too. If the original Javascript file name is found in the hash table then it quickly stats its saved dependencies to see if they are newer than the saved minified file. If the minified file is up to date then steps 1 through 5 are skipped.</li>
</ul>
<h1>The advantages of this approach</h1>
<h2>It solves the original problem.</h2>
<p>When the user refreshes the page they will either get the page from their browser cache or they will get it from our site. No matter where it came from the Javascript files it references are now uniquely named so that it is impossible for the files to be out of date from each other.</p>
<p>That is, if you get the old html file you will reference all the old named Javascript files and everything will be mutually consistent (even though it is out of date). If you get the new html file it guarantees you will have to fetch the latest Javascript files because the new html only references the new hashed names that aren&#8217;t going to be in your browser cache.</p>
<h2>It&#8217;s fast.</h2>
<p>Everything is cached so it only does the minification and hash calculations once per file. We&#8217;re obviously running FastCGI so the in memory cache goes across http requests. More importantly the js/ dir is statically served by the web server so it&#8217;s exactly as fast as it was before we did this (since we served the .js files without any preprocessing). All this technique adds is a couple filesystem stats per page load, which isn&#8217;t much.</p>
<h2>It&#8217;s automatic.</h2>
<p>There&#8217;s no script to remember to run when we update the site. We just push our changes up to the site using our version control and the script lazily takes care of rebuilding any files that may have gone out of date.</p>
<p>So you might be thinking, isn&#8217;t all that dependency stuff hard and error prone? Well, it&#8217;s really only one line of perl code:</p>
<p><code>sub max_timestamp(@) { max map { (stat $_)[9] || 0 } @_ } # Obviously 9 is mtime</code></p>
<h2>It&#8217;s stateless.</h2>
<p>It doesn&#8217;t rely on incrementing numbers (&#8220;js/v10/script.js&#8221; or even &#8220;js/script-v10.js&#8221;). We considered this approach but decided it was actually harder to implement and had no advantages over the way we chose to do it. This may have been colored by our chosen version control system (darcs) where monotonically increasing version numbers have no meaning.</p>
<h2>It allows aggressive caching.</h2>
<p>Since the files are named by their contents&#8217; hash, you can set the cache time up to be practically infinite.</p>
<h2>It&#8217;s very simple to understand.</h2>
<p>It took less than a page of perl code to implement the whole thing and it worked the first time with no bugs. I believe it&#8217;s taken me longer to write this blog post than it took to write the code (granted I&#8217;d been thinking about it for a long time before I started coding).</p>
<h2>No files are deleted.</h2>
<p>The old js files are not automatically deleted (why bother, they are tiny) so people with extremely old html files will not have inconsistent pages when they reload. However:</p>
<h2>The js/ dir is volatile.</h2>
<p>It&#8217;s written so we can rm js/* at any point and it will just recreate what it needs to on the next request. This means there&#8217;s nothing to do when you unpack the source into a new directory while developing.</p>
<h2>You get a bit of history.</h2>
<p>Do a quick ls -lrt of the directory and you can see which scripts have been updated recently and in what order they got built.</p>
<h1>What it doesn&#8217;t solve</h1>
<p>While it does solve the problem of Javascript to Javascript API interaction, it does <em>not</em> help with Javascript to server API interaction&#8211;it doesn&#8217;t even attempt to solve that issue. The only way I know to solve that is to carefully craft the new APIs in parallel with the old ones so that there is a period of time where both old and new can work while the browser caches slowly catch up with your new world.</p>
<h1>And&#8230; It seems to work</h1>
<p>I&#8217;ve seen similar schemes discussed but I&#8217;ve not seen exactly what we ended up with. It&#8217;s been working well for us&#8211;I don&#8217;t think I&#8217;ve seen a single bug from a user in a couple months that is caused by inconsistent caching of Javascript files by the browser.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.greenfelt.net/2009/09/01/caching-javascript-safely/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Plumbing changes</title>
		<link>http://blog.greenfelt.net/2009/09/01/plumbing-changes/</link>
		<comments>http://blog.greenfelt.net/2009/09/01/plumbing-changes/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 00:30:33 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://blog.greenfelt.net/?p=26</guid>
		<description><![CDATA[Last night we pushed a bunch (literally hundreds) of changes up to the main site. You shouldn't notice anything visually different, but hopefully things will be running a little smoother than they used to.]]></description>
			<content:encoded><![CDATA[<p>Last night we pushed a bunch (literally hundreds) of changes up to the main site. What do they mean for you, the user? Well, you shouldn&#8217;t notice anything visually different, but hopefully things will run a little smoother than they used to. The changes were designed to address the hiccups and slowdowns seen from time to time. Whether they actually will remains to be seen.</p>
<p>We&#8217;ve already found at least one large bug that slipped past our rigorous (ahem) testing, so be on the lookout for anything weird and make sure you <a href="http://forum.greenfelt.net/posting.php?mode=newtopic&#038;f=3">send us a bug report</a> if you do find something wrong.</p>
<p>These changes should ease development for Jim&#8217;s and I as well. We&#8217;ve been unable to add certain features to the site because of design decisions we made 4 years ago. Even simple things like changing your user name were pretty much impossible because of the way we did things originally. We look forward to being able to add some neat features in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.greenfelt.net/2009/09/01/plumbing-changes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Single-click is the new double-click</title>
		<link>http://blog.greenfelt.net/2009/06/18/single-click-is-the-new-double-click/</link>
		<comments>http://blog.greenfelt.net/2009/06/18/single-click-is-the-new-double-click/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 15:55:13 +0000</pubDate>
		<dc:creator>jim</dc:creator>
				<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://blog.greenfelt.net/?p=17</guid>
		<description><![CDATA[We just rolled out a change that will probably affect all of our players.  Whereas you used to double-click a card to make the default move for that card, you now only need to single-click it in order to do so.  This should make playing faster and easier.  Let us know what [...]]]></description>
			<content:encoded><![CDATA[<p>We just rolled out a change that will probably affect all of our players.  Whereas you used to double-click a card to make the default move for that card, you now only need to single-click it in order to do so.  This should make playing faster and easier.  Let us know what you think about the change.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.greenfelt.net/2009/06/18/single-click-is-the-new-double-click/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Even Better Super Moves</title>
		<link>http://blog.greenfelt.net/2008/08/14/even-better-super-moves/</link>
		<comments>http://blog.greenfelt.net/2008/08/14/even-better-super-moves/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 21:16:29 +0000</pubDate>
		<dc:creator>jim</dc:creator>
				<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://blog.greenfelt.net/?p=16</guid>
		<description><![CDATA[Recently we added automatic double click on all cards above any card you try to move.  Now we&#8217;ve added automatic double click to all cards above those you might drag to.  Give it a try on Sea Haven Towers or Spider.  Also, from the small change department, undo animates now.
]]></description>
			<content:encoded><![CDATA[<p><a href="/2008/07/14/better-super-moves/">Recently</a> we added automatic double click on all cards above any card you try to move.  Now we&#8217;ve added automatic double click to all cards above those you might drag to.  Give it a try on <a href="http://greenfelt.net/sht.html">Sea Haven Towers</a> or <a href="http://greenfelt.net/spider.html">Spider</a>.  Also, from the small change department, undo animates now.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.greenfelt.net/2008/08/14/even-better-super-moves/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Better Super Moves</title>
		<link>http://blog.greenfelt.net/2008/07/14/better-super-moves/</link>
		<comments>http://blog.greenfelt.net/2008/07/14/better-super-moves/#comments</comments>
		<pubDate>Tue, 15 Jul 2008 04:55:54 +0000</pubDate>
		<dc:creator>jim</dc:creator>
				<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://blog.greenfelt.net/?p=15</guid>
		<description><![CDATA[Earlier today we added a usability feature to the solitaire games that have stacks of cards.  We now allow moving cards that are not at the top of a pile by first automatically (if possible) moving any blocking cards out of the way.  By moving the blocking cards using their default (double-click) move [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier today we added a usability feature to the solitaire games that have stacks of cards.  We now allow moving cards that are not at the top of a pile by first automatically (if possible) moving any blocking cards out of the way.  By moving the blocking cards using their default (double-click) move we avoid giving too much help while still allowing more efficient play.</p>
<p>This means for example that in <a href="http://greenfelt.net/freecell.html">Free Cell</a> and <a href="http://greenfelt.net/sht.html">Sea Haven Towers</a> you can now often drag the bottom card in one of the tableaus as the very first move!  Give it a try and let us know what you think.</p>
<p>Currently in <a href="http://greenfelt.net/klondike.html">Klondike</a> you can even move cards that are still turned over if the cards above can easily be moved.  This seems a bit like cheating in this case since if you let go without moving, you can get sneak peak at the card without incurring the normal undo penalty.  We may disallow this in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.greenfelt.net/2008/07/14/better-super-moves/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flower Garden super-moves</title>
		<link>http://blog.greenfelt.net/2008/02/11/flower-garden-super-moves/</link>
		<comments>http://blog.greenfelt.net/2008/02/11/flower-garden-super-moves/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 18:55:35 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://blog.greenfelt.net/2008/02/11/flower-garden-super-moves/</guid>
		<description><![CDATA[Flower Garden has been updated with support for super moves. So if you have any empty piles then you can drag 2 cards at a time instead of just one. If you have 2 empty stacks you can drag 4 cards. Note that the super moves still follow the rules as if you were moving [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://greenfelt.net/flower.html">Flower Garden</a> has been updated with support for super moves. So if you have any empty piles then you can drag 2 cards at a time instead of just one. If you have 2 empty stacks you can drag 4 cards. Note that the super moves still follow the rules as if you were moving one card at a time so you can&#8217;t drag 2 cards onto an empty pile if it&#8217;s your only empty pile.</p>
<p>As a Flower Garden fan, I think this improves the gameplay a lot when you are towards the end of a game.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.greenfelt.net/2008/02/11/flower-garden-super-moves/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sudoku!</title>
		<link>http://blog.greenfelt.net/2008/01/27/sudoku/</link>
		<comments>http://blog.greenfelt.net/2008/01/27/sudoku/#comments</comments>
		<pubDate>Mon, 28 Jan 2008 00:04:59 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://blog.greenfelt.net/2008/01/27/sudoku/</guid>
		<description><![CDATA[Today I fixed the last showstopper bugs in Sudoku and put it up on the main site. So now you have a new game to play.
It doesn&#8217;t seem that new to us because Jim wrote the first rough draft of it in September of 2005. Wow, we move kind of slow sometimes! It&#8217;s been 99% [...]]]></description>
			<content:encoded><![CDATA[<p>Today I fixed the last showstopper bugs in <a href="http://greenfelt.net/sudoku.html">Sudoku</a> and <a href="http://greenfelt.net/sudoku.html">put it up on the main site</a>. So now you have a new game to play.</p>
<p>It doesn&#8217;t seem that new to us because Jim wrote the first rough draft of it in September of 2005. Wow, we move kind of slow sometimes! It&#8217;s been 99% done for almost a year and a half but we had a bug where it wouldn&#8217;t let you type numbers into your username or password so many of you wouldn&#8217;t have been able to log in when the page was up. I finally got that fixed today (in a way that made me happy) and so you will now see <a href="http://greenfelt.net/sudoku.html">Sudoku</a> on the leader board and in the menus.</p>
<p>Have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.greenfelt.net/2008/01/27/sudoku/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Under the hood changes</title>
		<link>http://blog.greenfelt.net/2008/01/27/under-the-hood-changes/</link>
		<comments>http://blog.greenfelt.net/2008/01/27/under-the-hood-changes/#comments</comments>
		<pubDate>Mon, 28 Jan 2008 00:02:12 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://blog.greenfelt.net/2008/01/27/under-the-hood-changes/</guid>
		<description><![CDATA[About a year ago we got frustrated with some of the behind the scenes workings of the site. Certain things were too slow or just written using old techniques that weren&#8217;t making us happy. So we upgraded all of the back-end code and site templating functions which should be faster and easier to work with [...]]]></description>
			<content:encoded><![CDATA[<p>About a year ago we got frustrated with some of the behind the scenes workings of the site. Certain things were too slow or just written using old techniques that weren&#8217;t making us happy. So we upgraded all of the back-end code and site templating functions which should be faster and easier to work with in the long run.</p>
<p>We&#8217;ve been testing them internally for the past 9 months and we haven&#8217;t found any bugs in the past 6 months, so today I loaded all the new stuff onto the main site.</p>
<p>It looks like everything is working to me, but if you have any strange problem first try holding down shift while reloading/refreshing the page. If that you still have the problem after that, <a href="http://greenfelt.net/forum/posting.php?mode=newtopic&#038;f=3">report it to us</a> so we can fix it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.greenfelt.net/2008/01/27/under-the-hood-changes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
