<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<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/"
	>

<channel>
	<title>sick.snusnu.info</title>
	<link>http://sick.snusnu.info</link>
	<description></description>
	<pubDate>Wed, 10 Dec 2008 12:09:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>default ordering with datamapper</title>
		<link>http://sick.snusnu.info/2008/12/10/default-ordering-with-datamapper/</link>
		<comments>http://sick.snusnu.info/2008/12/10/default-ordering-with-datamapper/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 12:09:08 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/12/10/default-ordering-with-datamapper/</guid>
		<description><![CDATA[Thanks to Adam French for this tip on the datamapper mailinglist.
You&#8217;d essentially be update&#8217;ing the default query object that all
calls to all() and first() start off with before applying the user&#8217;s
parameters

class Post
 include DataMapper::Resource
 #... other properties here
 default_scope(:default).update(:order =&#62; [:created_at.desc])
end
]]></description>
			<content:encoded><![CDATA[<p>Thanks to Adam French for this tip on the <a href="http://datamapper.org/doku.php?id=docs">datamapper</a> <a href="http://groups.google.com/group/datamapper">mailinglist</a>.</p>
<blockquote><p>You&#8217;d essentially be update&#8217;ing the default query object that all<br />
calls to all() and first() start off with before applying the user&#8217;s<br />
parameters</p></blockquote>
<pre name="code" class="ruby">
class Post
 include DataMapper::Resource
 #... other properties here
 default_scope(:default).update(:order =&gt; [:created_at.desc])
end</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/12/10/default-ordering-with-datamapper/feed/</wfw:commentRss>
		</item>
		<item>
		<title>datamapper stand alone script (for bugreports)</title>
		<link>http://sick.snusnu.info/2008/12/10/datamapper-stand-alone-script-for-bugreports/</link>
		<comments>http://sick.snusnu.info/2008/12/10/datamapper-stand-alone-script-for-bugreports/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 23:50:07 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/12/10/datamapper-stand-alone-script-for-bugreports/</guid>
		<description><![CDATA[
#!/usr/bin/env ruby

require 'rubygems'

gem 'dm-core', '~&#62;0.9.8'
require 'dm-core'

DataMapper::Logger.new(STDOUT, :debug)
# DataObjects::Sqlite3.logger = DataObjects::Logger.new(STDOUT, :debug)

DataMapper.setup(:default, 'sqlite3::memory:')

# here come the demo class(es)

DataMapper.auto_migrate!

# here comes initial creation of records if necessary

puts '-' * 80

# here comes the demo code demonstrating the error or whatever
]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
#!/usr/bin/env ruby

require 'rubygems'

gem 'dm-core', '~&gt;0.9.8'
require 'dm-core'

DataMapper::Logger.new(STDOUT, :debug)
# DataObjects::Sqlite3.logger = DataObjects::Logger.new(STDOUT, :debug)

DataMapper.setup(:default, 'sqlite3::memory:')

# here come the demo class(es)

DataMapper.auto_migrate!

# here comes initial creation of records if necessary

puts '-' * 80

# here comes the demo code demonstrating the error or whatever</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/12/10/datamapper-stand-alone-script-for-bugreports/feed/</wfw:commentRss>
		</item>
		<item>
		<title>relevant merb / datamapper ticket information</title>
		<link>http://sick.snusnu.info/2008/12/02/relevant-merb-datamapper-ticket-information/</link>
		<comments>http://sick.snusnu.info/2008/12/02/relevant-merb-datamapper-ticket-information/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 17:14:27 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[merb]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/12/02/relevant-merb-datamapper-ticket-information/</guid>
		<description><![CDATA[When filing a ticket for merb or datamapper, it&#8217;s a good idea to put the following information into the ticket
(Suggested by Dan Kubb - dkubb in #datamapper)

uname -a (for unixes at least)
ruby --version
mysql --version (or the equivalent for your db)
gem list '\A(?:(?:d[mo]&#124;merb)[_-]&#124;data_?(?:mapper&#124;objects)&#124;extlib)'

]]></description>
			<content:encoded><![CDATA[<p>When filing a ticket for <a href="http://merbivore.com">merb</a> or <a href="http://datamapper.org/doku.php">datamapper</a>, it&#8217;s a good idea to put the following information into the ticket<br />
(Suggested by Dan Kubb - dkubb in #datamapper)</p>
<pre>
uname -a (for unixes at least)
ruby --version
mysql --version (or the equivalent for your db)
gem list '\A(?:(?:d[mo]|merb)[_-]|data_?(?:mapper|objects)|extlib)'
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/12/02/relevant-merb-datamapper-ticket-information/feed/</wfw:commentRss>
		</item>
		<item>
		<title>merb_resource_controller now supports nested (singleton) resources</title>
		<link>http://sick.snusnu.info/2008/11/27/merb_resource_controller-now-supports-nested-singleton-resources/</link>
		<comments>http://sick.snusnu.info/2008/11/27/merb_resource_controller-now-supports-nested-singleton-resources/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 02:42:05 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[merb]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/11/27/merb_resource_controller-now-supports-nested-singleton-resources/</guid>
		<description><![CDATA[merb_resource_controller is a merb plugin that provides the default CRUD actions for controllers and allows for easy customization of the generated actions. You might have already heard of or used one of its counterparts in rails world, like make_resourceful, James Golick&#8217;s resource_controller, Ian White&#8217;s resources_controller or other projects on github. Thx a lot for the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/snusnu/merb_resource_controller/tree/master" title="merb_resource_controller" target="_blank">merb_resource_controller</a> is a <a href="http://merbivore.com" target="_blank" title="merb">merb</a> plugin that provides the default <a href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete" title="CRUD" target="_blank"><code>CRUD</code></a> actions for controllers and allows for easy customization of the generated actions. You might have already heard of or used one of its counterparts in <a href="http://rubyonrails.org/" title="rails" target="_blank">rails</a> world, like <a href="http://mr.hamptoncatlin.com/" target="_blank" title="make_resourceful">make_resourceful</a>, <a href="http://jamesgolick.com/resource_controller" target="_blank" title="James Golick's resource_controller">James Golick&#8217;s resource_controller</a>, <a href="http://plugins.ardes.com/doc/resources_controller/" title="Ian White's resources_controller" target="_blank">Ian White&#8217;s resources_controller</a> or other <a href="http://github.com/search?q=resource_controller" target="_blank" title="other projects on github">projects on github</a>. Thx a lot for the inspiration guys!</p>
<p>As it so happens, today <a href="http://github.com/snusnu/merb_resource_controller/tree/master" title="merb_resource_controller" target="_blank">merb_resource_controller</a> learned to work with arbitrarily nested (singleton) resources AND got a massive README update :-)</p>
<p>So if you are a  <a href="http://merbivore.com" target="_blank" title="merb">merbivore</a> you should really check it out and give me feedback!</p>
<p>What&#8217;s left to say? I say let the code do the talking &#8230;</p>
<pre name="code" class="ruby">
class Articles &lt; Application
  controlling :articles
end</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/11/27/merb_resource_controller-now-supports-nested-singleton-resources/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to uninstall datamapper (or any rubygem)</title>
		<link>http://sick.snusnu.info/2008/11/19/how-to-uninstall-datamapper-or-any-rubygem/</link>
		<comments>http://sick.snusnu.info/2008/11/19/how-to-uninstall-datamapper-or-any-rubygem/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 14:09:13 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[ruby gem datamapper]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/11/19/how-to-uninstall-datamapper-or-any-rubygem/</guid>
		<description><![CDATA[gem list dm --no-version &#124; xargs sudo gem uninstall -a -x
gem list data --no-version &#124; xargs sudo gem uninstall -a -x
gem list do_ --no-version &#124; xargs sudo gem uninstall -a -x
]]></description>
			<content:encoded><![CDATA[<p><code>gem list dm --no-version | xargs sudo gem uninstall -a -x<br />
gem list data --no-version | xargs sudo gem uninstall -a -x<br />
gem list do_ --no-version | xargs sudo gem uninstall -a -x</code></p>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/11/19/how-to-uninstall-datamapper-or-any-rubygem/feed/</wfw:commentRss>
		</item>
		<item>
		<title>fun with merb -i and dm-sweatshop</title>
		<link>http://sick.snusnu.info/2008/11/14/sweatshop-fun-in-merb-i/</link>
		<comments>http://sick.snusnu.info/2008/11/14/sweatshop-fun-in-merb-i/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 15:05:53 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[dm-sweatshop]]></category>

		<category><![CDATA[merb]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/11/14/sweatshop-fun-in-merb-i/</guid>
		<description><![CDATA[
# in spec/fixtures.rb
# of course these are just examples of what the content could look like
User.fix {{
  :login =&#62; /\w+/.gen,
  :password =&#62; (password = /\w{12}/.gen),
  :password_confirmation =&#62; password
}}

GeoPoint.fix {{
  :lat =&#62; BigDecimal.new((rand * 180 -  90).to_s),
  :lng =&#62; BigDecimal.new((rand * 360 - 180).to_s),
}}

Location.fix {{
  :geo_point =&#62; unique { [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
# in spec/fixtures.rb
# of course these are just examples of what the content could look like
User.fix {{
  :login =&gt; /\w+/.gen,
  :password =&gt; (password = /\w{12}/.gen),
  :password_confirmation =&gt; password
}}

GeoPoint.fix {{
  :lat =&gt; BigDecimal.new((rand * 180 -  90).to_s),
  :lng =&gt; BigDecimal.new((rand * 360 - 180).to_s),
}}

Location.fix {{
  :geo_point =&gt; unique { GeoPoint.gen },
  :name =&gt; /\w+/.gen,
  :short_description =&gt; /\w+/.gen,
  :long_description =&gt; /\w+/.gen,
  :address =&gt; /\w+/.gen
}}

20.times { Location.gen }

# in config/init.rb
Merb::BootLoader.after_app_loads do

  # This will get executed after your app's classes have been loaded.

  if Merb.env == "development"
    # allows for easy playin around in merb -i
    # dm-sweatshop will provide enough data for that
    require Merb.root / "spec" / "spec_fixtures"
  end

end</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/11/14/sweatshop-fun-in-merb-i/feed/</wfw:commentRss>
		</item>
		<item>
		<title>running system commands with ruby</title>
		<link>http://sick.snusnu.info/2008/10/18/running-system-commands-with-ruby/</link>
		<comments>http://sick.snusnu.info/2008/10/18/running-system-commands-with-ruby/#comments</comments>
		<pubDate>Sat, 18 Oct 2008 19:18:56 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/10/18/running-system-commands-with-ruby/</guid>
		<description><![CDATA[
# notice the backticks
`git config --global user.email`
]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
# notice the backticks
`git config --global user.email`</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/10/18/running-system-commands-with-ruby/feed/</wfw:commentRss>
		</item>
		<item>
		<title>support for speccing datamapper models with rspec</title>
		<link>http://sick.snusnu.info/2008/10/10/support-for-speccing-datamapper-models-with-rspec/</link>
		<comments>http://sick.snusnu.info/2008/10/10/support-for-speccing-datamapper-models-with-rspec/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 15:44:56 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[rspec]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/10/10/support-for-speccing-datamapper-models-with-rspec/</guid>
		<description><![CDATA[
# Put this in spec_helper.rb
module SpecSupport

  def self.unload_class(*classes)
    classes.each do &#124;c&#124;
      Object.send(:remove_const, c) if Object.const_defined?(c)
    end
  end

  def self.fresh_class(name, superclass = nil, &#038;block)
    unload_class(name)
    args = superclass ? [ superclass ] : []
   [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
# Put this in spec_helper.rb
module SpecSupport

  def self.unload_class(*classes)
    classes.each do |c|
      Object.send(:remove_const, c) if Object.const_defined?(c)
    end
  end

  def self.fresh_class(name, superclass = nil, &#038;block)
    unload_class(name)
    args = superclass ? [ superclass ] : []
    Object.const_set(name, Class.new(*args))
    Object.const_get(name).class_eval(&#038;block)
  end

  def self.fresh_model(name)
    fresh_class(name) do
      include DataMapper::Resource
      property :id,         DataMapper::Types::Serial
      property :created_at, DateTime
      property :updated_at, DateTime
    end
  end

end</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/10/10/support-for-speccing-datamapper-models-with-rspec/feed/</wfw:commentRss>
		</item>
		<item>
		<title>dm-is-protectable</title>
		<link>http://sick.snusnu.info/2008/10/10/dm-is-protectable/</link>
		<comments>http://sick.snusnu.info/2008/10/10/dm-is-protectable/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 00:45:03 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/10/10/dm-is-protectable/</guid>
		<description><![CDATA[I just released dm-is-protectable which is an attempt to make it easier for datamapper users on merb or on rails to implement permission checking in their models, instead of in their controller.s Yes, I know that sounds weird! but too many permission checks are done solely in controllers these days &#8230;
]]></description>
			<content:encoded><![CDATA[<p>I just released <a href="http://github.com/snusnu/dm-is-protectable/tree/master">dm-is-protectable</a> which is an attempt to make it easier for <a href="http://datamapper.org/">datamapper</a> users on <a href="http://merbivore.com/">merb</a> or on <a href="http://rubyonrails.org/">rails</a> to implement permission checking in their models, instead of in their controller.s <em>Yes, I know that sounds weird!</em> but too many permission checks are done solely in controllers these days &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/10/10/dm-is-protectable/feed/</wfw:commentRss>
		</item>
		<item>
		<title>debugging the call stack using puts and caller in ruby</title>
		<link>http://sick.snusnu.info/2008/10/09/debugging-the-call-stack-using-puts-and-caller-in-ruby/</link>
		<comments>http://sick.snusnu.info/2008/10/09/debugging-the-call-stack-using-puts-and-caller-in-ruby/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 15:28:05 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/10/09/debugging-the-call-stack-using-puts-and-caller-in-ruby/</guid>
		<description><![CDATA[

# call this anywhere inside a method
# it will print out the call stack for the current execution
# play with the numbers to narrow down the area of interest

def print_call_stack(method_name, from, to)
  from.upto(to) { &#124;i&#124; p "#{method_name}[#{i}]: #{caller[i]}" }
end

]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">

# call this anywhere inside a method
# it will print out the call stack for the current execution
# play with the numbers to narrow down the area of interest

def print_call_stack(method_name, from, to)
  from.upto(to) { |i| p "#{method_name}[#{i}]: #{caller[i]}" }
end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/10/09/debugging-the-call-stack-using-puts-and-caller-in-ruby/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ruby aliasing</title>
		<link>http://sick.snusnu.info/2008/09/30/ruby-aliasing/</link>
		<comments>http://sick.snusnu.info/2008/09/30/ruby-aliasing/#comments</comments>
		<pubDate>Tue, 30 Sep 2008 19:27:50 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[irb]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/09/30/ruby-aliasing/</guid>
		<description><![CDATA[
irb(main):001:0&#62; class Foo
irb(main):002:1&#62;   alias model class
irb(main):003:1&#62;   def bar
irb(main):004:2&#62;     p self.model
irb(main):005:2&#62;   end
irb(main):006:1&#62;   def baz
irb(main):007:2&#62;     p model
irb(main):008:2&#62;   end
irb(main):009:1&#62;   def self.bam
irb(main):010:2&#62;     p model
irb(main):011:2&#62;   end
irb(main):012:1&#62; end
=&#62; nil
irb(main):013:0&#62; f = Foo.new
=&#62; #
irb(main):014:0&#62; f.bar
Foo
=&#62; nil
irb(main):015:0&#62; [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
irb(main):001:0&gt; class Foo
irb(main):002:1&gt;   alias model class
irb(main):003:1&gt;   def bar
irb(main):004:2&gt;     p self.model
irb(main):005:2&gt;   end
irb(main):006:1&gt;   def baz
irb(main):007:2&gt;     p model
irb(main):008:2&gt;   end
irb(main):009:1&gt;   def self.bam
irb(main):010:2&gt;     p model
irb(main):011:2&gt;   end
irb(main):012:1&gt; end
=&gt; nil
irb(main):013:0&gt; f = Foo.new
=&gt; #<foo:0x5d23c>
irb(main):014:0&gt; f.bar
Foo
=&gt; nil
irb(main):015:0&gt; f.baz
Foo
=&gt; nil
irb(main):016:0&gt; Foo.bam
NameError: undefined local variable or method `model&#8217; for Foo:Class
        from (irb):10:in `bam&#8217;
        from (irb):16
        from :0
</foo:0x5d23c>
irb(main):017:0> Foo.model
NoMethodError: undefined method `model&#8217; for Foo:Class
        from (irb):17
        from :0
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/09/30/ruby-aliasing/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Thread local variables in ruby</title>
		<link>http://sick.snusnu.info/2008/09/29/thread-local-variables-in-ruby/</link>
		<comments>http://sick.snusnu.info/2008/09/29/thread-local-variables-in-ruby/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 11:36:14 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[concurrency]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/09/29/thread-local-variables-in-ruby/</guid>
		<description><![CDATA[The following is taken from the Pickaxe
 As we described in the previous section, a thread can normally access any variables that are in scope when the thread is created. Variables local to the block of a thread are local to the thread, and are not shared.But what if you need per-thread variables that can [...]]]></description>
			<content:encoded><![CDATA[<p>The following is taken from the <a href="http://www.rubycentral.com/pickaxe/tut_threads.html">Pickaxe</a></p>
<blockquote><p> As we described in the previous section, a thread can normally <em>access any variables that are in scope when the thread is created</em>. Variables local to the block of a thread are local to the thread, and are not shared.But what if you need per-thread variables that can be accessed by other threads &#8212; including the main thread? <code>Thread</code> features a special facility that allows thread-local variables to be created and accessed by name. You simply treat the thread object as if it were a <code>Hash</code>, writing to elements using <code>[]=</code> and reading them back using <code>[]</code>.</p></blockquote>
<pre name="code" class="ruby">
Thread.current[:thread_local_var] = :foo
Thread.current[:thread_local_var] # prints foo</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/09/29/thread-local-variables-in-ruby/feed/</wfw:commentRss>
		</item>
		<item>
		<title>class and module order relation in ruby</title>
		<link>http://sick.snusnu.info/2008/09/29/class-and-module-order-relation-in-ruby/</link>
		<comments>http://sick.snusnu.info/2008/09/29/class-and-module-order-relation-in-ruby/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 23:15:51 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[irb]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/09/29/class-and-module-order-relation-in-ruby/</guid>
		<description><![CDATA[
irb(main):001:0&#62; class Stone
irb(main):002:1&#62; end
=&#62; nil
irb(main):003:0&#62;
irb(main):004:0* module Alive
irb(main):005:1&#62;   # superset
irb(main):006:1* end
=&#62; nil
irb(main):007:0&#62;
irb(main):008:0* class Reptile
irb(main):009:1&#62;   # subset of alive creatures
irb(main):010:1*   include Alive
irb(main):011:1&#62; end
=&#62; Reptile
irb(main):012:0&#62;
irb(main):013:0* class Mammal
irb(main):014:1&#62;   # subset of alive creatures
irb(main):015:1*   include Alive
irb(main):016:1&#62; end
=&#62; Mammal
irb(main):017:0&#62;
irb(main):018:0* class Dolphin &#60; Mammal
irb(main):019:1&#62;   # subset of alive creatures
irb(main):020:1* end
=&#62; [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
irb(main):001:0&gt; class Stone
irb(main):002:1&gt; end
=&gt; nil
irb(main):003:0&gt;
irb(main):004:0* module Alive
irb(main):005:1&gt;   # superset
irb(main):006:1* end
=&gt; nil
irb(main):007:0&gt;
irb(main):008:0* class Reptile
irb(main):009:1&gt;   # subset of alive creatures
irb(main):010:1*   include Alive
irb(main):011:1&gt; end
=&gt; Reptile
irb(main):012:0&gt;
irb(main):013:0* class Mammal
irb(main):014:1&gt;   # subset of alive creatures
irb(main):015:1*   include Alive
irb(main):016:1&gt; end
=&gt; Mammal
irb(main):017:0&gt;
irb(main):018:0* class Dolphin &lt; Mammal
irb(main):019:1&gt;   # subset of alive creatures
irb(main):020:1* end
=&gt; nil
irb(main):021:0&gt;
irb(main):022:0* Alive &gt; Stone
=&gt; nil
irb(main):023:0&gt; Alive &gt; Reptile
=&gt; true
irb(main):024:0&gt; Alive &gt; Mammal
=&gt; true
irb(main):025:0&gt; Alive &gt; Dolphin
=&gt; true
irb(main):026:0&gt;
irb(main):027:0* Stone   &lt; Alive
=&gt; nil
irb(main):028:0&gt; Reptile &lt; Alive
=&gt; true
irb(main):029:0&gt; Mammal  &lt; Alive
=&gt; true
irb(main):030:0&gt; Dolphin &lt; Alive
=&gt; true
irb(main):031:0&gt;
irb(main):032:0* Dolphin &lt; Mammal
=&gt; true
irb(main):033:0&gt; Mammal &gt; Dolphin
=&gt; true
irb(main):034:0&gt;
irb(main):035:0* Dolphin &gt; Mammal
=&gt; false
irb(main):036:0&gt; Mammal &lt; Dolphin
=&gt; false
irb(main):037:0&gt;
irb(main):038:0* Reptile &gt; Mammal # unrelated creatures
=&gt; nil
irb(main):039:0&gt; Reptile &lt; Mammal # unrelated creatures
=&gt; nil
irb(main):040:0&gt; Mammal &lt; Reptile # unrelated creatures
=&gt; nil
irb(main):041:0&gt; Mammal &gt; Reptile # unrelated creatures
=&gt; nil</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/09/29/class-and-module-order-relation-in-ruby/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Patterns for require (3)</title>
		<link>http://sick.snusnu.info/2008/09/25/patterns-for-require-3/</link>
		<comments>http://sick.snusnu.info/2008/09/25/patterns-for-require-3/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 17:50:30 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[idioms]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/09/25/patterns-for-require-3/</guid>
		<description><![CDATA[
dir = File.dirname(__FILE__)
require dir + '/core_ext'
require dir + '/randexp/parser'
require dir + '/randexp/reducer'
require dir + '/randexp/dictionary'
require dir + '/randgen'
require dir + '/wordlists/real_name'
]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
dir = File.dirname(__FILE__)
require dir + '/core_ext'
require dir + '/randexp/parser'
require dir + '/randexp/reducer'
require dir + '/randexp/dictionary'
require dir + '/randgen'
require dir + '/wordlists/real_name'</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/09/25/patterns-for-require-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>exceptions in ruby method, class and module definitions</title>
		<link>http://sick.snusnu.info/2008/09/21/exceptions-in-ruby-class-and-module-definitions/</link>
		<comments>http://sick.snusnu.info/2008/09/21/exceptions-in-ruby-class-and-module-definitions/#comments</comments>
		<pubDate>Sun, 21 Sep 2008 15:51:30 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/?p=153</guid>
		<description><![CDATA[taken from The Book Of Ruby

def calc
  result = 1/0
rescue Exception =&#62; e
  puts( e.class )
  puts( e )
  result = nil
  return result
end 

class X
  @@x = 1/0
rescue Exception =&#62; e
  puts( e.class )
  puts( e )
end 

module Y
  @@x = 1/0
rescue Exception =&#62; e
 [...]]]></description>
			<content:encoded><![CDATA[<p>taken from <a href="http://www.sapphiresteel.com/The-Book-Of-Ruby">The Book Of Ruby</a></p>
<pre name="code" class="ruby">
def calc
  result = 1/0
rescue Exception =&gt; e
  puts( e.class )
  puts( e )
  result = nil
  return result
end 

class X
  @@x = 1/0
rescue Exception =&gt; e
  puts( e.class )
  puts( e )
end 

module Y
  @@x = 1/0
rescue Exception =&gt; e
  puts( e.class )
  puts( e )
end</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/09/21/exceptions-in-ruby-class-and-module-definitions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>methods on a module&#8217;s singleton class</title>
		<link>http://sick.snusnu.info/2008/08/05/methods-on-a-modules-singleton/</link>
		<comments>http://sick.snusnu.info/2008/08/05/methods-on-a-modules-singleton/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 12:19:00 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[irb]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/?p=5</guid>
		<description><![CDATA[
irb(main):001:0&#62; module M
irb(main):002:1&#62;   class &#60;&#60; self
irb(main):003:2&#62;     def foo
irb(main):004:3&#62;       p "Hello from M.foo"
irb(main):005:3&#62;     end
irb(main):006:2&#62;   end
irb(main):007:1&#62; end
=&#62; nil
irb(main):008:0&#62; M.foo
"Hello from M.foo"
=&#62; nil
irb(main):009:0&#62;

irb(main):001:0&#62; m = Module.new
=&#62; #
irb(main):002:0&#62; m.foo
NoMethodError: undefined method `foo&#8217; for #
from (irb):2
irb(main):003:0&#62; class &#60;&#60; m
irb(main):004:1&#62;   def [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
irb(main):001:0&gt; module M
irb(main):002:1&gt;   class &lt;&lt; self
irb(main):003:2&gt;     def foo
irb(main):004:3&gt;       p "Hello from M.foo"
irb(main):005:3&gt;     end
irb(main):006:2&gt;   end
irb(main):007:1&gt; end
=&gt; nil
irb(main):008:0&gt; M.foo
"Hello from M.foo"
=&gt; nil
irb(main):009:0&gt;

irb(main):001:0&gt; m = Module.new
=&gt; #<module:0x19bcc>
irb(main):002:0&gt; m.foo
NoMethodError: undefined method `foo&#8217; for #<module:0x19bcc>
from (irb):2
irb(main):003:0&gt; class &lt;&lt; m
irb(main):004:1&gt;   def foo
irb(main):005:2&gt;     &#8220;Hello from m.foo&#8221;
irb(main):006:2&gt;   end
irb(main):007:1&gt; end
=&gt; nil
irb(main):008:0&gt; m.foo
=&gt; &#8220;Hello from m.foo&#8221;
</module:0x19bcc>
</module:0x19bcc></pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/08/05/methods-on-a-modules-singleton/feed/</wfw:commentRss>
		</item>
		<item>
		<title>search plugin for rails</title>
		<link>http://sick.snusnu.info/2008/07/10/restful_search-plugin-for-rails/</link>
		<comments>http://sick.snusnu.info/2008/07/10/restful_search-plugin-for-rails/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 00:25:00 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[rails plugins]]></category>

		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/?p=6</guid>
		<description><![CDATA[
# USAGE EXAMPLE
# -----------------------------------------------------------
# class PostsController &#60; ApplicationController
#   restful_search do &#124;s&#124;
#     s.model = :foo
#     s.search_param_name = "search" # defaults to 'match'
#     s.columns = [ 'foo.name', 'bar.state', 'baz.comment' ],
#     s.joins = [ :foo =&#62; { :bar =&#62; :baz [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
# USAGE EXAMPLE
# -----------------------------------------------------------
# class PostsController &lt; ApplicationController
#   restful_search do |s|
#     s.model = :foo
#     s.search_param_name = "search" # defaults to 'match'
#     s.columns = [ 'foo.name', 'bar.state', 'baz.comment' ],
#     s.joins = [ :foo =&gt; { :bar =&gt; :baz } ],
#   end
#
#   def index
#     @posts = restful_search_results
#   end
# end
# -----------------------------------------------------------</pre>
<p> <a href="http://sick.snusnu.info/2008/07/10/restful_search-plugin-for-rails/#more-6" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/07/10/restful_search-plugin-for-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>integer range collection_select form helper</title>
		<link>http://sick.snusnu.info/2008/07/09/integer-range-collection_select/</link>
		<comments>http://sick.snusnu.info/2008/07/09/integer-range-collection_select/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 19:23:00 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[rails views]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/?p=7</guid>
		<description><![CDATA[
&#60;%= f.collection_select :priority, (1..5), :to_i, :to_i %&#62;
]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
&lt;%= f.collection_select :priority, (1..5), :to_i, :to_i %&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/07/09/integer-range-collection_select/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ruby statement modifier local variables</title>
		<link>http://sick.snusnu.info/2008/07/08/ruby-statement-modifier-local-v/</link>
		<comments>http://sick.snusnu.info/2008/07/08/ruby-statement-modifier-local-v/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 17:28:00 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[irb]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/?p=8</guid>
		<description><![CDATA[
irb(main):001:0&#62; puts foo if foo = "foo"
(irb):1: warning: found = in conditional, should be ==
NameError: undefined local variable or method `foo' for main:Object
from (irb):1

irb(main):002:0&#62; puts foo if(foo = "foo")
(irb):2: warning: found = in conditional, should be ==
foo
=&#62; nil
irb(main):003:0&#62;
]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
irb(main):001:0&gt; puts foo if foo = "foo"
(irb):1: warning: found = in conditional, should be ==
NameError: undefined local variable or method `foo' for main:Object
from (irb):1

irb(main):002:0&gt; puts foo if(foo = "foo")
(irb):2: warning: found = in conditional, should be ==
foo
=&gt; nil
irb(main):003:0&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/07/08/ruby-statement-modifier-local-v/feed/</wfw:commentRss>
		</item>
		<item>
		<title>sex spam</title>
		<link>http://sick.snusnu.info/2008/07/02/quotneed-a-mighty-wang-to-bri/</link>
		<comments>http://sick.snusnu.info/2008/07/02/quotneed-a-mighty-wang-to-bri/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 15:48:00 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[sex spam]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/?p=10</guid>
		<description><![CDATA[
&#8220;Need a mighty wang to bring out your greatest bang?&#8221; &#8212; sorrapac@margulius.com

]]></description>
			<content:encoded><![CDATA[<blockquote><p>
&#8220;Need a mighty wang to bring out your greatest bang?&#8221; &#8212; sorrapac@margulius.com
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/07/02/quotneed-a-mighty-wang-to-bri/feed/</wfw:commentRss>
		</item>
		<item>
		<title>creating a tar.gz archive</title>
		<link>http://sick.snusnu.info/2008/06/24/creating-a-targz-archive/</link>
		<comments>http://sick.snusnu.info/2008/06/24/creating-a-targz-archive/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 16:45:00 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/?p=11</guid>
		<description><![CDATA[
tar -pczf name_of_your_archive.tar.gz /path/to/directory

]]></description>
			<content:encoded><![CDATA[<pre>
tar -pczf name_of_your_archive.tar.gz /path/to/directory
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/06/24/creating-a-targz-archive/feed/</wfw:commentRss>
		</item>
		<item>
		<title>truncating files to zero length in the bash shell</title>
		<link>http://sick.snusnu.info/2008/06/24/truncating-files-to-zero-length/</link>
		<comments>http://sick.snusnu.info/2008/06/24/truncating-files-to-zero-length/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 22:34:00 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[bash]]></category>

		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/?p=12</guid>
		<description><![CDATA[
&#62; some_file.ext
]]></description>
			<content:encoded><![CDATA[<pre>
&gt; some_file.ext</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/06/24/truncating-files-to-zero-length/feed/</wfw:commentRss>
		</item>
		<item>
		<title>calling named_scope in a loop doesn&#8217;t seem to work in rails 2.1.0 ?</title>
		<link>http://sick.snusnu.info/2008/06/20/calling-named_scope-in-a-loop-d/</link>
		<comments>http://sick.snusnu.info/2008/06/20/calling-named_scope-in-a-loop-d/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 14:00:00 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[rails models]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/?p=13</guid>
		<description><![CDATA[
#  # Raises NoMethodError: undefined method `processing'
#  %(pending processing complete error).each do &#124;s&#124;
#    named_scope s.to_sym,
#      :conditions =&#62; ["state = ?", s],
#      :order =&#62; "priority, created_at"
#  end

named_scope :pending,
:conditions =&#62; "state = 'pending'",
:order =&#62; "priority, created_at"

named_scope :processing,
:conditions =&#62; "state = 'processing'",
:order [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
#  # Raises NoMethodError: undefined method `processing'
#  %(pending processing complete error).each do |s|
#    named_scope s.to_sym,
#      :conditions =&gt; ["state = ?", s],
#      :order =&gt; "priority, created_at"
#  end

named_scope :pending,
:conditions =&gt; "state = 'pending'",
:order =&gt; "priority, created_at"

named_scope :processing,
:conditions =&gt; "state = 'processing'",
:order =&gt; "priority, created_at"

named_scope :complete,
:conditions =&gt; "state = 'complete'",
:order =&gt; "priority, created_at"

named_scope :errorneous,
:conditions =&gt; "state = 'error'",
:order =&gt; "priority, created_at"
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/06/20/calling-named_scope-in-a-loop-d/feed/</wfw:commentRss>
		</item>
		<item>
		<title>generating print optimized pdf documents from html and css using apache fop and css2xslfo</title>
		<link>http://sick.snusnu.info/2008/06/19/generating-print-optimized-pdf/</link>
		<comments>http://sick.snusnu.info/2008/06/19/generating-print-optimized-pdf/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 13:46:00 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[fop]]></category>

		<category><![CDATA[html]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[xslfo]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/?p=14</guid>
		<description><![CDATA[
# Uses css2xslfo and apache fop to generate a print optimized pdf document
# from an html document and a css stylesheet. This works by converting the
# styled html to an xslfo document, which then gets translated to the final
# pdf document. For further details on apache fop and how wo write appropriate
# css stylesheets for [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
# Uses css2xslfo and apache fop to generate a print optimized pdf document
# from an html document and a css stylesheet. This works by converting the
# styled html to an xslfo document, which then gets translated to the final
# pdf document. For further details on apache fop and how wo write appropriate
# css stylesheets for css2xslfo, see http://xmlgraphics.apache.org/fop/ and
# http://www.re.be/css2xslfo/

module Css2fopRenderer

class PdfGenerationException &lt; Exception; end
class HtmlGenerationException &lt; Exception; end

# overwrite for customization
def after_html_generation; end

def css2fop(template_file, html_file, pdf_file, base_url, erb_binding = nil)
render_html(template_file, html_file, erb_binding)
after_html_generation
render_pdf(html_file, pdf_file, base_url)
end

def render_pdf(html_file, pdf_file, base_url)
success = execute_css2fop(html_file, pdf_file, base_url)
unless success &amp;&amp; $?.exitstatus == 0 &amp;&amp; (f = File.stat(pdf_file)) &amp;&amp; f.size &gt; 0
raise PdfGenerationException
end
end

def render_html(template_file, html_file, erb_binding = nil)
template = ERB.new(File.read(template_file))
File.open(html_file, "w") { |f| f.puts template.result(erb_binding) }
unless (f = File.stat(html_file)) &amp;&amp; f.size &gt; 0
raise HtmlGenerationException
end
end

# a shell script is used so that sysadmins can customize the fop installation
def execute_css2fop(html_file, pdf_file, base_url)
system "#{ENV['css2fop-pdf']} #{html_file} #{pdf_file} #{base_url}"
end

end</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/06/19/generating-print-optimized-pdf/feed/</wfw:commentRss>
		</item>
		<item>
		<title>calling rake tasks with parameters</title>
		<link>http://sick.snusnu.info/2008/06/18/calling-rake-tasks-with-paramet/</link>
		<comments>http://sick.snusnu.info/2008/06/18/calling-rake-tasks-with-paramet/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 14:41:00 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[rake]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/?p=15</guid>
		<description><![CDATA[
namespace :backup do

task :dump_dynamic_tables =&#62; :environment do

ENV[TABLES] = 'users'
Rake::Task['db:fixtures:export_for_tables'].invoke

end

end

]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
namespace :backup do

task :dump_dynamic_tables =&gt; :environment do

ENV[TABLES] = 'users'
Rake::Task['db:fixtures:export_for_tables'].invoke

end

end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/06/18/calling-rake-tasks-with-paramet/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
