<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Invisible Blocks</title>
	<atom:link href="http://invisibleblocks.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://invisibleblocks.com</link>
	<description>for building invisible machines</description>
	<lastBuildDate>Sun, 27 May 2012 16:49:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='invisibleblocks.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Invisible Blocks</title>
		<link>http://invisibleblocks.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://invisibleblocks.com/osd.xml" title="Invisible Blocks" />
	<atom:link rel='hub' href='http://invisibleblocks.com/?pushpress=hub'/>
		<item>
		<title>Out of Love with Active Record</title>
		<link>http://invisibleblocks.com/2012/05/08/out-of-love-with-active-record/</link>
		<comments>http://invisibleblocks.com/2012/05/08/out-of-love-with-active-record/#comments</comments>
		<pubDate>Wed, 09 May 2012 00:36:44 +0000</pubDate>
		<dc:creator>Daniel Bernier</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://invisibleblocks.com/?p=540</guid>
		<description><![CDATA[(I&#8217;m a new-comer to Rails. When I first found Ruby, and Rails, I liked the Ruby better. And I never found many Rails jobs near home anyway. So for years, Ruby flavored my C#, and C# is where I learned, among other things, to persist my domain aggregates with NHibernate. Now I&#8217;m a card-carrying Rails [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=540&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>(I&#8217;m a new-comer to Rails. When I first found Ruby, and Rails, I liked the Ruby better. And I never found many Rails jobs near home anyway. So for years, Ruby flavored my C#, and C# is where I learned, among other things, to persist my domain aggregates with NHibernate. Now I&#8217;m a card-carrying Rails jobber, which is great, because I play with Ruby all day. And the Rails community is discovering domain-driven design, and ORMs&#8230;)</p>
<p>Steve Klabnik just posted about <a href="http://blog.steveklabnik.com/posts/2012-05-07-mixins--a-refactoring-anti-pattern">resisting the urge to factor your models into behavior-in-a-mixin and dumb-persistence-with-active-record</a>. He nails it when he says:</p>
<blockquote><p>Whenever we refactor, we have to consider what we&#8217;re using to evaluate that our refactoring has been successful. For me, the default is complexity. That is, any refactoring I&#8217;m doing is trying to reduce complexity&#8230; One good way that I think about complexity on an individual object level [is its] &#8216;attack surface.&#8217; We call this &#8216;encapsulation&#8217; in object oriented software design.</p></blockquote>
<p>If you learn only one thing from his post, let it be that &#8220;mixins do not really reduce the complexity of your objects.&#8221; Greg Brown threw me when he said that mixins are just another form of inheritance, and I think he was getting at the same thing.</p>
<p>Steve&#8217;s suggestion for separating persistence and behavior is to &#8211; duh, once you see it &#8211; separate them into different classes: a Post and a PostMapper, or a Post and a PostRepository. When I used C# and NHibernate, we loaded our Posts from the PostRepository, which used our PostMapper for data access. (Actually, our PostMapper was an XML mapping file.) You might call that overkill, but in a legacy app, it was nice to sheetrock our repositories over all the different data access technologies we&#8217;d acquired over the years, from the shiny new ORM to the crusty old Strongly-Typed DataSets.</p>
<p>When I was on that team, the thing that we worried about was, what grain should we build our repositories at? We didn&#8217;t have simple models, we had domain aggregates: we&#8217;d load a ThirdPartyAdministrator, which had many Clients, which each had a number of Accounts of different types, each of which had different options and sub-objects. So, what kind of repositories should we build, and what methods should they have? If we want to load the Client&#8217;s Accounts, should we load the ThirdPartyAdministrator, find the Client, and get its Accounts? load the Accounts directly? load the Client, and get its Accounts?</p>
<p>For a ridiculously simplified example, but to give you the flavor of it, say we load the ThirdPartyAdministrator, the aggregate root, and go from there:</p>
<p><pre class="brush: ruby;">
class ThirdPartyAdministratorRepository
  def load_tpa(id)
    ...
  end
end

tpa = ThirdPartyAdministratorRepositor.load_tpa(42)
client = tpa.clients[client_id]
accounts = client.accounts
</pre></p>
<p>That&#8217;s too coarse; do we really have to load the TPA before we can get the client we&#8217;re after?</p>
<p><pre class="brush: ruby;">
class ClientRepository
  def load_client(id)
    ...
  end
end

class AccountRepository
  def load_account(id)
    ...
  end
end

client = ClientRepository.load_client(client_id)
accounts = client.account_ids.map { |id|
  AccountRepository.load_account(id)
}
</pre></p>
<p>That&#8217;s too fine a grain, too low-level; we don&#8217;t want to have to muck around with Account IDs.</p>
<p><pre class="brush: ruby;">
client = ClientRepository.load_client(client_id)
accounts = client.accounts
</pre></p>
<p>That might be a good middle-approach.</p>
<p>It comes down to knowing your application&#8217;s data-access patterns, and your domain&#8217;s constraints. If you often need a chunk of data, all together, you should probably have a repository for it. If one piece of data depends on another, your repository probably shouldn&#8217;t make you get them separately.</p>
<p>With Rails&#8217; ActiveRecord, all this is sorted out for you &#8211; you define your associations, it provides all those querying methods, and you use the correct ones for what you need. With repositories, you have decisions to make &#8211; you have to design it, and design is choice. But choosing is work! and you can choose inconsistently! sometimes, it even makes sense to! I&#8217;m curious to see how the Rails community, with its culture of convention, tackles this. And for myself, I plan to check out DataMapper at some point.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invisibleblocks.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invisibleblocks.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/invisibleblocks.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/invisibleblocks.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/invisibleblocks.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/invisibleblocks.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/invisibleblocks.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/invisibleblocks.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/invisibleblocks.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/invisibleblocks.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/invisibleblocks.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/invisibleblocks.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/invisibleblocks.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/invisibleblocks.wordpress.com/540/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=540&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invisibleblocks.com/2012/05/08/out-of-love-with-active-record/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/360300f6962b973dae989991dc204f75?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bonsaigiant</media:title>
		</media:content>
	</item>
		<item>
		<title>BarCamp Boston 7: This Weekend!</title>
		<link>http://invisibleblocks.com/2012/04/03/barcamp-boston-7-this-weekend/</link>
		<comments>http://invisibleblocks.com/2012/04/03/barcamp-boston-7-this-weekend/#comments</comments>
		<pubDate>Tue, 03 Apr 2012 20:34:09 +0000</pubDate>
		<dc:creator>Daniel Bernier</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://invisibleblocks.com/?p=535</guid>
		<description><![CDATA[I don&#8217;t know what the tea thing is about, but whatever! I&#8217;ll be there, come say hi!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=535&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img src="http://wiki.barcampboston.org/images/thumb/4/4a/BCB7AttendeeLogoFinal.png/800px-BCB7AttendeeLogoFinal.png" alt="BarCamp Boston 7"></p>
<p>I don&#8217;t know what the tea thing is about, but whatever! I&#8217;ll be there, come say hi!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invisibleblocks.wordpress.com/535/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invisibleblocks.wordpress.com/535/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/invisibleblocks.wordpress.com/535/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/invisibleblocks.wordpress.com/535/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/invisibleblocks.wordpress.com/535/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/invisibleblocks.wordpress.com/535/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/invisibleblocks.wordpress.com/535/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/invisibleblocks.wordpress.com/535/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/invisibleblocks.wordpress.com/535/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/invisibleblocks.wordpress.com/535/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/invisibleblocks.wordpress.com/535/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/invisibleblocks.wordpress.com/535/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/invisibleblocks.wordpress.com/535/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/invisibleblocks.wordpress.com/535/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=535&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invisibleblocks.com/2012/04/03/barcamp-boston-7-this-weekend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/360300f6962b973dae989991dc204f75?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bonsaigiant</media:title>
		</media:content>

		<media:content url="http://wiki.barcampboston.org/images/thumb/4/4a/BCB7AttendeeLogoFinal.png/800px-BCB7AttendeeLogoFinal.png" medium="image">
			<media:title type="html">BarCamp Boston 7</media:title>
		</media:content>
	</item>
		<item>
		<title>Cover your Moleskine in Brown Paper</title>
		<link>http://invisibleblocks.com/2012/02/21/cover-your-moleskine-in-brown-paper/</link>
		<comments>http://invisibleblocks.com/2012/02/21/cover-your-moleskine-in-brown-paper/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 04:05:25 +0000</pubDate>
		<dc:creator>Daniel Bernier</dc:creator>
				<category><![CDATA[Notebooks]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[moleskine notebook]]></category>

		<guid isPermaLink="false">http://invisibleblocks.com/?p=501</guid>
		<description><![CDATA[(He&#8217;s kidding, right? He didn&#8217;t really cover his moleskine in ugly brown papeAUGGUGHHUH) (..UGUGHAOMIGOD, he actually did. So gross.) Ok. Did you hear the story about the reporter who interviewed Steve Jobs about the iPod, and Steve Jobs was outraged that the reporter&#8217;s iPod was in a protective neoprene case, which made it a) look [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=501&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>(He&#8217;s kidding, right? He didn&#8217;t really cover his moleskine in ugly brown papeAUGGUGHHUH)</p>
<p><a href="http://invisibleblocks.files.wordpress.com/2012/02/finished-moleskine.jpg"><img class="size-medium wp-image-502" title="Moleskine notebook, covered in brown paper" src="http://invisibleblocks.files.wordpress.com/2012/02/finished-moleskine.jpg?w=300&h=225" alt="" width="300" height="225" /></a></p>
<p>(..UGUGHAOMIGOD, he actually did. So gross.)</p>
<p>Ok. Did you hear the story about the reporter who interviewed Steve Jobs about the iPod, and Steve Jobs was outraged that the reporter&#8217;s iPod was in a protective neoprene case, which made it a) look ugly, and b) not gradually pick up that &#8220;scratched stainless steel&#8221; patina? Maybe this is like that. Maybe a brown paper bag is uglier than sleek faux-leather. Maybe a moleskine should look like it doesn&#8217;t often drink beer, but when it does&#8230;</p>
<p>Or maybe raw brown paper is DIY-chic. Maybe you can&#8217;t tell your moleskine from everybody else&#8217;s. Maybe your notebook already takes enough abuse. Maybe a brown paper cover is a good idea.</p>
<p>Whatever. I got the idea for this about a year ago, and did it just to see whether I could. (The moleskine elastic, as you&#8217;ll see, makes this a little trickier than your typical book covering.) I&#8217;ve done it several times, because I kind of like it. I finally googled today to see whether anyone else had instructions up for this, and was surprised I couldn&#8217;t find any. So here we go!</p>
<h3>Materials</h3>
<p><a href="http://invisibleblocks.files.wordpress.com/2012/02/moleskine-materials.jpg"><img class="size-medium wp-image-503" title="Materials" src="http://invisibleblocks.files.wordpress.com/2012/02/moleskine-materials.jpg?w=300&h=225" alt="" width="300" height="225" /></a></p>
<ul>
<li>Your uncovered moleskine notebook. I&#8217;m using a <a href="http://www.amazon.com/Moleskine-Plain-Notebook-Large/dp/8883701143/">large</a>, but I&#8217;ve also done this with <a href="http://www.amazon.com/Moleskine-Ruled-Notebook-Pocket/dp/8883701003/">small ones</a>.</li>
<li>A brown paper bag. For the large notebook, I&#8217;m using a bag that&#8217;s 7 1/16 x 4 1/2 x 13 3/4; for small notebooks, you can use something as small as a lunch bag.</li>
<li>scissors</li>
<li>a pen</li>
<li>packing tape (optional &#8211; just for reinforcing some weak joints)</li>
</ul>
<h3>The Easy Part &#8211; a pretty ordinary book covering</h3>
<p>This part is just like the <a href="http://www.google.com/search?q=how%20to%20cover%20a%20book%20with%20a%20shopping%20bag">book coverings you maybe made in school.</a></p>
<p>Cut down the seam of the paper bag, and cut off the bottom, so you have a large sheet of brown paper.</p>
<p>Fold the top and bottom edges of the paper down, so the book is the same height as the paper.</p>
<p><a href="http://invisibleblocks.files.wordpress.com/2012/02/notebook-on-folded-paper.jpg"><img class="size-medium wp-image-504 alignnone" title="notebook-on-folded-paper" src="http://invisibleblocks.files.wordpress.com/2012/02/notebook-on-folded-paper.jpg?w=300&h=225" alt="" width="300" height="225" /></a></p>
<p>The paper folds create a sleeve, and you want to be able to slide the front cover into it. In fact, slide the notebook&#8217;s front cover into it now, and fold it back, around the book. If it looks like this:</p>
<p><a href="http://invisibleblocks.files.wordpress.com/2012/02/too-much-paper.jpg"><img class="alignnone size-medium wp-image-506" title="too-much-paper" src="http://invisibleblocks.files.wordpress.com/2012/02/too-much-paper.jpg?w=300&h=225" alt="" width="300" height="225" /></a></p>
<p>&#8230;then cut the extra paper, so it looks like this:</p>
<p><a href="http://invisibleblocks.files.wordpress.com/2012/02/just-enough-paper.jpg"><img class="alignnone size-medium wp-image-505" title="just-enough-paper" src="http://invisibleblocks.files.wordpress.com/2012/02/just-enough-paper.jpg?w=300&h=225" alt="" width="300" height="225" /></a></p>
<h3>Where it gets different</h3>
<p>That elastic is getting in the way, right? Unwrap the book a bit, we&#8217;re gonna use the scissors &#8211; but read through this part all the way before you start cutting.</p>
<p>If you measure, you&#8217;ll see that the elastic is 1/4&#8243; wide, and 3/4&#8243; from the edge of the book cover (sorry for the blue-and-purple):</p>
<p><a href="http://invisibleblocks.files.wordpress.com/2012/02/measurments.jpg"><img class="alignnone size-medium wp-image-507" title="measurments" src="http://invisibleblocks.files.wordpress.com/2012/02/measurments.jpg?w=300&h=225" alt="" width="300" height="225" /></a></p>
<p>The trick is to cut some of the paper off of the cover-flap, so the elastics can get out. In this picture, I marked the parts to cut out with a black marker (the green arrows):</p>
<p><a href="http://invisibleblocks.files.wordpress.com/2012/02/where-to-cut2.jpg"><img class="alignnone size-full wp-image-510" title="where-to-cut" src="http://invisibleblocks.files.wordpress.com/2012/02/where-to-cut2.jpg?w=500&h=375" alt="" width="500" height="375" /></a></p>
<p>Make sure you cut on the back flap, not on the back cover. For some reason, I always screw this up &#8211; I want to cut the back cover. Don&#8217;t do that. Cut the back flap.</p>
<p>Leave at least 1/4&#8243; between the cut and the fold. I cut a trapezoid shape, which makes it a bit easier to put it together, but it&#8217;s not that important. Here&#8217;s how it should look when you&#8217;re done:</p>
<p><a href="http://invisibleblocks.files.wordpress.com/2012/02/cut-results1.jpg"><img class="alignnone size-full wp-image-513" title="cut-results" src="http://invisibleblocks.files.wordpress.com/2012/02/cut-results1.jpg?w=500&h=375" alt="" width="500" height="375" /></a></p>
<p>You don&#8217;t <em>have</em> to reinforce this section with packing tape, but I&#8217;d recommend it &#8211; with the larger notebook, the elastic jerks this part of the cover around a lot, and the packing tape will make it last a lot longer. Don&#8217;t forget to do the bottom half, too.</p>
<p>Take the whole cover off the book &#8211; it&#8217;s easiest to put the back cover on first. Slide it in, so the elastic pops out of the cuts you just made:</p>
<p><a href="http://invisibleblocks.files.wordpress.com/2012/02/img_3762.jpg"><img class="alignnone size-full wp-image-512" title="Elastic sticking through the slits" src="http://invisibleblocks.files.wordpress.com/2012/02/img_3762.jpg?w=500&h=375" alt="" width="500" height="375" /></a></p>
<p>Ok, this is the tricky bit &#8211; getting the cover on, and the elastic arranged right. Close the front of the book under, so you&#8217;re still looking at the back side of it:</p>
<p><a href="http://invisibleblocks.files.wordpress.com/2012/02/putting-it-together.jpg"><img class="alignnone size-full wp-image-514" title="putting-it-together" src="http://invisibleblocks.files.wordpress.com/2012/02/putting-it-together.jpg?w=500&h=375" alt="" width="500" height="375" /></a></p>
<p>Fold the elastic around the spine (to the right, in the above picture), so it&#8217;s holding the book shut. Here&#8217;s a close-up of the top of the book:</p>
<p><a href="http://invisibleblocks.files.wordpress.com/2012/02/putting-it-together-2.jpg"><img class="alignnone size-full wp-image-515" title="putting-it-together-2" src="http://invisibleblocks.files.wordpress.com/2012/02/putting-it-together-2.jpg?w=500&h=375" alt="" width="500" height="375" /></a></p>
<p>The hard part&#8217;s done! Wrap the cover around the back of the book. Before you wrap it around the front, take the elastic off again &#8211; you&#8217;ll need to open the notebook to get the front of the cover on. Open the front cover of the notebook, and slide on the cover flap. Pop the elastic back on, and&#8230;</p>
<p><a href="http://invisibleblocks.files.wordpress.com/2012/02/finished-moleskine.jpg"><img class="alignnone size-full wp-image-502" title="Moleskine notebook, covered in brown paper" src="http://invisibleblocks.files.wordpress.com/2012/02/finished-moleskine.jpg?w=500&h=375" alt="" width="500" height="375" /></a></p>
<p>All done!</p>
<h3>Side Benefits</h3>
<p>Moleskines famously sport that back accordion pocket. Covering one in brown paper like this means you can add two more:</p>
<p><a href="http://invisibleblocks.files.wordpress.com/2012/02/front-pocket.jpg"><img class="alignnone size-medium wp-image-517" title="front-pocket" src="http://invisibleblocks.files.wordpress.com/2012/02/front-pocket.jpg?w=225&h=300" alt="" width="225" height="300" /></a>   <a href="http://invisibleblocks.files.wordpress.com/2012/02/back-pocket.jpg"><img class="size-medium wp-image-516 alignnone" title="back-pocket" src="http://invisibleblocks.files.wordpress.com/2012/02/back-pocket.jpg?w=300&h=225" alt="" width="300" height="225" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invisibleblocks.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invisibleblocks.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/invisibleblocks.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/invisibleblocks.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/invisibleblocks.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/invisibleblocks.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/invisibleblocks.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/invisibleblocks.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/invisibleblocks.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/invisibleblocks.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/invisibleblocks.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/invisibleblocks.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/invisibleblocks.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/invisibleblocks.wordpress.com/501/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=501&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invisibleblocks.com/2012/02/21/cover-your-moleskine-in-brown-paper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/360300f6962b973dae989991dc204f75?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bonsaigiant</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2012/02/finished-moleskine.jpg?w=300" medium="image">
			<media:title type="html">Moleskine notebook, covered in brown paper</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2012/02/moleskine-materials.jpg?w=300" medium="image">
			<media:title type="html">Materials</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2012/02/notebook-on-folded-paper.jpg?w=300" medium="image">
			<media:title type="html">notebook-on-folded-paper</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2012/02/too-much-paper.jpg?w=300" medium="image">
			<media:title type="html">too-much-paper</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2012/02/just-enough-paper.jpg?w=300" medium="image">
			<media:title type="html">just-enough-paper</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2012/02/measurments.jpg?w=300" medium="image">
			<media:title type="html">measurments</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2012/02/where-to-cut2.jpg" medium="image">
			<media:title type="html">where-to-cut</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2012/02/cut-results1.jpg" medium="image">
			<media:title type="html">cut-results</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2012/02/img_3762.jpg" medium="image">
			<media:title type="html">Elastic sticking through the slits</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2012/02/putting-it-together.jpg" medium="image">
			<media:title type="html">putting-it-together</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2012/02/putting-it-together-2.jpg" medium="image">
			<media:title type="html">putting-it-together-2</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2012/02/finished-moleskine.jpg" medium="image">
			<media:title type="html">Moleskine notebook, covered in brown paper</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2012/02/front-pocket.jpg?w=225" medium="image">
			<media:title type="html">front-pocket</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2012/02/back-pocket.jpg?w=300" medium="image">
			<media:title type="html">back-pocket</media:title>
		</media:content>
	</item>
		<item>
		<title>Redder Pastures</title>
		<link>http://invisibleblocks.com/2011/08/17/redder-pastures/</link>
		<comments>http://invisibleblocks.com/2011/08/17/redder-pastures/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 01:46:44 +0000</pubDate>
		<dc:creator>Daniel Bernier</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://invisibleblocks.wordpress.com/?p=470</guid>
		<description><![CDATA[What the hell happened? I mean, I don&#8217;t care for &#8220;I haven&#8217;t been blogging because&#8230;&#8221; posts either, but it&#8217;s been quiet here lately, hasn&#8217;t it? The explanation comes in two parts: After I announced I was releasing WordCram, I worked like mad on it. In my last post, the one announcing WordCram, I said &#8220;There’s still work [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=470&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>What the hell happened? I mean, I don&#8217;t care for &#8220;I haven&#8217;t been blogging because&#8230;&#8221; posts either, but it&#8217;s been <em>quiet</em> here lately, hasn&#8217;t it?</p>
<p>The explanation comes in two parts:</p>
<p>After I announced I was releasing <a href="http://wordcram.org">WordCram</a>, I worked like mad on it. In my last post, the one announcing WordCram, I said &#8220;There’s still work to do, but that’s the fun part,&#8221; but I had no idea. And it&#8217;s not even a big library, or do anything useful! And there is certainly still work to do. I have a new, visceral appreciation for how much open source software developers give us. That&#8217;s the first part.</p>
<p>But all that stopped last April, when my employer began going through some &#8211; I guess &#8220;changes&#8221; is a safe enough word. Nevermind what they were. It got me thinking it was time to find a job I liked better. The job search is the second part of the explanation. I didn&#8217;t want another ordinary-business kind of job, but I didn&#8217;t know which direction to head in. After  sinking myself in some Processing.org dataviz, science, and Ruby, talking to a bunch of excellent people, and finding some luck, I got a spot on the <a href="http://seeclickfix.com">SeeClickFix</a> team, doing Ruby on Rails, and helping citizens improve their community.</p>
<p>Get a great job, working in a great language, making the world a little bit better:</p>
<p><a href="http://invisibleblocks.files.wordpress.com/2011/08/checked_box.jpg"><img class="size-full wp-image-473 alignnone" style="border-color:initial;border-style:initial;border-width:0;" title="checked_box" src="http://invisibleblocks.files.wordpress.com/2011/08/checked_box.jpg?w=500" alt=""   /></a><br />
<img class="alignright" style="border-color:initial;border-style:initial;border-width:0;" src="http://upload.wikimedia.org/wikipedia/commons/7/73/Ruby_logo.svg" alt="" width="100" height="100" />I start in September, right before I start classes at <a href="http://university.rubymendicant.com/">Ruby Mendicant University</a>. It&#8217;s been a busy spring and summer, and it&#8217;ll be a busy fall, too.</p>
<p>And at some point, I have some WordCram things to finish&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invisibleblocks.wordpress.com/470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invisibleblocks.wordpress.com/470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/invisibleblocks.wordpress.com/470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/invisibleblocks.wordpress.com/470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/invisibleblocks.wordpress.com/470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/invisibleblocks.wordpress.com/470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/invisibleblocks.wordpress.com/470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/invisibleblocks.wordpress.com/470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/invisibleblocks.wordpress.com/470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/invisibleblocks.wordpress.com/470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/invisibleblocks.wordpress.com/470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/invisibleblocks.wordpress.com/470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/invisibleblocks.wordpress.com/470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/invisibleblocks.wordpress.com/470/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=470&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invisibleblocks.com/2011/08/17/redder-pastures/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/360300f6962b973dae989991dc204f75?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bonsaigiant</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2011/08/checked_box.jpg" medium="image">
			<media:title type="html">checked_box</media:title>
		</media:content>

		<media:content url="http://upload.wikimedia.org/wikipedia/commons/7/73/Ruby_logo.svg" medium="image" />
	</item>
		<item>
		<title>WordCram: Open-Source Word Clouds for Processing</title>
		<link>http://invisibleblocks.com/2010/08/31/wordcram-open-source-word-clouds-for-processing/</link>
		<comments>http://invisibleblocks.com/2010/08/31/wordcram-open-source-word-clouds-for-processing/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 01:31:08 +0000</pubDate>
		<dc:creator>Daniel Bernier</dc:creator>
				<category><![CDATA[WordCram]]></category>

		<guid isPermaLink="false">http://invisibleblocks.wordpress.com/?p=463</guid>
		<description><![CDATA[I just released a project I&#8217;ve been working on for a while, called WordCram.  As the title says, it&#8217;s a Processing library for generating word clouds. I found wordle.net a few years ago and really liked it, and after seeing the code for Algirdas Rascius&#8217; Scattered Letters on OpenProcessing.org, I tried making some of my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=463&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I just released a project I&#8217;ve been working on for a while, called <a href="http://wordcram.wordpress.com">WordCram</a>.  As the title says, it&#8217;s a Processing library for generating word clouds.</p>
<p>I found <a href="http://wordle.net">wordle.net</a> a few years ago and really liked it, and after seeing the code for Algirdas Rascius&#8217; <a href="http://www.openprocessing.org/visuals/?visualID=1811">Scattered Letters</a> on OpenProcessing.org, I tried making <a href="http://www.flickr.com/photos/bonsai_giant/tags/wordle/">some of my own</a>.  It was fun, but I thought it ran too slowly to bother bundling it into a Processing library.</p>
<p>After reading the <a href="http://blog.wordle.net/2010/05/wordle-as-beautiful-visualization.html">Wordle chapter</a> from <a href="http://www.amazon.com/gp/product/1449379869?ie=UTF8&amp;tag=invisblock-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1449379869">Beautiful Visualization</a>, I learned a few new tricks, and it&#8217;s a bit faster now, so here it is.  There&#8217;s still work to do, but that&#8217;s the fun part.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invisibleblocks.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invisibleblocks.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/invisibleblocks.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/invisibleblocks.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/invisibleblocks.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/invisibleblocks.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/invisibleblocks.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/invisibleblocks.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/invisibleblocks.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/invisibleblocks.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/invisibleblocks.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/invisibleblocks.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/invisibleblocks.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/invisibleblocks.wordpress.com/463/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=463&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invisibleblocks.com/2010/08/31/wordcram-open-source-word-clouds-for-processing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/360300f6962b973dae989991dc204f75?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bonsaigiant</media:title>
		</media:content>
	</item>
		<item>
		<title>After OsCon 2010</title>
		<link>http://invisibleblocks.com/2010/07/28/after-oscon-2010/</link>
		<comments>http://invisibleblocks.com/2010/07/28/after-oscon-2010/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 12:07:24 +0000</pubDate>
		<dc:creator>Daniel Bernier</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://invisibleblocks.wordpress.com/?p=445</guid>
		<description><![CDATA[OsCon 2010 is done, and I&#8217;m pooped. I met some great people, the talks were good, and I saw some promising ideas and technologies. Portland is a great city, with free public transportation, good beer, veggie-friendly restaurants, and Mt. Hood close by. What more could you want? Here&#8217;s my highlights and impressions. Innovation Rolf Skyberg [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=445&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.oscon.com/oscon2010">OsCon 2010</a> is done, and I&#8217;m pooped. I met some great people, the talks were good, and I saw some promising ideas and technologies. Portland is a great city, with free public transportation, good beer, veggie-friendly restaurants, and <a href="http://images.google.com/images?q=mt+hood+oregon">Mt. Hood</a> close by. What more could you want?</p>
<p>Here&#8217;s my highlights and impressions.</p>
<h4>Innovation</h4>
<p><a href="http://www.oscon.com/oscon2010/public/schedule/detail/13553">Rolf Skyberg</a> explained where corporate innovation initiatives come from, and <a href="http://www.oscon.com/oscon2010/public/schedule/detail/14836">Simon Wardley</a> talked about innovation. Those links are to the talk descriptions, but you can watch <a href="http://www.youtube.com/watch?v=5Oyf4vvJyy4&amp;feature=PlayList&amp;p=12696FB0B040FA53&amp;playnext_from=PL&amp;index=39">Simon&#8217;s talk on youtube</a>, since it was a keynote.</p>
<p>As a company ages, Rolf says it gets more risk-averse, and that stifles innovation. He names each life-stage of a company for its most prominent employees: innovators, rock-stars, proceduralists, optimizers, and vultures. Once the company becomes so risk-averse that new ideas are stifled, and it starts losing money, the CEO assumes the problem is a lack of new ideas, rather than a culture that can&#8217;t absorb them.<em></em></p>
<p>As a technology matures, Simon says it gets more stable and ubiquitous, becoming a commodity. This &#8220;creative destruction&#8221; frees us up to do more interesting things.</p>
<p>I&#8217;ll be going back over their presentations, thinking about the commonalities between their talks.</p>
<h4>Google&#8217;s Go</h4>
<p>Rob Pike&#8217;s talk <a href="http://www.youtube.com/watch?v=5kj5ApnhPAE&amp;feature=PlayList&amp;p=12696FB0B040FA53&amp;playnext_from=PL&amp;index=25">Public Static Void</a> gave  some context around Google&#8217;s new(-ish) language, <a href="http://golang.org/">Go</a>, which I&#8217;d pretty much ignored. A few choice bits:</p>
<ul>
<li>&#8220;there&#8217;s a false dichotomy between nice &amp; dynamic &amp; interpreted, and ugly &amp; static &amp; compiled&#8221;</li>
<li>Scala is &#8220;beautiful and rigorous&#8221;</li>
<li>(my favorite) &#8220;a language should be light on the page&#8221;</li>
</ul>
<h4>Processing</h4>
<p>I got to show Processing to a bunch of people, which made me happy &#8212; Processing is a great tool, and a lot of fun.  <a href="http://www.kathrynaaker.com/blog/">Kathryn Aaker</a> was there, and she even made a <a href="http://openprocessing.org/visuals/?visualID=10950">sketch</a> on the flight home.</p>
<p>I also talked with a guy whose name I can&#8217;t remember, and whose card I didn&#8217;t get, about how his friend used Processing to teach math concepts to his kids.  That&#8217;s a pretty amazing thing. Take that, <a href="http://www.maa.org/devlin/LockhartsLament.pdf">Mathematician&#8217;s Lament</a>!</p>
<h4>Scala, Mirah?</h4>
<p>I really enjoy <a href="http://processing.org">Processing</a>, but&#8230;Java. Can we have something fast, but with closures and easy syntax, please? Either Scala or Mirah might meet that need.</p>
<p><a href="http://www.mirah.org/">Mirah</a> is a Java compiler that reads Ruby-like syntax: looks like Ruby, but  it&#8217;s still Java. That seems promising, but I don&#8217;t think you can use,  say, Array.map, since it&#8217;s not part of Java&#8217;s core library.</p>
<p><a href="http://www.scala-lang.org/">Scala</a> is a functional/OO hybrid language that brings closures and  higher-order programming to Java, with a helping of type inference.  It  seems promising, but it also seems like a lot of features mixed in  together; compared to Io or Scheme, there&#8217;s tons to learn.  But maybe  that&#8217;s the wrong way to look at it &#8212; maybe it&#8217;s close enough to Java that it&#8217;ll be fairly quick to learn.</p>
<h4>Powell&#8217;s Technical Books</h4>
<p>Powell&#8217;s books is humbling, and amazing. There are whole sections I&#8217;m not even smart enough to understand. I still walked out with three books, though.</p>
<p><a href="http://invisibleblocks.files.wordpress.com/2010/07/img_2860-small.jpg"><img class="alignnone size-full wp-image-448" src="http://invisibleblocks.files.wordpress.com/2010/07/img_2860-small.jpg?w=500" alt="I'm a book fiend"   /></a></p>
<p>The first one is <a href="http://www.amazon.com/gp/product/0312186509?ie=UTF8&amp;tag=invisblock-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0312186509">The Philosophical Programmer</a><img class=" byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze" style="border:none!important;margin:0!important;" src="http://www.assoc-amazon.com/e/ir?t=invisblock-20&amp;l=as2&amp;o=1&amp;a=0312186509" border="0" alt="" width="1" height="1" />, which I&#8217;d never heard of, but for $6, I had to grab it.  (Yes, it&#8217;s an old library book.)  I got <a href="http://www.amazon.com/gp/product/0262561158?ie=UTF8&amp;tag=invisblock-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0262561158">A Little Java, A Few Patterns</a><img class=" byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze" style="border:none!important;margin:0!important;" src="http://www.assoc-amazon.com/e/ir?t=invisblock-20&amp;l=as2&amp;o=1&amp;a=0262561158" border="0" alt="" width="1" height="1" /> because I loved <a href="http://www.amazon.com/gp/product/0262560992?ie=UTF8&amp;tag=invisblock-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0262560992">The Little Schemer</a><img class=" byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze" style="border:none!important;margin:0!important;" src="http://www.assoc-amazon.com/e/ir?t=invisblock-20&amp;l=as2&amp;o=1&amp;a=0262560992" border="0" alt="" width="1" height="1" />.  <a href="http://www.amazon.com/gp/product/354021304X?ie=UTF8&amp;tag=invisblock-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=354021304X">Grammatical Picture Generation</a><img class=" byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze" style="border:none!important;margin:0!important;" src="http://www.assoc-amazon.com/e/ir?t=invisblock-20&amp;l=as2&amp;o=1&amp;a=354021304X" border="0" alt="" width="1" height="1" /> is about writing tiny languages that generate fractal-type images, something I&#8217;ve been playing with recently.  And I actually bought <a href="http://www.amazon.com/gp/product/1449379869?ie=UTF8&amp;tag=invisblock-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1449379869">Beautiful Visualization</a><img class=" byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi byxmxweyeumkaqzmwcfi hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze hiumsgquelgxvvjyynze" style="border:none!important;margin:0!important;" src="http://www.assoc-amazon.com/e/ir?t=invisblock-20&amp;l=as2&amp;o=1&amp;a=1449379869" border="0" alt="" width="1" height="1" /> at the conference itself, not at Powell&#8217;s.  It&#8217;s fantastic, though, I read it the whole flight home.</p>
<p>OK!  Enough fawning over books, I&#8217;m embarrassing myself.</p>
<h4>Asynchronous JavaScript</h4>
<p>My team&#8217;s been bogged down lately by some ASPX pages with very complex javascript behavior.  Somewhere between <a href="http://stratifiedjs.org/">Stratefied.js</a> and <a href="http://msdn.microsoft.com/en-us/devlabs/ee794896.aspx">Reactive Extensions for JS</a>, there might be a way to tame them.</p>
<p>Stratefied.js introduces new language constructs to javascript to implement concurrency semantics. I&#8217;m not 100% on the semantics themselves &#8212; they bear looking further into, but they don&#8217;t seem terribly complicated. The part I thought was neat was how they&#8217;re implemented in all browsers, even geriatric IE6:</p>
<p><pre class="brush: xml;">
&lt;script src=&quot;stratefied.js&quot; type=&quot;text/js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/sjs&quot;&gt;
  /* your code here, including new syntax */
&lt;/script&gt;
</pre></p>
<p>Notice the type attribute of the second script?  Once the page is loaded, Stratefied.js loads all scripts of type &#8220;text/sjs&#8221;, and does some source-transformation, turning the new constructs into (I&#8217;m guessing) gnarly, but standard, javascript.</p>
<p>Reactive Extensions for JS come from open source&#8217;s best friend Microsoft. The gist is this: asynchronous coding with call-backs is hard, but if you treat events (from the user, from ajax HTTP, or whatever) as a collection that you can subscribe to, and you can map and filter those collections with anonymous functions, it&#8217;s easier. We&#8217;ll have to see. The speaker, Erik Meijer, gave a <a href="http://live.visitmix.com/MIX10/Sessions/FTL01">pretty similar talk at MIX</a>.</p>
<h4>Badges, with Ribbons</h4>
<p><a href="http://invisibleblocks.files.wordpress.com/2010/07/img_2857-small.jpg"><img class="alignnone size-full wp-image-447" src="http://invisibleblocks.files.wordpress.com/2010/07/img_2857-small.jpg?w=500" alt="my badge"   /></a></p>
<p>They took some flak for the ribbon color-text, especially for the <a href="http://www.flickr.com/photos/oreillyconf/4816395283/in/set-72157624428101453/">desperate perl hackers</a>, but they were pretty good about it.  They even asked what ribbons we&#8217;d like to see next year, so we don&#8217;t have to customize quite so much.</p>
<h4>Inspiration and Awesomeness</h4>
<p>The world is full of inventive, stubborn people doing really cool things to make the world better. <a href="http://mifos.org/">Mifos.org</a> helps microfinance banks run smoothly. <a href="http://arduino.cc">Arduino</a> and <a href="http://www.concurrency.cc/">Plumbing</a> making hardware hacking accessible to whole new audiences.  <a href="http://www.oscon.com/oscon2010/public/schedule/detail/13425">OpenSETI</a> wants to involve programmers more in finding whether we&#8217;re alone in the universe.  <a href="http://codeforamerica.org/">Code for America</a> can help our government be more efficient and transparent.  If you ever wanted to start contributing to open source, joining <em>any</em> of these projects should be a great start.</p>
<h4>Pretend You Were There!</h4>
<p>Or re-live the experience, if you were!  Here&#8217;s the <a href="http://www.youtube.com/view_play_list?p=12696FB0B040FA53">keynotes on youtube</a>, and <a href="http://www.flickr.com/photos/oreillyconf/sets/72157624428101453/">photos on flickr</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invisibleblocks.wordpress.com/445/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invisibleblocks.wordpress.com/445/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/invisibleblocks.wordpress.com/445/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/invisibleblocks.wordpress.com/445/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/invisibleblocks.wordpress.com/445/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/invisibleblocks.wordpress.com/445/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/invisibleblocks.wordpress.com/445/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/invisibleblocks.wordpress.com/445/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/invisibleblocks.wordpress.com/445/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/invisibleblocks.wordpress.com/445/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/invisibleblocks.wordpress.com/445/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/invisibleblocks.wordpress.com/445/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/invisibleblocks.wordpress.com/445/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/invisibleblocks.wordpress.com/445/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=445&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invisibleblocks.com/2010/07/28/after-oscon-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/360300f6962b973dae989991dc204f75?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bonsaigiant</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2010/07/img_2860-small.jpg" medium="image">
			<media:title type="html">I&#039;m a book fiend</media:title>
		</media:content>

		<media:content url="http://www.assoc-amazon.com/e/ir?t=invisblock-20&#38;l=as2&#38;o=1&#38;a=0312186509" medium="image" />

		<media:content url="http://www.assoc-amazon.com/e/ir?t=invisblock-20&#38;l=as2&#38;o=1&#38;a=0262561158" medium="image" />

		<media:content url="http://www.assoc-amazon.com/e/ir?t=invisblock-20&#38;l=as2&#38;o=1&#38;a=0262560992" medium="image" />

		<media:content url="http://www.assoc-amazon.com/e/ir?t=invisblock-20&#38;l=as2&#38;o=1&#38;a=354021304X" medium="image" />

		<media:content url="http://www.assoc-amazon.com/e/ir?t=invisblock-20&#38;l=as2&#38;o=1&#38;a=1449379869" medium="image" />

		<media:content url="http://invisibleblocks.files.wordpress.com/2010/07/img_2857-small.jpg" medium="image">
			<media:title type="html">my badge</media:title>
		</media:content>
	</item>
		<item>
		<title>Disable Your Links, or Gate Your Functions?</title>
		<link>http://invisibleblocks.com/2010/07/01/disable-your-links-or-gate-your-functions/</link>
		<comments>http://invisibleblocks.com/2010/07/01/disable-your-links-or-gate-your-functions/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 23:02:18 +0000</pubDate>
		<dc:creator>Daniel Bernier</dc:creator>
				<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://invisibleblocks.wordpress.com/?p=434</guid>
		<description><![CDATA[It&#8217;s pretty common to disable links and buttons that cause updates, so those updates don&#8217;t happen twice, and re-enable them when the update has finished. At work, our app&#8217;s links are usually wired to javascript functions that use jQuery to scrape the form data and post it to web services via ajax. We normally disable [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=434&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s pretty common to disable links and buttons that cause updates, so those updates don&#8217;t happen twice, and re-enable them when the update has finished.</p>
<p>At work, our app&#8217;s links are usually wired to javascript functions that use jQuery to scrape the form data and post it to web services via ajax.  We normally disable links and buttons something like this:</p>
<p><pre class="brush: jscript;">
var updateLink = $('#updateLink');  // Find the link.
updateLink.click(function() {       // When it's clicked...
   updateLink.disable();            // disable it...
   ajax({
      data: getFormData(),          // ... &amp; send the form data
      url: 'http://someWebService', // to some web service.
      success: function(results) {  // When the service
         if (results.hasErrors) {   // finishes,
            showErrors(results);    // show any errors,
            updateLink.enable();    // and enable the link
         }                          // so they can try again.
      }
   });
});
</pre></p>
<p>We added those enable() and disable() functions to jQuery &#8212; they just add or remove the <code>disabled</code> attribute from whatever they&#8217;re called on.  But it seems Firefox doesn&#8217;t support <code>disabled</code> on anchor tags, like IE8 does, so we couldn&#8217;t stop the repeat-calls that way.</p>
<p>We got to thinking, what if the link <em>always</em> called its javascript function, but the function could turn itself off after the first call, and back on after a successful ajax post?  That led to this:</p>
<p><pre class="brush: jscript;">
function makeGated(fn) {
   var open = true;
   var gate = {
      open: function() { open = true; }
      shut: function() { open = false; }
   };

   return function() {
      if (open) {
         fn(gate);
      }
   };
}
</pre></p>
<p>makeGated takes your function, and wraps it in another function, a gate function (it &#8220;makes your function a gated function&#8221;).  When you call the function it creates, it will only call your function if the gate is open &#8212; which it is, at first. But then, your function can decide whether to close the gate (that&#8217;s why the gate is passed to your function).  You could use it like this:</p>
<p><pre class="brush: jscript;">
var updateLink = $('#updateLink');  // Find the link.
updateLink.click(
   makeGated(function(gate) {       // When it's clicked...
      gate.shut();                  // shut the gate...
      ajax({
         data: getFormData(),       // ...same as before...
         url: 'http://someWebService',
         success: function(results) {
            if (results.hasErrors) {
               showErrors(results);
               gate.open();  // Open the gate
                             // so they can try again.
            }
         }
      });
   }));
</pre></p>
<p>We dropped this in, and it worked pretty much as expected: you can click all you want, and the update will only fire once; when the update completes, it&#8217;ll turn back on.</p>
<p>The downside? Since it doesn&#8217;t disable the link, the user has no idea what&#8217;s going on.  In fact, since the closed-gate function finishes so quickly, it seems like the button&#8217;s not doing anything at all, which might even make it look broken.</p>
<p>So we chucked it, and hid the links instead. It&#8217;s not as nifty, and it&#8217;s not reusable, but it&#8217;s clear enough for both end-users and programmers who don&#8217;t grok higher-order functions.  Even when you have a nice, flexible language, and can make a sweet little hack, it doesn&#8217;t mean the dumb approach won&#8217;t sometimes win out.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invisibleblocks.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invisibleblocks.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/invisibleblocks.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/invisibleblocks.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/invisibleblocks.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/invisibleblocks.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/invisibleblocks.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/invisibleblocks.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/invisibleblocks.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/invisibleblocks.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/invisibleblocks.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/invisibleblocks.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/invisibleblocks.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/invisibleblocks.wordpress.com/434/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=434&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invisibleblocks.com/2010/07/01/disable-your-links-or-gate-your-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/360300f6962b973dae989991dc204f75?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bonsaigiant</media:title>
		</media:content>
	</item>
		<item>
		<title>Where the Abstraction Leaks: JavaScript&#8217;s Fake Arrays</title>
		<link>http://invisibleblocks.com/2010/06/15/where-the-abstraction-leaks-javascripts-fake-arrays/</link>
		<comments>http://invisibleblocks.com/2010/06/15/where-the-abstraction-leaks-javascripts-fake-arrays/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 16:01:08 +0000</pubDate>
		<dc:creator>Daniel Bernier</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://invisibleblocks.wordpress.com/?p=369</guid>
		<description><![CDATA[Ruby arrays have a nice feature: you can construct a new array with an integer N, and a block, which will be called N times, to fill up the array: I tried to recreate this in JavaScript: Oops! I guess the Array constructor works differently in JavaScript. No worries, we can just call map on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=369&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ruby arrays have a nice feature: you can construct a new array with an integer N, and a block, which will be called N times, to fill up the array:</p>
<p><pre class="brush: ruby;">
Array.new(5) { 'yo' }
# gives:
[&quot;yo&quot;, &quot;yo&quot;, &quot;yo&quot;, &quot;yo&quot;, &quot;yo&quot;]

# Closures, too!
i = 0
Array.new(4) { i = i + 1 }
# gives:
[1, 2, 3, 4]
</pre></p>
<p>I tried to recreate this in JavaScript:</p>
<p><pre class="brush: jscript;">
new Array(5, function() { return &quot;drip&quot;; });
// gives:
[5, function() {
    return &quot;drip&quot;;
}]
</pre></p>
<p>Oops!  I guess the Array constructor works differently in JavaScript.  No worries, we can just call map on the new array.</p>
<p><pre class="brush: jscript;">
new Array(5).map(function() { return &quot;drip&quot;; });
// gives:
[, , , , ]
</pre></p>
<p>&#8230;um, what?  Shouldn&#8217;t that be <code>["drip", "drip", "drip", "drip", "drip"]</code>?  If I call <code>new Array(3)</code>, I should get a brand new array, with 3 slots, all set to <code>undefined</code>; and I should be able to map over it, and fill up the array.</p>
<p>Let&#8217;s see what its elements are:<br />
<pre class="brush: jscript;">
var array = new Array(5);
array[0]; // undefined, as expected
array[1]; // also undefined
</pre></p>
<p>So far, so good.  What arguments are passed to the function?<br />
<pre class="brush: jscript;">
function printAndDrip(arg) {
    print(arg);
    return &quot;drip&quot;;
}
array.map(printAndDrip); // prints nothing, and returns [, , , , ]
</pre></p>
<p>It looks like the <code>printAndDrip</code> function is never being called, almost like the array has no contents.</p>
<p>Let&#8217;s try setting a value manually, <i>then</i> mapping:</p>
<p><pre class="brush: jscript;">
array[2] = &quot;hey there&quot;; // [, , &quot;hey there&quot;, , ], as expected
array.map(printAndDrip);
// prints &quot;hey there&quot;, and returns [, , &quot;drip&quot;, , ]
</pre></p>
<p>So, it only calls the function for values we&#8217;ve manually put there.  Maybe map doesn&#8217;t call the function if the value of a slot is undefined?  I know, I&#8217;m reaching here&#8230;</p>
<p><pre class="brush: jscript;">
array = [1, undefined, 2];
array.map(printAndDrip);

/* prints:
1
undefined
2
then outputs:
[&quot;drip&quot;, &quot;drip&quot;, &quot;drip&quot;]
*/
</pre></p>
<p>So it <i>does</i> call the function for undefined values!  Then why didn&#8217;t it in our newly-created array?</p>
<p>This is when it hit me, and it&#8217;s a funny JavaScript fact that I always forget: JavaScript has fake arrays.</p>
<p>They&#8217;re actually closer to hash tables, whose keys are numbers.  <code>["zero", "one"]</code> is just syntax sugar: it creates an object with two properties, named 0 and 1; 0 points to &#8220;zero&#8221;, and 1 points to &#8220;one&#8221;.  </p>
<p><pre class="brush: jscript;">
// pretty much the same:
var arrayLiteral = [&quot;zero&quot;, &quot;one&quot;];
var objectLiteral = { 0: &quot;zero&quot;, 1: &quot;one&quot; };
</pre></p>
<p>Apparently, if you use the <code>new Array(10)</code> constructor, it creates an array with length 10, but with no named properties.</p>
<p>We can see the properties an object has with the <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object/hasOwnProperty">hasOwnProperty</a> method, so we can use that to test our hypothesis.</p>
<p><pre class="brush: jscript;">
var emptyArray = new Array(10);
emptyArray.hasOwnProperty(0); // false
emptyArray.hasOwnProperty(1); // false

var fullArray = [1,2,3];
fullArray.hasOwnProperty(0); // true
fullArray.hasOwnProperty(1); // true
fullArray.hasOwnProperty(99); // false: gone past the end
</pre></p>
<p>So where does that leave us? Nowhere, really.  At least I&#8217;m a little clearer about JavaScript&#8217;s fake arrays.  Imitating Ruby&#8217;s Array constructor is pretty much out; it&#8217;s easy enough, though a bit unsatisfying, to hand-roll our own:</p>
<p><pre class="brush: jscript;">
Array.filled = function(n, fn) {
    var array = [];
    while(n-- &gt; 0) {
        array.push(fn());
    }
    return array;
}
Array.filled(5, function() { return &quot;drip&quot;; });
// gives:
[&quot;drip&quot;, &quot;drip&quot;, &quot;drip&quot;, &quot;drip&quot;, &quot;drip&quot;]
</pre></p>
<p>Perhaps the folks working on the new JavaScript standards can put in a line-item about initializing Arrays with all the right numbered slots, and that&#8217;ll be unnecessary.</p>
<p><i>While writing this post, I used the <a href="http://www.squarefree.com/shell/shell.html">JavaScript Shell 1.4</a> in FireFox 3.6.3 on Windows 7.  I also redefined <code>Array.prototype.toString</code> to <a href="http://invisibleblocks.wordpress.com/2010/02/02/array-prototype-tostring/">display JavaScript arrays the way you type them</a>.</i></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invisibleblocks.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invisibleblocks.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/invisibleblocks.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/invisibleblocks.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/invisibleblocks.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/invisibleblocks.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/invisibleblocks.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/invisibleblocks.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/invisibleblocks.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/invisibleblocks.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/invisibleblocks.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/invisibleblocks.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/invisibleblocks.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/invisibleblocks.wordpress.com/369/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=369&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invisibleblocks.com/2010/06/15/where-the-abstraction-leaks-javascripts-fake-arrays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/360300f6962b973dae989991dc204f75?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bonsaigiant</media:title>
		</media:content>
	</item>
		<item>
		<title>Array.prototype.toString</title>
		<link>http://invisibleblocks.com/2010/02/02/array-prototype-tostring/</link>
		<comments>http://invisibleblocks.com/2010/02/02/array-prototype-tostring/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 18:27:30 +0000</pubDate>
		<dc:creator>Daniel Bernier</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://invisibleblocks.wordpress.com/?p=366</guid>
		<description><![CDATA[This is one of my favorite javascript tricks, because of its effort-to-payoff ratio. Problem: the default Array.prototype.toString hides any nested structure. Solution: override Array.prototype.toString.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=366&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is one of my favorite javascript tricks, because of its effort-to-payoff ratio.</p>
<p>Problem: the default Array.prototype.toString hides any nested structure.</p>
<p><pre class="brush: jscript;">
[1, 2, 3, 4, 5].toString(); //-&gt; &quot;1, 2, 3, 4, 5&quot;
[1, 2, [3, 4], 5].toString(); //-&gt; &quot;1, 2, 3, 4, 5&quot;
</pre></p>
<p>Solution: override Array.prototype.toString.</p>
<p><pre class="brush: jscript;">
Array.prototype.toString = function() {
    return '[' + this.join(', ') + ']';
};

[1, 2, 3, 4, 5].toString(); //-&gt; &quot;[1, 2, 3, 4, 5]&quot;
[1, 2, [3, 4], 5].toString(); //-&gt; &quot;[1, 2, [3, 4], 5]&quot;
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invisibleblocks.wordpress.com/366/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invisibleblocks.wordpress.com/366/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/invisibleblocks.wordpress.com/366/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/invisibleblocks.wordpress.com/366/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/invisibleblocks.wordpress.com/366/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/invisibleblocks.wordpress.com/366/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/invisibleblocks.wordpress.com/366/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/invisibleblocks.wordpress.com/366/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/invisibleblocks.wordpress.com/366/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/invisibleblocks.wordpress.com/366/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/invisibleblocks.wordpress.com/366/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/invisibleblocks.wordpress.com/366/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/invisibleblocks.wordpress.com/366/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/invisibleblocks.wordpress.com/366/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=366&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invisibleblocks.com/2010/02/02/array-prototype-tostring/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/360300f6962b973dae989991dc204f75?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bonsaigiant</media:title>
		</media:content>
	</item>
		<item>
		<title>Firebug and Monaco, on Windows</title>
		<link>http://invisibleblocks.com/2009/11/20/firebug-and-monaco-on-windows/</link>
		<comments>http://invisibleblocks.com/2009/11/20/firebug-and-monaco-on-windows/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 22:06:45 +0000</pubDate>
		<dc:creator>Daniel Bernier</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Firebug Monaco fonts]]></category>

		<guid isPermaLink="false">http://invisibleblocks.wordpress.com/?p=351</guid>
		<description><![CDATA[I&#8217;ve been running Firebug at work for a long time, it&#8217;s a really solid tool. A while ago, I started using a Monaco.ttf for Windows. I think it looks much better on my Ubuntu system, but it&#8217;s nice to have on Vista. Firebug was apparently written for the Mac, because it uses Monaco all over [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=351&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been running <a href="http://getfirebug.com/">Firebug</a> at work for a long time, it&#8217;s a really solid tool.  A while ago, I started using a <a href="http://www.webdevkungfu.com/textmate-envy-aka-monaco-font-for-windows/">Monaco.ttf for Windows</a>.  I think it looks much better on my Ubuntu system, but it&#8217;s nice to have on Vista.</p>
<p>Firebug was apparently written for the Mac, because it uses Monaco all over the place. That would be very nice, but on Windows, a bold Monaco is a wider Monaco.  This makes the line number gutters uneven, and makes the screen flash when you scroll through text:</p>
<p><a href="http://invisibleblocks.files.wordpress.com/2009/11/firebug-monaco-vista2.gif"><img class="alignnone size-full wp-image-361" title="Firebug and Monaco on Vista" src="http://invisibleblocks.files.wordpress.com/2009/11/firebug-monaco-vista2.gif?w=500" alt=""   /></a></p>
<p>I finally got irritated enough to google it, and I found this <a href="http://toscho.de/2009/schrift-in-firebug-aendern/" target="_blank">post by Thomas Scholz</a> (it&#8217;s in German, here&#8217;s <a href="http://translate.google.com/translate?js=y&amp;prev=_t&amp;hl=en&amp;ie=UTF-8&amp;u=http%3A%2F%2Ftoscho.de%2F2009%2Fschrift-in-firebug-aendern%2F&amp;sl=de&amp;tl=en">Google&#8217;s translation</a>).</p>
<p>The details: Firebug&#8217;s CSS files are located in its extension directory, which is probably someplace like this:</p>
<ul>
<li>Vista: C:\Users\{<strong>USERNAME</strong>}\AppData\Roaming\Mozilla\Firefox\Profiles\{<strong>alphanumerics</strong>}.default\extensions\firebug@software.joehewitt.com\skin\classic</li>
<li>XP: C:\Documents and Settings\{<strong>USERNAME</strong>}\Application Data\Mozilla Firefox\Profiles\extensions\firebug@software.joehewitt.com\skin\classic</li>
</ul>
<p>Search-and-replace the Monaco away, and restart Firefox.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invisibleblocks.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invisibleblocks.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/invisibleblocks.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/invisibleblocks.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/invisibleblocks.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/invisibleblocks.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/invisibleblocks.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/invisibleblocks.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/invisibleblocks.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/invisibleblocks.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/invisibleblocks.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/invisibleblocks.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/invisibleblocks.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/invisibleblocks.wordpress.com/351/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invisibleblocks.com&#038;blog=290283&#038;post=351&#038;subd=invisibleblocks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invisibleblocks.com/2009/11/20/firebug-and-monaco-on-windows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/360300f6962b973dae989991dc204f75?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bonsaigiant</media:title>
		</media:content>

		<media:content url="http://invisibleblocks.files.wordpress.com/2009/11/firebug-monaco-vista2.gif" medium="image">
			<media:title type="html">Firebug and Monaco on Vista</media:title>
		</media:content>
	</item>
	</channel>
</rss>
