<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>My Pragmatig life -- Michael Grosser</title>
	<atom:link href="http://pragmatig.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://pragmatig.wordpress.com</link>
	<description>Building web applications and fighting the daily madness</description>
	<lastBuildDate>Sat, 14 Nov 2009 14:17:45 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='pragmatig.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/44cfef6a38ca0475550b41b22284f09b?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>My Pragmatig life -- Michael Grosser</title>
		<link>http://pragmatig.wordpress.com</link>
	</image>
			<item>
		<title>What are your git-stats?</title>
		<link>http://pragmatig.wordpress.com/2009/11/14/what-are-your-git-stats/</link>
		<comments>http://pragmatig.wordpress.com/2009/11/14/what-are-your-git-stats/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 14:17:45 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Git]]></category>

		<guid isPermaLink="false">http://pragmatig.wordpress.com/?p=968</guid>
		<description><![CDATA[Also available as Gist
Ever wondered how much who adds/removes, its time to find out 
(those are real stats, I just obfuscated the names   )
Results

Git scores (in LOC):
mr-add              :  +482273       -9466
justu    [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=968&subd=pragmatig&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Also available as <a href="http://gist.github.com/234560">Gist</a></p>
<p>Ever wondered how much who adds/removes, its time to find out <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
(those are real stats, I just obfuscated the names <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>
<p><strong>Results</strong></p>
<pre style="font-size:12px;overflow:auto;">
Git scores (in LOC):
mr-add              :  +482273       -9466
justu               :  +286250       -159905
grosser             :  +152384       -323344
another             :  +121257       -82116
naames              :  +104577       -13591
justfor             :  +68716        -72446
example             :  +7795         -4987
andeven             :  +5100         -1730
morenow             :  +4225         -2764
finish              :  +17           -19
</pre>
<p><strong>Install</strong><br />
Copy init git_stats.rb and ruby git_stats.rb<br />
(you can add the names of people who commit with different users into the &#8217;same&#8217; array)</p>
<pre style="font-size:12px;overflow:auto;">
# please add enhancements to http://gist.github.com/234560
#!/usr/bin/env ruby
t = Time.now

same = [['name-a','name-b'],['mr fred','fred']]
pipe = open("|git log --shortstat")
author = "unknown"
stats = {}

loop do
  line = pipe.readline rescue break
  author = $1 if line =~ /Author\: ([a-z]+) &lt;/
  found = same.detect{|a| a.include?(author)}
  author = found.first if found

  if line =~  /files changed, (\d+) insertions\(\+\), (\d+) deletions/
    stats[author] ||= Hash.new(0)
    stats[author]['+']+=$1.to_i
    stats[author]['-']+=$2.to_i
    print '.'
  end
end

puts "\nGit scores (in LOC):"
puts stats.sort_by{|a,d| -d['+'] }.map{|author, data| "#{author.ljust(20)}:  +#{data['+'].to_s.ljust(10)}   -#{data['-'].to_s.ljust(10)} " } * "\n"
</pre>
 Tagged: Git, Ruby <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/968/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/968/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/968/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/968/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/968/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/968/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/968/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/968/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/968/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/968/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=968&subd=pragmatig&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://pragmatig.wordpress.com/2009/11/14/what-are-your-git-stats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>Hash.pass and Hash.block that also work with HashWithIndifferentAccess</title>
		<link>http://pragmatig.wordpress.com/2009/11/08/hash-pass-and-hash-block-that-also-work-with-hashwithindifferentaccess/</link>
		<comments>http://pragmatig.wordpress.com/2009/11/08/hash-pass-and-hash-block-that-also-work-with-hashwithindifferentaccess/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 11:58:26 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://pragmatig.wordpress.com/?p=960</guid>
		<description><![CDATA[A new version of the old pass/block hack, but this time they also work as expected on HashWithIndifferentAccess (params/session&#8230;)
When attr_protected or attr_accessible are just to complicated, a simple user.attributes = params[:user].pass(:name, :email) just works.
Or user.attributes = params[:user].block(:admin) for the opposite&#8230;

# lets through the keys in the argument
# &#62;&#62; {:one =&#62; 1, :two =&#62; 2, :three [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=960&subd=pragmatig&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A new version of the <a href="http://snippets.dzone.com/posts/show/2178">old pass/block hack</a>, but this time they also work as expected on HashWithIndifferentAccess (params/session&#8230;)</p>
<p>When attr_protected or attr_accessible are just to complicated, a simple <b>user.attributes = params[:user].pass(:name, :email)</b> just works.<br />
Or <b>user.attributes = params[:user].block(:admin)</b> for the opposite&#8230;</p>
<pre style="font-size:12px;overflow:hidden;">
# lets through the keys in the argument
# &gt;&gt; {:one =&gt; 1, :two =&gt; 2, :three =&gt; 3}.pass(:one)
# =&gt; {:one=&gt;1}
def pass(*selected_keys)
  tmp = self.dup
  dup.block(*selected_keys).keys.each{|k| tmp.delete k }
  tmp
end

# blocks the keys in the arguments
# &gt;&gt; {:one =&gt; 1, :two =&gt; 2, :three =&gt; 3}.block(:one)
# =&gt; {:two=&gt;2, :three=&gt;3}
def block(*blocked_keys)
  tmp = self.dup
  blocked_keys.each{|k| tmp.delete k }
  tmp
end
</pre>
 Tagged: Rails, Ruby <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/960/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/960/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/960/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/960/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/960/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/960/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/960/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/960/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/960/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/960/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=960&subd=pragmatig&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://pragmatig.wordpress.com/2009/11/08/hash-pass-and-hash-block-that-also-work-with-hashwithindifferentaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>Solving Background Processing with a Single, Generic Background Job</title>
		<link>http://pragmatig.wordpress.com/2009/11/04/solving-background-processing-with-a-single-generic-background-job/</link>
		<comments>http://pragmatig.wordpress.com/2009/11/04/solving-background-processing-with-a-single-generic-background-job/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 06:34:03 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://pragmatig.wordpress.com/?p=948</guid>
		<description><![CDATA[Again I read an article about background processing that generates many different jobs which all do the same: call method a on b with parameter z. At the moment we are using one GenericJob to handle all those cases.
It serializes ActiveRecord objects to a string representation, so that they do not get submittet as instance(often [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=948&subd=pragmatig&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Again I read an <a href="http://techno-weenie.net/2009/11/4/structuring-your-background-jobs">article</a> about background processing that generates many different jobs which all do the same: <strong>call method a on b with parameter z</strong>. At the moment we are using <strong>one GenericJob to handle all those cases</strong>.</p>
<p>It serializes ActiveRecord objects to a string representation, so that they do not get submittet as instance(often too large or deserialisation problems), if you do not need this feature, :<a href="http://github.com/tobi/delayed_job">send_later</a> could be a good option for starting with generic jobs.</p>
<p><strong>Usage</strong></p>
<pre style="font-size:12px;overflow:hidden;">GenericJob.publish UserMailer, :deliver_notification,
  :args=&gt;[user, comment], :priority=&gt;2
</pre>
<p><strong>Install</strong></p>
<pre style="font-size:12px;overflow:hidden;">class GenericJob &lt; DelayedJobBase
  DEFAULT_JOB_PRIORITY = 5

  # GenericJob.publish( Product, :find, :args=&gt;[:all, {:conditions=&gt;"1 = 2"}], :priority=&gt;3 )
  def self.publish(klass, method, options={})
    args = options[:args] || []
    args = GenericJob.serialize_ar(args)
    priority = options[:priority] || DEFAULT_JOB_PRIORITY
    Delayed::Job.enqueue self.new(:class_name =&gt; klass.to_s, :method_name =&gt; method, :args =&gt; args), priority
  end

  def perform
    klass = message[:class_name].constantize
    args = GenericJob.deserialize_ar(message[:args]||[])
    klass.send(message[:method_name], *args)
  end

  private

  def self.serialize_ar(args)
    args.map do |arg|
      if arg.is_a?(ActiveRecord::Base)
        "ActiveRecord:#{arg.class}:#{arg.id}"
      else
        arg
      end
    end
  end

  def self.deserialize_ar(args)
    args.map do |arg|
      if arg.to_s =~ /^ActiveRecord:(\w+):(\d+)$/
        $1.constantize.find($2)
      else
        arg
      end
    end
  end
end
</pre>
 Tagged: Rails, Ruby <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/948/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=948&subd=pragmatig&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://pragmatig.wordpress.com/2009/11/04/solving-background-processing-with-a-single-generic-background-job/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>Ubuntu Karmic Koala is here, time for a fresh install</title>
		<link>http://pragmatig.wordpress.com/2009/10/25/karmic-koala-is-here-time-for-a-fresh-install/</link>
		<comments>http://pragmatig.wordpress.com/2009/10/25/karmic-koala-is-here-time-for-a-fresh-install/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 06:35:56 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Karmic Koala]]></category>
		<category><![CDATA[Rubymine]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://pragmatig.wordpress.com/?p=930</guid>
		<description><![CDATA[Since my old Ubuntu lived a long live and saw numerous hacks, I chose to reinstall from scratch, here are the steps I took:

install dotfiles
Skype
Multi-clipboard: sudo apt-get install glipper
Application laucher: sudo apt-get install gnome-do + enable skype plugin
Ruby enterprise
Rubymine + Desktop icon+ Meta key for Rubymine
Mysql: sudo apt-get install mysql-server mysql-client libmysql-ruby
Apache:  sudo apt-get install [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=930&subd=pragmatig&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Since my old Ubuntu lived a long live and saw numerous hacks, I chose to reinstall from scratch, here are the steps I took:</p>
<ol>
<li>install <a href="http://github.com/grosser/dotfiles/">dotfiles</a></li>
<li><a href="http://www.skype.com/intl/en/download/skype/linux/choose/">Skype</a></li>
<li>Multi-clipboard: sudo apt-get install glipper</li>
<li>Application laucher: sudo apt-get install gnome-do + enable skype plugin</li>
<li><a href="http://www.rubyenterpriseedition.com/download.html">Ruby enterprise</a></li>
<li><a href="http://www.jetbrains.com/ruby/index.html">Rubymine</a> + <a href="http://mylescarrick.com/articles/installing_rubymine_in_ubuntu_jaunty_904">Desktop icon</a>+ <a href="http://pragmatig.wordpress.com/2009/10/01/switching-to-rubymine-from-netbeans-on-ubuntu/">Meta key for Rubymine</a></li>
<li>Mysql: sudo apt-get install mysql-server mysql-client libmysql-ruby</li>
<li>Apache:  sudo apt-get install apache2 apache2-mpm-prefork apache2-prefork-dev</li>
<li><a href="http://www.modrails.com/install.html">Passenger</a></li>
<li><a href="http://pragmatig.wordpress.com/2009/10/21/sslhttps-for-passenger-in-development-on-ubuntu-jaunty/">SSL for apache/passenger</a></li>
<li>gem sources -a http://gems.github.com</li>
<li>gems&#8230;</li>
<li>Java: sudo apt-get install sun-java6-jre</li>
<li>Git: sudo apt-get install git-core</li>
</ol>
<p>No more hacks, everything works, very fast startup (~10s), faster graphics (for intel chips) <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p style="text-align:center;">
<div id="attachment_938" class="wp-caption aligncenter" style="width: 400px"><a href="http://pragmatig.files.wordpress.com/2009/10/screenshot.png"><img class="size-medium wp-image-938    " title="Ubuntu Karmic Koala Screenshot" src="http://pragmatig.files.wordpress.com/2009/10/screenshot.png?w=390&#038;h=243" alt="My new desktop" width="390" height="243" /></a><p class="wp-caption-text">My new desktop</p></div>
 Tagged: Karmic Koala, Rails, Ruby, Rubymine, Ubuntu <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/930/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/930/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/930/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/930/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/930/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/930/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/930/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/930/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/930/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/930/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=930&subd=pragmatig&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://pragmatig.wordpress.com/2009/10/25/karmic-koala-is-here-time-for-a-fresh-install/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>

		<media:content url="http://pragmatig.files.wordpress.com/2009/10/screenshot.png" medium="image">
			<media:title type="html">Ubuntu Karmic Koala Screenshot</media:title>
		</media:content>
	</item>
		<item>
		<title>SSL/HTTPS for Passenger in development on Ubuntu Jaunty</title>
		<link>http://pragmatig.wordpress.com/2009/10/21/sslhttps-for-passenger-in-development-on-ubuntu-jaunty/</link>
		<comments>http://pragmatig.wordpress.com/2009/10/21/sslhttps-for-passenger-in-development-on-ubuntu-jaunty/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 19:46:37 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://pragmatig.wordpress.com/?p=912</guid>
		<description><![CDATA[Making a certificate
sudo mkdir /etc/apache2/ssl
sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem

sudo nano /etc/apache2/sites-available/default-ssl
  #deactivete other crt/key files (snakeoil)
  SSLCertificateFile /etc/apache2/ssl/apache.pem

sudo a2ensite default-ssl
sudo a2enmod ssl
sudo /etc/init.d/apache2 restart

Configure passenger
&#60;VirtualHost *:80&#62;
 ServerAlias *.something.com
 RailsEnv development
 DocumentRoot /apps/something/public
&#60;/VirtualHost&#62;
&#60;VirtualHost *:443&#62;
 SSLEngine on
 SSLCertificateFile /etc/apache2/ssl/apache.pem
 ServerAlias *.something.com
 RailsEnv development
 DocumentRoot /apps/something/public
&#60;/VirtualHost&#62;
host
 Tagged: Rails, Ruby, Server, SSL, Ubuntu      [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=912&subd=pragmatig&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Making a certificate</strong></p>
<pre style="font-size:12px;overflow:auto;">sudo mkdir /etc/apache2/ssl
sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem

sudo nano /etc/apache2/sites-available/default-ssl
  #deactivete other crt/key files (snakeoil)
  SSLCertificateFile /etc/apache2/ssl/apache.pem

sudo a2ensite default-ssl
sudo a2enmod ssl
sudo /etc/init.d/apache2 restart
</pre>
<p><strong>Configure passenger</strong></p>
<pre style="font-size:12px;overflow:auto;">&lt;VirtualHost *:80&gt;
 ServerAlias *.something.com
 RailsEnv development
 DocumentRoot /apps/something/public
&lt;/VirtualHost&gt;
&lt;VirtualHost *:443&gt;
 SSLEngine on
 SSLCertificateFile /etc/apache2/ssl/apache.pem
 ServerAlias *.something.com
 RailsEnv development
 DocumentRoot /apps/something/public
&lt;/VirtualHost&gt;</pre>
<p>host</p>
 Tagged: Rails, Ruby, Server, SSL, Ubuntu <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/912/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=912&subd=pragmatig&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://pragmatig.wordpress.com/2009/10/21/sslhttps-for-passenger-in-development-on-ubuntu-jaunty/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>The opposite of Rails blank? is present?</title>
		<link>http://pragmatig.wordpress.com/2009/10/19/the-opposite-of-rails-blank/</link>
		<comments>http://pragmatig.wordpress.com/2009/10/19/the-opposite-of-rails-blank/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 13:53:51 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://pragmatig.wordpress.com/?p=915</guid>
		<description><![CDATA[params[:id].present?
nil.present?
( the original post was a hack adding String.filled? / NilClass.filled? )
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=915&subd=pragmatig&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>params[:id].present?<br />
nil.present?</p>
<p>( the original post was a hack adding String.filled? / NilClass.filled? )</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/915/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/915/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/915/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/915/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/915/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/915/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/915/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/915/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/915/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/915/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=915&subd=pragmatig&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://pragmatig.wordpress.com/2009/10/19/the-opposite-of-rails-blank/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>descriptive raise &#8212; tired of exception class/object expected ?</title>
		<link>http://pragmatig.wordpress.com/2009/10/15/descriptive-raise-tired-of-exception-classobject-expected/</link>
		<comments>http://pragmatig.wordpress.com/2009/10/15/descriptive-raise-tired-of-exception-classobject-expected/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 12:34:04 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://pragmatig.wordpress.com/?p=909</guid>
		<description><![CDATA[
# descriptive raise
# normale: raise 1 == TypeError: exception class/object expected
# now: raise 1 == RuntimeError: 1
class Object
  def raise_with_helpfulness(*args)
    raise_without_helpfulness(*args)
  rescue TypeError =&#62; e
    raise_without_helpfulness args.first.inspect if e.to_s == 'exception class/object expected'
    raise e
  end
  alias_method_chain :raise, :helpfulness

 Tagged: Rails, Ruby [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=909&subd=pragmatig&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><pre style="overflow:auto;font-size:12px;">
# descriptive raise
# normale: raise 1 == TypeError: exception class/object expected
# now: raise 1 == RuntimeError: 1
class Object
  def raise_with_helpfulness(*args)
    raise_without_helpfulness(*args)
  rescue TypeError =&gt; e
    raise_without_helpfulness args.first.inspect if e.to_s == 'exception class/object expected'
    raise e
  end
  alias_method_chain :raise, :helpfulness
</pre>
 Tagged: Rails, Ruby <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/909/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/909/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/909/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/909/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/909/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/909/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/909/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/909/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/909/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/909/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=909&subd=pragmatig&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://pragmatig.wordpress.com/2009/10/15/descriptive-raise-tired-of-exception-classobject-expected/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>Switching to RubyMine from Netbeans on Ubuntu</title>
		<link>http://pragmatig.wordpress.com/2009/10/01/switching-to-rubymine-from-netbeans-on-ubuntu/</link>
		<comments>http://pragmatig.wordpress.com/2009/10/01/switching-to-rubymine-from-netbeans-on-ubuntu/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 11:52:47 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://pragmatig.wordpress.com/?p=906</guid>
		<description><![CDATA[I recently did the switch and it was fun, and now I finally got everything working, here are the steps I took:

Install rubymine and make a shortcut
Use Textmate style shortcuts (so I can work with all the evil textmaters out there :&#62; )
Correct Meta key behaviour:
1. change LWIN in /usr/share/X11/xkb/symbols/pc
key &#60;LWIN&#62; {        [ Meta_L, Super_L       [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=906&subd=pragmatig&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I recently did the switch and it was fun, and now I finally got everything working, here are the steps I took:</p>
<ul>
<li><a href="http://mylescarrick.com/articles/installing_rubymine_in_ubuntu_jaunty_904">Install rubymine and make a shortcut</a></li>
<li>Use Textmate style shortcuts (so I can work with all the evil textmaters out there :&gt; )</li>
<li>Correct Meta key behaviour:<br />
1. change LWIN in /usr/share/X11/xkb/symbols/pc<br />
key &lt;LWIN&gt; {        [ Meta_L, Super_L       ]       };<br />
2. System &gt; administration &gt; keyboard &gt; layout options<br />
choose meta is mapped to left win</li>
<li>fuzzy autocomplete / Textmate Esc autocomplete is called &#8220;cyclic completion&#8221;, find it in keymap and replace it with Esc</li>
<li>add ctrl+c/v/x/z/&#8230; shortcuts so rubymine behaves like all the other apps</li>
</ul>
<p>Benefits:</p>
<ul>
<li>great fuzzy file search e.g. &#8220;ba/us/in&#8221; -&gt; app/backend/users/index.erb</li>
<li>Fast autocompletion</li>
<li>Nice refactoring with preview</li>
<li>Warnings / hints on local / global / unused variables and sane spellchecking</li>
<li>Tons of options for whitespace/editor layout</li>
<li>Integrated git with visible history</li>
<li>&#8220;click something and got to its definition&#8221; works great</li>
</ul>
<p>Drawbacks</p>
<ul>
<li>Startup takes ~30s for large app (initial indexing took ~ 4min)</li>
<li>To many menu entries, but they can be customized out&#8230;</li>
</ul>
 Tagged: Ruby <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/906/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/906/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/906/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/906/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/906/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/906/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/906/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/906/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/906/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/906/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=906&subd=pragmatig&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://pragmatig.wordpress.com/2009/10/01/switching-to-rubymine-from-netbeans-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>Speeding up Slow Spork Startup for Rails 2.3+</title>
		<link>http://pragmatig.wordpress.com/2009/09/27/speeding-up-slow-spork-startup-for-rails-2-3/</link>
		<comments>http://pragmatig.wordpress.com/2009/09/27/speeding-up-slow-spork-startup-for-rails-2-3/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 07:57:11 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Test]]></category>

		<guid isPermaLink="false">http://pragmatig.wordpress.com/?p=902</guid>
		<description><![CDATA[If you noticed spork startup getting slower when switching to Rails 2.3, your not alone  

Views are eager loaded
app/ is eager loaded (when config.cache_classes is on)

Without hack: 18s startup
With hack: 2s startup  
Try it
#spec/spec_helper.rb
begin
  require 'spork/app_framework/rails'
  module Spork::AppFramework::Rails::NinjaPatcher
    # views are preloaded  spork must be restarted for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=902&subd=pragmatig&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you noticed spork startup getting slower when switching to Rails 2.3, your not alone <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<ul>
<li>Views are eager loaded</li>
<li>app/ is eager loaded (when config.cache_classes is on)</li>
</ul>
<p>Without hack: 18s startup<br />
With hack: 2s startup <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><strong>Try it</strong></p>
<pre style="font-size:12px;">#spec/spec_helper.rb
begin
  require 'spork/app_framework/rails'
  module Spork::AppFramework::Rails::NinjaPatcher
    # views are preloaded  spork must be restarted for view changes
    def delay_eager_view_loading
      puts "removed because i am too slow..."
    end

    # do not preload application files
    # alternatively urn off config.cache_classes
    def delay_app_preload
      ::Rails::Initializer.send(:define_method, :load_application_classes) do
      end
    end
  end
rescue
end

Spork.prefork do
  ...
</pre>
 Tagged: Rails, Ruby, Test <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/902/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/902/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/902/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/902/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/902/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/902/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/902/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/902/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/902/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/902/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=902&subd=pragmatig&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://pragmatig.wordpress.com/2009/09/27/speeding-up-slow-spork-startup-for-rails-2-3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
		<item>
		<title>Stop spec_helper from being loaded multiple times</title>
		<link>http://pragmatig.wordpress.com/2009/09/24/stop-spec_helper-from-being-loaded-multiple-times/</link>
		<comments>http://pragmatig.wordpress.com/2009/09/24/stop-spec_helper-from-being-loaded-multiple-times/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 18:58:22 +0000</pubDate>
		<dc:creator>pragmatig</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Test]]></category>

		<guid isPermaLink="false">http://pragmatig.wordpress.com/?p=891</guid>
		<description><![CDATA[If you got a big project, chances are spec_helper is required through different ways, File.expand_path / File.join() / &#8230; which results in it being loaded several times!
Try it:

#spec_helper.rb
print "YEP!"

rake spec -&#62; &#8220;YEP!YEP!YEP!YEP!YEP!YEP!YEP!YEP!&#8230;&#8230;&#8221;
So how to prevent it ?
Unify!
Unify it to &#8217;spec/spec_helper&#8217; which is dead-simple, can be copied without modification (like adding &#8216;../../&#8217;) and prevents duplicate spec_helper [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=891&subd=pragmatig&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you got a big project, chances are spec_helper is required through different ways, File.expand_path / File.join() / &#8230; which results in it being loaded several times!</p>
<p><b>Try it:</b></p>
<pre style="font-size:12px;overflow:auto;">
#spec_helper.rb
print "YEP!"
</pre>
<p>rake spec -&gt; &#8220;YEP!YEP!YEP!YEP!YEP!YEP!YEP!YEP!&#8230;&#8230;&#8221;</p>
<p>So how to prevent it ?</p>
<p><b>Unify!</b><br />
Unify it to &#8217;spec/spec_helper&#8217; which is dead-simple, can be copied without modification (like adding &#8216;../../&#8217;) and prevents duplicate spec_helper calls</p>
<pre style="font-size:12px;overflow:auto;">
#unify_spec_helper.rb
require 'rake'

files = FileList["spec/**/*_spec.rb"].reject{|file|File.directory?(file)}
files.each do |file|
  lines = File.readlines(file)
  lines = lines.map do |line|
    if line =~ /require.*spec_helper/
      "require 'spec/spec_helper'\n"
    else
      line
    end
  end
  File.open(file,'w'){|f| f.write lines.join('') }
end
</pre>
<p>Run: ruby unify_spec_helper.rb</p>
 Tagged: Ruby, Test <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pragmatig.wordpress.com/891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pragmatig.wordpress.com/891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pragmatig.wordpress.com/891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pragmatig.wordpress.com/891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pragmatig.wordpress.com/891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pragmatig.wordpress.com/891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pragmatig.wordpress.com/891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pragmatig.wordpress.com/891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pragmatig.wordpress.com/891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pragmatig.wordpress.com/891/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pragmatig.wordpress.com&blog=2921704&post=891&subd=pragmatig&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://pragmatig.wordpress.com/2009/09/24/stop-spec_helper-from-being-loaded-multiple-times/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4fc8066b5aeba133f665ec8f30f92a9c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pragmatig</media:title>
		</media:content>
	</item>
	</channel>
</rss>