<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>SENS3 blog</title>
    <link>http://www.sens3.com/</link>
    <language>en-us</language>
    <item>
      <title>Flying Lotus - MmmHmm (Video)</title>
      <description>&lt;object width="640" height="385"&gt;&lt;param name="movie" value="http://www.youtube.com/v/2uCyv05SG1g&amp;amp;hl=en_US&amp;amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/2uCyv05SG1g&amp;amp;hl=en_US&amp;amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;</description>
      <author>smn</author>
      <pubDate>Wed, 14 Jul 2010 00:20:57 +0200</pubDate>
      <link>http://www.sens3.com/blog/2010/7/14/Flying-Lotus-MmmHmm-Video-</link>
      <guid>http://www.sens3.com/blog/2010/7/14/Flying-Lotus-MmmHmm-Video-</guid>
    </item>
    <item>
      <title>Nu Blu</title>
      <description>&lt;object width="400" height="300"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=13085676&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=13085676&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;p&gt;&lt;a href="http://vimeo.com/13085676"&gt;BIG BANG BIG BOOM - the new wall-painted animation by BLU&lt;/a&gt; from &lt;a href="http://vimeo.com/blu"&gt;blu&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;</description>
      <author>smn</author>
      <pubDate>Mon, 12 Jul 2010 22:53:25 +0200</pubDate>
      <link>http://www.sens3.com/blog/2010/7/12/Nu-Blu</link>
      <guid>http://www.sens3.com/blog/2010/7/12/Nu-Blu</guid>
    </item>
    <item>
      <title>The Art behind Cosmogramma</title>
      <description>&lt;object width="466" height="354" &gt;&lt;param name="movie" value="http://warp.net/swf/warp_embed.swf" /&gt;&lt;param name="flashvars" value="file=http://warp.net/rss/rss.xml%3Fpl_type%3D5%26pl_id%3D981&amp;playerType=embed&amp;playlist=bottom&amp;fullscreen=true&amp;controlbar=over" /&gt;&lt;param name="wmode" value="transparent" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;embed src="http://warp.net/swf/warp_embed.swf" width="466" height="354" bgcolor="#000000" allowscriptaccess="always" allowfullscreen="true" FlashVars="file=http://warp.net/rss/rss.xml%3Fpl_type%3D5%26pl_id%3D981&amp;playerType=embed&amp;playlist=bottom&amp;fullscreen=true&amp;controlbar=over" type="application/x-shockwave-flash" wmode="transparent"&gt;&lt;/embed&gt;&lt;/object&gt;

&lt;p&gt;
Short interview with the guy behind the artwork of Flying Lotus' fantastic album Cosmogramma.&lt;br/&gt;
If you don't have it yet &lt;a href='http://bleep.com/index.php?page=release_details&amp;releaseid=23694'&gt;get it&lt;/a&gt;!!
&lt;/p&gt;</description>
      <author>smn</author>
      <pubDate>Wed, 30 Jun 2010 00:26:17 +0200</pubDate>
      <link>http://www.sens3.com/blog/2010/6/30/The-Art-behind-Cosmogramma</link>
      <guid>http://www.sens3.com/blog/2010/6/30/The-Art-behind-Cosmogramma</guid>
    </item>
    <item>
      <title>dBridge - ZX81(Shed Remix)</title>
      <description>&lt;object width="480" height="385"&gt;&lt;param name="movie" value="http://www.youtube.com/v/e0sxtLMQpII&amp;hl=en_US&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/e0sxtLMQpII&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;
&lt;br/&gt;

I decided to post more music here. So here's the first one. dBridge who's quite a sensation himself gets the remix treatment by none other than the mighty Shed. London meets Berlin. Dubstep meets Techno. Sancho meets Pancho. Greatness!</description>
      <author>smn</author>
      <pubDate>Fri, 25 Jun 2010 02:27:10 +0200</pubDate>
      <link>http://www.sens3.com/blog/2010/6/25/dBridge-ZX81-Shed-Remix-</link>
      <guid>http://www.sens3.com/blog/2010/6/25/dBridge-ZX81-Shed-Remix-</guid>
    </item>
    <item>
      <title>acts_as_soft_deletable deleted_tables auto-update</title>
      <description>Check out &lt;a href="http://github.com/sens3/acts_as_soft_deletable"&gt;my fork&lt;/a&gt; of acts_as_soft_deletable.
