<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>JOEZACK.COM</title>
	
	<link>http://joezack.com</link>
	<description>Code Musings and Such</description>
	<lastBuildDate>Thu, 02 Sep 2010 00:36:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/joezack" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="joezack" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Searching for Read-Only Files with Ruby</title>
		<link>http://joezack.com/index.php/2010/09/01/searching-for-read-only-files-with-ruby/</link>
		<comments>http://joezack.com/index.php/2010/09/01/searching-for-read-only-files-with-ruby/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 00:35:56 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1437</guid>
		<description><![CDATA[Wrote a quick ruby script that someone might find useful. It will recursively find and list readonly files from a passed in directory. There's also a an array of file extensions you can exclude. Nothing Fancy: require 'find' # update to exclude by file extension exclude_extensions = ['.jpg','.txt','.png','.gif','.git'] if(ARGV[0] == nil) then puts "Please pass [...]]]></description>
			<content:encoded><![CDATA[<p>Wrote a quick ruby script that someone might find useful. It will recursively find and list readonly files from a passed in directory. There's also a an array of file extensions you can exclude.</p>
<p>Nothing Fancy:</p>
<pre class="ruby" name="code">require 'find'

# update to exclude by file extension
exclude_extensions = ['.jpg','.txt','.png','.gif','.git']

if(ARGV[0] == nil) then
	puts "Please pass in a directory."
	exit
end

puts "Searching for NON read only files"

puts "Excluding: " + exclude_extensions.join("\s")

writable = []
Find.find(ARGV[0]) do |path|

	if File.file?(path) and File.writable?(path) then
		if exclude_extensions.include?(File.extname(path))
			writable.push path
		end
	end
end

if writable.size then

	puts "Writable Files:"

	puts "\t" + writable.join("\n\t")

else

	puts "No writable files."

end
</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F09%2F01%2Fsearching-for-read-only-files-with-ruby%2F&amp;title=Searching+for+Read-Only+Files+with+Ruby"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F09%2F01%2Fsearching-for-read-only-files-with-ruby%2F&amp;title=Searching+for+Read-Only+Files+with+Ruby"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F09%2F01%2Fsearching-for-read-only-files-with-ruby%2F&amp;title=Searching+for+Read-Only+Files+with+Ruby"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F09%2F01%2Fsearching-for-read-only-files-with-ruby%2F&amp;headline=Searching+for+Read-Only+Files+with+Ruby"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Searching+for+Read-Only+Files+with+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F09%2F01%2Fsearching-for-read-only-files-with-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Searching+for+Read-Only+Files+with+Ruby&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F09%2F01%2Fsearching-for-read-only-files-with-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Searching+for+Read-Only+Files+with+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F09%2F01%2Fsearching-for-read-only-files-with-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Searching+for+Read-Only+Files+with+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F09%2F01%2Fsearching-for-read-only-files-with-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Searching+for+Read-Only+Files+with+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F09%2F01%2Fsearching-for-read-only-files-with-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F09%2F01%2Fsearching-for-read-only-files-with-ruby%2F&amp;title=Searching+for+Read-Only+Files+with+Ruby&amp;summary=&amp;source="><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F09%2F01%2Fsearching-for-read-only-files-with-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F09%2F01%2Fsearching-for-read-only-files-with-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F09%2F01%2Fsearching-for-read-only-files-with-ruby%2F&amp;title=Searching+for+Read-Only+Files+with+Ruby"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://joezack.com/index.php/2010/09/01/searching-for-read-only-files-with-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flood It .NET</title>
		<link>http://joezack.com/index.php/2010/04/18/flood-it-net/</link>
		<comments>http://joezack.com/index.php/2010/04/18/flood-it-net/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 15:44:02 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[gaming]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[game programming]]></category>
		<category><![CDATA[silverlight]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1416</guid>
		<description><![CDATA[I've been playing a bit with Silverlight this weekend, and I made a little app based on little game called Flood-It! Unfortunately, at the time I started I couldn't remember the name of the app, so it's a bit of an interpretation... Anyhow, the goal of the game is to 'flood' the screen with all [...]]]></description>
			<content:encoded><![CDATA[<p>I've been playing a bit with Silverlight this weekend, and I made a little app based on little game called <a href="http://www.google.com/search?hl=en&safe=off&client=firefox-a&hs=J0W&rls=org.mozilla%3Aen-US%3Aofficial&q=flood+it&aq=f&aqi=g10&aql=&oq=&gs_rfai=">Flood-It</a>! Unfortunately, at the time I started I couldn't remember the name of the app, so it's a bit of an interpretation...</p>
<p>Anyhow, the goal of the game is to 'flood' the screen with all one color. It's a bit difficult to explain, so just click around a bit and it will start making sense.</p>
<p><iframe src="http://joezack.com/downloads/code/silverlight/Fill/FillTestPage.html" width="100%" height="420"></iframe></p>
<div align="center">
<a href="https://www.assembla.com/code/joe-zack-personal/subversion/nodes/net/fill-it?rev=147">SVN Hosting on Assembla.com</a></div>
<p>So far I've really liked working in Silverlight, it's very similar to Flex except that C# blows ActionScript out of the water. I've got a few more little projects I'd like to try before I give my final verdict, so don't touch that dial!</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F04%2F18%2Fflood-it-net%2F&amp;title=Flood+It+.NET"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F04%2F18%2Fflood-it-net%2F&amp;title=Flood+It+.NET"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F04%2F18%2Fflood-it-net%2F&amp;title=Flood+It+.NET"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F04%2F18%2Fflood-it-net%2F&amp;headline=Flood+It+.NET"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Flood+It+.NET&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F04%2F18%2Fflood-it-net%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Flood+It+.NET&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F04%2F18%2Fflood-it-net%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Flood+It+.NET&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F04%2F18%2Fflood-it-net%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Flood+It+.NET&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F04%2F18%2Fflood-it-net%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Flood+It+.NET&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F04%2F18%2Fflood-it-net%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F04%2F18%2Fflood-it-net%2F&amp;title=Flood+It+.NET&amp;summary=&amp;source="><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F04%2F18%2Fflood-it-net%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F04%2F18%2Fflood-it-net%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F04%2F18%2Fflood-it-net%2F&amp;title=Flood+It+.NET"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://joezack.com/index.php/2010/04/18/flood-it-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Project Euler : Problem 29 in Ruby</title>
		<link>http://joezack.com/index.php/2010/03/15/project-euler-problem-29-in-ruby/</link>
		<comments>http://joezack.com/index.php/2010/03/15/project-euler-problem-29-in-ruby/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 05:40:54 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[project euler]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1410</guid>
		<description><![CDATA[I spent some time playing around with a way to reduce calculations by constructing something akin to a sieve, (2^16 is the same as 4^8 and 16^4), but it turns out that the brute force solutions runs in under a second on my machine so it seemed silly to spend any more time with it. [...]]]></description>
			<content:encoded><![CDATA[<p>I spent some time playing around with a way to reduce calculations by constructing something akin to a <a href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes">sieve</a>, (2^16 is the same as 4^8 and 16^4), but it turns out that the brute force solutions runs in under a second on my machine so it seemed silly to spend any more time with it.</p>
<p>Ruby even minds the big numbers for me, so the solution is quite trivial:</p>
<p><a href="http://projecteuler.net/index.php?section=problems&id=29">Problem #29</a></p>
<blockquote><p>How many distinct terms are in the sequence generated by a^(b) for 2 ≤ a  ≤ 100 and 2 ≤ b  ≤ 100?</p></blockquote>
<pre name="code" class="ruby">MIN, MAX = 2,100
values = []

(MIN..MAX).each do |base|
  (MIN..MAX).each do |power|
    values << base**power
  end
end

puts values.uniq.length</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F15%2Fproject-euler-problem-29-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+29+in+Ruby"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F15%2Fproject-euler-problem-29-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+29+in+Ruby"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F15%2Fproject-euler-problem-29-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+29+in+Ruby"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F15%2Fproject-euler-problem-29-in-ruby%2F&amp;headline=Project+Euler+%3A+Problem+29+in+Ruby"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Project+Euler+%3A+Problem+29+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F15%2Fproject-euler-problem-29-in-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Project+Euler+%3A+Problem+29+in+Ruby&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F15%2Fproject-euler-problem-29-in-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Project+Euler+%3A+Problem+29+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F15%2Fproject-euler-problem-29-in-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Project+Euler+%3A+Problem+29+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F15%2Fproject-euler-problem-29-in-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Project+Euler+%3A+Problem+29+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F15%2Fproject-euler-problem-29-in-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F15%2Fproject-euler-problem-29-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+29+in+Ruby&amp;summary=&amp;source="><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F15%2Fproject-euler-problem-29-in-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F15%2Fproject-euler-problem-29-in-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F15%2Fproject-euler-problem-29-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+29+in+Ruby"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://joezack.com/index.php/2010/03/15/project-euler-problem-29-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Euler : Problem 27 in Ruby</title>
		<link>http://joezack.com/index.php/2010/03/11/project-euler-problem-27-in-ruby/</link>
		<comments>http://joezack.com/index.php/2010/03/11/project-euler-problem-27-in-ruby/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 21:05:45 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[project euler]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1402</guid>
		<description><![CDATA[I've taken ill for the last two days, so I've been working on a couple Project Euler problems in between trips to the bathroom. Problem #27 Find the product of the coefficients, a and b, for the quadratic expression that produces the maximum number of primes for consecutive values of n, starting with n = [...]]]></description>
			<content:encoded><![CDATA[<p>I've taken ill for the last two days, so I've been working on a couple Project Euler problems in between trips to the bathroom.</p>
<p><a href="http://projecteuler.net/index.php?section=problems&id=27">Problem #27</a></p>
<blockquote><p>Find the product of the coefficients, a and b, for the quadratic expression that produces the maximum number of primes for consecutive values of n, starting with n = 0.</p></blockquote>
<p>Since you start with <strong>n = 0</strong>, you know that <strong>b</strong> always has to be prime in order to satisfy <strong>n = 0</strong>.</p>
<p>Next, if <strong>b</strong> must be prime, and all primes greater than 2 are odd, and we don't care about expressions resulting in less than 3 consecutive primes (example expression has 40), then we know that all values of <strong>a</strong> <i>must</i> be odd in order to satisfy <strong>n = 1</strong>!</p>
<p>I also suspect that for the number of consecutive primes we need to 'win', that we only need to look at negative values of <strong>a</strong>, but I'm having a heck of a time trying to prove it.</p>
<h2>027.rb</h2>
<pre name="code" class="ruby">require 'prime_generator'

# pre-calculate primes
MAX     = 1_000
primer  = Prime_Generator.new MAX
primes  = primer.stack
product = 0
highest = 0

# a must be odd
(0..MAX).each do |i|
  next if i & 1 == 0

  # b must be prime
  primes.each do |b|

    # a can be positive or negative
    [i,-i].each do |a|
      n = 0
      while n += 1 do
        break unless primer.is_prime?(n ** 2 + a * n + b)
      end

      if highest &lt; n
        highest = n
        product = a * b
      end

    end
  end
end

puts product</pre>
<p>And here's the prime generator I'm using:</p>
<h2>prime_generator.rb</h2>
<pre name="code" class="ruby">class Prime_Generator

  attr_reader :stack

  def initialize max = 3
    @stack  = [1,2,3]
    fill_to max
  end

  def fill_to max
    n = 1
    while true do
      n += 4
      return @stack if n &gt; max
      @stack &lt;&lt; n if is_prime? n

      n += 2
      return @stack if n &gt; max
      @stack &lt;&lt; n if is_prime? n
    end
  end

  def is_prime? n
    return false if n &lt;= 0
    max = Math.sqrt(n).floor
    fill_to(max + 1) if max &gt; @stack.last

    @stack.each do |i|
      next if i == 1
      return true if i &gt; max
      return false if n % i == 0
    end

    true
  end

end</pre>
<p>You can find more Project Euler solutions here: <a href="https://svn2.assembla.com/svn/joe-zack-personal/projects/euler/ruby/">https://svn2.assembla.com/svn/joe-zack-personal/projects/euler/ruby/</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F11%2Fproject-euler-problem-27-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+27+in+Ruby"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F11%2Fproject-euler-problem-27-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+27+in+Ruby"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F11%2Fproject-euler-problem-27-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+27+in+Ruby"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F11%2Fproject-euler-problem-27-in-ruby%2F&amp;headline=Project+Euler+%3A+Problem+27+in+Ruby"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Project+Euler+%3A+Problem+27+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F11%2Fproject-euler-problem-27-in-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Project+Euler+%3A+Problem+27+in+Ruby&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F11%2Fproject-euler-problem-27-in-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Project+Euler+%3A+Problem+27+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F11%2Fproject-euler-problem-27-in-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Project+Euler+%3A+Problem+27+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F11%2Fproject-euler-problem-27-in-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Project+Euler+%3A+Problem+27+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F11%2Fproject-euler-problem-27-in-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F11%2Fproject-euler-problem-27-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+27+in+Ruby&amp;summary=&amp;source="><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F11%2Fproject-euler-problem-27-in-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F11%2Fproject-euler-problem-27-in-ruby%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F11%2Fproject-euler-problem-27-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+27+in+Ruby"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://joezack.com/index.php/2010/03/11/project-euler-problem-27-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The War of The Roosevelts – Part Deux</title>
		<link>http://joezack.com/index.php/2010/03/09/the-war-of-the-roosevelts-part-deux/</link>
		<comments>http://joezack.com/index.php/2010/03/09/the-war-of-the-roosevelts-part-deux/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 01:22:10 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[game programming]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1397</guid>
		<description><![CDATA[After spending a few dozen hours playing The War of the Roosevelts, I realized that there was a wee bit of room for improvement. Now, there's like cards and stuff. Enjoy. THE WAR OF THE ROOSEVELTS! Here's the source, but I still won't waste my time looking up the svn link.]]></description>
			<content:encoded><![CDATA[<p>After spending a few dozen hours playing <a href="http://joezack.com/index.php/2010/03/02/the-war-of-the-roosevelts/">The War of the Roosevelts</a>, I realized that there was a wee bit of room for improvement.</p>
<p>Now, there's like cards and stuff.</p>
<p>Enjoy.</p>
<h1>THE WAR OF THE ROOSEVELTS!</h1>
<p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="War" width="500" height="375" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"><param name="movie" value="/downloads/code/flex/War/v2/War.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#869ca7" /><param name="allowScriptAccess" value="sameDomain" /><embed src="/downloads/code/flex/War/v2/War.swf" quality="high" bgcolor="#869ca7" width="500" height="375" name="War of the Roosevelts!" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object></p>
<p><a href="/downloads/code/flex/War/v2/srcview/index.html">Here's the source</a>, but I still won't waste my time looking up the svn link. <img src='http://joezack.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F09%2Fthe-war-of-the-roosevelts-part-deux%2F&amp;title=The+War+of+The+Roosevelts+-+Part+Deux"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F09%2Fthe-war-of-the-roosevelts-part-deux%2F&amp;title=The+War+of+The+Roosevelts+-+Part+Deux"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F09%2Fthe-war-of-the-roosevelts-part-deux%2F&amp;title=The+War+of+The+Roosevelts+-+Part+Deux"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F09%2Fthe-war-of-the-roosevelts-part-deux%2F&amp;headline=The+War+of+The+Roosevelts+-+Part+Deux"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=The+War+of+The+Roosevelts+-+Part+Deux&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F09%2Fthe-war-of-the-roosevelts-part-deux%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=The+War+of+The+Roosevelts+-+Part+Deux&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F09%2Fthe-war-of-the-roosevelts-part-deux%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=The+War+of+The+Roosevelts+-+Part+Deux&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F09%2Fthe-war-of-the-roosevelts-part-deux%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=The+War+of+The+Roosevelts+-+Part+Deux&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F09%2Fthe-war-of-the-roosevelts-part-deux%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=The+War+of+The+Roosevelts+-+Part+Deux&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F09%2Fthe-war-of-the-roosevelts-part-deux%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F09%2Fthe-war-of-the-roosevelts-part-deux%2F&amp;title=The+War+of+The+Roosevelts+-+Part+Deux&amp;summary=&amp;source="><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F09%2Fthe-war-of-the-roosevelts-part-deux%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F09%2Fthe-war-of-the-roosevelts-part-deux%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F09%2Fthe-war-of-the-roosevelts-part-deux%2F&amp;title=The+War+of+The+Roosevelts+-+Part+Deux"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://joezack.com/index.php/2010/03/09/the-war-of-the-roosevelts-part-deux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The War of The Roosevelts</title>
		<link>http://joezack.com/index.php/2010/03/02/the-war-of-the-roosevelts/</link>
		<comments>http://joezack.com/index.php/2010/03/02/the-war-of-the-roosevelts/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 03:23:12 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[game programming]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1384</guid>
		<description><![CDATA[I've been tinkering around with C# and Flex a lot this year, but I haven't been posting much. So in the interest of posting *something* I give you... *drumroll* THE WAR OF THE ROOSEVELTS! You, standing in the (uneven?) shoes of Franklin D. Roosevelt, finally get a posthumous chance to stand up to your bullying [...]]]></description>
			<content:encoded><![CDATA[<p>I've been tinkering around with C# and Flex a lot this year, but I haven't been posting much.</p>
<p>So in the interest of posting *something* I give you...</p>
<p>*drumroll*</p>
<h1>THE WAR OF THE ROOSEVELTS!</h1>
<p>You, standing in the (uneven?) shoes of Franklin D. Roosevelt, finally get a posthumous chance to stand up to your bullying older cousin Teddy in a game of WAR...well, at least the game of war as I knew it growing up. <a href="http://en.wikipedia.org/wiki/War_%28card_game%29">Wikipedia's</a> got it's own ideas.</p>
<p>I lost interest in it by the time I got to the gui, so that aspects (aka as the part people actually see) is a bit...rough. Just a bit.<strong> ENJOY!</strong></p>
<p>  	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="War" width="500" height="375" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"><param name="movie" value="/downloads/code/flex/War/v1/War.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#869ca7" /><param name="allowScriptAccess" value="sameDomain" /><embed src="/downloads/code/flex/War/v1/War.swf" quality="high" bgcolor="#869ca7" width="500" height="375" name="War of the Roosevelts!" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object></p>
<p><a href="/downloads/code/flex/War/v1/srcview/index.html">Here's the source</a>, but I won't waste my time looking up the svn link. <img src='http://joezack.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F02%2Fthe-war-of-the-roosevelts%2F&amp;title=The+War+of+The+Roosevelts"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F02%2Fthe-war-of-the-roosevelts%2F&amp;title=The+War+of+The+Roosevelts"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F02%2Fthe-war-of-the-roosevelts%2F&amp;title=The+War+of+The+Roosevelts"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F02%2Fthe-war-of-the-roosevelts%2F&amp;headline=The+War+of+The+Roosevelts"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=The+War+of+The+Roosevelts&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F02%2Fthe-war-of-the-roosevelts%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=The+War+of+The+Roosevelts&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F02%2Fthe-war-of-the-roosevelts%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=The+War+of+The+Roosevelts&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F02%2Fthe-war-of-the-roosevelts%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=The+War+of+The+Roosevelts&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F02%2Fthe-war-of-the-roosevelts%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=The+War+of+The+Roosevelts&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F02%2Fthe-war-of-the-roosevelts%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F02%2Fthe-war-of-the-roosevelts%2F&amp;title=The+War+of+The+Roosevelts&amp;summary=&amp;source="><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F02%2Fthe-war-of-the-roosevelts%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F02%2Fthe-war-of-the-roosevelts%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F03%2F02%2Fthe-war-of-the-roosevelts%2F&amp;title=The+War+of+The+Roosevelts"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://joezack.com/index.php/2010/03/02/the-war-of-the-roosevelts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ColdFusion CacheLocker</title>
		<link>http://joezack.com/index.php/2010/02/07/coldfusion-cachelocker/</link>
		<comments>http://joezack.com/index.php/2010/02/07/coldfusion-cachelocker/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 23:18:44 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[coldfusion]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1276</guid>
		<description><![CDATA[I ran into a problem the other day where I needed a way to temporarily store data between page requests. Typically I'm able to stash this sort of thing in the session scope, but these requests originated from different sources and I prefer to avoid (de)serializing when I can. Instead I set up something akin [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1280" class="wp-caption alignleft" style="width: 310px"><a href="http://images.google.com/images?gbv=2&#038;hl=en&#038;safe=off&#038;ei=8Nk8S9TaJIO0tgfKoumPCg&#038;sa=X&#038;oi=spell&#038;resnum=0&#038;ct=result&#038;cd=1&#038;q=pay+per+use+locker&#038;spell=1&#038;start=0"><img src="http://joezack.com/wp-content/uploads/2009/01/Locker-300x224.jpg" alt="Pay Per Use Locker" title="Locker" width="300" height="224" class="size-medium wp-image-1280" /></a><p class="wp-caption-text">Pay Per Use Locker</p></div>
<p>I ran into a problem the other day where I needed a way to temporarily store data between page requests. Typically I'm able to stash this sort of thing in the session scope, but these requests originated from different sources and I prefer to avoid (de)serializing when I can.</p>
<p>Instead I set up something akin to one of those pay-per-use lockers. You stick your items in the bin, drop in a few quarters, and take the newly unlocked key. Later you come back and use that key to retrieve your items. Your key is now 'locked' back into the starting position and the cycle begins anew.</p>
<p>Like one of those pay-per-use lockers you just stash your data, save they key, use the key, trash the data.</p>
<p><strong>Simple as pie.</strong></p>
<p>This isn't the sort of thing that comes up often, but should it arise I've got just the tool for the job!</p>
<p>Example Usage:</p>
<pre class="javascript" name="code">// initialize the locker
application.cacheLocker = CreateObject("component","cacheLocker").init();

// store some arbitrary data
key = application.cacheLocker.store([1,2,3,4]);

// then retrieve the data using the saved key
// throws a CacheException if the key doesn't 'fit'
arbitraryNumbers = application.cacheLocker.retrieve(key);</pre>
<p>The data is destroyed after being retrieved; it's a one time only locker.</p>
<p>There are two important things to keep in mind when using this utility:</p>
<ol>
<li>There's currently no mechanism for cleaning out lockers, so if you're not regularly retrieving your data then this thing is just going to grow, and grow, and grow.</li>
<li>The locker is not stored in any sort of persistent memory. If ColdFusion goes down, then the lockers are destroyed.</li>
</ol>
<p><a href="joezack.com/downloads/code/coldfusion/cacheLocker.zip">Enjoy!</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F07%2Fcoldfusion-cachelocker%2F&amp;title=ColdFusion+CacheLocker"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F07%2Fcoldfusion-cachelocker%2F&amp;title=ColdFusion+CacheLocker"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F07%2Fcoldfusion-cachelocker%2F&amp;title=ColdFusion+CacheLocker"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F07%2Fcoldfusion-cachelocker%2F&amp;headline=ColdFusion+CacheLocker"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=ColdFusion+CacheLocker&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F07%2Fcoldfusion-cachelocker%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=ColdFusion+CacheLocker&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F07%2Fcoldfusion-cachelocker%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=ColdFusion+CacheLocker&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F07%2Fcoldfusion-cachelocker%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=ColdFusion+CacheLocker&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F07%2Fcoldfusion-cachelocker%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=ColdFusion+CacheLocker&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F07%2Fcoldfusion-cachelocker%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F07%2Fcoldfusion-cachelocker%2F&amp;title=ColdFusion+CacheLocker&amp;summary=&amp;source="><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F07%2Fcoldfusion-cachelocker%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F07%2Fcoldfusion-cachelocker%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F07%2Fcoldfusion-cachelocker%2F&amp;title=ColdFusion+CacheLocker"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://joezack.com/index.php/2010/02/07/coldfusion-cachelocker/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Generating Mock Images in ColdFusion</title>
		<link>http://joezack.com/index.php/2010/02/05/generating-mock-images-in-coldfusion/</link>
		<comments>http://joezack.com/index.php/2010/02/05/generating-mock-images-in-coldfusion/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 05:01:24 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[coldfusion]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1363</guid>
		<description><![CDATA[My co-worker Brian passed an interesting lifehacker post along about dummyimage.com. It's a cool site that lets you pass in a width and a height to generate an image which could come in really handy for quickly mocking up web pages. I can't believe I never thought of doing something like this! ColdFusion is a [...]]]></description>
			<content:encoded><![CDATA[<p><div class="wp-caption alignleft" style="width: 110px"><img alt="Dummy Image!" src="http://dummyimage.com/100x100" title="Dummy Image!" width="100" height="100" /><p class="wp-caption-text">Dummy Image!</p></div>My co-worker Brian passed an <a href="http://lifehacker.com/5463500/dummy-image-generator-is-the-lorem-ipsum-of-images"> interesting lifehacker post</a> along about <a href="http://dummyimage.com">dummyimage.com</a>.</p>
<p>It's a cool site that lets you pass in a width and a height to generate an image which could come in really handy for quickly mocking up web pages.</p>
<p>I can't believe I never thought of doing something like this!</p>
<p>ColdFusion is a great language for doing this sort of thing, so it was trivial to whip something up quickly.</p>
<p>I was originally writing a file to disk because I didn't realize you could <a href="http://www.coldfusionjedi.com/index.cfm/2007/9/14/Serving-up-CFIMages-via-Image-Tags-and-a-NonCF-Friday-contest">stream an image variable to the browser</a>, but my other co-worker Jim came to the rescue with the cfimage "writeToBrowser" action!</p>
<pre class="html" name="code">&lt;cfset params = listToArray(cgi.query_string,"x") /&gt;

&lt;cfif arrayLen(params) lt 2&gt;
	&lt;cfthrow message="Input should be like ?[w]x[h]"/&gt;
&lt;/cfif&gt;

&lt;cfset width  = params[1] /&gt;
&lt;cfset height = params[2] /&gt;
&lt;cfset color  = "gray" /&gt;

&lt;cfif not (isNumeric(width) and isNumeric(height))/&gt;
	&lt;cfthrow message="Width/Height should be numeric ?100x100"&gt;
&lt;/cfif&gt;

&lt;cfset image = ImageNew("", width, height,"rgb", color) /&gt;
&lt;cfset ImageDrawText(image, "#width# x #height#", 0, 10)&gt;
&lt;cfimage source="#image#" action="writeToBrowser"/&gt;</pre>
<p>I'd love to link an example to you, but <a href="http://joezack.com/image.cfm?100x100">my hosting plan doesn't support _cf_image_</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F05%2Fgenerating-mock-images-in-coldfusion%2F&amp;title=Generating+Mock+Images+in+ColdFusion"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F05%2Fgenerating-mock-images-in-coldfusion%2F&amp;title=Generating+Mock+Images+in+ColdFusion"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F05%2Fgenerating-mock-images-in-coldfusion%2F&amp;title=Generating+Mock+Images+in+ColdFusion"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F05%2Fgenerating-mock-images-in-coldfusion%2F&amp;headline=Generating+Mock+Images+in+ColdFusion"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Generating+Mock+Images+in+ColdFusion&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F05%2Fgenerating-mock-images-in-coldfusion%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Generating+Mock+Images+in+ColdFusion&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F05%2Fgenerating-mock-images-in-coldfusion%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Generating+Mock+Images+in+ColdFusion&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F05%2Fgenerating-mock-images-in-coldfusion%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Generating+Mock+Images+in+ColdFusion&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F05%2Fgenerating-mock-images-in-coldfusion%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Generating+Mock+Images+in+ColdFusion&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F05%2Fgenerating-mock-images-in-coldfusion%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F05%2Fgenerating-mock-images-in-coldfusion%2F&amp;title=Generating+Mock+Images+in+ColdFusion&amp;summary=&amp;source="><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F05%2Fgenerating-mock-images-in-coldfusion%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F05%2Fgenerating-mock-images-in-coldfusion%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F02%2F05%2Fgenerating-mock-images-in-coldfusion%2F&amp;title=Generating+Mock+Images+in+ColdFusion"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://joezack.com/index.php/2010/02/05/generating-mock-images-in-coldfusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Engagement Photos</title>
		<link>http://joezack.com/index.php/2010/01/10/engagement-photos/</link>
		<comments>http://joezack.com/index.php/2010/01/10/engagement-photos/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 18:57:12 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[photography]]></category>
		<category><![CDATA[wedding]]></category>
		<category><![CDATA[engagement photos]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1349</guid>
		<description><![CDATA[Our friend Jesse Allen took some stunning engagement photos for us to use on our wedding site and our save-the-dates. The pictures came out wonderful, thanks again Jesse!]]></description>
			<content:encoded><![CDATA[<div id="attachment_1351" class="wp-caption aligncenter" style="width: 610px"><a href="http://www.flickr.com/photos/thejoezack/sets/72157623181932184/"><img src="http://joezack.com/wp-content/uploads/2010/01/engage-photo1.jpg" alt="Engagement Photos" title="Joe Zack - Engagement Photos" width="600" height="400" class="size-full wp-image-1351" /></a><p class="wp-caption-text">Engagement Photos</p></div>
<p>Our friend <a href="http://www.flickr.com/people/savage_land_pictures/">Jesse Allen</a> took some <a href="http://www.flickr.com/photos/thejoezack/sets/72157623181932184/">stunning engagement photos</a> for us to use on <a href="http://www.mywedding.com/ashtonzack/">our wedding site</a> and our save-the-dates. The pictures came out wonderful, thanks again Jesse!</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F10%2Fengagement-photos%2F&amp;title=Engagement+Photos"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F10%2Fengagement-photos%2F&amp;title=Engagement+Photos"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F10%2Fengagement-photos%2F&amp;title=Engagement+Photos"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F10%2Fengagement-photos%2F&amp;headline=Engagement+Photos"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Engagement+Photos&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F10%2Fengagement-photos%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Engagement+Photos&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F10%2Fengagement-photos%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Engagement+Photos&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F10%2Fengagement-photos%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Engagement+Photos&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F10%2Fengagement-photos%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Engagement+Photos&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F10%2Fengagement-photos%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F10%2Fengagement-photos%2F&amp;title=Engagement+Photos&amp;summary=&amp;source="><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F10%2Fengagement-photos%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F10%2Fengagement-photos%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F10%2Fengagement-photos%2F&amp;title=Engagement+Photos"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://joezack.com/index.php/2010/01/10/engagement-photos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Delving into C#</title>
		<link>http://joezack.com/index.php/2010/01/07/delving-into-c-sharp/</link>
		<comments>http://joezack.com/index.php/2010/01/07/delving-into-c-sharp/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 11:02:31 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[meta-programming]]></category>
		<category><![CDATA[project euler]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1316</guid>
		<description><![CDATA[This year I've decided to really get into C#. My .NET experience is shall at best so aiming to rectify, I picked up C# in Depth and commenced skimming! Now, I've made my fair share of M$ snide asides, but I'm having a hard time coming to gripes with C#. Everything I run into either [...]]]></description>
			<content:encoded><![CDATA[<p>This year I've decided to really get into C#. My .NET experience is shall at best so aiming to rectify, I picked up <a href="http://www.amazon.com/C-Depth-Jon-Skeet/dp/1933988363">C# in Depth</a> and commenced skimming!</p>
<p>Now, I've made my fair share of M$ snide asides, but I'm having a hard time coming to gripes with C#. Everything I run into either "just works" or exceeds my expectations. And the cool features are in fact, quite cool! Color me impressed!</p>
<p><div id="attachment_1326" class="wp-caption alignleft" style="width: 310px"><img src="http://joezack.com/wp-content/uploads/2010/01/noob1-300x282.jpg" alt="Noob!" title="Noob!" width="300" height="282" class="size-medium wp-image-1326" /><p class="wp-caption-text">Noob!</p></div><br />
For fun I rewrote a few of my <a href="http://joezack.com/index.php/tag/project-euler/">Project Euler Solutions</a> to buff up on the syntax. After I got the semi-colons and brackets all figured out, I moved on to something a little bigger.</p>
<p>I wanted a simple program to run and benchmark my solutions, so I wouldn't have to do as much leg work every time I converted a problem. I figured this would be a simple enough thing to do, and it would provide a good foundation for a future gui application and beginning unit testing.</p>
<p>I wanted to share some particulars that I thought were pretty cool, you can <a href="<a href="http://my-project-euler-solutions.googlecode.com/svn/tags/c-sharp-initial-release/">grab the code I'm talking about from the google code repository</a>, and follow along...or something.<br />
<br/><br />
<strong>Generics, Delegates and Lambdas</strong><br />
Generic Collections provide a data structure that I can access and use just like an array, but also provides methods for dealing with delegates.</p>
<p>Delegates are very similar to closures, blocks, procs, and lambdas like I've worked with in other languages, so the transition was smooth. The lambda syntax was particularly reminiscent of <a href="http://www.secnetix.de/olli/Python/list_comprehensions.hawk">pythonic list comprehensions</a>. </p>
<p>Thanks to delegates, I can turn this:
<pre name="code" class="c#">
var matchingTypes = new List&lt;Type&gt;();
foreach(t in CurrentTypes) {
	if(t.IsSubclassOf(parentType) {
		matchingTypes.Add(t);
	}
}
return matchingTypes;</pre>
<p>Into this:</p>
<pre name="code" class="c#">return CurrentTypes.FindAll(
	delegate(Type t)
	{
		return t.IsSubclassOf(parentType);
	}
);</pre>
<p>And finally, via lambda, to this!</p>
<pre name="code" class="c#">return CurrentTypes.FindAll(
	t =&gt; t.IsSubclassOf(parentType)
);</pre>
<p>Not too shabby, eh?</p>
<p><strong>Reflection</strong><br />
Most of my programming has been in ColdFusion, JavaScript and Ruby. There's been a little bit of this and a little bit of that peppered in there, particually C and Java while I was at <a href="http://www.ucf.edu/">UCF</a>, but for the most part I've enjoyed working with dynamic and/or interpreted languages. Meta-programming is common in these types of languages, but I was surprised and impressed to read up on reflection. In this case, reflection allows me to dynamically detect and run my problems, which makes it easier (and cleaner) for me to add new solutions.</p>
<p>Here's a simplified "ClassMaster" class I use to wrap my reflection calls for listing and creating classes, so you can see what I'm on about:</p>
<pre name="code" class="c#">class ClassMaster
{
	private Assembly CurrentAssembly { get; set; }
	private List&lt;Type&gt; CurrentTypes { get; set; }

	public ClassMaster()
	{
		CurrentAssembly = Assembly.GetExecutingAssembly();
		CurrentTypes = new List&lt;Type&gt;(CurrentAssembly.GetTypes());
	}

	// should probably take arguments to pass thru...somehow
	public Object CreateClass(Type classType)
	{
		return CurrentAssembly.CreateInstance(classType.FullName);
	}

	public List&lt;Type&gt; getTypesByParentClass(Type parentType)
	{
		return CurrentTypes.FindAll(
			t =&gt; t.IsSubclassOf(parentType)
		);
	}
}</pre>
<p>That's it for now. I'll be looking into LINQ and unit testing in the next couple weeks, and then I'm on to the gui. ASP, SilverLight, and WPF here I come!</p>
<p>Here are those links again:<br />
<a href="http://my-project-euler-solutions.googlecode.com/svn/tags/c-sharp-initial-release/">Release</a><br />
<a href="http://my-project-euler-solutions.googlecode.com/svn/trunk/c%23/">Latest Version</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F07%2Fdelving-into-c-sharp%2F&amp;title=Delving+into+C%23"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F07%2Fdelving-into-c-sharp%2F&amp;title=Delving+into+C%23"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F07%2Fdelving-into-c-sharp%2F&amp;title=Delving+into+C%23"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F07%2Fdelving-into-c-sharp%2F&amp;headline=Delving+into+C%23"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Delving+into+C%23&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F07%2Fdelving-into-c-sharp%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Delving+into+C%23&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F07%2Fdelving-into-c-sharp%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Delving+into+C%23&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F07%2Fdelving-into-c-sharp%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Delving+into+C%23&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F07%2Fdelving-into-c-sharp%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Delving+into+C%23&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F07%2Fdelving-into-c-sharp%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F07%2Fdelving-into-c-sharp%2F&amp;title=Delving+into+C%23&amp;summary=&amp;source="><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F07%2Fdelving-into-c-sharp%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F07%2Fdelving-into-c-sharp%2F"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F01%2F07%2Fdelving-into-c-sharp%2F&amp;title=Delving+into+C%23"><img class="lightsocial_img" src="http://joezack.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://joezack.com/index.php/2010/01/07/delving-into-c-sharp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
