<?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/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Icebergist</title>
	
	<link>http://icebergist.com</link>
	<description>Exploring hidden depths of web apps business</description>
	<lastBuildDate>Mon, 24 Jan 2011 17:24:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/icebergist" /><feedburner:info uri="icebergist" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license><item>
		<title>Paperclip, Heroku and Amazon S3 credentials</title>
		<link>http://feedproxy.google.com/~r/icebergist/~3/3X3OVV-4gqY/paperclip-heroku-and-amazon-s3-credentials</link>
		<comments>http://icebergist.com/posts/paperclip-heroku-and-amazon-s3-credentials#comments</comments>
		<pubDate>Mon, 24 Jan 2011 17:19:33 +0000</pubDate>
		<dc:creator>Slobodan Kovačević</dc:creator>
				<category><![CDATA[Ruby and Rails]]></category>
		<category><![CDATA[amazon s3]]></category>
		<category><![CDATA[heroku]]></category>
		<category><![CDATA[paperclip]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rails3]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://icebergist.com/?p=45</guid>
		<description><![CDATA[Setting up Paperclip to use Amazon&#8217;s S3 is as simple as setting :storage =&#62; :s3 and providing right credentials to Paperclip by setting :s3_credentials option. Best way to provide S3 credentials is to use an YML file (usually config/s3.yml) which allows you to set different credentials for each environment. For example: # config/s3.yml development: access_key_id: [...]]]></description>
			<content:encoded><![CDATA[<p>Setting up Paperclip to use Amazon&#8217;s S3 is as simple as setting :storage =&gt; :s3 and providing right credentials to Paperclip by setting :s3_credentials option. Best way to provide S3 credentials is to use an YML file (usually config/s3.yml) which allows you to set different credentials for each environment. For example:</p>
<pre>
# config/s3.yml
development:
  access_key_id: XYZXYZXYZ
  secret_access_key: XYZXYZXYZ
  bucket: mygreatapp-development
production:
  access_key_id: XYZXYZXYZ
  secret_access_key: XYZXYZXYZ
  bucket: mygreatapp-production
</pre>
<p>Of course you want to treat s3.yml same as database.yml &#8211; i.e. you don&#8217;t want to track it with git and you want for each person/server to have it&#8217;s own.</p>
<p>However, consider this: you are working on Open Source app in a public git repository and you are deploying it on Heroku. Heroku doesn&#8217;t allow you to create files (unless they are in git repository) and you can&#8217;t commit s3.yml with your credentials to public repository.</p>
<p>One solution is to define different :s3_credentials hash in one of the environment files or to load different YML file for each environment and generate hash from it. Downside is that you need to have a separate YML file for each environment and/or you need to convert YML to hash. Other solution could be to have separate local branch from which you will push to Heroku. Problem with this is that you have to have a local branch for deploying. This means if there are multiple developers who deploy to production each should have separate local branch.</p>
<p>Much simpler way to deploy Paperclip with different S3 credentials for each environment (with one of the environment being deployed on Heroku; and repository being public) is to create s3.yml file as usual (and don&#8217;t commit it to git), but define values only for local environment.</p>
<p>For production deployment on Heroku you can write initializer which will set :s3_credentials from ENV variables.</p>
<pre>
# initializers/s3.rb
if Rails.env == "production"
  # set credentials from ENV hash
  S3_CREDENTIALS = { :access_key_id => ENV['S3_KEY'], :secret_access_key => ENV['S3_SECRET'], :bucket => "sharedearth-production"}
else
  # get credentials from YML file
  S3_CREDENTIALS = Rails.root.join("config/s3.yml")
end

# in your model
has_attached_file :photo, :storage => :s3, :s3_credentials => S3_CREDENTIALS
</pre>
<p>and you can easily set persistant ENV vars on Heroku with:</p>
<pre>
$ heroku config:add S3_KEY=XYZXYZ S3_SECRET=XYZXYZ
</pre>
<p>(<a href="http://docs.heroku.com/config-vars#quick-example">according to Heroku docs</a>)</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://icebergist.com/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a> </p><img src="http://feeds.feedburner.com/~r/icebergist/~4/3X3OVV-4gqY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icebergist.com/posts/paperclip-heroku-and-amazon-s3-credentials/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://icebergist.com/posts/paperclip-heroku-and-amazon-s3-credentials</feedburner:origLink></item>
		<item>
		<title>Rails 3 reading list</title>
		<link>http://feedproxy.google.com/~r/icebergist/~3/zDd8N84OMLo/rails-3-reading-list</link>
		<comments>http://icebergist.com/posts/rails-3-reading-list#comments</comments>
		<pubDate>Mon, 29 Mar 2010 13:14:23 +0000</pubDate>
		<dc:creator>Slobodan Kovačević</dc:creator>
				<category><![CDATA[Ruby and Rails]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rails3]]></category>
		<category><![CDATA[resources]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://icebergist.com/?p=38</guid>
		<description><![CDATA[I&#8217;ve been planning to catchup with all the new Rails 3 stuff. To get me started I&#8217;ve compiled a small Rails 3 related reading list. Ruby on Rails 3.0 Release Notes Active Record Query Interface 3.0 The Skinny on Scopes (Formerly named_scope) Rails 3 Beautiful Code Railscasts &#8211; rails-3.0 episodes jQuery with Rails 3 The [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been planning to catchup with all the new Rails 3 stuff. To get me started I&#8217;ve compiled a small Rails 3 related reading list.</p>
<ol>
<li><a href="http://guides.rails.info/3_0_release_notes.html">Ruby on Rails 3.0 Release Notes</a></li>
<li><a href="http://m.onkey.org/2010/1/22/active-record-query-interface">Active Record Query Interface 3.0</a></li>
<li><a href="http://edgerails.info/articles/what-s-new-in-edge-rails/2010/02/23/the-skinny-on-scopes-formerly-named-scope/">The Skinny on Scopes (Formerly named_scope)</a></li>
<li><a href="http://blog.envylabs.com/2010/02/rails-3-beautiful-code/">Rails 3 Beautiful Code</a></li>
<li><a href="http://railscasts.com/tags/27">Railscasts &#8211; rails-3.0 episodes</a></li>
<li><a href="http://joshhuckabee.com/jquery-rails-3">jQuery with Rails 3</a></li>
<li><a href="http://litanyagainstfear.com/blog/2010/02/03/the-rails-module/">The Rails Module (in Rails 3)</a></li>
</ol>
<p>Once I&#8217;m done with it I plan to get even more from:</p>
<ul>
<li><a href="http://edgerails.info/articles/what-s-new-in-edge-rails/2010/02/10/rails-3-resources/">Rails 3 Resources</a></li>
<li><a href="http://www.rubyinside.com/rails-3-0-beta-links-2966.html">Rails 3.0 Beta: 36 Links and Resources To Get You Going</a></li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://icebergist.com/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a> </p><img src="http://feeds.feedburner.com/~r/icebergist/~4/zDd8N84OMLo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icebergist.com/posts/rails-3-reading-list/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://icebergist.com/posts/rails-3-reading-list</feedburner:origLink></item>
		<item>
		<title>Expected x.rb to define X (LoadError)</title>
		<link>http://feedproxy.google.com/~r/icebergist/~3/sq0RGayvWLk/expected-xrb-to-define-x-loaderror</link>
		<comments>http://icebergist.com/posts/expected-xrb-to-define-x-loaderror#comments</comments>
		<pubDate>Wed, 15 Apr 2009 16:00:56 +0000</pubDate>
		<dc:creator>Slobodan Kovačević</dc:creator>
				<category><![CDATA[Ruby and Rails]]></category>

		<guid isPermaLink="false">http://icebergist.com/?p=33</guid>
		<description><![CDATA[I have been working on extending Rails&#8217; I18n Simple backend to make it work with Serbian grammar (post on that will follow soon), but I kept getting an error: Expected ./lib/serbian_simple.rb to define SerbianSimple (LoadError) I&#8217;ve just spent an hour trying to figure out why this keeps happening and I found that there&#8217;s a lot [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working on extending Rails&#8217; I18n Simple backend to make it work with Serbian grammar (post on that will follow soon), but I kept getting an error:</p>
<p><code>Expected ./lib/serbian_simple.rb to define SerbianSimple (LoadError)</code></p>
<p>I&#8217;ve just spent an hour trying to figure out why this keeps happening and I found that there&#8217;s a lot of people with similar problem.</p>
<p>It seems that the problem appears when Rails tries to autoload files. In my case there was a simple solution &#8211; I just added require &#8216;serbian_simple.rb&#8217; in environment.rb to manually load the file.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://icebergist.com/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a> </p><img src="http://feeds.feedburner.com/~r/icebergist/~4/sq0RGayvWLk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icebergist.com/posts/expected-xrb-to-define-x-loaderror/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://icebergist.com/posts/expected-xrb-to-define-x-loaderror</feedburner:origLink></item>
		<item>
		<title>Simple password protected administration with CodeIgniter</title>
		<link>http://feedproxy.google.com/~r/icebergist/~3/_-PllekGEyY/simple-password-protected-administration-with-codeigniter</link>
		<comments>http://icebergist.com/posts/simple-password-protected-administration-with-codeigniter#comments</comments>
		<pubDate>Sun, 08 Mar 2009 17:38:08 +0000</pubDate>
		<dc:creator>Slobodan Kovačević</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[erkanaauth]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[password protected]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://icebergist.com/?p=19</guid>
		<description><![CDATA[Last week I&#8217;ve taken a break from Ruby/Rails development and I&#8217;ve worked on a site that uses PHP with CodeIgniter framework. Despite the fact that CodeIgniter has a very nice documentation I found it very difficult to find a way to do some simple things, that are more or less obvious, but which can be [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I&#8217;ve taken a break from Ruby/Rails development and I&#8217;ve worked on a site that uses PHP with <a href="http://codeigniter.com/">CodeIgniter</a> framework.</p>
<p>Despite the fact that CodeIgniter has a very nice documentation I found it very difficult to find a way to do some simple things, that are more or less obvious, but which can be a problem for someone who hasn&#8217;t worked with CodeIgniter before. (for example, I found myself more than once looking at CI code to figure out how it works, so I can use it)</p>
<p>I had to make a simple password protected administration section. One admin user, one password, no user registrations, no roles &#8211; simple as possible. As I was using CI framework I decided to find a plugin/library that does this. Unfortunately most CI authorization plugins/libraries are very bloated and too complicated for this simple task. I tried to find some examples how to handle this simple use case, but nothing came up.</p>
<p>Finally I&#8217;ve found a small authorization plugin: <a href="http://codeigniter.com/wiki/Erkana/">Erkanaauth</a>.</p>
<p>First you need a user table (must be named &#8216;users&#8217;) which only needs to have an id field and all other fields are optional because you will manually specify what other columns will be used. I opted for simple id, username, password:</p>
<pre>CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL auto_increment,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
);</pre>
<p>We will need to &#8220;install&#8221; ErkanaAuth library. You should <a href="http://codeigniter.com/wiki/File:erkanaauth.zip/">download it</a> and unzip it.</p>
<p>Next we should create an Admin controller which will handle all administration tasks (remember I&#8217;m making simple admin here, so I don&#8217;t need to protect multiple controllers).</p>
<pre>&lt;?php
class Admin extends Controller {
  function Admin()
  {
    parent::Controller();
    $this->load->database();
    $this->load->helper(array('url', 'form', 'date'));
    $this->load->library(array('form_validation', 'upload', 'Erkanaauth', 'session'));
  }
}
?&gt;</pre>
<p>Constructor just connects to database and loads some standard helpers and libraries (including Erkanaauth) that are usually used.</p>
<p>Next step is to add a function which we can call to verify if user is logged in:</p>
<pre>
  private
  function authorize()
  {
	  if($this->erkanaauth->try_session_login())
	      return true;

	  redirect('admin/login');
  }
</pre>
<p>Function uses Erkanaauth&#8217;s try_session_login which checks if user is already logged in (checks session for user id). If user isn&#8217;t logged in we&#8217;ll redirect him to our login page:</p>
<pre>
  function login()
  {
    $username = $this->input->post('username', true);
    $password = $this->input->post('password', true);
    if($username || $password)
    {
      if($this->erkanaauth->try_login(array('username' => $username, 'password' => $password)))
        redirect('admin');
    }

    $this->load->view('admin_login');
  }

  function logout()
  {
    $this->erkanaauth->logout();
    redirect('admin');
  }
</pre>
<p>Key command here is try_login in login function which tries to find an entry in users table that fulfills given conditions. If you have different users table than the one I made this is the place where you should enter your column names.</p>
<p>Logout function is has just a simple call to Erkana&#8217;s logout function. Nothing special there.</p>
<p>Of course we also need a login page template which should contain a simple user/pass form. It&#8217;s pretty basic and you can see it if you get the complete code (see at the end).</p>
<p>Finally we have everything needed to protect any page in Admin controller. In order to protect a page all you need to do is to add a call to authorize function to any function you want to protect. Like this:</p>
<pre>
  function index()
  {
    $this->authorize();
    echo "Do something useful... For now just display logout link: ";
    echo anchor('admin/logout', "Logout");
  }
</pre>
<p>That&#8217;s it. Now you have fully functional administration section which requires username and password authorization.</p>
<p>You can get the complete sample application from <a href="http://github.com/basti/ci-admin-section/tree/master">Github repository</a>. Feel free to expand on it or use it any way you like.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://icebergist.com/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a> </p><img src="http://feeds.feedburner.com/~r/icebergist/~4/_-PllekGEyY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icebergist.com/posts/simple-password-protected-administration-with-codeigniter/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://icebergist.com/posts/simple-password-protected-administration-with-codeigniter</feedburner:origLink></item>
		<item>
		<title>Restoring superblock on Ubutnu</title>
		<link>http://feedproxy.google.com/~r/icebergist/~3/x0bpyaK6Ot4/restoring-superblock-on-ubutnu</link>
		<comments>http://icebergist.com/posts/restoring-superblock-on-ubutnu#comments</comments>
		<pubDate>Sun, 09 Nov 2008 10:13:43 +0000</pubDate>
		<dc:creator>Slobodan Kovačević</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://icebergist.com/?p=16</guid>
		<description><![CDATA[Recently I had a problem on my Torrent box (an old PC that I use as dedicated torrent client) that runs Ubuntu. For some reason my root partition was being mounted as read-only. Everything else seemed to work (all other partitions were mounted properly), but I couldn&#8217;t change any of my config or do anything [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had a problem on my Torrent box (an old PC that I use as dedicated torrent client) that runs Ubuntu. For some reason my root partition was being mounted as read-only. Everything else seemed to work (all other partitions were mounted properly), but I couldn&#8217;t change any of my config or do anything on root partition.</p>
<p>I did the usual stuff:</p>
<ul>
<li>Run fsck checks and it said that everything is fine</li>
<li>Used Ubuntu&#8217;s live CD to boot, which got me read-write access to root partition. I changed some things in fstab, tried to get it to be rw permanently. No matter what I did as soon as I rebooted the root partition was once again read-only.</li>
<li>I tried booting from some repair disks I have, but all checks passed and no problem was detected. <img src='http://icebergist.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </li>
</ul>
<p>Finally, I read somewhere that a similar problem was caused by faulty superblock on hard drive. Fortunately Ubuntu stores superblock backups in different places around disk, so I decided to try to restore it from one of those backups.</p>
<p>It turned out that all I needed was a single command (this <a title="Bad superblock" href="http://ubuntuforums.org/showpost.php?s=72da065bbe1506b27f41a8cfc252c732&amp;p=1424786&amp;postcount=5">Ubuntu forum post helped</a>) to restore superblock:</p>
<p><code>e2fsck -b 32768 /dev/hdc1</code></p>
<p>After that my root partition was back to read-write mode. <img src='http://icebergist.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Before you do stuff like that to your computer I suggest that you read man pages for <a title="mke2fs" href="http://linux.die.net/man/8/mke2fs">mke2fs</a> and <a title="e2fsck" href="http://linux.die.net/man/8/e2fsck">e2fsck</a>. It will prevent you from doing something foolish like deleting your whole hard drive. <img src='http://icebergist.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://icebergist.com/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a> </p><img src="http://feeds.feedburner.com/~r/icebergist/~4/x0bpyaK6Ot4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icebergist.com/posts/restoring-superblock-on-ubutnu/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://icebergist.com/posts/restoring-superblock-on-ubutnu</feedburner:origLink></item>
		<item>
		<title>RESTful admin namespaced controller using scaffolding</title>
		<link>http://feedproxy.google.com/~r/icebergist/~3/HgqEnAvQbCM/restful-admin-namespaced-controller-using-scaffolding</link>
		<comments>http://icebergist.com/posts/restful-admin-namespaced-controller-using-scaffolding#comments</comments>
		<pubDate>Wed, 17 Sep 2008 20:58:56 +0000</pubDate>
		<dc:creator>Slobodan Kovačević</dc:creator>
				<category><![CDATA[Ruby and Rails]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[resources]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[restful]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[scaffold]]></category>

		<guid isPermaLink="false">http://icebergist.com/?p=14</guid>
		<description><![CDATA[Most of my clients prefer to have a separate admin section. In turn, I like to have separate controllers for admin section and front-end in my Rails app. This is not as straightforward as it might seem, especially if you like to use scaffolding for admin controller. The goal is to get 2 separate RESTful [...]]]></description>
			<content:encoded><![CDATA[<p>Most of my clients prefer to have a separate admin section. In turn, I like to have separate controllers for admin section and front-end in my Rails app. This is not as straightforward as it might seem, especially if you like to use scaffolding for admin controller.</p>
<p>The goal is to get 2 separate RESTful controllers, admin &amp; front-end controller, one model and for admin pages to have scaffolding.</p>
<p>Here is the easiest way I found so far to accomplish this. This example generates categories model and controllers for it.</p>
<p><code>./script/generate controller admin/categories<br />
./script/generate scaffold category name:string</code></p>
<p>This will generate an empty controller in admin namespace and a scaffolded resource for front-end controller.</p>
<p>Now we have everything generated we just need to make it work with admin controller and not with front-end.</p>
<ul>
<li>move all templates from app/views/categories to app/views/<strong>admin</strong>/categories</li>
<li>copy all functions from categories_controller.rb to admin/categories_controller.rb</li>
<li>add namespace for admin controller in routes.rb:<code>map.namespace :admin do |admin|<br />
admin.resources :categories<br />
end</code></li>
<li>in admin/categories_controller.rb replace in 3 places redirect_to calls to work with admin namespace. It will have something like redirect_to(@category), but to work with namespace it needs to have redirect_to([:admin, @category])</li>
<li>make similar changes in all templates, i.e. make it work within an admin namespace. You need to make following changes:
<ul>
<li>form_for(@category) =&gt; <strong>form_for([:admin, @category])</strong></li>
<li>&lt;%= link_to &#8216;Show&#8217;, @category %&gt; =&gt; <strong>&lt;%= link_to &#8216;Show&#8217;, [:admin, @category] %&gt;</strong></li>
<li>categories_path =&gt; <strong>admin_categories_path</strong></li>
<li>edit_category_path(@category) =&gt; <strong>edit_admin_category_path(@category)</strong></li>
<li>new_category_path =&gt; <strong>new_admin_category_path</strong></li>
</ul>
</li>
</ul>
<p>That&#8217;s it. Now you&#8217;ll have /admin/categories for all administrative tasks and you have a free controller for front-end actions.</p>
<p>You might wonder why not just generate scaffold for admin/categories&#8230; The reason is that you&#8217;ll also get a model that is namespaced in admin (i.e. model would be Admin::Category). Scaffolded views also wouldn&#8217;t work as it seems that generator doesn&#8217;t take into account the fact that you are using a namespace.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://icebergist.com/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a> </p><img src="http://feeds.feedburner.com/~r/icebergist/~4/HgqEnAvQbCM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icebergist.com/posts/restful-admin-namespaced-controller-using-scaffolding/feed</wfw:commentRss>
		<slash:comments>35</slash:comments>
		<feedburner:origLink>http://icebergist.com/posts/restful-admin-namespaced-controller-using-scaffolding</feedburner:origLink></item>
		<item>
		<title>Mosso hosting cloud</title>
		<link>http://feedproxy.google.com/~r/icebergist/~3/QwAVQFH6_jQ/mosso-hosting-cloud</link>
		<comments>http://icebergist.com/posts/mosso-hosting-cloud#comments</comments>
		<pubDate>Wed, 17 Sep 2008 10:44:33 +0000</pubDate>
		<dc:creator>Slobodan Kovačević</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Ruby and Rails]]></category>
		<category><![CDATA[cloud computing]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://icebergist.com/?p=13</guid>
		<description><![CDATA[Mosso&#8217;s hosting cloud at $100 / month seems like a good solution to get a scalable server. However one thing bugs me, actually two things&#8230; First one: they offer FTP only access. Meaning you cannot deploy sites directly from code repositories (i.e. git or svn). That sucks. Second thing that bugs me: for $100 you [...]]]></description>
			<content:encoded><![CDATA[<p><a class="external" href="http://www.mosso.com/">Mosso&#8217;s hosting cloud</a> at $100 / month seems like a good solution to get a scalable server. However one thing bugs me, actually two things&#8230;</p>
<p>First one: they offer <strong>FTP only access</strong>. Meaning you cannot deploy sites directly from code repositories (i.e. git or svn). That sucks.</p>
<p>Second thing that bugs me: for $100 you get quite a lot of computing power which can be used to run multiple sites &#8211; but <strong>you are only allowed to have one Rails app running</strong>. Only one. If you want additional Rails apps (for example to have a test server) you need to pay an extra fee.</p>
<p>I know it&#8217;s cloud computing and that you have to be able to run it with any additional configuration (that&#8217;s why I think it&#8217;s ok that you have to freeze your gems in Rails apps, because you cannot install any gems yourself)&#8230; but not being able to checkout my code from repository and having to upload the whole app each time you make changes <strong>is really annoying</strong>.</p>
<p>In their defense, the support guy said that they are working on it, but he could give me an ETA when they&#8217;ll allow something like that.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://icebergist.com/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a> </p><img src="http://feeds.feedburner.com/~r/icebergist/~4/QwAVQFH6_jQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icebergist.com/posts/mosso-hosting-cloud/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://icebergist.com/posts/mosso-hosting-cloud</feedburner:origLink></item>
		<item>
		<title>InnoDB per-table tablespaces – split ibdata1 to smaller chunks</title>
		<link>http://feedproxy.google.com/~r/icebergist/~3/04pHx3d5LWo/innodb-per-table-tablespaces-split-ibdata1-to-smaller-chunks</link>
		<comments>http://icebergist.com/posts/innodb-per-table-tablespaces-split-ibdata1-to-smaller-chunks#comments</comments>
		<pubDate>Thu, 24 Jul 2008 21:01:16 +0000</pubDate>
		<dc:creator>Slobodan Kovačević</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://icebergist.com/?p=12</guid>
		<description><![CDATA[Today I had to import 3GB of InnoDB tables in MySQL. Unfortunately, while importing the server run out of disk space &#8211; which caused whole server to grind to a halt. Naively I tried to delete imported data to free up space&#8230; I was in for an unpleasant surprise. By default when MySQL uses InnoDB [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had to import 3GB of InnoDB tables in MySQL. Unfortunately, while importing the server run out of disk space &#8211; which caused whole server to grind to a halt. Naively I tried to delete imported data to free up space&#8230; I was in for an unpleasant surprise.</p>
<p>By default when MySQL uses InnoDB engine it stores most of the information in single file called ibdata1. One downside is that once ibdata1 file grows it cannot shrink &#8211; even if you delete all InnoDB tables. For some reason MySQL is set to use single file instead of per-table tablespaces similar to MyISAM.</p>
<p>Enabling per-table tablespaces is easy just add <a title="InnoDB Per-table tablespaces" href="http://dev.mysql.com/doc/refman/5.0/en/multiple-tablespaces.html">innodb_file_per_table</a> to my.cnf file. Problem is that <strong>all newly created tables</strong>, only new tables, will be in separate files. It seems that there&#8217;s no easy way to convert old tables and reclaim the space taken by ibdata1.</p>
<p>There are 3 ways and two are basically export-drop-delete-import type of solutions:</p>
<ol>
<li>Convert all InnoDB tables to MyISAM</li>
<li>Export only InnoDB tables, drop them, delete ibdata1 and import InnoDB tables.</li>
<li>Export all databases, delete ibdata1 and import everything back.</li>
</ol>
<p>I choose option 2 because I luckily had only 40 InnoDB tables and much more using MyISAM. For details on how to apply each solution and down/up sides of each read <a title="MySQL Reducing ibdata1" href="http://vdachev.net/blog/2007/02/22/mysql-reducing-ibdata1/en/">MySQL: Reducing ibdata1</a>.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://icebergist.com/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a> </p><img src="http://feeds.feedburner.com/~r/icebergist/~4/04pHx3d5LWo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icebergist.com/posts/innodb-per-table-tablespaces-split-ibdata1-to-smaller-chunks/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://icebergist.com/posts/innodb-per-table-tablespaces-split-ibdata1-to-smaller-chunks</feedburner:origLink></item>
		<item>
		<title>This should be interesting weekly – week 28</title>
		<link>http://feedproxy.google.com/~r/icebergist/~3/uroZCAV7M0I/this-should-be-interesting-weekly-week-28</link>
		<comments>http://icebergist.com/posts/this-should-be-interesting-weekly-week-28#comments</comments>
		<pubDate>Sun, 13 Jul 2008 10:25:00 +0000</pubDate>
		<dc:creator>Slobodan Kovačević</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[This should be interesting - weekly]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[weekly]]></category>

		<guid isPermaLink="false">http://icebergist.com/?p=10</guid>
		<description><![CDATA[What&#8217;s New in Edge Rails: Easy Join Table Conditions. Faces of Millions &#8211; Art project which aims to gather one million photos of people faces and create 10m x 10m photo mosaic. Uni-Form is an attempt to standardize form markup (xhtml) and css. Mac OS X full screen QuickLook shortcut. A guide to CSS support [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li>What&#8217;s New in Edge Rails: <a href="http://tumblelog.slobodankovacevic.com/post/41430445/whats-new-in-edge-rails-easy-join-table-conditions">Easy Join Table Conditions.</a></li>
<li><a href="http://tumblelog.slobodankovacevic.com/post/41483353/faces-of-millions">Faces of Millions</a> &#8211; Art project which aims to gather one million photos of people faces and create 10m x 10m photo mosaic.</li>
<li><a href="http://tumblelog.slobodankovacevic.com/post/41727168/uni-form">Uni-Form</a> is an attempt to standardize form markup (xhtml) and css.</li>
<li><a href="http://tumblelog.slobodankovacevic.com/post/41886839/mac-fullscreen-quicklook-a-k-a-slideshow">Mac OS X full screen QuickLook shortcut.</a></li>
<li>A guide to <a href="http://tumblelog.slobodankovacevic.com/post/41978415/a-guide-to-css-support-in-email">CSS support in Email</a>.</li>
</ul>
<p>[condensed from '<a href="http://tumblelog.slobodankovacevic.com/">this should be interesting</a>' tumblelog]</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://icebergist.com/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a> </p><img src="http://feeds.feedburner.com/~r/icebergist/~4/uroZCAV7M0I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icebergist.com/posts/this-should-be-interesting-weekly-week-28/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://icebergist.com/posts/this-should-be-interesting-weekly-week-28</feedburner:origLink></item>
		<item>
		<title>Collection partial variable naming – new in edge rails</title>
		<link>http://feedproxy.google.com/~r/icebergist/~3/9UaiL2gAius/collection-partial-variable-naming</link>
		<comments>http://icebergist.com/posts/collection-partial-variable-naming#comments</comments>
		<pubDate>Mon, 07 Jul 2008 21:41:41 +0000</pubDate>
		<dc:creator>Slobodan Kovačević</dc:creator>
				<category><![CDATA[Ruby and Rails]]></category>
		<category><![CDATA[edge]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://icebergist.com/?p=9</guid>
		<description><![CDATA[One thing that always annoyed me when rendering collection partials is that a local var in partial is named same as a partial template name. So, to go around this I always created another local variable in partial and gave it a more meaningful name. No longer&#8230; As the Ryan says from now on in [...]]]></description>
			<content:encoded><![CDATA[<p>One thing that always annoyed me when rendering collection partials is that a local var in partial is named same as a partial template name. So, to go around this I always created another local variable in partial and gave it a more meaningful name.</p>
<p>No longer&#8230; As the <a title="What's New in Edge Rails: Collection Partial Variable Naming " href="http://ryandaigle.com/articles/2008/7/7/what-s-new-in-edge-rails-collection-partial-variable-naming">Ryan says</a> from now on in the Edge Rails you can specify the name of the local variable in which each collection element will be exposed within a partial. You will can do this:</p>
<pre>render :partial =&gt; 'employees', :collection =&gt; @workers, :as =&gt; :person</pre>
<p>It&#8217;s a simple thing, but it&#8217;s just one of the things that bugged me. I am glad it&#8217;s gone now.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://icebergist.com/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a> </p><img src="http://feeds.feedburner.com/~r/icebergist/~4/9UaiL2gAius" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icebergist.com/posts/collection-partial-variable-naming/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://icebergist.com/posts/collection-partial-variable-naming</feedburner:origLink></item>
	</channel>
</rss>

