<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="en-US">
  <id>tag:notahat.com,2007:posts</id>
  <link type="text/html" rel="alternate" href="http://notahat.com/posts" />
  
  <title>Not A Hat Blog</title>
  <updated>2009-06-03 02:10:24 +1000</updated>
  <author>
    <name>Pete Yandell</name>
    <email>pete@notahat.com</email>
  </author>
  <link rel="self" href="http://feeds.feedburner.com/notahat" type="application/atom+xml" /><entry>
    <id>tag:notahat.com,2007:Post35</id>
    <published>2009-06-03T02:10:24+10:00</published>
    <updated>2009-06-11T10:59:45+10:00</updated>
    <title>Machinist 1.0, now with DataMapper support</title>
    <content type="html">&lt;p&gt;Machinist 1.0 is &lt;a href="http://github.com/notahat/machinist"&gt;now available on GitHub&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;The major feature is &lt;strong&gt;DataMapper support&lt;/strong&gt;. Big thanks to &lt;a href="http://github.com/hassox"&gt;Daniel Neighman&lt;/a&gt; for his help with this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: I wrote up a &lt;a href="http://gist.github.com/124652"&gt;simple example&lt;/a&gt; of how Machinist intelligently handles associations in DataMapper and ActiveRecord.&lt;/p&gt;

&lt;p&gt;You can also now blueprint plain old Ruby objects.&lt;/p&gt;

&lt;p&gt;It's easy to add support for other ORM layers. If you're keen, take a look at &lt;code&gt;lib/machinist/active_record.rb&lt;/code&gt; for a comprehensive example of how it's done.&lt;/p&gt;

&lt;h3&gt;Upgrading&lt;/h3&gt;

&lt;p&gt;If you've installed it as a gem:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo gem update notahat-machinist
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you're using it as a Rails plugin:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;./script/plugin install --force git://github.com/notahat/machinist.git
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Important&lt;/strong&gt;: You now have to require Machinist and Sham in your blueprints.rb:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;require 'machinist/active_record'
require 'sham'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Substitute in data_mapper if that's your weapon of choice.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/notahat/~4/0SI7F4adjFo" height="1" width="1"/&gt;</content>
    <link type="text/html" rel="alternate" href="http://feedproxy.google.com/~r/notahat/~3/0SI7F4adjFo/35" />
  <feedburner:origLink>http://notahat.com/posts/35</feedburner:origLink></entry>
  <entry>
    <id>tag:notahat.com,2007:Post34</id>
    <published>2009-05-08T18:18:26+10:00</published>
    <updated>2009-05-08T18:37:54+10:00</updated>
    <title>Asylum seekers as individuals</title>
    <content type="html">&lt;p&gt;On April 25, the Lady Sandra, an oil rig support ship off Cairns, helped rescue 60 Afghan asylum seekers who arrived in an unseaworthy boat. The Lady Sandra's skipper, exposed to the human side of the issue for the first time, immediately changed his views on boat people. He talks about it eloquently in &lt;a href="http://www.cairns.com.au/article/2009/05/07/41535_local-news.html"&gt;an article from the Cairns Post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Our policy of locking away asylum seekers means it's easy not to think of them as individuals. As a group, they're often portrayed as a threat, or as greedy people wanting to sneak into the country and take our jobs, or somehow undermine our way of life.&lt;/p&gt;

&lt;p&gt;Think about this: What would it take to make you give up all your possessions, leave behind your home, your friends, your family? What would it take to make you risk your life by getting on a crowded, leaky boat, and try to sail half way around the world?&lt;/p&gt;

&lt;p&gt;Would you do it because you wanted a holiday? Would you do it just because you felt you could make more money in another country? Would you do it if you were a terrorist wanting to attack a country?&lt;/p&gt;

&lt;p&gt;No. You'd do it because you felt it was the only alternative. You'd do it because you were desperate, because you feared for your freedom, or your life.&lt;/p&gt;

&lt;p&gt;The vast majority of asylum seekers are people just like us, trying to escape horrendous circumstances. I wish Australia's treatment of them reflected the compassion I feel when I think about that.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/notahat/~4/FihtLMWbbEE" height="1" width="1"/&gt;</content>
    <link type="text/html" rel="alternate" href="http://feedproxy.google.com/~r/notahat/~3/FihtLMWbbEE/34" />
  <feedburner:origLink>http://notahat.com/posts/34</feedburner:origLink></entry>
  <entry>
    <id>tag:notahat.com,2007:Post33</id>
    <published>2009-05-03T13:44:37+10:00</published>
    <updated>2009-05-03T13:45:20+10:00</updated>
    <title>Printing stone and circuits</title>
    <content type="html">&lt;p&gt;More cool developments in personal fabrication: &lt;a href="http://blog.reprap.org/2009/04/first-reprapped-circuit.html"&gt;the RepRap prints its first circuit board&lt;/a&gt;, and some very clever folks have worked out how to make a 3D printer &lt;a href="http://blog.makezine.com/archive/2009/05/3d_printing_goes_back_to_the_stone.html"&gt;print in stone&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/notahat/~4/YeBiWjBVKG8" height="1" width="1"/&gt;</content>
    <link type="text/html" rel="alternate" href="http://feedproxy.google.com/~r/notahat/~3/YeBiWjBVKG8/33" />
  <feedburner:origLink>http://notahat.com/posts/33</feedburner:origLink></entry>
  <entry>
    <id>tag:notahat.com,2007:Post32</id>
    <published>2009-04-03T15:49:38+11:00</published>
    <updated>2009-04-03T15:49:38+11:00</updated>
    <title>Links from my Trampoline talk</title>
    <content type="html">&lt;p&gt;Last weekend, I gave a talk about personal fabrication at &lt;a href="http://trampolinemelb.com/"&gt;Trampoline&lt;/a&gt;. For anybody who was paying attention, here are links to some of the bits and pieces I covered:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://thru-you.com/"&gt;Thru-You&lt;/a&gt; is Kutiman's excellent YouTube music mashup.&lt;/li&gt;
