<?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>Brain Matters &#187; Uncategorized</title>
	<atom:link href="http://blog.agoragames.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.agoragames.com</link>
	<description></description>
	<lastBuildDate>Thu, 29 Jul 2010 19:13:58 +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>Brightercove</title>
		<link>http://blog.agoragames.com/2010/07/29/brightercove/</link>
		<comments>http://blog.agoragames.com/2010/07/29/brightercove/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 19:13:58 +0000</pubDate>
		<dc:creator>David Czarnecki</dc:creator>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[brightcove]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.agoragames.com/?p=676</guid>
		<description><![CDATA[We&#8217;re using Brightcove here at Agora Games for some video platform work. In our group chats, we&#8217;ve talked about, &#8220;It would be nice if we had a Ruby API for interacting with Brightcove.&#8221;
And so I did just that, http://github.com/agoragames/brightcove


sudo gem install brightcove-api

&#62;&#62; require &#039;brightcove-api&#039;
=&#62; true
&#62;&#62; brightcove = Brightcove::API.new(&#039;0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.&#039;)
=&#62; #&#60;brightcove ::API:0x114dbc8 @token=&#34;0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.&#34;, @api_url=&#34;http://api.brightcove.com/services/library&#34;&#62;
&#62;&#62; response = brightcove.get(&#039;find_all_videos&#039;, [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re using <a href="http://www.brightcove.com/en/">Brightcove</a> here at Agora Games for some video platform work. In our group chats, we&#8217;ve talked about, &#8220;It would be nice if we had a Ruby API for interacting with Brightcove.&#8221;</p>
<p>And so I did just that, <a href="http://github.com/agoragames/brightcove">http://github.com/agoragames/brightcove</a></p>
<pre class="brush: ruby">

sudo gem install brightcove-api

&gt;&gt; require &#039;brightcove-api&#039;
=&gt; true
&gt;&gt; brightcove = Brightcove::API.new(&#039;0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.&#039;)
=&gt; #&lt;brightcove ::API:0x114dbc8 @token=&quot;0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.&quot;, @api_url=&quot;http://api.brightcove.com/services/library&quot;&gt;
&gt;&gt; response = brightcove.get(&#039;find_all_videos&#039;, {:page_size =&gt; 3, :video_fields =&gt; &#039;id,name,linkURL,linkText&#039;})
=&gt; {&quot;items&quot;=&gt;[{&quot;name&quot;=&gt;&quot;Documentarian Skydiving&quot;, &quot;id&quot;=&gt;496518762, &quot;linkText&quot;=&gt;nil, &quot;linkURL&quot;=&gt;nil}, {&quot;name&quot;=&gt;&quot;Surface Tricks&quot;, &quot;id&quot;=&gt;496518763, &quot;linkText&quot;=&gt;nil, &quot;linkURL&quot;=&gt;nil}, {&quot;name&quot;=&gt;&quot;Free Skiing&quot;, &quot;id&quot;=&gt;496518765, &quot;linkText&quot;=&gt;nil, &quot;linkURL&quot;=&gt;nil}], &quot;page_number&quot;=&gt;0, &quot;page_size&quot;=&gt;3, &quot;total_count&quot;=&gt;-1}
</pre>
<p></brightcove></p>

<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F07%2F29%2Fbrightercove%2F&amp;title=Brightercove" title="Reddit"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F07%2F29%2Fbrightercove%2F&amp;title=Brightercove&amp;bodytext=We%27re%20using%20Brightcove%20here%20at%20Agora%20Games%20for%20some%20video%20platform%20work.%20In%20our%20group%20chats%2C%20we%27ve%20talked%20about%2C%20%22It%20would%20be%20nice%20if%20we%20had%20a%20Ruby%20API%20for%20interacting%20with%20Brightcove.%22%0D%0A%0D%0AAnd%20so%20I%20did%20just%20that%2C%20http%3A%2F%2Fgithub.com%2Fagoragames%2Fbrightco" title="Digg"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F07%2F29%2Fbrightercove%2F&amp;title=Brightercove&amp;notes=We%27re%20using%20Brightcove%20here%20at%20Agora%20Games%20for%20some%20video%20platform%20work.%20In%20our%20group%20chats%2C%20we%27ve%20talked%20about%2C%20%22It%20would%20be%20nice%20if%20we%20had%20a%20Ruby%20API%20for%20interacting%20with%20Brightcove.%22%0D%0A%0D%0AAnd%20so%20I%20did%20just%20that%2C%20http%3A%2F%2Fgithub.com%2Fagoragames%2Fbrightco" title="del.icio.us"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.agoragames.com%2F2010%2F07%2F29%2Fbrightercove%2F" title="Technorati"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.agoragames.com/2010/07/29/brightercove/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Party for Misha</title>
		<link>http://blog.agoragames.com/2010/07/29/party-for-misha/</link>
		<comments>http://blog.agoragames.com/2010/07/29/party-for-misha/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 16:52:28 +0000</pubDate>
		<dc:creator>Brian Corrigan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.agoragames.com/?p=674</guid>
		<description><![CDATA[

Today is Misha&#8217;s last day.  We wished him luck and toasted him off with some local microbrews from the Troy Pub and Brewery. 





	
	
	
	


]]></description>
			<content:encoded><![CDATA[<p><img style="display:block;margin-right:auto;margin-left:auto;" alt="image" src="http://blog.agoragames.com/wp-content/uploads/2010/07/wpid-1280422338861.jpg" /></p>
</p>
<p>Today is Misha&#8217;s last day.  We wished him luck and toasted him off with some local microbrews from the Troy Pub and Brewery. </p>
<p></p>

<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F07%2F29%2Fparty-for-misha%2F&amp;title=Party%20for%20Misha" title="Reddit"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F07%2F29%2Fparty-for-misha%2F&amp;title=Party%20for%20Misha&amp;bodytext=%0AToday%20is%20Misha%27s%20last%20day.%C2%A0%20We%20wished%20him%20luck%20and%20toasted%20him%20off%20with%20some%20local%20microbrews%20from%20the%20Troy%20Pub%20and%20Brewery.%20%0A%0A" title="Digg"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F07%2F29%2Fparty-for-misha%2F&amp;title=Party%20for%20Misha&amp;notes=%0AToday%20is%20Misha%27s%20last%20day.%C2%A0%20We%20wished%20him%20luck%20and%20toasted%20him%20off%20with%20some%20local%20microbrews%20from%20the%20Troy%20Pub%20and%20Brewery.%20%0A%0A" title="del.icio.us"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.agoragames.com%2F2010%2F07%2F29%2Fparty-for-misha%2F" title="Technorati"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.agoragames.com/2010/07/29/party-for-misha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby Reversible Encryption</title>
		<link>http://blog.agoragames.com/2010/05/13/rubyreversibleencryption/</link>
		<comments>http://blog.agoragames.com/2010/05/13/rubyreversibleencryption/#comments</comments>
		<pubDate>Fri, 14 May 2010 00:31:56 +0000</pubDate>
		<dc:creator>Brian Corrigan</dc:creator>
				<category><![CDATA[Bending Rails]]></category>
		<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.agoragames.com/?p=557</guid>
		<description><![CDATA[It&#8217;s been awhile since I had to do anything with reversible encryption.  Here&#8217;s a working sample using AES.


#/usr/bin/ruby
require &#039;openssl&#039;
require &#34;base64&#34;
require &#039;uri&#039;

# First lets encrypt the string!
plaintext = &#039;Super secret message&#039;

# Create the cipher
cipher = OpenSSL::Cipher::Cipher.new(&#34;aes-256-cbc&#34;)
cipher.encrypt # Tell OpenSSL to operate in encrypt mode
puts &#34;Cipher wants a key that is #{cipher.key_len}&#34;
key = &#039;01234567890123456789012345678901&#039;
cipher.key = key

puts [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been awhile since I had to do anything with reversible encryption.  Here&#8217;s a working sample using AES.</p>
<p><!-- mofe --></p>
<pre class="brush: ruby">
#/usr/bin/ruby
require &#039;openssl&#039;
require &quot;base64&quot;
require &#039;uri&#039;

# First lets encrypt the string!
plaintext = &#039;Super secret message&#039;

# Create the cipher
cipher = OpenSSL::Cipher::Cipher.new(&quot;aes-256-cbc&quot;)
cipher.encrypt # Tell OpenSSL to operate in encrypt mode
puts &quot;Cipher wants a key that is #{cipher.key_len}&quot;
key = &#039;01234567890123456789012345678901&#039;
cipher.key = key

puts &quot;Cipher wants an initialization vector that is #{cipher.iv_len}&quot;
cipher.iv = iv = cipher.random_iv # Create and set a random initialization vector

# Encrypted
encrypted = cipher.update(plaintext) + cipher.final
encrypted = iv + encrypted # Send along the IV

# Lets pretty up the encrypted string
encrypted = Base64.encode64(encrypted)
#encrypted = URI.escape(encrypted, Regexp.new(&quot;[^#{URI::PATTERN::UNRESERVED}]&quot;))
encrypted = URI.escape(encrypted)

# Now lets unencrypt it, first start with a new cipher
cipher = OpenSSL::Cipher::Cipher.new(&quot;aes-256-cbc&quot;)
cipher.decrypt # Use SSL in decrypt mode
cipher.key = key
encrypted = URI.unescape(encrypted)
encrypted = Base64.decode64(encrypted)
cipher.iv = encrypted.slice!(0,16) # Remove the IV from the encrypted data
decrypted = cipher.update(encrypted) + cipher.final 

# Test
puts &#039;The original was &#039;+ plaintext
puts &#039;Encrypted that was &#039; + encrypted
puts &#039;Decrypted we have &#039; + decrypted
</pre>

<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F05%2F13%2Frubyreversibleencryption%2F&amp;title=Ruby%20Reversible%20Encryption" title="Reddit"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F05%2F13%2Frubyreversibleencryption%2F&amp;title=Ruby%20Reversible%20Encryption&amp;bodytext=It%27s%20been%20awhile%20since%20I%20had%20to%20do%20anything%20with%20reversible%20encryption.%20%20Here%27s%20a%20working%20sample%20using%20AES.%0D%0A%0D%0A%0D%0A%0D%0A%5Bsource%20language%3D%27ruby%27%5D%0D%0A%23%2Fusr%2Fbin%2Fruby%0D%0Arequire%20%27openssl%27%0D%0Arequire%20%22base64%22%0D%0Arequire%20%27uri%27%0D%0A%0D%0A%23%20First%20lets%20encrypt%20the%20string%21%0D%0Aplain" title="Digg"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F05%2F13%2Frubyreversibleencryption%2F&amp;title=Ruby%20Reversible%20Encryption&amp;notes=It%27s%20been%20awhile%20since%20I%20had%20to%20do%20anything%20with%20reversible%20encryption.%20%20Here%27s%20a%20working%20sample%20using%20AES.%0D%0A%0D%0A%0D%0A%0D%0A%5Bsource%20language%3D%27ruby%27%5D%0D%0A%23%2Fusr%2Fbin%2Fruby%0D%0Arequire%20%27openssl%27%0D%0Arequire%20%22base64%22%0D%0Arequire%20%27uri%27%0D%0A%0D%0A%23%20First%20lets%20encrypt%20the%20string%21%0D%0Aplain" title="del.icio.us"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.agoragames.com%2F2010%2F05%2F13%2Frubyreversibleencryption%2F" title="Technorati"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.agoragames.com/2010/05/13/rubyreversibleencryption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It&#8217;s My Gem In A Box</title>
		<link>http://blog.agoragames.com/2010/04/28/its-my-gem-in-a-box/</link>
		<comments>http://blog.agoragames.com/2010/04/28/its-my-gem-in-a-box/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 21:04:59 +0000</pubDate>
		<dc:creator>David Czarnecki</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[gem in a box]]></category>
		<category><![CDATA[jeweler]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.agoragames.com/?p=550</guid>
		<description><![CDATA[Hey developers, I got something real important to give you. So just sit down, and listen.

We recently started a number of projects, each of which will require the use of a common library. So, here&#8217;s how it went down:
* Create the common library as a gem using the jeweler tool.
* Install Gem in a Box [...]]]></description>
			<content:encoded><![CDATA[<p>Hey developers, I got something real important to give you. So just sit down, and listen.</p>
<p><span id="more-550"></span></p>
<p>We recently started a number of projects, each of which will require the use of a common library. So, here&#8217;s how it went down:</p>
<p>* Create the common library as a gem using the <a href="http://github.com/technicalpickles/jeweler">jeweler</a> tool.</p>
<p>* Install <a href="http://tomlea.co.uk/posts/gem-in-a-box/">Gem in a Box</a> to allow the gem to be downloaded internally by our developers using gem install.</p>
<p>* Upload the common library gem.</p>
<p>BLAMMO! Now every developer can pull my gem ;)</p>
<p>But seriously, &#8220;Gem in a Box&#8221; is awesome and a great way to share gems internally at your office.</p>

<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F04%2F28%2Fits-my-gem-in-a-box%2F&amp;title=It%27s%20My%20Gem%20In%20A%20Box%20" title="Reddit"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F04%2F28%2Fits-my-gem-in-a-box%2F&amp;title=It%27s%20My%20Gem%20In%20A%20Box%20&amp;bodytext=Hey%20developers%2C%20I%20got%20something%20real%20important%20to%20give%20you.%20So%20just%20sit%20down%2C%20and%20listen.%0D%0A%0D%0A%0D%0A%0D%0AWe%20recently%20started%20a%20number%20of%20projects%2C%20each%20of%20which%20will%20require%20the%20use%20of%20a%20common%20library.%20So%2C%20here%27s%20how%20it%20went%20down%3A%0D%0A%0D%0A%2A%20Create%20the%20common%20lib" title="Digg"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F04%2F28%2Fits-my-gem-in-a-box%2F&amp;title=It%27s%20My%20Gem%20In%20A%20Box%20&amp;notes=Hey%20developers%2C%20I%20got%20something%20real%20important%20to%20give%20you.%20So%20just%20sit%20down%2C%20and%20listen.%0D%0A%0D%0A%0D%0A%0D%0AWe%20recently%20started%20a%20number%20of%20projects%2C%20each%20of%20which%20will%20require%20the%20use%20of%20a%20common%20library.%20So%2C%20here%27s%20how%20it%20went%20down%3A%0D%0A%0D%0A%2A%20Create%20the%20common%20lib" title="del.icio.us"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.agoragames.com%2F2010%2F04%2F28%2Fits-my-gem-in-a-box%2F" title="Technorati"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.agoragames.com/2010/04/28/its-my-gem-in-a-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Packaging For Pleasure</title>
		<link>http://blog.agoragames.com/2010/04/19/packaging-for-pleasure/</link>
		<comments>http://blog.agoragames.com/2010/04/19/packaging-for-pleasure/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 20:15:11 +0000</pubDate>
		<dc:creator>David Czarnecki</dc:creator>
				<category><![CDATA[Bending Rails]]></category>
		<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[packaging]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://blog.agoragames.com/?p=540</guid>
		<description><![CDATA[Let me be more explicit and say I&#8217;m going to be talking about Rails application packaging. Sorry, I needed a good post title for the lulz and the page views.

There are a few rake tasks that I&#8217;ve been using more and more now that all of our applications are running in a shared, virtual enviroment. [...]]]></description>
			<content:encoded><![CDATA[<p>Let me be more explicit and say I&#8217;m going to be talking about Rails application packaging. Sorry, I needed a good post title for the lulz and the page views.</p>
<p><span id="more-540"></span></p>
<p>There are a few rake tasks that I&#8217;ve been using more and more now that all of our applications are running in a shared, virtual enviroment. They are:</p>
<p>* rake -T     # -T, &#8211;tasks [PATTERN]            Display the tasks (matching optional PATTERN) with descriptions, then exit.</p>
<p>Everyone should know and use this task at least once in their Rails-development life.</p>
<p>* rake rails:freeze:gems   # Lock this application to the current gems (by unpacking them into vendor/rails)<br />
* rake gems:unpack   # Unpacks all required gems into vendor/gems.<br />
* rake gems:unpack:dependencies   # Unpacks all required gems and their dependencies into vendor/gems.</p>
<p>So, once I&#8217;ve created my project with &#8220;rails [project name]&#8220;, then next thing I do is &#8220;rake rails:freeze:gems&#8221; to freeze the Rails gems. I&#8217;ll enumerate the application&#8217;s dependencies in the environment.rb file and then run &#8220;rake gems:unpack&#8221; to make sure those dependencies exist with the application. Example:</p>
<pre class="brush: ruby">

config.gem &#039;will_paginate&#039;, :version =&gt; &#039;2.3.11&#039;, :source =&gt; &#039;http://gemcutter.org&#039;
config.gem &#039;factory_girl&#039;, :version =&gt; &#039;1.2.4&#039;, :source =&gt; &#039;http://gemcutter.org&#039;
config.gem &#039;fakeweb&#039;, :version =&gt; &#039;1.2.8&#039;, :source =&gt; &#039;http://gemcutter.org&#039;
</pre>
<p>Why do I like this approach? In a shared environment, it means we don&#8217;t have to have our systems folks install any dependencies for our application to run making the application self-contained. This is mostly fine for gems that don&#8217;t have an explicit native component. Also, in being explicit about versions of the gems that an application is using, we do not run the risk of chasing a moving target. Again, in a shared environment, if someone updates a gem on the system, it&#8217;s probably not an issue until the one time it is and you&#8217;re being called at 3 AM that the application is down because of a gem incompatibility change.</p>
<p>That&#8217;s it. Any other packaging dos and don&#8217;t?</p>

<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F04%2F19%2Fpackaging-for-pleasure%2F&amp;title=Packaging%20For%20Pleasure" title="Reddit"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F04%2F19%2Fpackaging-for-pleasure%2F&amp;title=Packaging%20For%20Pleasure&amp;bodytext=Let%20me%20be%20more%20explicit%20and%20say%20I%27m%20going%20to%20be%20talking%20about%20Rails%20application%20packaging.%20Sorry%2C%20I%20needed%20a%20good%20post%20title%20for%20the%20lulz%20and%20the%20page%20views.%0D%0A%0D%0A%0D%0A%0D%0AThere%20are%20a%20few%20rake%20tasks%20that%20I%27ve%20been%20using%20more%20and%20more%20now%20that%20all%20of%20our%20app" title="Digg"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F04%2F19%2Fpackaging-for-pleasure%2F&amp;title=Packaging%20For%20Pleasure&amp;notes=Let%20me%20be%20more%20explicit%20and%20say%20I%27m%20going%20to%20be%20talking%20about%20Rails%20application%20packaging.%20Sorry%2C%20I%20needed%20a%20good%20post%20title%20for%20the%20lulz%20and%20the%20page%20views.%0D%0A%0D%0A%0D%0A%0D%0AThere%20are%20a%20few%20rake%20tasks%20that%20I%27ve%20been%20using%20more%20and%20more%20now%20that%20all%20of%20our%20app" title="del.icio.us"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.agoragames.com%2F2010%2F04%2F19%2Fpackaging-for-pleasure%2F" title="Technorati"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.agoragames.com/2010/04/19/packaging-for-pleasure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Importance of Having a (Fast) Test Suite</title>
		<link>http://blog.agoragames.com/2010/04/07/the-importance-of-having-a-fast-test-suite/</link>
		<comments>http://blog.agoragames.com/2010/04/07/the-importance-of-having-a-fast-test-suite/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 13:49:06 +0000</pubDate>
		<dc:creator>David Czarnecki</dc:creator>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://blog.agoragames.com/?p=523</guid>
		<description><![CDATA[Speed is the name of the game. Or is it?
I was adding another project to our Continuous Integration (CI) server that runs the test suite for a project after code is checked in and started noticing the time it takes to build certain projects. A few interesting statistics for you to noodle on.
Average build time: [...]]]></description>
			<content:encoded><![CDATA[<p>Speed is the name of the game. Or is it?</p>
<p>I was adding another project to our Continuous Integration (CI) server that runs the test suite for a project after code is checked in and started noticing the time it takes to build certain projects. A few interesting statistics for you to noodle on.</p>
<p>Average build time: ~32 seconds</p>
<p>Max build time: 1 hour and 48 minutes</p>
<p><span id="more-523"></span>There are approximately 18 projects that get built through CI and many other projects that have not been setup for CI.</p>
<p>What does this tell us? Testing is not an impediment to development because it takes too long to run tests. As most test suites run in less than a minute, not running the test suite is not an option for our developers. And if you don&#8217;t, CI sends an e-mail to the team letting everyone know you broke the build. And since our post-commit hooks for SVN and git notify our Campfire room each time code is committed, chances are you&#8217;re going to get an earful in Campfire telling you to fix the build because your last commit broke the build.</p>
<p><img class="alignnone size-full wp-image-527" title="chet_weird_science" src="http://blog.agoragames.com/wp-content/uploads/2010/04/Picture-17.png" alt="chet_weird_science" width="495" height="264" /></p>
<p>I&#8217;m glad nearly all of our projects have test suites that run quickly, but I also have a practical view on test suites. <strong>Above all, if nothing else, I want a test suite to exist.</strong> I want it to be there so that when I&#8217;m adding code to the repository, the test suite is looking at me asking for more.</p>
<p><img class="size-full wp-image-526 alignnone" title="More tests please!" src="http://blog.agoragames.com/wp-content/uploads/2010/04/Picture-16.png" alt="More tests please!" width="188" height="203" /></p>
<p>About that project that takes 1 hour and 48 minutes to build? Right. Guitar Hero. It&#8217;s a BIG project. It&#8217;s over 3 years old. There is a LOT of code. We test A LOT of systems, e.g. accounts, clans, tournaments, leaderboards, game configurations, game integration processing, etc. I&#8217;m OK with it taking that long to run the test suite. We have development practices that we follow for running sub-sections of the test suite when we touch the application to test our new code.</p>
<p>To summarize:</p>
<ul>
<li>Ensure your projects have a test suite</li>
<li>Run a Continuous Integration (CI) server for your projects for when developers forget to run the test suite before committing code</li>
<li>Ensure your projects have a test suite</li>
<li>Ensure your projects have a test suite</li>
<li>Ensure your projects have a test suite</li>
<li>Make sure developers know how to run part of the test suite for long-running test suites</li>
<li>Ensure your projects have a test suite</li>
</ul>

<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F04%2F07%2Fthe-importance-of-having-a-fast-test-suite%2F&amp;title=The%20Importance%20of%20Having%20a%20%28Fast%29%20Test%20Suite" title="Reddit"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F04%2F07%2Fthe-importance-of-having-a-fast-test-suite%2F&amp;title=The%20Importance%20of%20Having%20a%20%28Fast%29%20Test%20Suite&amp;bodytext=Speed%20is%20the%20name%20of%20the%20game.%20Or%20is%20it%3F%0D%0A%0D%0AI%20was%20adding%20another%20project%20to%20our%20Continuous%20Integration%20%28CI%29%20server%20that%20runs%20the%20test%20suite%20for%20a%20project%20after%20code%20is%20checked%20in%20and%20started%20noticing%20the%20time%20it%20takes%20to%20build%20certain%20projects.%20A%20few" title="Digg"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F04%2F07%2Fthe-importance-of-having-a-fast-test-suite%2F&amp;title=The%20Importance%20of%20Having%20a%20%28Fast%29%20Test%20Suite&amp;notes=Speed%20is%20the%20name%20of%20the%20game.%20Or%20is%20it%3F%0D%0A%0D%0AI%20was%20adding%20another%20project%20to%20our%20Continuous%20Integration%20%28CI%29%20server%20that%20runs%20the%20test%20suite%20for%20a%20project%20after%20code%20is%20checked%20in%20and%20started%20noticing%20the%20time%20it%20takes%20to%20build%20certain%20projects.%20A%20few" title="del.icio.us"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.agoragames.com%2F2010%2F04%2F07%2Fthe-importance-of-having-a-fast-test-suite%2F" title="Technorati"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.agoragames.com/2010/04/07/the-importance-of-having-a-fast-test-suite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>All Parsers Are Not Created Equal</title>
		<link>http://blog.agoragames.com/2010/03/30/all-parsers-are-not-created-equal/</link>
		<comments>http://blog.agoragames.com/2010/03/30/all-parsers-are-not-created-equal/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 20:38:58 +0000</pubDate>
		<dc:creator>David Czarnecki</dc:creator>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hpricot]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[simple-rss]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xpath]]></category>

		<guid isPermaLink="false">http://blog.agoragames.com/?p=509</guid>
		<description><![CDATA[This is a post about XML and JSON.
We recently came across a bottleneck in one of our applications that grabs data from a content repository. A large part of the bottleneck had to do with caching of data from the content repository, or lack thereof. A small part of the bottleneck has to do with [...]]]></description>
			<content:encoded><![CDATA[<p>This is a post about <a href="http://en.wikipedia.org/wiki/Xml">XML</a> and <a href="http://en.wikipedia.org/wiki/JSON">JSON</a>.</p>
<p><span id="more-509"></span>We recently came across a bottleneck in one of our applications that grabs data from a content repository. A large part of the bottleneck had to do with caching of data from the content repository, or lack thereof. A small part of the bottleneck has to do with parsing of XML data as the application grabs XML feeds from the content repository and parses it to display data within the application. Novel idea using XML as a communication mechanism between 2 applications? You betcha.</p>
<p>In any event, boring machine name aside, I decided to benchmark the data parsing via JSON, Hpricot, and Simple-RSS.</p>
<pre class="brush: ruby">

David-Czarneckis-iMac:application-playground dczarnecki$ ruby parsing-benchmarking.rb
&quot;Benchmarking JSON&quot;
&quot;    JSON document: /Users/dczarnecki/projects/parsing-benchmarking/sample_json_document.json, Size: 161574&quot;
&quot;    JSON::Ext::ParserJSON::Ext::Generator&quot;
&quot;    Benchmarked JSON parse for 20x (average): 0.0121459603309631&quot;
&quot;Benchmarking Hpricot&quot;
&quot;    XML document: /Users/dczarnecki/projects/parsing-benchmarking/sample_photo_rss_document.rss, Size: 162644&quot;
&quot;    Benchmarked XML parse for 20x (average): 0.00232400894165039&quot;
&quot;Benchmarking Simple-RSS&quot;
&quot;    XML document: /Users/dczarnecki/projects/parsing-benchmarking/sample_photo_rss_document.rss, Size: 162644&quot;
&quot;    Benchmarked XML parse for 20x (average): 1.78787769079208&quot;
David-Czarneckis-iMac:application-playground dczarnecki$
</pre>
<p>The numbers are interesting. Here is my opinion on the results:</p>
<p>- Hpricot is the fastest at parsing a big XML document. You have to use XPath to get at the elements in the document. XPath is, for me, non-intuitive and you sacrifice a bit in terms of readability of the code.</p>
<p>- JSON is the second fastest at parsing a big JSON document. Also, you have a four letter acronym technology integrated into your application, and let&#8217;s finally admit it, size matters. For me, you gain intuitive access to the underlying data and more readability of the code.</p>
<p>- Simple-RSS is slow.</p>
<p>- XML output from our content repository doesn&#8217;t give us paged access to the content, but the JSON API in the content repository does give us paged access to the content. With the XML output, we have to suck down a firehose and slice it up appropriately leading to a bunch of flackery with caching the parsed document.</p>
<p>If you&#8217;re looking for a better read, then check out the following book, &#8220;Paint It Black: A Guide to Gothic Homemaking&#8221;.</p>
<p><a href="http://www.amazon.com/Paint-Black-Guide-Gothic-Homemaking/dp/1578633613/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1269982528&amp;sr=1-1"><img class="alignnone size-full wp-image-517" title="Paint it Black" src="http://blog.agoragames.com/wp-content/uploads/2010/03/41Jbbh8d2SL._BO2204203200_PIsitb-sticker-arrow-clickTopRight35-76_AA300_SH20_OU01_.jpg" alt="Paint it Black" width="300" height="300" /></a></p>

<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F03%2F30%2Fall-parsers-are-not-created-equal%2F&amp;title=All%20Parsers%20Are%20Not%20Created%20Equal" title="Reddit"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F03%2F30%2Fall-parsers-are-not-created-equal%2F&amp;title=All%20Parsers%20Are%20Not%20Created%20Equal&amp;bodytext=This%20is%20a%20post%20about%20XML%20and%20JSON.%0D%0A%0D%0AWe%20recently%20came%20across%20a%20bottleneck%20in%20one%20of%20our%20applications%20that%20grabs%20data%20from%20a%20content%20repository.%20A%20large%20part%20of%20the%20bottleneck%20had%20to%20do%20with%20caching%20of%20data%20from%20the%20content%20repository%2C%20or%20lack%20thereo" title="Digg"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F03%2F30%2Fall-parsers-are-not-created-equal%2F&amp;title=All%20Parsers%20Are%20Not%20Created%20Equal&amp;notes=This%20is%20a%20post%20about%20XML%20and%20JSON.%0D%0A%0D%0AWe%20recently%20came%20across%20a%20bottleneck%20in%20one%20of%20our%20applications%20that%20grabs%20data%20from%20a%20content%20repository.%20A%20large%20part%20of%20the%20bottleneck%20had%20to%20do%20with%20caching%20of%20data%20from%20the%20content%20repository%2C%20or%20lack%20thereo" title="del.icio.us"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.agoragames.com%2F2010%2F03%2F30%2Fall-parsers-are-not-created-equal%2F" title="Technorati"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.agoragames.com/2010/03/30/all-parsers-are-not-created-equal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Experimenting with Redis</title>
		<link>http://blog.agoragames.com/2010/02/23/experimenting-with-redis/</link>
		<comments>http://blog.agoragames.com/2010/02/23/experimenting-with-redis/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 13:05:04 +0000</pubDate>
		<dc:creator>David Czarnecki</dc:creator>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[redis]]></category>
		<category><![CDATA[resque]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.agoragames.com/?p=470</guid>
		<description><![CDATA[Yesterday I started looking at ways to do inter-application communication. In a number of projects we&#8217;ve done here at Agora Games, we&#8217;ve used queues to make that happen. Redis has been on my radar for awhile now, but yesterday I drove my Chevy to the levee and guess what? The levee is NOT dry people. [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I started looking at ways to do inter-application communication. In a number of projects we&#8217;ve done here at Agora Games, we&#8217;ve used queues to make that happen. <a href="http://code.google.com/p/redis/">Redis</a> has been on my radar for awhile now, but yesterday I drove my Chevy to the levee and guess what? The levee is NOT dry people. I mean, who drinks rye anyway these days? Old people.</p>
<p><span id="more-470"></span></p>
<p>Right, <a href="http://code.google.com/p/redis/">Redis</a>.</p>
<p>&#8220;Redis is an advanced key-value store. It is similar to memcached but the dataset is not volatile, and values can be strings, exactly like in memcached, but also lists, sets, and ordered sets. All this data types can be manipulated with atomic operations to push/pop elements, add/remove elements, perform server side union, intersection, difference between sets, and so forth. Redis supports different kind of sorting abilities.&#8221;</p>
<p>I was particularly interested in the support in Redis for lists, which would allow me to have one application push stuff into the datastore and allow for another application to pull stuff from the datastore. A datastore that could operate as a queue? I guess this is as close as we&#8217;re going to get to flying cars in 2010. Redis is also supposed to be wicked fast and there are a number of libraries available in your programming language of choice with which to communicate with Redis.</p>
<p>Redis setup was trivial and &#8220;just worked&#8221;.</p>
<p>After starting the Redis server, I could just prototype in script/console.</p>
<p>Here we go:</p>
<pre style="font-family: monospace;"><span>&gt;&gt;</span> redis_queue = Redis.<span>new</span>
<span>=&gt;</span> <span>#&lt;Redis:0x222df9c @thread_safe=nil, @logger=nil, @password=nil, @timeout=5, @db=0, @sock=nil, @host="127.0.0.1", @port=6379&gt;</span>
<span>&gt;&gt;</span> redis_queue.<span>push_tail</span> <span>'strings'</span>, <span>'string 1'</span>
<span>=&gt;</span> <span>"OK"
&gt;&gt; </span>redis_queue.<span>push_tail</span> <span>'strings'</span>, <span>'string 2'</span><span>
&gt;&gt;</span> <span>"OK"</span><span>
&gt;&gt;</span> redis_queue.<span>list_length</span><span>(</span><span>'strings'</span><span>)</span><span>
=&gt;</span> <span>2
&gt;&gt; </span>redis_queue.<span>list_range</span><span>(</span><span>'strings'</span>, <span>0</span>, <span>-</span><span>1</span><span>)</span>
=&gt; ["string 1", "string 2"]
&gt;&gt; some_string = redis_queue.pop_head('strings')
=&gt; "string 1"
&gt;&gt; r.list_range('strings', 0, -1)
=&gt; ["string 2"]
&gt;&gt; r.list_length('strings')
=&gt; 1
&gt;&gt; quit</pre>
<p><a href="http://code.google.com/p/redis/wiki/CommandReference">There are quite a few commands that make Redis even more awesome, but for now I&#8217;m sold</a>. (If using an entire sentence as a link is wrong then I don&#8217;t want to be right)</p>
<p>Also, I know of <a href="http://github.com/defunkt/resque#readme">Resque</a>, &#8220;a Redis-backed library for creating background jobs, placing those jobs on multiple queues, and processing them later.&#8221; If I ever feel like driving the Mercedes Benz of flying cars, I&#8217;ll use it.</p>

<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F02%2F23%2Fexperimenting-with-redis%2F&amp;title=Experimenting%20with%20Redis" title="Reddit"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F02%2F23%2Fexperimenting-with-redis%2F&amp;title=Experimenting%20with%20Redis&amp;bodytext=Yesterday%20I%20started%20looking%20at%20ways%20to%20do%20inter-application%20communication.%20In%20a%20number%20of%20projects%20we%27ve%20done%20here%20at%20Agora%20Games%2C%20we%27ve%20used%20queues%20to%20make%20that%20happen.%20Redis%20has%20been%20on%20my%20radar%20for%20awhile%20now%2C%20but%20yesterday%20I%20drove%20my%20Chevy%20to%20the" title="Digg"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F02%2F23%2Fexperimenting-with-redis%2F&amp;title=Experimenting%20with%20Redis&amp;notes=Yesterday%20I%20started%20looking%20at%20ways%20to%20do%20inter-application%20communication.%20In%20a%20number%20of%20projects%20we%27ve%20done%20here%20at%20Agora%20Games%2C%20we%27ve%20used%20queues%20to%20make%20that%20happen.%20Redis%20has%20been%20on%20my%20radar%20for%20awhile%20now%2C%20but%20yesterday%20I%20drove%20my%20Chevy%20to%20the" title="del.icio.us"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.agoragames.com%2F2010%2F02%2F23%2Fexperimenting-with-redis%2F" title="Technorati"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.agoragames.com/2010/02/23/experimenting-with-redis/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting started with data_fabric</title>
		<link>http://blog.agoragames.com/2010/01/29/getting-started-with-data_fabric/</link>
		<comments>http://blog.agoragames.com/2010/01/29/getting-started-with-data_fabric/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 15:46:01 +0000</pubDate>
		<dc:creator>David Czarnecki</dc:creator>
				<category><![CDATA[Bending Rails]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[active_record]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[data_fabric]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[sharding]]></category>

		<guid isPermaLink="false">http://blog.agoragames.com/?p=447</guid>
		<description><![CDATA[The data_fabric gem &#8220;provides flexible database connection switching for ActiveRecord&#8221;. If you&#8217;re not concerned with database sharding, you might want to skip this blog post. Or not. Either way, I&#8217;m not going to be offended.
I have a requirement that certain data in an application that I&#8217;m developing will probably have to be sharded because, if [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://github.com/mperham/data_fabric">data_fabric</a> gem &#8220;provides flexible database connection switching for ActiveRecord&#8221;. If you&#8217;re not concerned with database sharding, you might want to skip this blog post. Or not. Either way, I&#8217;m not going to be offended.</p>
<p>I have a requirement that certain data in an application that I&#8217;m developing will probably have to be sharded because, if you&#8217;ll excuse my English, there will a &#8220;shit ton&#8221; of data. This only affects one model out of the few models I have in the application. I don&#8217;t have a requirement that the data will be replicated (which is another feature supported in data_fabric), so I&#8217;m not going into that here. In any event, here is a rundown of how I got started developing and testing with data_fabric.</p>
<p>- Configure the data_fabric gem in your config/environment.rb file.</p>
<pre class="brush: ruby">

config.gem &#039;data_fabric&#039;
</pre>
<p>- In your model(s), decide on which column or how the data is going to be shared.</p>
<pre class="brush: ruby">

data_fabric :replicated =&gt; false, :shard_by =&gt; :initial_code
</pre>
<p>In this case, inital_code is a method that looks at a piece of the model&#8217;s data and gives me the correct shard.</p>
<p>- Setup the database shards in your config/database.yml file. I actually setup only one shard for development and testing environments to make things easier. I&#8217;m just including the one for the test environment here. You can read on the data_fabric site about the naming convention for sharded database connections.</p>
<pre class="brush: sql">

test:
adapter: mysql
encoding: utf8
reconnect: false
database: myapp_test
pool: 5
username: root
password:

# This is the database shard
initial_code_testenv_test:
adapter: mysql
encoding: utf8
reconnect: false
database: myapp_test_testenv
pool: 5
username: root
password:
</pre>
<p>- In config/initializers/my_app_model.rb, I actually stub out the initial_code method to return a single value for the development and test environments. This is merely convenience so I don&#8217;t have to include every single database shard for development and testing.</p>
<pre class="brush: ruby">

require &#039;mocha&#039;

if &#039;development&#039;.eql?(RAILS_ENV)
PromotionCode.stubs(:initial_code).returns(&#039;devenv&#039;)
end

if &#039;test&#039;.eql?(RAILS_ENV)
PromotionCode.stubs(:initial_code).returns(&#039;testenv&#039;)
end
</pre>
<p>- I copied part of the Rakefile from the data_fabric gem to actually be able to migrate the database for the sharded database connections. This was definitely missing from the data_fabric README.</p>
<pre class="brush: ruby">

require &#039;fileutils&#039;
include FileUtils::Verbose

namespace :db do
task :migrate do
require &#039;erb&#039;
require &#039;logger&#039;
require &#039;active_record&#039;
reference = YAML::load(ERB.new(IO.read(&quot;config/database.yml&quot;)).result)
env = RAILS_ENV = ENV[&#039;RAILS_ENV&#039;] || &#039;development&#039;
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.logger.level = Logger::WARN
ActiveRecord::Base.configurations = reference.dup
old_config = reference[env]
reference.each_key do |name|
next unless name.include? env
next if name.include? &#039;slave&#039; # Replicated databases should not be touched directly

puts &quot;Migrating #{name}&quot;
ActiveRecord::Base.clear_active_connections!
ActiveRecord::Base.configurations[env] = reference[name]
ActiveRecord::Base.establish_connection RAILS_ENV
ActiveRecord::Migration.verbose = ENV[&quot;VERBOSE&quot;] ? ENV[&quot;VERBOSE&quot;] == &quot;true&quot; : true
ActiveRecord::Migrator.migrate(&quot;db/migrate/&quot;, ENV[&quot;VERSION&quot;] ? ENV[&quot;VERSION&quot;].to_i : nil)
end
end
end
</pre>
<p>- In my test classes that use the sharded model, I have setup and teardown methods that activate and deactivate the shard.</p>
<pre class="brush: ruby">

def setup
DataFabric.activate_shard(:initial_code =&gt; &#039;testenv&#039;)
end

def teardown
MyAppModel.delete_all
DataFabric.deactivate_shard(:initial_code =&gt; &#039;testenv&#039;)
end
</pre>
<p>I did find that I needed to delete all the objects in the database for the sharded model. I&#8217;m still digging into why that&#8217;s the case. My ActiveRecord_fu isn&#8217;t that strong I guess.</p>
<p>All in all, sharding is relatively easy with data_fabric. Pimping, however, &#8220;ain&#8217;t easy.&#8221; But that&#8217;s for another blog post I guess.</p>

<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F01%2F29%2Fgetting-started-with-data_fabric%2F&amp;title=Getting%20started%20with%20data_fabric" title="Reddit"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F01%2F29%2Fgetting-started-with-data_fabric%2F&amp;title=Getting%20started%20with%20data_fabric&amp;bodytext=The%20data_fabric%20gem%20%22provides%20flexible%20database%20connection%20switching%20for%20ActiveRecord%22.%20If%20you%27re%20not%20concerned%20with%20database%20sharding%2C%20you%20might%20want%20to%20skip%20this%20blog%20post.%20Or%20not.%20Either%20way%2C%20I%27m%20not%20going%20to%20be%20offended.%0D%0A%0D%0AI%20have%20a%20requirement%20t" title="Digg"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F01%2F29%2Fgetting-started-with-data_fabric%2F&amp;title=Getting%20started%20with%20data_fabric&amp;notes=The%20data_fabric%20gem%20%22provides%20flexible%20database%20connection%20switching%20for%20ActiveRecord%22.%20If%20you%27re%20not%20concerned%20with%20database%20sharding%2C%20you%20might%20want%20to%20skip%20this%20blog%20post.%20Or%20not.%20Either%20way%2C%20I%27m%20not%20going%20to%20be%20offended.%0D%0A%0D%0AI%20have%20a%20requirement%20t" title="del.icio.us"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.agoragames.com%2F2010%2F01%2F29%2Fgetting-started-with-data_fabric%2F" title="Technorati"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.agoragames.com/2010/01/29/getting-started-with-data_fabric/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I Am Git (And So Can You!)</title>
		<link>http://blog.agoragames.com/2010/01/15/i-am-git-and-so-can-you/</link>
		<comments>http://blog.agoragames.com/2010/01/15/i-am-git-and-so-can-you/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 15:16:05 +0000</pubDate>
		<dc:creator>David Czarnecki</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://blog.agoragames.com/?p=439</guid>
		<description><![CDATA[It&#8217;s amazing how a few months can change your mindset around the version control system you use. Ever since I joined Agora Games in May 2008, we have used Subversion (SVN). Subversion is a fine version control system. We have one new project using Subversion and we will probably have a few legacy projects that [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s amazing how a few months can change your mindset around the version control system you use. Ever since I joined Agora Games in May 2008, we have used Subversion (SVN). Subversion is a fine version control system. We have one new project using Subversion and we will probably have a few legacy projects that will always use Subversion. However, last year, one of our project teams made the switch to Git and ever since then, new projects have been using Git. Looking at CruiseControl, here&#8217;s the breakdown of Subversion and Git projects:</p>
<p>Subversion: 4</p>
<p>Git: 7</p>
<p>Here is what I found personally about my Git transition experience.</p>
<ul>
<li>* If you look at the simple examples or cursory blog post introductions of using Git as a version control system, you&#8217;re probably not going to switch. I didn&#8217;t find those examples or Git blog posts enlightening at all. I just thought to myself, &#8220;Great, Git can track changes to files just like Subversion, so why should I switch?&#8221;.</li>
<li>* Git is something I can use independent of a service like GitHub locally to implement version control on projects that might never make it off of my machine.</li>
<li>* Git can be taken to the extreme where every &#8220;change&#8221; can be separated from the main branch of development and then merged at a later point. At Agora, we&#8217;ve taken a more balanced approach where major features go into a new branch and then are reviewed and merged back into the main branch, after which the new branch can be safely removed (e.g. replacing an authentication system).</li>
<li>* Although tools like <a href="http://www.syntevo.com/smartgit/index.html">SmartGit</a> exist, I needed to get comfortable by using Git from the command-line.</li>
<li>* There are a lot of Git commands and capabilities I haven&#8217;t used yet, and that&#8217;s OK.</li>
<li>* I love the idea of the Git stash, where you can scurry away local changes and revert to a clean working directory, but then recover those changes later.</li>
</ul>
<p>Git is just something you need to try. I&#8217;m no expert in Git (yet). Git&#8217;s barrier to entry feels very minimal when compared to other version control systems.</p>
<p>P.S. I realize this blog post falls under the &#8220;cursory blog post introductions of using Git as a version control system&#8221; category. Whatever.</p>
<p>:)</p>

<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F01%2F15%2Fi-am-git-and-so-can-you%2F&amp;title=I%20Am%20Git%20%28And%20So%20Can%20You%21%29" title="Reddit"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F01%2F15%2Fi-am-git-and-so-can-you%2F&amp;title=I%20Am%20Git%20%28And%20So%20Can%20You%21%29&amp;bodytext=It%27s%20amazing%20how%20a%20few%20months%20can%20change%20your%20mindset%20around%20the%20version%20control%20system%20you%20use.%20Ever%20since%20I%20joined%20Agora%20Games%20in%20May%202008%2C%20we%20have%20used%20Subversion%20%28SVN%29.%20Subversion%20is%20a%20fine%20version%20control%20system.%20We%20have%20one%20new%20project%20using%20Su" title="Digg"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F01%2F15%2Fi-am-git-and-so-can-you%2F&amp;title=I%20Am%20Git%20%28And%20So%20Can%20You%21%29&amp;notes=It%27s%20amazing%20how%20a%20few%20months%20can%20change%20your%20mindset%20around%20the%20version%20control%20system%20you%20use.%20Ever%20since%20I%20joined%20Agora%20Games%20in%20May%202008%2C%20we%20have%20used%20Subversion%20%28SVN%29.%20Subversion%20is%20a%20fine%20version%20control%20system.%20We%20have%20one%20new%20project%20using%20Su" title="del.icio.us"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.agoragames.com%2F2010%2F01%2F15%2Fi-am-git-and-so-can-you%2F" title="Technorati"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.agoragames.com/2010/01/15/i-am-git-and-so-can-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->