<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>casperfabricius.com</title>
	
	<link>http://casperfabricius.com/site</link>
	<description>expert ruby on rails development</description>
	<pubDate>Sun, 31 May 2009 13:37:14 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/FingerprintsOfCasperFabricius" type="application/rss+xml" /><item>
		<title>Community Day 2009 in Copenhagen</title>
		<link>http://casperfabricius.com/site/2009/05/31/community-day-2009-in-copenhagen/</link>
		<comments>http://casperfabricius.com/site/2009/05/31/community-day-2009-in-copenhagen/#comments</comments>
		<pubDate>Sun, 31 May 2009 13:36:36 +0000</pubDate>
		<dc:creator>Casper Fabricius</dc:creator>
		<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/cfp/casperfabricius.com/site/wp-content/plugins/autometa/autometa.php</b> on line <b>324</b><br />

		<category><![CDATA[mac]]></category>

		<category><![CDATA[rails]]></category>

	<!-- AutoMeta Start -->
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=225</guid>
		<description><![CDATA[It has been a while since I had a good technical post on this blog, and this is will not be one either. Instead, just a few brief words on a very successful event for geeks in Copenhagen that took place last Thursday. Sponsored by Microsoft and co-presented by the Danish development community, Community Day [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a while since I had a good technical post on this blog, and this is will not be one either. Instead, just a few brief words on a very successful event for geeks in Copenhagen that took place last Thursday. Sponsored by <a href="http://www.microsoft.com/da/dk/default.aspx">Microsoft</a> and co-presented by the <a href="http://eksperten.dk/">Danish</a> <a href="http://udvikleren.dk/">development</a> <a href="http://activedeveloper.dk/">community</a>, <a href="http://communityday.in/copenhagen/">Community Day 2009 Copenhagen</a> delivered what it had promised: A day with free beer and food, interesting presentations and lots of networking across the usual technical boundaries. While the event, previously exclusively with a focus on Microsoft technology, was dominated by seasoned .NET developers, we, the Ruby crowd, was well represented as was the PHP programmers.</p>
<p>Daniel Mellgaard Frost, Developer Evangelist with Microsoft Denmark, had put together <a href="http://communityday.in/copenhagen/Home/Agenda">a diverse program</a> where only two talks was devoted entirely to Microsoft technologies (<a href="http://www.microsoft.com/silverlight/">Silverlight</a> and <a href="http://msdn.microsoft.com/en-us/netframework/aa904594.aspx">LINQ</a>), but six out of eight talks was about web development in some form. I did a talk on <a href="http://ar.rubyonrails.org/files/README.html">ActiveRecord</a>, the O/RM of <a href="http://rubyonrails.org/">Ruby on Rails</a>, and according to the many happy comment I got afterwards, it went pretty well.</p>
<p><span id="more-225"></span></p>
<p>One really great thing about <a href="http://www.ruby-lang.org/">Ruby</a> is that you can start writing code in front a crowd that have never seen the language before, and they will understand everything you are doing - provided, of course, that they know another object-oriented programming language. Ruby is such a beautiful language that it instantly appeals to most coders, and that makes it a pure joy to do a presentation mostly based on live code examples such as I did.</p>
<p>It also helps that ActiveRecord has an impressive number of features to show off, and even though I don&#8217;t how much it really mattered, I think I made a good tactical choice in demonstrating the O/RM running against a Microsoft SQL Server instance. <a href="http://toolmantim.com/articles/getting_rails_talking_to_sqlserver_on_osx_via_odbc">This post</a>, by the way, is what helped me to get my Mac to talk to SQL Server, but bear in mind, that if you run an older Ruby version and/or use the installation that comes with Leopard, that tutorial will upgrade you to Ruby 1.8.7 running via Macports.</p>
<p>Here is the <a href="/site/wp-content/uploads/2009/05/activerecord.pdf">presentation slides</a> from the talk (in Danish), and here is the very limited quantity of <a href="/site/wp-content/uploads/2009/05/ar_code.zip">code</a> I wrote.</p>
<p>I also lead an open space meeting on <a href="http://jquery.com/">jQuery</a> - the presentation on the topic was unfortunately canceled in the last minute - and although I am still learning the many aspects of this great Javascript framework, I think every web developer owe it to his or hers own productivity to take a look at it. Doing Javascript development with jQuery and <a href="http://getfirebug.com/">Firebug</a> is immensely effective, not least because of the literally <a href="http://plugins.jquery.com/">thousands of open source plugins </a>that have been written for the framework by the community.</p>
<p>Thanks for Daniel, Microsoft and the community sites for sponsoring and organizing this fun and inspiring event - I look forward to next year.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=_3gJaIJr7kU:9VO7URV2zN0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=_3gJaIJr7kU:9VO7URV2zN0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=_3gJaIJr7kU:9VO7URV2zN0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=_3gJaIJr7kU:9VO7URV2zN0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=_3gJaIJr7kU:9VO7URV2zN0:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://casperfabricius.com/site/2009/05/31/community-day-2009-in-copenhagen/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Notes and impressions from RailsConf 2009</title>
		<link>http://casperfabricius.com/site/2009/05/08/notes-and-impressions-from-railsconf-2009/</link>
		<comments>http://casperfabricius.com/site/2009/05/08/notes-and-impressions-from-railsconf-2009/#comments</comments>
		<pubDate>Fri, 08 May 2009 19:49:24 +0000</pubDate>
		<dc:creator>Casper Fabricius</dc:creator>
		<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/cfp/casperfabricius.com/site/wp-content/plugins/autometa/autometa.php</b> on line <b>324</b><br />

		<category><![CDATA[agile]]></category>

		<category><![CDATA[mac]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[railsconf]]></category>

	<!-- AutoMeta Start -->
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=217</guid>
		<description><![CDATA[I&#8217;d never have guessed that the first time I&#8217;d visit Las Vegas, the gambling and the drinking, the shows and the shopping would be a minor thing, something that I&#8217;d squeeze in between what really mattered. But RailsConf 2009 had such a comprehensive and interesting program that this ended up being the case. From the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d never have guessed that the first time I&#8217;d visit Las Vegas, the gambling and the drinking, the shows and the shopping would be a minor thing, something that I&#8217;d squeeze in between what really mattered. But RailsConf 2009 had such a comprehensive and interesting program that this ended up being the case. From the casual networking at breakfast and lunch over packed keynotes and high-quality talks to late-night Birds Of a Feather sessions, RailsConf did give the attendants any reason to step out if the air-conditioned Hilton and into the sun and lights of the Strip.</p>
<p>We did that anyway, obviously, but mostly we were learning, tweeting, chatting, coding, emailing and taking notes at a conference where the wifi actually worked and power strips were easily available. I&#8217;m not going to reference all the talks that I went to here, but I have uploaded my notes <a href="http://casperfabricius.com/site/wp-content/uploads/2009/05/">here</a>. Also, I&#8217;ve written a detailed summery of David Heinemeier Hansson&#8217;s keynote and a few select talks that I attended for <a href="http://railsmagazine.com/issues/2">RailsMagazine</a>, <strike>but the free PDF-edition won&#8217;t be available for another two weeks</strike> now freely available for download &#8230; slides from all the presentations can be found <a href="http://www.scribd.com/group/74983-railsconf-2009">here</a>.</p>
<p><span id="more-217"></span></p>
<p>So what did I take away from RailsConf from the top of my head? The first that springs to mind, is that I got to try <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a>, a new IDE for Ruby on Rails. At first glance this might look like another Aptana or Netbeans, but the <a href="http://railsenvy.com/">Rails Envy</a> guys gave a stunning demonstration of the power of this new IDE: From TextMate keymapping and navigation, over code completion and refactoring that actually works, to automatic diagramming of models and their relationships, this product looks like a real productivity booster. I&#8217;m going to try it out the minute I get home.</p>
<p><i>Rack</i> kept popping up everywhere. Lots of talks on Rack and Rails Metal (which is really just a wrapper for a &#8220;raw&#8221; Rack handler), and now Rack suddenly doesn&#8217;t feel so scary anymore. It just a way to do cool things on a raw request and/or response without the (full) overhead of the Rails stack. <i>JRuby</i> was another popular topic, as well as <i>clouds</i> - how to deploy to server environment that will seamlessly scale with your needs.</p>
<p>I have been following IronRuby with great interest since the project was started 2-3 years ago, and I was a bit disappointed to hear that the .NET implementation of Ruby is still nowhere near completed. I asked Jimmy Schementi from the Microsoft IronRuby team what took them so long (to be honest, I was a bit rude, sorry Jimmy), and asked that things simply took time. He said that JRuby had been 6 years underway. The positive news, however, was that the IronRuby team is still very committed to making their implementation fully Ruby 1.8 compliant, and that are using Rails to measure their success against.</p>
<p>I&#8217;d love to tell you more, but my plane is leaving soon, so you will have to make do with <a href="http://casperfabricius.com/site/wp-content/uploads/2009/05/">my notes</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=AsowCDYqWmU:mxVRey0P1Ic:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=AsowCDYqWmU:mxVRey0P1Ic:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=AsowCDYqWmU:mxVRey0P1Ic:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=AsowCDYqWmU:mxVRey0P1Ic:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=AsowCDYqWmU:mxVRey0P1Ic:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://casperfabricius.com/site/2009/05/08/notes-and-impressions-from-railsconf-2009/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Introductions to Ruby on Rails</title>
		<link>http://casperfabricius.com/site/2009/04/22/introductions-to-ruby-on-rails/</link>
		<comments>http://casperfabricius.com/site/2009/04/22/introductions-to-ruby-on-rails/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 07:45:03 +0000</pubDate>
		<dc:creator>Casper Fabricius</dc:creator>
		<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/cfp/casperfabricius.com/site/wp-content/plugins/autometa/autometa.php</b> on line <b>324</b><br />

		<category><![CDATA[agile]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[railsconf]]></category>

	<!-- AutoMeta Start -->
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=212</guid>
		<description><![CDATA[You have at least two chances to get introduced to Ruby on Rails by yours truly this year. I do a presentation on Rails with a focus on ActiveRecord, the ORM of Rails, on Commity Day 2009 in Copenhagen. I am also teaching Rails used with agile methods at Copenhagen Business School this fall.
Community Day [...]]]></description>
			<content:encoded><![CDATA[<p>You have at least two chances to get introduced to Ruby on Rails by yours truly this year. I do a presentation on Rails with a focus on ActiveRecord, the <a href="http://en.wikipedia.org/wiki/Object-relational_mapping">ORM</a> of Rails, on <a href="http://communityday.in/copenhagen/">Commity Day 2009</a> in Copenhagen. I am also teaching Rails used with agile methods at <a href="http://cbs.dk/">Copenhagen Business School</a> this fall.</p>
<p>Community Day 2009 is free 1-day event May 28 in Copenhagen sponsored by Danish developer communities. Besides my two cents, it also features presentations on Android, Flex, Air, Silverlight, LINQ, Drupal, jQuery and ASP.NET MVC - in other words it looking to be a lot of buzzwords and popular technologies explained. As if that wasn&#8217;t enough, the day also include three geek-friendly meals, friendly competitions and lots of free beer.</p>
<p>The course I will be teaching at Copenhagen Business School is called Agile Development in Practice, and builds upon a theoretic platform of agile methods. The course focus is on giving the students practical experience with Scrum and Ruby on Rails through a combination of traditional teaching and working with real-life examples. The course is free to attend for all Danish students, and counts for either 7,5 or 15 ETCS points. Others can also enroll in the course for a fee. The course description is not yet available on the CBS homepage, but I will link to here as soon as it is ready.</p>
<p>But before all that, I myself will hopefully learn many new and useful things about Ruby, Rails and all things geeky at <a href="http://en.oreilly.com/rails2009/">RailsConf</a> in Las Vegas. See you there? :)</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=vuFFAX2-mXQ:nFMpytva6zw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=vuFFAX2-mXQ:nFMpytva6zw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=vuFFAX2-mXQ:nFMpytva6zw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=vuFFAX2-mXQ:nFMpytva6zw:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=vuFFAX2-mXQ:nFMpytva6zw:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://casperfabricius.com/site/2009/04/22/introductions-to-ruby-on-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Uploading multiple files with progress indicator using jQuery, Flash and Rails</title>
		<link>http://casperfabricius.com/site/2009/03/26/uploading-multiple-files-with-progress-indicator-using-jquery-flash-and-rails/</link>
		<comments>http://casperfabricius.com/site/2009/03/26/uploading-multiple-files-with-progress-indicator-using-jquery-flash-and-rails/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 14:15:37 +0000</pubDate>
		<dc:creator>Casper Fabricius</dc:creator>
		<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/cfp/casperfabricius.com/site/wp-content/plugins/autometa/autometa.php</b> on line <b>324</b><br />

		<category><![CDATA[rails]]></category>

	<!-- AutoMeta Start -->
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=197</guid>
		<description><![CDATA[I just implemented a new way of uploading assets such as photos and PDF-files to Lokalebasen.dk. There is nothing revolutionary about it, but I hit a few snags on the way, and I thought I&#8217;d share my choices here.
Lokalebasen (a Danish website for rental and sale of business property) is (of course) based on Ruby [...]]]></description>
			<content:encoded><![CDATA[<p>I just implemented a new way of uploading assets such as photos and PDF-files to <a href="http://www.lokalebasen.dk">Lokalebasen.dk</a>. There is nothing revolutionary about it, but I hit a few snags on the way, and I thought I&#8217;d share my choices here.</p>
<p>Lokalebasen (a Danish website for rental and sale of business property) is (of course) based on <a href="http://www.rubyonrails.com">Ruby on Rails</a> and uses the notoriously brilliant <a href="http://jquery.com/">jQuery</a> as Javascript framework. When the customer asked for a progress bar while uploading assets, I knew there was basically two choices: Polling the server for the progress of the upload, or uploading through Flash. I choose the last option because I believe it is easier to implement, and it gives the added bonus of being able to start the upload in an &#8220;ajaxy&#8221; way without refreshing the page.</p>
<p>Several ready-made solutions exists, and chose one that was built as a jQuery plugin, was updated recently and was easy to use while being highly configurable: <a href="http://www.uploadify.com/">Uploadify</a>. This article is not an Uploadify tutorial - you&#8217;ll have to work the out from the <a href="http://www.uploadify.com/documentation/">documentation</a> and the <a href="http://www.uploadify.com/download/">examples</a>. Rather, it&#8217;s about the last piece of the puzzle, how to make Rails play nicely with Uploadify.</p>
<p><span id="more-197"></span></p>
<p>Lokalebasen uses <a href="http://github.com/technoweenie/attachment_fu/tree/master">attachment_fu</a> for handling assets. Since traditional file upload was already implemented, I had fallback functionality for users without Javascript or Flash - and so should you. All I had to add the controller handling the upload was a detection of the correct content type. Browsers will usually provide this, but Flash does not. And so the controller ended up looking something like this:</p>
<p><script src="http://gist.github.com/86020.js"></script></p>
<p>The <a href="http://rubyforge.org/projects/mime-types/">mime-types gem</a> is used to detect the content type - installation and usage is explained <a href="http://jimneath.org/2008/05/15/swfupload-paperclip-and-ruby-on-rails/">here</a>.</p>
<p>I needed the functionality several places, so I wrote a partial I could reuse:</p>
<p><script src="http://gist.github.com/86027.js"></script></p>
<p>There is a lot going here, so let&#8217;s take it from the top. The <code>content_for :head</code> section is the code that will be placed inside the <code>&lt;head&#038;gt</code> part of the page - my layout takes care of that with a <code>yield :head</code> call. So first the Uploadify jQuery plugin javascript file is included, followed by some javascript that applies Uploadify to the <code>file_uploader</code> div seen later in the partial. This includes a lot options, some of which uses variables supplied to the partial. Here is an example of how I call the partial:</p>
<p><script src="http://gist.github.com/86090.js"></script></p>
<p> I won&#8217;t walk you through all the options I supply for Uploadify, but let&#8217;s take a look at the important ones: <code>script</code> is where Uploadify will post the uploaded file to. This should be the <code>create</code> action of your asset controller. <code>scriptData</code> is the most tricky one. The option specifies what parameters should be posted to the controller along with the file. <code>'format': 'json'</code> ensures that the <code>wants.json</code> block is invoked in the controller, instead of the default <code>wants.html</code>. This helps the controller to separate Flash uploads from ordinary uploads. The two other parameters in <code>scriptData</code> will be explained later in the article, is they are the key to get the uploading past security and authentication measures taken. <code>fileDataName</code> extracts the name to use for the uploaded file (e.g. <code>asset[:uploaded_data]</code> for attachment_fu) directly from the fallback form. <code>onComplete</code> makes an ajax get request through jQuery to <i>the same</i> url we are currently on. I use this to render some javascript that updates the page in a <code>wants.js</code> in the controller.</p>
<p>There are several gotchas when you upload files through Flash. The most common one, which also apply to ajax, is the infamous <code>ActionController::InvalidAuthenticityToken</code> exception. You will get this exception on any default Rails installation with authenticity checking enabled. Rails expects any post to an action the include the <code>authenticity_token</code> parameter. It is used to verify the post actually came from the same application, and Rails automatically adds to all the forms and ajax requests it generates. In this case, we have to apply it manually, and this what happens with <code>'authenticity_token': encodeURIComponent('<%= form_authenticity_token if protect_against_forgery? %>&#8216;)</code>. The <code>form_authenticity_token</code> returns a valid token, but first we check if forgery is enabled. If it is disabled (which it usually is in tests), we will get an error if we invoke <code>form_authenticity_token</code>.  <code>encodeURIComponent</code> makes sure that any characters in the token is encoded correctly. With this parameter, we should be able to make an authentic post through Flash - or maybe not &#8230;</p>
<p>Rails use data in the user session to authenticate requests, and requests directly from Flash does not include the session cookie that Rails use to find the session. Thus we still get the <code>ActionController::InvalidAuthenticityToken</code> exception, even with the <code>authenticity_token</code> parameter added. We have to make a slight hack into how Rails handles sessions to make this work. Place <a href="http://gist.github.com/11753">this code</a> in a file in <code>config/initializers</code> to apply the hack, which tells Rails to try to read the session id from a parameter, if it can&#8217;t find in a cookie. This will only happen, however, if we add the line <code>session :cookie_only => false, :only => :create</code> to the asset controller. Also, we must supply the session in a parameter, which is what <code>'<%= Rails.configuration.action_controller.session[:session_key]%>&#8216;: &#8216;<%= u session.session_id %>&#8216; }</code> do. The unique session key of the application is taken from the Rails configuration, and the session id is taken from session.</p>
<p>With these measures in place, Rails can now properly authenticate our Flash upload request as a legal, secure post. As an added bonus, actions protected behind session-based logins now also just works. And I would guess that most applications require their users to register and login before they can upload files.</p>
<p>Finally, here is a trick if you use http basic authentication e.g. for the administration tool like we do on Lokalebasen.dk. Place an <code>is_admin?</code> flag in the session, as shown in the code below. This will allow even Flash uploads to be authenticated, even if they don&#8217;t supply http basic authentication information:</p>
<p><script src="http://gist.github.com/86115.js"></script></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=4X1gANCeG14:m86h3l81qhs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=4X1gANCeG14:m86h3l81qhs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=4X1gANCeG14:m86h3l81qhs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=4X1gANCeG14:m86h3l81qhs:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=4X1gANCeG14:m86h3l81qhs:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://casperfabricius.com/site/2009/03/26/uploading-multiple-files-with-progress-indicator-using-jquery-flash-and-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Playing with Webby</title>
		<link>http://casperfabricius.com/site/2009/03/15/playing-with-webby/</link>
		<comments>http://casperfabricius.com/site/2009/03/15/playing-with-webby/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 15:32:54 +0000</pubDate>
		<dc:creator>Casper Fabricius</dc:creator>
		<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/cfp/casperfabricius.com/site/wp-content/plugins/autometa/autometa.php</b> on line <b>324</b><br />

		<category><![CDATA[other]]></category>

	<!-- AutoMeta Start -->
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=192</guid>
		<description><![CDATA[I have been in a relationship with Ruby on Rails for more than 3 years, and I&#8217;ve completely dedicated and faithful to the beautiful web framework for almost 2 years. Until now.
Today I decided to cheat on Rails. And I&#8217;m not talking going back to the ugly ex, ASP.NET, or getting back in touch with [...]]]></description>
			<content:encoded><![CDATA[<p>I have been in a relationship with <a href="http://rubyonrails.org">Ruby on Rails</a> for more than 3 years, and I&#8217;ve completely dedicated and faithful to the beautiful web framework for almost 2 years. Until now.</p>
<p>Today I decided to cheat on Rails. And I&#8217;m not talking going back to the ugly ex, ASP.NET, or getting back in touch with old flirts such as PHP or Java, no &#8230; Once you go Ruby, you don&#8217;t go back.</p>
<p>But there are other Ruby web frameworks than Rails. &#8220;What? I thougth Ruby was invented for Rails, as a kind of unintentional side effect?&#8221; you might say, but it is no so. Until recentl, <a href="http://www.merbivore.com/">Merb</a> has probably been the most well-known &#8220;Ruby-based framework that is not Rails&#8221;, but now <a href="/site/2009/01/01/hello-merb/">the two are getting hitched</a> and as such we have to look elsewhere for alternative Ruby frameworks.</p>
<p><a href="http://webby.rubyforge.org/">Webby</a> is one such framework. Or to be fair, Webby is so much less than both Rails and Merb, and that&#8217;s the whole point. Webby are for simple, static home pages that can be hosted on anywhere. The Ruby framework generates static html files based on layouts and content pieces defined in the project. It doesn&#8217;t use a database, it doesn&#8217;t parse forms and that is exactly the simplicity you sometimes need.</p>
<p><span id="more-192"></span></p>
<p>The two greatest benefits in Webby is:</p>
<ol>
<li>Content is plain text files and can be put in source control painlessly</li>
<li>Output is plain html files and be deployed anywhere with just FTP, RSync or SSH</li>
</ol>
<p>As I see it, this makes Webby the perfect &#8220;un-CMS&#8221; for a web site maintained by developers. We don&#8217;t want to type in long texts in textareas in the browser - we want to do it <a href="http://macromates.com">Textmate</a> or whatever our favorite text editor is called. We want full control over the HTML, we want speed and we want real versioning for our content.</p>
<p>Some times Rails is just plain overkill.</p>
<p>Resources:</p>
<ul>
<li><a href="http://webby.rubyforge.org/">Webby homepage</a></li>
<li><a href="http://clarkware.com/cgi/blosxom/2008/08/06#Webby">Great Webby tutorial</a> (but a bit outdated, make sure to replace references to <code>webby</code> with <code>webby-gen</code>, and references to <code>rake</code> with <code>webby</code>.)</li>
<li><a href="http://judofyr.net/posts/building-a-website-with-webby.html">Another good tutorial</a></li>
</ul>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=CQXjsdws-RU:qQNtJHkDhJs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=CQXjsdws-RU:qQNtJHkDhJs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=CQXjsdws-RU:qQNtJHkDhJs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=CQXjsdws-RU:qQNtJHkDhJs:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=CQXjsdws-RU:qQNtJHkDhJs:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://casperfabricius.com/site/2009/03/15/playing-with-webby/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Reflections on Copenhagen Twestival</title>
		<link>http://casperfabricius.com/site/2009/02/15/reflections-on-copenhagen-twestival/</link>
		<comments>http://casperfabricius.com/site/2009/02/15/reflections-on-copenhagen-twestival/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 23:29:59 +0000</pubDate>
		<dc:creator>Casper Fabricius</dc:creator>
		<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/cfp/casperfabricius.com/site/wp-content/plugins/autometa/autometa.php</b> on line <b>324</b><br />

		<category><![CDATA[other]]></category>

	<!-- AutoMeta Start -->
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=177</guid>
		<description><![CDATA[

&#169; 2009 Rasmus Luckow

We were all there. The geeks, the journalists, the communication and new media consultants and the Internet entrepreneurs. Copenhagen Twestival was my first experience of meeting the Twitter community, and my guess is it was probably also the largest gathering of Danish Twitter users to date - we were around 120 people. [...]]]></description>
			<content:encoded><![CDATA[<div class="photo left"><a href="http://flickr.com/photos/rasmusluckow/3275526654/"><img src="http://farm4.static.flickr.com/3455/3275526654_51ebec4806_m_d.jpg" alt="Copenhagen Twestival crowd" /><br />
</a>
<div class="caption">&copy; 2009 <a href="http://www.flickr.com/photos/rasmusluckow/">Rasmus Luckow</a></div>
</div>
<p>We were all there. The geeks, the journalists, the communication and new media consultants and the Internet entrepreneurs. <a href="http://copenhagen.twestival.com/">Copenhagen Twestival</a> was my first experience of meeting the <a href="http://www.twitter.com">Twitter</a> community, and my guess is it was probably also the largest gathering of Danish Twitter users to date - we were around 120 people. Turns out that the Danish tweet-crowd consists of many well known faces from gatherings such as <a href="http://copenhagenrb.dk/">Copenhagen Ruby Brigade</a>, <a href="http://barcamp.org/BarCampCopenhagen">Barcamp Copenhagen</a> and <a href="http://www.reboot.dk">Reboot</a>.</p>
<p>Copenhagen Twestival was, along with many other similar meetings around the world, a charity event with the purpose of raising money for <a href="http://www.charitywater.org">charity:water</a> - an organization that argues that clean drinking water is the essential foundation upon which developing countries can evolve into something better. I can&#8217;t claim that I suffer from any great social conscience, but when Maame Agyeben - a former intern with the organization - told about charity:water, I was truly impressed. Their administration costs is sponsored separately, which makes them able to say that 100% of the general donations goes to building wells.</p>
<p>Red Cross and other global help organizations are doing a great job, but I like the prospects of charity organizations with a more narrow and dedicated purpose being able to pursue their cause globally by innovative use of Internet services. That night, we generated DKK 5,000 from the sale of 500 lottery tickets to win donated gifts, and probably a similar amount from buying overpriced, donated drinks.</p>
<p><span id="more-177"></span></p>
<div class="photo right"><a href="http://www.flickr.com/photos/rasmusluckow/3274705911/in/set-72157613723071738"><img src="http://farm4.static.flickr.com/3432/3274705911_7e9d73ab57_m_d.jpg" alt="Mikkel Malmberg" /><br />
</a>
<div class="caption">&copy; 2009 <a href="http://www.flickr.com/photos/rasmusluckow/">Rasmus Luckow</a></div>
</div>
<p>The twestival was not just about water and charity. Members of the Danish Twitter community had prepared presentations, and one of them was <a href="http://www.twitter.com/mikker">Mikkel Malmberg a.k.a. mikker</a> with a talk about Twitter - for people who know Twitter. Mikkel was introduced as &#8220;the craziest guy on Twitter&#8221;, and he showed himself worthy of the title with an entertaining and energetic show. I wouldn&#8217;t do his talk any justice by repeating it in text - you will have to see him in person some other time.</p>
<p>The culmination of the evening was the Twitter panel, consisting of <a href="http://twitter.com/Funzafunza">Henrik Fohns</a>, journalist from DR, <a href="http://www.twitter.com/mygdal">Thomas Madsen-Mygdal</a>, entrepreneur and organizer of Reboot, and Troels Jørgensen, director of Berlingske Online. The format was a number of predefined questions - ideally in 140 characters or less - which each panel member got a chance to reply to. Fohns is a well-known voice from a long-running Danish radio series on technology - <a href="http://www.dr.dk/P1/harddisken/">Harddisken</a> - and it was good to see him in the flesh. It was also clear that this was a man with great experience in voicing his opinion on media and technology in comfortable, well-phrased sentences, and I for one felt compelled to believe in everything he said just from the familiarity of the voice.</p>
<div class="photo left"><a href="http://www.flickr.com/photos/rasmusluckow/3274712013/in/set-72157613723071738/"><img src="http://farm4.static.flickr.com/3350/3274712013_aa2937426d_m_d.jpg" alt="Thomas Madsen-Mygdal" /><br />
</a>
<div class="caption">&copy; 2009 <a href="http://www.flickr.com/photos/rasmusluckow/">Rasmus Luckow</a></div>
</div>
<p>Another familiar voice was that of Mygdal. I know him from his Reboot opening speeches and from some of the many technology projects he is involved with, but I didn&#8217;t know how opinionated and loud-mouthed he could be once someone gave him a microphone and asked him to voice his opinions. He reminded me of the hero in the <a href="http://www.rubyonrails.com">Ruby on Rails</a> community - <a href="http://www.loudthinkning.com">David Heinemeier Hansson</a> - but where David&#8217;s battle is with &#8220;enterprise&#8221; software development, Thomas&#8217; seems to be with established media and journalism.</p>
<p>The first question was about the future news outlook. Mygdal said that journalists does a poor job, because it is impossible to do what they do. Also that the business model for news papers hasn&#8217;t changed in 250 years, which why they are they are now in so much trouble. &#8220;It&#8217;s pure biology&#8221;, he said, &#8220;nobody tries anything [..] We are really fucked, but we have to try something and fail.&#8221; Fohns compared the volunteer news papers run by all kinds of unemployed people in the 80&#8217;s to today&#8217;s blogging. It is journalism by the unestablished, he said, and he called it &#8220;New Cultural Press&#8221;.</p>
<div class="photo right"><a href="http://www.flickr.com/photos/rasmusluckow/3274712969/in/set-72157613723071738/"><img src="http://farm4.static.flickr.com/3045/3274712969_56b2a3db75_m_d.jpg" alt="Henrik Fohns" /><br />
</a>
<div class="caption">&copy; 2009 <a href="http://www.flickr.com/photos/rasmusluckow/">Rasmus Luckow</a></div>
</div>
<p>Another question was: Do we even need the traditional media? Troels Jørgensen was of the opinion that journalists has far too high wages in Denmark, compared to Sweden, for instance, and that was one reason it is so hard and expensive to run a media house in 2009. Mygdal pointed out that we use the term &#8220;new media&#8221; every time something new comes along that we doesn&#8217;t quite understand. In the mid-90&#8217;s, the Internet was called &#8220;new media&#8221;. He said that we need to reinvent media in a way that really brings the new opportunities together, instead of just trying to coerce &#8220;new media&#8221; into &#8220;old media&#8221;.</p>
<p>One final question worth mentioning was on the issue of media subsidy. As Mygdal put it: &#8220;We spend 6 billion on media subsidy - the government could finance 2,000 micro medias at 3 million each a year for that money.&#8221; However, as Fohns objected, working in small units, you don&#8217;t always have the required impact. As an example he mentioned the case of IT Factory, where the freelancer Dorte Toft, who spearheaded the whole uncovering process, were under a lot of pressure from the lawyers of Stein Bagger. That kind of pressure is easier too handle when you are part of something bigger, and have lawyers and other support of your own to back you up.</p>
<div class="photo left"><a href="http://flickr.com/photos/kristoffersolberg/3271727360/"><img src="http://farm4.static.flickr.com/3467/3271727360_bcd53fb600_m_d.jpg" alt="Copenhagen Twestival poster" /><br />
</a>
<div class="caption">&copy; 2009 <a href="http://flickr.com/photos/kristoffersolberg/">Kristoffer Solberg</a></div>
</div>
<p>I also remember that Mygdal mentioned at some point that Twitter really isn&#8217;t something new, that it is simply derived from blogging as a format better suited for people like himself, who might not be that good at formulating long articles. What do you think, perhaps I&#8217;d also be better off just keeping to 140 character outbursts? :)</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=R6qswEx1WsA:5y6hmsQ-gJg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=R6qswEx1WsA:5y6hmsQ-gJg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=R6qswEx1WsA:5y6hmsQ-gJg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=R6qswEx1WsA:5y6hmsQ-gJg:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=R6qswEx1WsA:5y6hmsQ-gJg:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://casperfabricius.com/site/2009/02/15/reflections-on-copenhagen-twestival/feed/</wfw:commentRss>
		</item>
		<item>
		<title>10 extensions for Radiant CMS you can’t live without</title>
		<link>http://casperfabricius.com/site/2009/01/25/10-extensions-for-radiant-cms-you-cant-live-without/</link>
		<comments>http://casperfabricius.com/site/2009/01/25/10-extensions-for-radiant-cms-you-cant-live-without/#comments</comments>
		<pubDate>Sun, 25 Jan 2009 14:28:01 +0000</pubDate>
		<dc:creator>Casper Fabricius</dc:creator>
		<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/cfp/casperfabricius.com/site/wp-content/plugins/autometa/autometa.php</b> on line <b>324</b><br />

		<category><![CDATA[radiant]]></category>

		<category><![CDATA[rails]]></category>

	<!-- AutoMeta Start -->
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=168</guid>
		<description><![CDATA[Radiant CMS is a great content management system. It&#8217;s Rails, it&#8217;s simple &#8230; in fact it is so simple that you are bound to be missing some basic features once you start implementing your web site.
This is by design. Radiant has a fantastic infrastructure for extensions, and rather than imposing a lot of advanced functionality [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://radiantcms.org/">Radiant CMS</a> is a great content management system. It&#8217;s Rails, it&#8217;s simple &#8230; in fact it is so simple that you are bound to be missing some basic features once you start implementing your web site.</p>
<p>This is by design. Radiant has a fantastic infrastructure for extensions, and rather than imposing a lot of advanced functionality making the software harder to get started with for everyone, it lets each developer make his or her own choices.</p>
<p>Still, even with the <a href="http://ext.radiantcms.org/extensions">official extension registry</a> it can be hard to navigate the many extensions out there. Many people have asked me what I recommend for just getting basics such as reordering, image upload and menu generation. There is no final answer to that question, but this article covers 10 extensions that are compatible with the newest versions of Radiant and gives you functionality you can&#8217;t live without.</p>
<p><span id="more-168"></span></p>
<p><strong>For everyone</strong></p>
<ul>
<li><a href="http://github.com/radiant/radiant-reorder-extension/tree">Reorder</a>: Yes, you really need to install an extension to be able to change the order of your pages in the page tree. I think this will be built into Radiant 0.7 - hopefully!</li>
<li><a href="http://github.com/kbingman/paperclipped/tree">Paperclipped</a>: Currently the most popular extension for adding upload of images and other files. Great user interface - highly recommended.</li>
<li><a href="http://github.com/pilu/radiant-copy-move/tree/master">Copy/Move</a>: Once your website is live, you&#8217;ll often find the need to move or copy pages to other places in the page tree - this extension lets you do just that.</li>
<li><a href="http://github.com/derencius/navigation_tags/tree/master">Navigation tags</a>: There is a tag for generating the menu built into Radiant, but it requires you to hardcode the pages. This extension allows you to build your menu in a similar manner, but draws on the actual published pages in the page tree.</li>
</ul>
<p><strong>For the slightly larger website</strong></p>
<ul>
<li><a href="http://github.com/moklett/radiant-nested-layouts-extension/tree">Nested layouts</a>: This extension is a real gem if you ask me. It allows you to have a master layout with header, footer, main menu and so on, and then setup other layouts &#8220;nested&#8221; within the master with, say, a custom sidebar or headline shared by a bunch of pages.</li>
<li><a href="http://github.com/SwankInnovations/radiant-sns-extension/tree/master">Styles and scripts</a>: If you want to be able to change all aspects of your website without deploying new files, there is no way around this extension. It allows you to store stylesheets and javascripts separately from your pages, while still being able to update them in the admin interface.</li>
<li><a href="http://github.com/avonderluft/radiant-concurrent_draft-extension/tree/master">Concurrent draft</a>: Allows you to have one published version and one draft version of each page. That way you can work with changes to a page and preview them, without having to actually publish them for everyone to see.</li>
</ul>
<p><strong><br />
For those who build their own extensions</strong></p>
<ul>
<li><a href="http://github.com/radiant/radiant-share-layouts-extension/tree/master">Shared layouts</a>: If your extension includes pages that need to use the same layouts as the Radiant pages, this extension is a must. It simply lets you specify a Radiant layout in the controller just like you specify a Rails layout.</li>
<li><a href="http://github.com/digitalpulp/radiant-exception-notification-extension/tree">Exception notification</a>: Once you add your own extensions to Radiant it makes very much sense to be notified of any exceptions that occurs. This extension wraps the popular <a href="http://github.com/rails/exception_notification/tree/master">exception notification</a> plugin which has a few compatibility issues with Radiant.</li>
<li><a href="http://github.com/Squeegy/radiant-settings/tree">Settings</a>: I highly recommend that you let your own extensions be configurable through the standard <code>Radiant::Config</code> interface. This extension provides a tab in the admin interface for adding and editing these settings.</li>
</ul>
<p>Many, many more great extensions exists for Radiant - I haven&#8217;t even mentioned my own! And while the <a href="http://ext.radiantcms.org/extensions">official extension registry</a> is a great initiative, you&#8217;ll find even more by searching for <a href="http://github.com/search?type=Repositories&#038;q=radiant+extension">&#8220;radiant extension&#8221;</a> on Github.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=TilPXkkeB2U:A_tWH83-8HM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=TilPXkkeB2U:A_tWH83-8HM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=TilPXkkeB2U:A_tWH83-8HM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=TilPXkkeB2U:A_tWH83-8HM:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=TilPXkkeB2U:A_tWH83-8HM:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://casperfabricius.com/site/2009/01/25/10-extensions-for-radiant-cms-you-cant-live-without/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hello Merb</title>
		<link>http://casperfabricius.com/site/2009/01/01/hello-merb/</link>
		<comments>http://casperfabricius.com/site/2009/01/01/hello-merb/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 15:46:32 +0000</pubDate>
		<dc:creator>Casper Fabricius</dc:creator>
		<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/cfp/casperfabricius.com/site/wp-content/plugins/autometa/autometa.php</b> on line <b>324</b><br />

		<category><![CDATA[engines]]></category>

		<category><![CDATA[radiant]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[railsconf]]></category>

	<!-- AutoMeta Start -->
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=158</guid>
		<description><![CDATA[Merb is getting merged into Ruby on Rails. Together they will become Rails 3, as announced by David Heinemeier Hansson here and Yehuda Katz here.
I wish I could claim to have been playing with Merb for a while and have some real insight into the framework, but to be honest, I haven&#8217;t. I still think [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.merbivore.org/">Merb</a> is getting merged into <a href="http://www.rubyonrails.com">Ruby on Rails</a>. Together they will become Rails 3, as announced by David Heinemeier Hansson <a href="http://weblog.rubyonrails.org/2008/12/23/merb-gets-merged-into-rails-3">here</a> and Yehuda Katz <a href="http://yehudakatz.com/2008/12/23/rails-and-merb-merge/">here</a>.</p>
<p>I wish I could claim to have been playing with Merb for a while and have some real insight into the framework, but to be honest, I haven&#8217;t. I still think this a very interesting news, though, and in my opinion this can only be good news for the Rails community. Already, the brilliant Merb guys are optimizing and improving Rails, for instance <a href="http://yehudakatz.com/2008/12/27/status-memorandum/">this 8% speed boost in using <code>respond_to</code></a>.</p>
<p>So, how can we expect the the merge to affect the Rails framework we know and love? Let&#8217;s peek into the possibilities of combining these two frameworks.</p>
<p><span id="more-158"></span></p>
<p>One change that seems certain, is changes to the <b>routing system</b>. &#8220;Plans are already underway to port the Merb router over to Rails. At the very least, you will have the option to use the Merb DSL syntax instead of the Rails hash-based syntax. We’ll see which one becomes the default.&#8221; Katz <a href="http://yehudakatz.com/2008/12/29/another-rails-2x3-update/">says</a>. David <a href="http://www.loudthinking.com/posts/37-bringing-merbs-providesdisplay-into-rails-3">explains</a> how Merb concepts for rendering resources in different formats will be used in Rails 3, but with more intuitive or &#8220;Rails-like&#8221; naming.</p>
<p>Another change which is likely to make it into Rails 3 is <b>slices</b>, as indicated by Katz in a response to his own <a href="http://yehudakatz.com/2008/12/23/rails-and-merb-merge/">announcement</a>. Slices are &#8220;similar to what Rails-Engines promise, except merb-slices are built into the framework&#8221; as Ezra Zygmuntowicz <a href="http://brainspl.at/articles/2008/05/21/merb-slices">explains</a>. This is exiting news! I&#8217;ve always been interested gaining leverage by having reusable application slices, and I&#8217;ve actively built and used both <a href="http://rails-engines.org/">Rails Engines</a> and <a href="http://casperfabricius.com/site/2007/07/19/advanced-radiant-extensions/">Radiant extensions</a>. Engines has previously been frowned upon by leading figures in the Rails community, but it has been improved to work in a quite clean and easy-to-understand manner since the release of Rails 2.0, and are in fact compared to Merb slices <a href="http://rails-engines.org/news/2008/05/24/merb-slices-again/">here</a>. Radiant extensions are obviously only for Radiant CMS-based websites, but the <a href="http://ext.radiantcms.org/extensions">diversity</a> of these extensions illustrates the potential of getting support for real full-stack application slices into the Rails core. A project like <a href="https://github.com/svenfuchs/adva_cms/tree">Adva CMS</a> also illustrates how it is possible to build high quality reusable application slices for the common good.</p>
<p>A third change I hope to see as a result of the merge is <b>controller-based mailers and partials</b>. <code>ActionMailer</code> has always been a bit of an ugly stepchild in the Rails framework, and the positioning of a <code>Mailer</code> as a sort-of model, but with templates, doesn&#8217;t seem logic to me. Merb has an <code>AbstractController</code> class that both mailers and partials (called parts in Merb) inherit from, which allows for a more intuitive control in rendering mails and parts.</p>
<p>I was curious to find out how the Merb community has reacted to this decision. The Rails community doesn&#8217;t seem to be overly concerned. Perhaps it&#8217;s because the merge of Merb and Rails are called &#8220;Rails 3&#8243;. Not &#8220;Merb 2&#8243;, not &#8220;MerbRails&#8221; - the names clearly signals that the merge will be done on Rails&#8217; terms. While it has become popular in the Rails community to dissociate one self with David Heinemeier Hansson, I still think people sees him as a good security for not letting the Rails principles go in the merge.</p>
<p>I browsed through the more than 100 comments to <a href="http://yehudakatz.com/2008/12/23/rails-and-merb-merge/">Yehuda Katzs announcement</a> of the merge, and while about half of the commenters simply expresses their happiness and agreement with the decision, the objections of the other half falls roughly into three categories: Technical, personal and economic.</p>
<p>The <b>technical concerns</b> are of course fully expected, and some of the more interesting are:</p>
<ul>
<li>&#8220;Does merging a lightweight framework into a bloated framework make the bloated framework any lighter?&#8221;</li>
<li>&#8220;I really hope that merb will be able to continue it’s ‘no-magic’ attitude and bring that to rails without compromises&#8221;</li>
<li>&#8220;I would have liked to see merb go further on its own just to push the envelope further&#8221;</li>
<li>&#8220;How many planned advancements are being put on hold while Rails catches up?&#8221;</li>
</ul>
<p>The <b>personal objections</b> is about one very visible person: David Heinemeier Hansson. I hold no grudge against David, so I shall only repeat one of the more curious comments in this category: &#8220;The big problem, as always with Rails, is DHH: a vainglorious, two-faced prima donna with a massive and fragile ego. He’s good, but not nearly as unique and amazing as he thinks he is. I went to Merb to get away from DHH. Ugh.&#8221; If many people in the Merb community feels like this guy, I understand if they are concerned that David will simply steamroller the philosophy of Merb. David has been fast to <a href="http://www.loudthinking.com/posts/36-work-on-what-you-use-and-share-the-rest">address these concerns</a>, but the question is if just saying everyone should work on what the care about is enough.</p>
<p>The <b>economic perspective</b> of the merge is where things gets interesting. Rails is trademarked by David and synonymous with <a href="http://www.37signals.com">37signals</a>, while Merb is very closely linked to <a href="http://www.engineyard.com">EngineYard</a>. Two commenters really nail it down:</p>
<ul>
<li>&#8220;How has the ‘Opinionated Software’ philosophy of “Fuck You (DHH)” Rails become aligned with the ‘open’ and democratic philosophy of Merb? Is this some kind of preemptive marketing in advance of a joint investment in both Engine Yard and 37 Signals by a common investor?&#8221;</li>
<li>&#8220;My suspicion turns to the fact that almost every Merb core team member is owned by Engine Yard. Something doesn’t smell right.&#8221;</li>
</ul>
<p>It&#8217;ll be interesting to follow not just the architectural design choices made on the technical front during the merge process, but also how this will change the positioning of 37signals and EngineYard, and if the two companies are really warming up to some kind of close relationship.</p>
<p>The timeline for a first peek at Rails 3 - the union of Merb and Rails - is <a href="http://merbist.com/2008/12/23/rails-and-merb-merge/">said</a> to be RailsConf 2009 - 4 months from now.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=Why4p0iPslo:pVN5rmXPCtw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=Why4p0iPslo:pVN5rmXPCtw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=Why4p0iPslo:pVN5rmXPCtw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=Why4p0iPslo:pVN5rmXPCtw:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=Why4p0iPslo:pVN5rmXPCtw:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://casperfabricius.com/site/2009/01/01/hello-merb/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Christmas greetings from a happy boy</title>
		<link>http://casperfabricius.com/site/2008/12/22/christmas-greetings/</link>
		<comments>http://casperfabricius.com/site/2008/12/22/christmas-greetings/#comments</comments>
		<pubDate>Mon, 22 Dec 2008 08:52:38 +0000</pubDate>
		<dc:creator>Casper Fabricius</dc:creator>
		<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/cfp/casperfabricius.com/site/wp-content/plugins/autometa/autometa.php</b> on line <b>324</b><br />

		<category><![CDATA[other]]></category>

	<!-- AutoMeta Start -->
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=156</guid>
		<description><![CDATA[Dear friends and clients, business associates and regular blog readers.
Thank you for helping me out, thank you for doing business with me, and thank you for following my ramblings. Let&#8217;s do it all again next year!
Now that I&#8217;ve had some time to experience self-employment on my own, I&#8217;ve come to realize that there are many [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Dear friends and clients, business associates and regular blog readers.</strong></p>
<p>Thank you for helping me out, thank you for doing business with me, and thank you for following my ramblings. Let&#8217;s do it all again next year!</p>
<p>Now that I&#8217;ve had some time to experience self-employment on my own, I&#8217;ve come to realize that there are many similarities between being an entrepreneur and being a nissemand. Both is hard, but when and if you reach the happy ending, everything will be good. As a Christmas greeting especially for you, I&#8217;ve recorded a song about just that :)</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/bylkpFb88fw&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/bylkpFb88fw&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>I wish you a merry Christmas and a happy New Year!</p>
<p>All the best,<br />
Casper</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=G77r7RIifXs:DzG9K3QZRVs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=G77r7RIifXs:DzG9K3QZRVs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=G77r7RIifXs:DzG9K3QZRVs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=G77r7RIifXs:DzG9K3QZRVs:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=G77r7RIifXs:DzG9K3QZRVs:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://casperfabricius.com/site/2008/12/22/christmas-greetings/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Removing Rails validations with metaprogramming</title>
		<link>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/</link>
		<comments>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 14:10:05 +0000</pubDate>
		<dc:creator>Casper Fabricius</dc:creator>
		<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/cfp/casperfabricius.com/site/wp-content/plugins/autometa/autometa.php</b> on line <b>324</b><br />

		<category><![CDATA[radiant]]></category>

		<category><![CDATA[rails]]></category>

	<!-- AutoMeta Start -->
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=153</guid>
		<description><![CDATA[I recently found myself facing a metaprogramming challenge. I solved it by combining two terrible ugly hacks, and as such I won&#8217;t say I found a solution that is anywhere near to be elegant.
My problem was this: I was developing a Radiant extension called tags_multi_site, which allows the tags extension to play nice with the [...]]]></description>
			<content:encoded><![CDATA[<p>I recently found myself facing a metaprogramming challenge. I solved it by combining two terrible ugly hacks, and as such I won&#8217;t say I found a solution that is anywhere near to be elegant.</p>
<p>My problem was this: I was developing a <a href="http://radiantcms.org">Radiant</a> extension called <a href="http://github.com/RSpace/radiant-tags_multi_site-extension/tree/master">tags_multi_site</a>, which allows the <a href="http://github.com/jomz/radiant-tags-extension/tree/master">tags extension</a> to play nice with the <a href="http://github.com/radiant/radiant-multi-site-extension/tree/master">multi_site extension</a>. This required me to scope all tags within a site, so that tags with the same name could exist in different sites, but in the same physical database table.</p>
<p>The tags extension has this validation:</p>
<pre class="cfcode">
class MetaTag < ActiveRecord::Base
  validates_uniqueness_of :name, :case_sensitive => false
end
</pre>
<p>I needed to add <code>:scope => :site_id</code>, but I couldn&#8217;t touch the code of tags extension itself, since that would terribly un-DRY and not reusable for anyone else. I had to either modify the existing validation programmatically from my own extension or to remove it and add my own.</p>
<p><span id="more-153"></span></p>
<p>I went for the last solution. I quickly discovered that validations are saved in an array available as an inheritable attribute on the model (<code>read_inheritable_attribute(:validate)</code>), and that the built-in Rails validation are stored as <code>Proc</code>s in this array. One could remove all validations added so far by emptying this array, but I only wanted to remove <code>validates_uniqueness_of</code> to stay as loosely coupled as possible.</p>
<p><code>Proc</code>s can&#8217;t tell much about themselves - they are mostly just there to be called. But I knew from the Rails code that each validation <code>Proc</code> is added from inside the class method of the validation. So, I just had to figure out a way to determine the method context the <code>Proc</code> had been declared in to be able to remove the right one.</p>
<p>I realized I could read variables from the <code>Proc</code>&#8217;s context by doing an <code>eval</code> with the <code>Proc</code>&#8217;s binding applied. I also found an expression somewhere that returned the name of current method by using the stacktrace information in <code>caller</code>.</p>
<p>All in all, the solution ended up like this:</p>
<pre class="cfcode">
module TagsMultiSite
  module MetaTagExtensions
    def self.included(base)
      base.extend(ClassMethods)
      base.class_eval {
        # HACK: Remove the existing validates_uniqueness_of block
        read_inheritable_attribute(:validate).reject! do |proc|
          if proc.is_a?(Proc)
            method = eval("caller[0] =~ /`([^']*)'/ and $1", proc.binding).to_sym rescue nil # Returns the name of method the proc was declared in
            :validates_uniqueness_of == method
          else
            false
          end
        end

        # Add new validates_uniqueness_of with correct scope
        validates_uniqueness_of :name, :case_sensitive => false, :scope => :site_id
      }
    end
  end
end
</pre>
<p>It would be easy to make this into a generalized method for removing Rails validations, but I think this issue is pretty rare. Usually people can just change or remove the original validation. Still, this example demonstrates fairly well how the trusting nature of Ruby allow us to make far-fetched metaprogramming hacks to solve our problems.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=4o0mmqvDGuw:aIHruTH5A68:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=4o0mmqvDGuw:aIHruTH5A68:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=4o0mmqvDGuw:aIHruTH5A68:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?a=4o0mmqvDGuw:aIHruTH5A68:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FingerprintsOfCasperFabricius?i=4o0mmqvDGuw:aIHruTH5A68:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