&lt;li&gt;Stan Swan &lt;a href="http://www.usbwifi.orconhosting.net.nz/"&gt;uses woks to extend wifi range&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;a href="http://www.googlelunarxprize.org/"&gt;Google Lunar X Prize&lt;/a&gt; is offering $30 million to the first privately funded team to land a rover on the moon, drive it 500m, and send back pictures.&lt;/li&gt;
&lt;li&gt;Neil Gershenfeld is behind &lt;a href="http://fab.cba.mit.edu/"&gt;Fab Labs&lt;/a&gt;, MIT's effort to let anybody build anything. He gave a good &lt;a href="http://www.ted.com/index.php/talks/neil_gershenfeld_on_fab_labs.html"&gt;TED talk about it&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;a href="http://reprap.org/bin/view/Main/WebHome"&gt;RepRap&lt;/a&gt; is an open-source 3D printer that can print 60% of its own parts.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Polycaprolactone"&gt;Polycaprolactone&lt;/a&gt; is the funky plastic that becomes mouldable in hot water. The RepRap can print with it.&lt;/li&gt;
&lt;li&gt;The anecdote about the kid looking for the mouse comes from a fabulous Clay Shirky talk: &lt;a href="http://www.youtube.com/watch?v=AyoNHIl-QLQ"&gt;part 1&lt;/a&gt; and &lt;a href="http://www.youtube.com/watch?v=jNCblGv0zjU"&gt;part 2&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/notahat/~4/WFGOXfZ8O88" height="1" width="1"/&gt;</content>
    <link type="text/html" rel="alternate" href="http://feedproxy.google.com/~r/notahat/~3/WFGOXfZ8O88/32" />
  <feedburner:origLink>http://notahat.com/posts/32</feedburner:origLink></entry>
  <entry>
    <id>tag:notahat.com,2007:Post31</id>
    <published>2009-02-05T14:37:30+11:00</published>
    <updated>2009-02-05T14:37:30+11:00</updated>
    <title>Machinist and Rails controller tests</title>
    <content type="html">&lt;style&gt;pre .normal {}
pre .comment { color: #005; }
pre .keyword { color: #A00; }
pre .method { color: #077; }
pre .class { color: #074; }
pre .module { color: #050; }
pre .punct { color: #447; }
pre .symbol { color: #099; }
pre .string { color: #944; }
pre .char { color: #F07; }
pre .ident { color: #004; }
pre .constant { color: #07F; }
pre .regex { color: #B66; }
pre .number { color: #D55; }
pre .attribute { color: #377; }
pre .global { color: #3B7; }
pre .expr { color: #227; }
&lt;/style&gt;&lt;p&gt;&lt;a href="http://github.com/notahat/machinist/tree/master"&gt;Machinist&lt;/a&gt;, my test-data generation plugin for Rails, has just gained some features that make it useful for controller tests. You can now do things like:&lt;/p&gt;

&lt;pre&gt;
&lt;span class="ident"&gt;test&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;should create post&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt;
  &lt;span class="ident"&gt;assert_difference&lt;/span&gt;&lt;span class="punct"&gt;('&lt;/span&gt;&lt;span class="string"&gt;Post.count&lt;/span&gt;&lt;span class="punct"&gt;')&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt;
    &lt;span class="ident"&gt;post&lt;/span&gt; &lt;span class="symbol"&gt;:create&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="symbol"&gt;:post&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="constant"&gt;Post&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;plan&lt;/span&gt;
  &lt;span class="keyword"&gt;end&lt;/span&gt;
  &lt;span class="ident"&gt;assert_redirected_to&lt;/span&gt; &lt;span class="ident"&gt;post_path&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;assigns&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="symbol"&gt;:post&lt;/span&gt;&lt;span class="punct"&gt;))&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;You an also call plan on ActiveRecord associations, making it easy to test nested controllers:&lt;/p&gt;

&lt;pre&gt;
&lt;span class="ident"&gt;test&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;should create comment&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt;
  &lt;span class="ident"&gt;post&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;Post&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;make&lt;/span&gt;
  &lt;span class="ident"&gt;assert_difference&lt;/span&gt;&lt;span class="punct"&gt;('&lt;/span&gt;&lt;span class="string"&gt;Comment.count&lt;/span&gt;&lt;span class="punct"&gt;')&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt;
    &lt;span class="ident"&gt;post&lt;/span&gt; &lt;span class="symbol"&gt;:create&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="symbol"&gt;:post_id&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="ident"&gt;post&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;id&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="symbol"&gt;:comment&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="ident"&gt;post&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;comments&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;plan&lt;/span&gt;
  &lt;span class="keyword"&gt;end&lt;/span&gt;
  &lt;span class="ident"&gt;assert_redirected_to&lt;/span&gt; &lt;span class="ident"&gt;post_comment_path&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;post&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="ident"&gt;assigns&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="symbol"&gt;:comment&lt;/span&gt;&lt;span class="punct"&gt;))&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/notahat/~4/CoPVV0n_rSU" height="1" width="1"/&gt;</content>
    <link type="text/html" rel="alternate" href="http://feedproxy.google.com/~r/notahat/~3/CoPVV0n_rSU/31" />
  <feedburner:origLink>http://notahat.com/posts/31</feedburner:origLink></entry>
</feed>