I added a little extension to ActiveRecord::Migrator to automatically update the columns of the deleted_* tables.
Before this had to be done manually by running
&lt;pre&gt;
Post::Deleted.update_columns
&lt;/pre&gt;
in your migration everytime you updated the Post table.

I always forgot to do it and thought this might as well be automated. So here's the piece of code that does it all:
&lt;pre&gt;
module MigratorExtension
  def self.included(base)
    base.class_eval do
      include InstanceMethods    
      alias_method_chain :migrate, :deleted_table_update
    end
  end
  module InstanceMethods
    def migrate_with_deleted_table_update(*args)
      migrate_without_deleted_table_update(*args)
# reloading column definitions, was having issues with Post.columns not reflecting changes  
 ActiveRecord::Base.reset_column_information_and_inheritable_attributes_for_all_subclasses
 ActiveRecord::Acts::SoftDeletable::Live::InstanceMethods.included_in_classes.each do |klass|
        klass::Deleted.update_columns
        puts "Updated columns of #{klass.name}::Deleted"
      end
    end
  end
end

class ActiveRecord::Migrator; include MigratorExtension; end
&lt;/pre&gt;

First, we wrap the &lt;code&gt;migrate&lt;/code&gt; instance method of ActiveRecord::Migrator using &lt;code&gt;alias_method_chain&lt;/code&gt;.
In this method we first call the original migrate method. Then we reset the column definitions for all tables, I had problems where Post.columns was not reflecting the just migrated changes and this fixed it (might only be a problem for the app I used it in but doesn't hurt :).

At last, we lookup all classes that include acts_as_soft_deletable and update the columns of the corresponding deleted_* table.

Check it out here: 
&lt;a href="http://github.com/sens3/acts_as_soft_deletable"&gt;http://github.com/sens3/acts_as_soft_deletable&lt;/a&gt;
</description>
      <author>smn</author>
      <pubDate>Wed, 31 Mar 2010 23:18:42 +0200</pubDate>
      <link>http://www.sens3.com/blog/2010/3/31/acts_as_soft_deletable-deleted_tables-auto-update</link>
      <guid>http://www.sens3.com/blog/2010/3/31/acts_as_soft_deletable-deleted_tables-auto-update</guid>
    </item>
    <item>
      <title>The New Socialight</title>
      <description>As of last Wednesday the completely re-written, enhanced and now-with-super-powers &lt;a href="http://socialight.com"&gt;Socialight&lt;/a&gt; is live.
We've spent several long nights getting this up on time and I'm proud to be a part of it.

With this re-write we had the chance to do everything better and the right way, with the right tools (everyone who ever had the pleasure of inheriting code knows what I'm talking about). And even though such a &lt;a href="http://chadfowler.com/the-big-rewrite"&gt;big rewrite&lt;/a&gt; may have some pitfalls I'm confident we did a good job and delivered a improved and solid platform.
Rails, Rspec, Cucumber, Git. Without these I'd certainly have had a heart attack during the last months. I like being a developer but I love being a Rails developer (I know, I know.. cheesy). My resolution for this year: contribute (more) to open source!

Back to Socialight: &lt;a href="http://adage.com/digitalnext/post?article_id=142271"&gt;here&lt;/a&gt; is an article on Adage that, besides the unfortunate title, does a good job summarizing what we do now and why we do it.
In short: If you want to create a community around location based content, we give you a platform to do just that.

I always wanted to create a way to attach songs to the places I associate them with. Trentemoeller at Central Park. NWAQ at The Bunker. De La Soul or ATCQ at that art studio I used to hang out in my teenage days.
You can become a member and access the admin interface here, a (quiet awesome) iPhone app is in the making: 

&lt;a href="http://cassette.socialight.com"&gt;http://cassette.socialight.com&lt;/a&gt;


</description>
      <author>smn</author>
      <pubDate>Sat, 27 Feb 2010 05:15:54 +0100</pubDate>
      <link>http://www.sens3.com/blog/2010/2/27/The-New-Socialight</link>
      <guid>http://www.sens3.com/blog/2010/2/27/The-New-Socialight</guid>
    </item>
    <item>
      <title>Delayed Paperclip</title>
      <description>I finally found the time to clean up the &lt;code&gt;delayed_paperclip&lt;/code&gt; - plugin I wrote a while back and load it up to Github. You can find it here: 

&lt;a href='http://github.com/sens3/delayed_paperclip'&gt;http://github.com/sens3/delayed_paperclip&lt;/a&gt;

If you are using Paperclip for media attachments and think about loading the processing off to a background job (delayed_job in this case) this might be for you. Enjoy! </description>
      <author>smn</author>
      <pubDate>Sun, 07 Feb 2010 07:31:56 +0100</pubDate>
      <link>http://www.sens3.com/blog/2010/2/7/Delayed-Paperclip</link>
      <guid>http://www.sens3.com/blog/2010/2/7/Delayed-Paperclip</guid>
    </item>
    <item>
      <title>Rails Magazine Issue 5</title>
      <description>Covers 37 Signals' Sprocket, Authentication with Gigya, Prince (PDF Generation)....
More info and download &lt;a href='http://railsmagazine.com/issues/5'&gt;here&lt;/a&gt;.</description>
      <author>smn</author>
      <pubDate>Thu, 28 Jan 2010 21:58:06 +0100</pubDate>
      <link>http://www.sens3.com/blog/2010/1/28/Rails-Magazine-Issue-5</link>
      <guid>http://www.sens3.com/blog/2010/1/28/Rails-Magazine-Issue-5</guid>
    </item>
    <item>
      <title>Association Count Methods</title>
      <description>The following module allows you to call *_count methods on any ActiveRecord Object. 
i.e &lt;code&gt;@post.comments_count&lt;/code&gt; instead of &lt;code&gt;@post.comments.count&lt;/code&gt;

It looks kinda stupid and unnecessary but comes in handy if you have(!) to specify a method by passing a symbol. In my case I was using this in JSON serialization parameters.
&lt;pre&gt;
@user.to_json :methods =&gt; [:post_count, :comment_count]
&lt;/pre&gt;
The module also takes care of the respond_to? method by checking if the given association exists.
&lt;pre&gt;
module AssocationCounts
  
  def respond_to?(name, include_private=false)
    if as = get_association(name)
      !self.class.reflect_on_association(as).nil?
    else
      super
    end
  end

  def method_missing(name, *args, &amp;block)
    if respond_to?(name) &amp;&amp; as = get_association(name)
      self.send(as).count
    else
      super
    end
  end

  private

  def get_association(name)
    if md = name.to_s.match(/^(.+)_count$/)
      md[1].to_sym
    end
  end
  
end

class ActiveRecord::Base; include AssocationCounts; end
&lt;/pre&gt;

&lt;i&gt;Update:&lt;/i&gt; made &lt;code&gt;get_association&lt;/code&gt; private
</description>
      <author>smn</author>
      <pubDate>Thu, 28 Jan 2010 21:47:30 +0100</pubDate>
      <link>http://www.sens3.com/blog/2010/1/28/Association-Count-Methods</link>
      <guid>http://www.sens3.com/blog/2010/1/28/Association-Count-Methods</guid>
    </item>
    <item>
      <title>Rails: Log output in console</title>
      <description>This is all over the internets but I'm sick of always having to search for it, so...
&lt;pre&gt;

 ActiveRecord::Base.logger = Logger.new(STDOUT)

&lt;/pre&gt;
</description>
      <author>smn</author>
      <pubDate>Thu, 29 Oct 2009 17:27:37 +0100</pubDate>
      <link>http://www.sens3.com/blog/2009/10/29/Rails-Log-output-in-console</link>
      <guid>http://www.sens3.com/blog/2009/10/29/Rails-Log-output-in-console</guid>
    </item>
  </channel>
</rss>
