<?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>JOEZACK.COM &#187; programming</title>
	<atom:link href="http://joezack.com/index.php" rel="self" type="application/rss+xml" />
	<link>http://joezack.com</link>
	<description>Code Musings and Such</description>
	<lastBuildDate>Sat, 02 Jul 2011 04:43:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Project Euler : Problem 39 in Ruby</title>
		<link>http://joezack.com/index.php/2011/07/02/project-euler-problem-39-in-ruby/</link>
		<comments>http://joezack.com/index.php/2011/07/02/project-euler-problem-39-in-ruby/#comments</comments>
		<pubDate>Sat, 02 Jul 2011 04:43:42 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[project euler]]></category>
		<category><![CDATA[puzzles]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1638</guid>
		<description><![CDATA[I had an easy time with this one, which makes me feel a lot better about all the ones I had problems with! No fancy-pants recursion or math short-cuts here, just a straight forward logic problem. The only "trick" here is to realize that since a &lte; b &#60; c, we only need to check [...]]]></description>
			<content:encoded><![CDATA[<p>I had an easy time with this one, which makes me feel a lot better about all the ones I had problems with!</p>
<p>No fancy-pants recursion or math short-cuts here, just a straight forward logic problem. The only "trick" here is to realize that since  a &lte; b &lt; c, we only need to check values of a and b up to 499.</p>
<p>I'm sure you could whittle that number down by crunching the numbers, but it's good enough for me!</p>
<p><a href="http://projecteuler.net/index.php?section=problems&id=39" target="_blank" title="Project Euler : Problem 39">Problem 39</a></p>
<blockquote><p>For which value of p  1000, is the number of solutions maximised?</p></blockquote>
<pre name="code" class="ruby">counts = {}
counts.default = 0

(1..499).each do |a|
  (a..499).each do |b|
    break if a + b > 500
    c = Math.sqrt(a**2 + b**2)
    next unless c.denominator == 1
    counts[a + b + c] += 1
  end
end

sorted = counts.sort { |a, b| a[1] <=> b[1] }

puts sorted.last[0]</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F07%2F02%2Fproject-euler-problem-39-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+39+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%2F2011%2F07%2F02%2Fproject-euler-problem-39-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+39+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%2F2011%2F07%2F02%2Fproject-euler-problem-39-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+39+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%2F2011%2F07%2F02%2Fproject-euler-problem-39-in-ruby%2F&amp;headline=Project+Euler+%3A+Problem+39+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+39+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F07%2F02%2Fproject-euler-problem-39-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+39+in+Ruby&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F07%2F02%2Fproject-euler-problem-39-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+39+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F07%2F02%2Fproject-euler-problem-39-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+39+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F07%2F02%2Fproject-euler-problem-39-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+39+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F07%2F02%2Fproject-euler-problem-39-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%2F2011%2F07%2F02%2Fproject-euler-problem-39-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+39+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%2F2011%2F07%2F02%2Fproject-euler-problem-39-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%2F2011%2F07%2F02%2Fproject-euler-problem-39-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/buzz/post?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F07%2F02%2Fproject-euler-problem-39-in-ruby%2F" ><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/2011/07/02/project-euler-problem-39-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Best Programming Music</title>
		<link>http://joezack.com/index.php/2011/06/29/the-best-programming-music/</link>
		<comments>http://joezack.com/index.php/2011/06/29/the-best-programming-music/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 00:14:34 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[music]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programming music]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1599</guid>
		<description><![CDATA[I listen to a lot of music at work. All day, every day. It helps smooth frustrations, keeps me awake, and provides "color" for my day. I want my office to feel like a 1960's Sci-Fi movie! Most importantly, the music helps me "flow" by drowning out the regular office clatter and bang-clangery. Admittedly, I [...]]]></description>
			<content:encoded><![CDATA[<p>I listen to a lot of music at work. All day, every day.</p>
<p>It helps smooth frustrations, keeps me awake, and provides "color" for my day. I want my office to feel like a 1960's Sci-Fi movie!</p>
<p>Most importantly, the music helps me "flow" by drowning out the regular office clatter and bang-clangery.</p>
<div id="attachment_1627" class="wp-caption aligncenter" style="width: 310px"><a href="http://joezack.com/wp-content/uploads/2011/06/stapler.jpg"><img class="size-medium wp-image-1627" title="and I used to be over by the window, and I could see the squirrels" src="http://joezack.com/wp-content/uploads/2011/06/stapler-300x143.jpg" alt="and I used to be over by the window, and I could see the squirrels" width="300" height="143" /></a><p class="wp-caption-text">I used to be over by the window, and I could see the squirrels...</p></div>
<p>Admittedly, I tend to "burn out" early on music, but 2,000+ hours of work/year will eventually tire even the most stalwart listener and extensive collection. Especially since a lot of the music I like "in real life" doesn't mesh well with concentrating. I usually find lyrics to be too distracting.</p>
<p>Since audiobooks and podcasts have taken over my ipod, I do almost all of my music listening at work. This has introduced a strange and large gap between the music that I used to like and the music I <em>actually</em> listen to.</p>
<p>Although I love it, my office is a no Kanye zone!</p>
<div id="attachment_1625" class="wp-caption aligncenter" style="width: 310px"><a href="http://joezack.com/wp-content/uploads/2011/06/no-kanye.png"><img class="size-medium wp-image-1625" title="My office is a No Kanye Zone" src="http://joezack.com/wp-content/uploads/2011/06/no-kanye-300x300.png" alt="My office is a No Kanye Zone" width="300" height="300" /></a><p class="wp-caption-text">My office is a No Kanye Zone</p></div>
<p>Since I require so much "background" music, services like and <a title="Pandora" href="http://pandora.com" target="_blank">Pandora</a> are perfect fit for me. I'm constantly tweaking my stations, but here's my current fave for work:</p>
<p><strong>My favorite Pandora Station:</strong><br />
<a href="http://www.pandora.com/?sc=sh206151893268671417#/" title="Programming Music: Boards of Mercury Circles" target="_blank">Programming Music: Boards of Mercury Circles</a></p>
<p>And here's a few youtubes of songs you might hear on that station:</p>
<p><object width="550" height="438"><param name="movie" value="http://www.youtube.com/v/M2dPYRhSb4c?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/M2dPYRhSb4c?version=3" type="application/x-shockwave-flash" width="550" height="438" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><br/><br />
<br/></p>
<p><object width="550" height="438"><param name="movie" value="http://www.youtube.com/v/mul4L61aZvA?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/mul4L61aZvA?version=3" type="application/x-shockwave-flash" width="550" height="438" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><br/><br />
<br/></p>
<p><object width="550" height="438"><param name="movie" value="http://www.youtube.com/v/Ps32wFxDY94?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Ps32wFxDY94?version=3" type="application/x-shockwave-flash" width="550" height="438" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F06%2F29%2Fthe-best-programming-music%2F&amp;title=The+Best+Programming+Music" ><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%2F2011%2F06%2F29%2Fthe-best-programming-music%2F&amp;title=The+Best+Programming+Music" ><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%2F2011%2F06%2F29%2Fthe-best-programming-music%2F&amp;title=The+Best+Programming+Music" ><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%2F2011%2F06%2F29%2Fthe-best-programming-music%2F&amp;headline=The+Best+Programming+Music" ><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+Best+Programming+Music&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F06%2F29%2Fthe-best-programming-music%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+Best+Programming+Music&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F06%2F29%2Fthe-best-programming-music%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+Best+Programming+Music&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F06%2F29%2Fthe-best-programming-music%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+Best+Programming+Music&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F06%2F29%2Fthe-best-programming-music%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+Best+Programming+Music&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F06%2F29%2Fthe-best-programming-music%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%2F2011%2F06%2F29%2Fthe-best-programming-music%2F&amp;title=The+Best+Programming+Music&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%2F2011%2F06%2F29%2Fthe-best-programming-music%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%2F2011%2F06%2F29%2Fthe-best-programming-music%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/buzz/post?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F06%2F29%2Fthe-best-programming-music%2F" ><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/2011/06/29/the-best-programming-music/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Euler : Problem 38 in Ruby</title>
		<link>http://joezack.com/index.php/2011/06/27/project-euler-problem-38-in-rub/</link>
		<comments>http://joezack.com/index.php/2011/06/27/project-euler-problem-38-in-rub/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 01:19:33 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[project euler]]></category>
		<category><![CDATA[puzzles]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1614</guid>
		<description><![CDATA[40 problems down, 10 more till level 2! The real trick here is to cut down on the numbers you check. Since the problem gives you 918273645 as an example we know the answer must be greater than or equal to it...meaning we only need to check digits that start with 9! I don't actually [...]]]></description>
			<content:encoded><![CDATA[<p>40 problems down, 10 more till <a href="http://projecteuler.net/index.php?section=scores&level=2" title="Project Euler : Level 2" target="_blank">level 2</a>!</p>
<p>The real trick here is to cut down on the numbers you check. Since the problem gives you 918273645 as an example we know the answer must be greater than or equal to it...meaning we only need to check digits that start with 9!</p>
<p>I don't actually do it because I couldn't figure out an elegant way to do, but it runs in just a few milliseconds so it's fast enough in my book.</p>
<p>Another important factor to note is that you only need to check numbers up to 9_876 since this is the first 'half' of the largest pandigital possible.</p>
<p>Those two tricks will cut down the calculations you need to run to just a few thousand.</p>
<p><a href="http://projecteuler.net/index.php?section=problems&id=38" title="Problem 38" title="_blank">Problem 38</a></p>
<blockquote><p>What is the largest 1 to 9 pandigital 9-digit number that can be formed as the concatenated product of an integer with (1,2, ... , n) where n  1?</p></blockquote>
<pre name="code" class="ruby">def get_pandigital? n
  nums = []
  (1..9).each do |digit|
    nums += (n * digit).to_s.split ''
    return 0 if nums.size != nums.uniq.size || nums.include?('0')
    return nums.join('').to_i if nums.size == 9
  end
end

solution = 0

(9..9_876).each do |n|
  # could do better by only looking at 9's!
  result = get_pandigital? n
  if result > solution
    solution = result
  end
end

puts solution</pre>
<p>Check out <a href="https://bitbucket.org/thejoezack/project-euler/src" target="_blank" title="Project Euler Solutions">all of my solutions</a> on bitbucket!</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F06%2F27%2Fproject-euler-problem-38-in-rub%2F&amp;title=Project+Euler+%3A+Problem+38+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%2F2011%2F06%2F27%2Fproject-euler-problem-38-in-rub%2F&amp;title=Project+Euler+%3A+Problem+38+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%2F2011%2F06%2F27%2Fproject-euler-problem-38-in-rub%2F&amp;title=Project+Euler+%3A+Problem+38+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%2F2011%2F06%2F27%2Fproject-euler-problem-38-in-rub%2F&amp;headline=Project+Euler+%3A+Problem+38+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+38+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F06%2F27%2Fproject-euler-problem-38-in-rub%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+38+in+Ruby&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F06%2F27%2Fproject-euler-problem-38-in-rub%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+38+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F06%2F27%2Fproject-euler-problem-38-in-rub%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+38+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F06%2F27%2Fproject-euler-problem-38-in-rub%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+38+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F06%2F27%2Fproject-euler-problem-38-in-rub%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%2F2011%2F06%2F27%2Fproject-euler-problem-38-in-rub%2F&amp;title=Project+Euler+%3A+Problem+38+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%2F2011%2F06%2F27%2Fproject-euler-problem-38-in-rub%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%2F2011%2F06%2F27%2Fproject-euler-problem-38-in-rub%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/buzz/post?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F06%2F27%2Fproject-euler-problem-38-in-rub%2F" ><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/2011/06/27/project-euler-problem-38-in-rub/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Euler: Problem 37 in Ruby</title>
		<link>http://joezack.com/index.php/2011/05/17/project-euler-problem-37-in-ruby/</link>
		<comments>http://joezack.com/index.php/2011/05/17/project-euler-problem-37-in-ruby/#comments</comments>
		<pubDate>Wed, 18 May 2011 03:37:54 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[project euler]]></category>
		<category><![CDATA[puzzles]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1602</guid>
		<description><![CDATA[It's been a while since I've done one of these, so I was afraid of being rusty but it worked out alright. I used the generator I made a while back to create the primes (pre-filled to the example given in the project) and used procs to take care of the truncation. BAM! Problem 37 [...]]]></description>
			<content:encoded><![CDATA[<p>It's been a while since I've done one of these, so I was afraid of being rusty but it worked out alright. I used <a href="https://bitbucket.org/thejoezack/project-euler/src/bd1f266e8cc0/prime_generator.rb" target="_blank" title="Prime Number Generator">the generator</a> I made a while back to create the primes (pre-filled to the example given in the project) and used procs to take care of the truncation.</p>
<p><strong>BAM!</strong></p>
<p><a href="http://projecteuler.net/index.php?section=problems&id=37" title="Problem 37" target="_blank">Problem 37</a></p>
<blockquote><p>The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3.</p>
<p>Find the sum of the only eleven primes that are both truncatable from left to right and right to left.
</p></blockquote>
<pre name="code" class="ruby">load 'prime_generator.rb'

def prime? n, truncate
  return false if !$primer.is_prime?(n)
  return true if n < 10
  prime? truncate.call(n), truncate
end

left = Proc.new { |n| n / 10 }
right = Proc.new { |n| n % 10**Math.log10(n).to_i }

$primer = Prime_Generator.new 3_797
n, sum, found = 0, 0, 0

while found < 11 do
  if (n += 1) > 10 && prime?(n, left) && prime?(n, right)
    found += 1
    sum += n
  end
end

puts sum</pre>
<p>Also, I've finally moved my project euler solutions over to <a href="https://bitbucket.org/thejoezack/project-euler/src" title="Project Euler Solutions on Bitbucket" target="_blank">bitbucket</a>. Long live Mercurial!</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F05%2F17%2Fproject-euler-problem-37-in-ruby%2F&amp;title=Project+Euler%3A+Problem+37+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%2F2011%2F05%2F17%2Fproject-euler-problem-37-in-ruby%2F&amp;title=Project+Euler%3A+Problem+37+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%2F2011%2F05%2F17%2Fproject-euler-problem-37-in-ruby%2F&amp;title=Project+Euler%3A+Problem+37+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%2F2011%2F05%2F17%2Fproject-euler-problem-37-in-ruby%2F&amp;headline=Project+Euler%3A+Problem+37+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+37+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F05%2F17%2Fproject-euler-problem-37-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+37+in+Ruby&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F05%2F17%2Fproject-euler-problem-37-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+37+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F05%2F17%2Fproject-euler-problem-37-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+37+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F05%2F17%2Fproject-euler-problem-37-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+37+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F05%2F17%2Fproject-euler-problem-37-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%2F2011%2F05%2F17%2Fproject-euler-problem-37-in-ruby%2F&amp;title=Project+Euler%3A+Problem+37+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%2F2011%2F05%2F17%2Fproject-euler-problem-37-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%2F2011%2F05%2F17%2Fproject-euler-problem-37-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/buzz/post?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F05%2F17%2Fproject-euler-problem-37-in-ruby%2F" ><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/2011/05/17/project-euler-problem-37-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Audio Automata with Otomata</title>
		<link>http://joezack.com/index.php/2011/04/16/audio-automata-with-otomata/</link>
		<comments>http://joezack.com/index.php/2011/04/16/audio-automata-with-otomata/#comments</comments>
		<pubDate>Sun, 17 Apr 2011 03:02:01 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[music]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[amazing]]></category>
		<category><![CDATA[cellular automata]]></category>
		<category><![CDATA[programming music]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1594</guid>
		<description><![CDATA[I don't normally like to blog links, Twitter and Google Reader are much better platforms for that, however this was so cool I just had to shout it out. Read more about it, and check it out yourself: Otomato The rules for the automation are simple, but the hypnotic patterns that emerge are truly beautiful [...]]]></description>
			<content:encoded><![CDATA[<p>I don't normally like to blog links, <a href="http://twitter.com/#!/thejoezack">Twitter</a> and <a href="http://www.google.com/reader/atom/user%2F14118470443293546192%2Fstate%2Fcom.google%2Freading-list" target="_blank">Google Reader</a> are much better platforms for that, however this was so cool I just had to shout it out.</p>
<div align="center">
<iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/lHCdHh1eSi0" frameborder="0" allowfullscreen></iframe>
</div>
<p>Read more about it, and check  it out yourself: <a href="http://www.earslap.com/projectslab/otomata?q=0d6p224s4v508n7n6012" target="_blank">Otomato</a></p>
<p>The rules for the automation are simple, but the hypnotic patterns that emerge are truly beautiful and <em>interesting</em>. The user interface is both easy and fun to use, and it does a great job of showing the simple beauty of what you're listening to.</p>
<p>The music reminds me a lot of one of my favorite bands <a href="http://www.boardsofcanada.com/" target="_blank">Boards of Canada</a>, so if like the sound of this then check them out, it makes for great programming music.</p>
<div align="center">
<iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/_lEsLcGB7Vo" frameborder="0" allowfullscreen></iframe>
</div>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F04%2F16%2Faudio-automata-with-otomata%2F&amp;title=Audio+Automata+with+Otomata" ><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%2F2011%2F04%2F16%2Faudio-automata-with-otomata%2F&amp;title=Audio+Automata+with+Otomata" ><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%2F2011%2F04%2F16%2Faudio-automata-with-otomata%2F&amp;title=Audio+Automata+with+Otomata" ><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%2F2011%2F04%2F16%2Faudio-automata-with-otomata%2F&amp;headline=Audio+Automata+with+Otomata" ><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=Audio+Automata+with+Otomata&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F04%2F16%2Faudio-automata-with-otomata%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=Audio+Automata+with+Otomata&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F04%2F16%2Faudio-automata-with-otomata%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=Audio+Automata+with+Otomata&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F04%2F16%2Faudio-automata-with-otomata%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=Audio+Automata+with+Otomata&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F04%2F16%2Faudio-automata-with-otomata%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=Audio+Automata+with+Otomata&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F04%2F16%2Faudio-automata-with-otomata%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%2F2011%2F04%2F16%2Faudio-automata-with-otomata%2F&amp;title=Audio+Automata+with+Otomata&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%2F2011%2F04%2F16%2Faudio-automata-with-otomata%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%2F2011%2F04%2F16%2Faudio-automata-with-otomata%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/buzz/post?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F04%2F16%2Faudio-automata-with-otomata%2F" ><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/2011/04/16/audio-automata-with-otomata/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reflections on Orlando Code Camp and BarCamp Orlando</title>
		<link>http://joezack.com/index.php/2011/04/04/reflections-on-orlando-code-camp-and-barcamporlando/</link>
		<comments>http://joezack.com/index.php/2011/04/04/reflections-on-orlando-code-camp-and-barcamporlando/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 04:46:14 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[barcamp]]></category>
		<category><![CDATA[code camp]]></category>
		<category><![CDATA[orlando]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1552</guid>
		<description><![CDATA[In the last two weeks I've had the great fortune to attend two fantastic conferences here in Orlando. Both completely free events, and both were fun, inspiring, and eye-opening in their own ways. I came away feeling inspired, invigorated, and with a couple of new nerdy (read: cool) t-shirts! Orlando CodeCamp was incredibly educational and [...]]]></description>
			<content:encoded><![CDATA[<p>In the last two weeks I've had the great fortune to attend two fantastic conferences here in Orlando.</p>
<p>Both completely free events, and both were fun, inspiring, and eye-opening in their own ways. I came away feeling inspired, invigorated, and with a couple of new nerdy (read:  cool) t-shirts!<br />
<br/><br />
<br/><br />
<a href="http://www.orlandocodecamp.com"><img src="http://joezack.com/wp-content/uploads/2011/04/CodeCamp.gif" alt="Orlando Code Camp" title="Orlando Code Camp" width="470" height="147" class="aligncenter size-full wp-image-1567" /></a><br />
Orlando CodeCamp was incredibly educational and informative with it's tech-heavy, hour-long formal presentations. I can't imagine all the hard work put in by the speakers and volunteers to have such a  large and superior quality event run, and run so smoothly.</p>
<p>There was a definite collegial vibe (taking place at the beautiful Seminole County College campus didn't hurt!) but oh how I wish my university experience was as interesting, efficient, relevant, and productive.</p>
<p><a href="http://joezack.com/wp-content/uploads/2011/04/TFS.gif"><img src="http://joezack.com/wp-content/uploads/2011/04/TFS.gif" alt="Team Foundation Server" title="TFS" width="242" height="197" class="alignright size-full wp-image-1563" /></a><br />
Special thanks to the <a href="http://onetug.org" title="ONETUG Orlando .NET User Group">ONETUG</a> president <a href="http://estebanfg.blogspot.com/">Esteban Garcia</a> for patiently and thoroughly answering all my inane <a href="http://en.wikipedia.org/wiki/Team_Foundation_Server">TFS</a> questions. I've avoided TFS talks in the past because I thought they would be boring, but boy was I wrong! It really cool to see everything up and integrated like that!</p>
<p>Also another special thanks to <a href="http://submain.com/" title="SubMain">SubMain</a> for the <a href="http://submain.com/products/codeit.right.aspx" title="CodeIt.Right">CodeIt.Right</a> licensce I won. I'm already putting it to good use!</p>
<p><br/><br />
<br/><br />
<br/></p>
<p><a href="http://joezack.com/wp-content/uploads/2011/04/barcamp.png"><img src="http://joezack.com/wp-content/uploads/2011/04/barcamp.png" alt="BarCamp Orlando" title="BarCamp Orlando" width="298" height="76" class="aligncenter size-full wp-image-1572" /></a><br />
If CodeCamp felt like school, then BarCamp felt more like...Woodstock. The event took place in the <a href="http://www.wallstplaza.net/" title="Wall Street Plaza">Wall Street Plaza</a>, with talks taking place in local venues like <a href="http://www.oneeyedjacks.net/" title="One-Eyed Jack">One-Eyed Jacks</a>, <a href="http://www.wallstplaza.net/slingapours" title="Slingapours">Slingapours</a>, and <a href="http://findlocal.orlandosentinel.com/listings/gibson-showroom-orlando">The Gibson Showroom</a>. The presentation times and topics were updated throughout the day on a giant white board, and there was a great little mobile site for keeping track of the ever evolving schedule the on your iPhone. (I'm an Android fanboy, but I don't think I've ever seen so many Apple products in one place before!)</p>
<p>The talks ranged from the technical to the artistic to the entrepreneurial, and there were strong revolutionary, community and outside-the-box undercurrents behind most talks.</p>
<p>The session that most picqued my interest was done by <a href="http://twitter.com/#!/stanschultes" title="Stan Schultes on Twitter">Stan Schultes</a>,  Microsoft MVP and organizer of the <a href="http://barcampsarasota.ning.com/">BarCamp Sarasota</a>. He led a 'birds of a feather' style centered around software start-ups, and what cities like San Francisco, Boston and New York have that we in the "Greater Central Florida Region" don't....and how we can organize to fix it!</p>
<p>The biggest take-away for me however is getting to see and meet so many inspired and passionate makers, shakers and enthusiasts out there trying to make a difference.</p>
<div align="center">
<a href="http://www.flickr.com/photos/nickpettit/sets/72157626422817972"><img src="http://joezack.com/wp-content/uploads/2011/04/5586596827_94785643ab.jpg" alt="Topics and Times" title="Topics and Times" width="333" height="500" class="size-full wp-image-1578" /></a></p>
<p>Photo Credit: <a href="http://nickpettit.com/">Nick Pettit</a></p>
</div>
<p><br/><br />
I'm looking forward to checking out recently discovered entities like <a href="http://orlandodojo.org/">Orlando Coding Dojo</a>, <a href="http://urbanrethink.com/">Urban ReThink</a>, and <a href="http://familab.org/blog/">Familab</a> events in the near future.</p>
<p>Big shout out to <a href="http://onetug.org">ONETUG</a>, <a href="http://orug.org/">ORUG</a>, and <a href="http://envylabs.com/">Envy Labs</a> for being such big drivers behind these events and a big thanks to all the organizers, sponsors and community. Fantastic job!</p>
<p>Oh, and I almost forgot to mention the best part about these two events: They're recurring!</p>
<p>I'm looking forward to seeing you all again soon!</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F04%2F04%2Freflections-on-orlando-code-camp-and-barcamporlando%2F&amp;title=Reflections+on+Orlando+Code+Camp+and+BarCamp+Orlando" ><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%2F2011%2F04%2F04%2Freflections-on-orlando-code-camp-and-barcamporlando%2F&amp;title=Reflections+on+Orlando+Code+Camp+and+BarCamp+Orlando" ><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%2F2011%2F04%2F04%2Freflections-on-orlando-code-camp-and-barcamporlando%2F&amp;title=Reflections+on+Orlando+Code+Camp+and+BarCamp+Orlando" ><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%2F2011%2F04%2F04%2Freflections-on-orlando-code-camp-and-barcamporlando%2F&amp;headline=Reflections+on+Orlando+Code+Camp+and+BarCamp+Orlando" ><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=Reflections+on+Orlando+Code+Camp+and+BarCamp+Orlando&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F04%2F04%2Freflections-on-orlando-code-camp-and-barcamporlando%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=Reflections+on+Orlando+Code+Camp+and+BarCamp+Orlando&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F04%2F04%2Freflections-on-orlando-code-camp-and-barcamporlando%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=Reflections+on+Orlando+Code+Camp+and+BarCamp+Orlando&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F04%2F04%2Freflections-on-orlando-code-camp-and-barcamporlando%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=Reflections+on+Orlando+Code+Camp+and+BarCamp+Orlando&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F04%2F04%2Freflections-on-orlando-code-camp-and-barcamporlando%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=Reflections+on+Orlando+Code+Camp+and+BarCamp+Orlando&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F04%2F04%2Freflections-on-orlando-code-camp-and-barcamporlando%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%2F2011%2F04%2F04%2Freflections-on-orlando-code-camp-and-barcamporlando%2F&amp;title=Reflections+on+Orlando+Code+Camp+and+BarCamp+Orlando&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%2F2011%2F04%2F04%2Freflections-on-orlando-code-camp-and-barcamporlando%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%2F2011%2F04%2F04%2Freflections-on-orlando-code-camp-and-barcamporlando%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/buzz/post?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F04%2F04%2Freflections-on-orlando-code-camp-and-barcamporlando%2F" ><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/2011/04/04/reflections-on-orlando-code-camp-and-barcamporlando/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>To uint, or not to uint</title>
		<link>http://joezack.com/index.php/2011/03/07/to-uint-or-not-to-uint/</link>
		<comments>http://joezack.com/index.php/2011/03/07/to-uint-or-not-to-uint/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 03:14:34 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1528</guid>
		<description><![CDATA[I like unsigned integers, always have. It's more correct, concise and expressive, you get more (positive) space out of it and you're preventing bugs by design. What's not to love? Well... I've been nooking CLR via C# and it's a fantastic read for anyone who wants to 'get serious' about .Net. The book's so crammed [...]]]></description>
			<content:encoded><![CDATA[<p>I like unsigned integers, always have. It's more correct, concise and expressive, you get more (positive) space out of it and you're preventing bugs by design. What's not to love?</p>
<p>Well...</p>
<p>I've been <a href="http://www.barnesandnoble.com/nook">nooking</a> <a href="http://oreilly.com/catalog/9780735627048/">CLR via C#</a> and it's a fantastic read for anyone who wants to 'get serious' about .Net. The book's so crammed full of good information it's hard not to gush, but I digress.</p>
<p>I was nooking, you see, and I came across this recommendation:</p>
<blockquote><p>"Use signed data types (such as Int32 and Int64 instead of unsigned numeric types such as UInt32 and UInt64) wherever possible."</p></blockquote>
<div align="center">
<h2>Say it aint so!</h2>
<p><iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/ENXvZ9YRjbo" frameborder="0" allowfullscreen></iframe>
</div>
<p>Jeffrey Richter continues:</p>
<blockquote><p>"This allows the compiler to detect more overflow/underflow errors. In addition, various parts of the class library (such as Array's and String's Length properties) are hard-coded to return signed values, and less casting is required as you move these values around in your code."</p></blockquote>
<p>Casting is ugly, no argument there but I don't care much about the overflow/underflow errors. I generally don't enable overflow checking, there's no political statement here, it's just never come up.</p>
<p>And it still feels wrong for me to declare a value signed when I know that it shouldn't be.</p>
<p>(Richter recommends enabling checking for debug builds, and disabling for release. Sound advice!)</p>
<p>But here's real the kicker for me:</p>
<blockquote><p>In addition, unsigned numeric types are not CLS-compliant.</p></blockquote>
<p>Doh. I did a bit of searching to try and track down why it's not part of the CLS, and I found that <a href="http://blogs.msdn.com/b/brada/archive/2003/09/02/50285.aspx">Brad Abrams expresses it best in this post</a>:</p>
<blockquote><p>"The general feeling among many of us is that the vast majority of programming is done with signed types.  Whenever you switch to unsigned types you force a mental model switch (and an ugly cast).  In the worst cast you build up a whole parallel world of APIs that take unsigned types.  The value of avoiding the '< 0' check is not worth the inclusion of generics in the CLS"</p></blockquote>
<p>Alright, I give in. I'm apparently in the minority, these guys are way smarter than I am, and it is easier, if not more concise. So it goes.</p>
<p>Goodbye for now uint, you'll always hold a positive place in my heart.</p>
<p>Just like <a href="http://www.amazon.com/Pinkerton-Weezer/dp/B000000OVP/ref=sr_1_1?ie=UTF8&qid=1299554017&sr=8-1">Weezer</a>:</p>
<div align="center"><iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/okthJIVbi6g" frameborder="0" allowfullscreen></iframe></div>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F03%2F07%2Fto-uint-or-not-to-uint%2F&amp;title=To+uint%2C+or+not+to+uint" ><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%2F2011%2F03%2F07%2Fto-uint-or-not-to-uint%2F&amp;title=To+uint%2C+or+not+to+uint" ><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%2F2011%2F03%2F07%2Fto-uint-or-not-to-uint%2F&amp;title=To+uint%2C+or+not+to+uint" ><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%2F2011%2F03%2F07%2Fto-uint-or-not-to-uint%2F&amp;headline=To+uint%2C+or+not+to+uint" ><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=To+uint%2C+or+not+to+uint&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F03%2F07%2Fto-uint-or-not-to-uint%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=To+uint%2C+or+not+to+uint&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F03%2F07%2Fto-uint-or-not-to-uint%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=To+uint%2C+or+not+to+uint&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F03%2F07%2Fto-uint-or-not-to-uint%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=To+uint%2C+or+not+to+uint&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F03%2F07%2Fto-uint-or-not-to-uint%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=To+uint%2C+or+not+to+uint&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F03%2F07%2Fto-uint-or-not-to-uint%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%2F2011%2F03%2F07%2Fto-uint-or-not-to-uint%2F&amp;title=To+uint%2C+or+not+to+uint&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%2F2011%2F03%2F07%2Fto-uint-or-not-to-uint%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%2F2011%2F03%2F07%2Fto-uint-or-not-to-uint%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/buzz/post?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2011%2F03%2F07%2Fto-uint-or-not-to-uint%2F" ><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/2011/03/07/to-uint-or-not-to-uint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Euler: Problem 35 in Ruby</title>
		<link>http://joezack.com/index.php/2010/10/23/project-euler-problem-35-in-ruby/</link>
		<comments>http://joezack.com/index.php/2010/10/23/project-euler-problem-35-in-ruby/#comments</comments>
		<pubDate>Sun, 24 Oct 2010 01:51:02 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[project euler]]></category>
		<category><![CDATA[puzzles]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1503</guid>
		<description><![CDATA[I used my prime generator from Problem 27 for this one. It would have been faster to build the rotation into my generator, but it ran fine without it. Problem 35 How many circular primes are there below one million? require 'prime_generator' primer = Prime_Generator.new 1_000_000 def is_rot_prime? primer, chars chars.size.times do &#124;i&#124; chars = [...]]]></description>
			<content:encoded><![CDATA[<p>I used my prime generator from Problem 27 for this one. It would have been faster to build the rotation into my generator, but it ran fine without it.</p>
<p><a href="http://projecteuler.net/index.php?section=problems&id=35">Problem 35</a></p>
<blockquote><p>How many circular primes are there below one million?</p></blockquote>
<pre name="code" class="ruby">require 'prime_generator'

primer = Prime_Generator.new 1_000_000

def is_rot_prime? primer, chars
	chars.size.times do |i|
		chars = Array.new(chars.size) { |i| chars[i - 1] }
		return false if !primer.is_prime?(chars.join("").to_i)
	end
	true
end

count = 0
primer.stack.each do |n|
	count += 1 if is_rot_prime? primer, n.to_s.split("")
end

# subtract 1 because "1" doesn't count
puts count - 1</pre>
<p>Speaking of the rotation, the ruby array initialize methods and negative indexers make it a cinch to rotate. How cool is this?</p>
<pre name="code" class="ruby">chars = Array.new(chars.size) { |i| chars[i - 1] }</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-35-in-ruby%2F&amp;title=Project+Euler%3A+Problem+35+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%2F10%2F23%2Fproject-euler-problem-35-in-ruby%2F&amp;title=Project+Euler%3A+Problem+35+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%2F10%2F23%2Fproject-euler-problem-35-in-ruby%2F&amp;title=Project+Euler%3A+Problem+35+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%2F10%2F23%2Fproject-euler-problem-35-in-ruby%2F&amp;headline=Project+Euler%3A+Problem+35+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+35+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-35-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+35+in+Ruby&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-35-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+35+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-35-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+35+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-35-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+35+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-35-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%2F10%2F23%2Fproject-euler-problem-35-in-ruby%2F&amp;title=Project+Euler%3A+Problem+35+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%2F10%2F23%2Fproject-euler-problem-35-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%2F10%2F23%2Fproject-euler-problem-35-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/buzz/post?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-35-in-ruby%2F" ><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/10/23/project-euler-problem-35-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Euler: Problem 34 in Ruby</title>
		<link>http://joezack.com/index.php/2010/10/23/project-euler-problem-34-in-ruby/</link>
		<comments>http://joezack.com/index.php/2010/10/23/project-euler-problem-34-in-ruby/#comments</comments>
		<pubDate>Sun, 24 Oct 2010 00:10:49 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[project euler]]></category>
		<category><![CDATA[puzzles]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1500</guid>
		<description><![CDATA[Practically every Project Euler problem benefits from memoization, however the issues I ran into with #34 had nothing to do with my algorithm. The first hurdle was figuring out the upper bound. After scratching around in my notebook, I figured any number I would be looking for would have 7 digits or less. That gives [...]]]></description>
			<content:encoded><![CDATA[<p>Practically every Project Euler problem benefits from <a href="http://en.wikipedia.org/wiki/Memoization">memoization</a>, however the issues I ran into with #34 had nothing to do with my algorithm.</p>
<p>The first hurdle was figuring out the upper bound. After scratching around in my notebook, I figured any number I would be looking for would have 7 digits or less. That gives us an upper bound of 9! * 7.  </p>
<p>The second hurde took me much, much longer to figure out.</p>
<p>Here's the secret: <strong>0! = 1</strong></p>
<p>I had taken it for granted that 0! would (of course!) be 0, and I had pre-filled my cache with the number 0. I went round, and round, and round, and round, and round, and round before figuring out (quite accidentally) my error.</p>
<p>It doesn't make any sense to me, but you can't argue with math!</p>
<p><a href="http://projecteuler.net/index.php?section=problems&id=34">Problem 34</a></p>
<blockquote><p>Find the sum of all numbers which are equal to the sum of the factorial of their digits.</p></blockquote>
<pre name="code" class="ruby"># cache the digit factorials
factorials = [1]
(1..9).each do |i|
	factorials.push(i * factorials.last)
end

result = 0
(3..2_540_160).each do |n|
	sum = n.to_s.split("").inject(0) do |sum,n|
		sum + factorials[n.to_i]
	end
	result += n if n == sum
end
puts result</pre>
<p>Runs in just under a minute <img src='http://joezack.com/wp-includes/images/smilies/icon_smile.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%2F10%2F23%2Fproject-euler-problem-34-in-ruby%2F&amp;title=Project+Euler%3A+Problem+34+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%2F10%2F23%2Fproject-euler-problem-34-in-ruby%2F&amp;title=Project+Euler%3A+Problem+34+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%2F10%2F23%2Fproject-euler-problem-34-in-ruby%2F&amp;title=Project+Euler%3A+Problem+34+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%2F10%2F23%2Fproject-euler-problem-34-in-ruby%2F&amp;headline=Project+Euler%3A+Problem+34+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+34+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-34-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+34+in+Ruby&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-34-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+34+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-34-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+34+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-34-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+34+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-34-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%2F10%2F23%2Fproject-euler-problem-34-in-ruby%2F&amp;title=Project+Euler%3A+Problem+34+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%2F10%2F23%2Fproject-euler-problem-34-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%2F10%2F23%2Fproject-euler-problem-34-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/buzz/post?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-34-in-ruby%2F" ><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/10/23/project-euler-problem-34-in-ruby/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Project Euler : Problem 36 in Ruby</title>
		<link>http://joezack.com/index.php/2010/10/23/project-euler-problem-36-in-ruby/</link>
		<comments>http://joezack.com/index.php/2010/10/23/project-euler-problem-36-in-ruby/#comments</comments>
		<pubDate>Sat, 23 Oct 2010 22:59:41 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[project euler]]></category>
		<category><![CDATA[puzzles]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joezack.com/?p=1492</guid>
		<description><![CDATA[I've been ill today, but there's no better medicine than an easy Project Euler problem! I tried doing some bitwise magic, but in the end my simplest solution proved the fastest as well. Problem 36 Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2. def [...]]]></description>
			<content:encoded><![CDATA[<p>I've been ill today, but there's no better medicine than an easy Project Euler problem! I tried doing some bitwise magic, but in the end my simplest solution proved the fastest as well.</p>
<p><a href="http://projecteuler.net/index.php?section=problems&id=36">Problem 36</a></p>
<blockquote><p>Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.</p></blockquote>
<pre name="code" class="ruby">def palindrome? s
	s == s.reverse
end

sum = (1..1_000_000).inject(0) do |sum, n|
	sum += palindrome?(n.to_s) && palindrome?(n.to_s 2) ? n : 0
end

puts sum</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-36-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+36+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%2F10%2F23%2Fproject-euler-problem-36-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+36+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%2F10%2F23%2Fproject-euler-problem-36-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+36+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%2F10%2F23%2Fproject-euler-problem-36-in-ruby%2F&amp;headline=Project+Euler+%3A+Problem+36+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+36+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-36-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+36+in+Ruby&amp;u=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-36-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+36+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-36-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+36+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-36-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+36+in+Ruby&amp;url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-36-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%2F10%2F23%2Fproject-euler-problem-36-in-ruby%2F&amp;title=Project+Euler+%3A+Problem+36+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%2F10%2F23%2Fproject-euler-problem-36-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%2F10%2F23%2Fproject-euler-problem-36-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/buzz/post?url=http%3A%2F%2Fjoezack.com%2Findex.php%2F2010%2F10%2F23%2Fproject-euler-problem-36-in-ruby%2F" ><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/10/23/project-euler-problem-36-in-ruby/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

