<?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/"
	>

<channel>
	<title>El racó del Ton &#187; Programació</title>
	<atom:link href="http://blog.mob1970.org/?feed=rss2&#038;cat=14" rel="self" type="application/rss+xml" />
	<link>http://blog.mob1970.org</link>
	<description>Històries diàries, software lliure i d'altres palles mentals</description>
	<lastBuildDate>Fri, 27 Aug 2010 10:21:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rails form_tag</title>
		<link>http://blog.mob1970.org/?p=319</link>
		<comments>http://blog.mob1970.org/?p=319#comments</comments>
		<pubDate>Fri, 27 Aug 2010 10:21:00 +0000</pubDate>
		<dc:creator>Ton</dc:creator>
				<category><![CDATA[Diari]]></category>
		<category><![CDATA[English Linux]]></category>
		<category><![CDATA[Programació]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.mob1970.org/?p=319</guid>
		<description><![CDATA[Hi
I know there are a lot of posts about the rails &#8220;dangerous&#8221; form_tag helper method, but why not another one.
Before saying anything about it, I want to write down the differences between form_tag and form_for (which was the choosen one previously). form_for is provided for updating data models and form_tag is provided for doing the [...]]]></description>
			<content:encoded><![CDATA[<p>Hi</p>
<p>I know there are a lot of posts about the rails &#8220;dangerous&#8221; form_tag helper method, but why not another one.</p>
<p>Before saying anything about it, I want to write down the differences between form_tag and form_for (which was the choosen one previously). form_for is provided for updating data models and form_tag is provided for doing the other form operations (search something,  change language in a page, etc).</p>
<p>Ok, after this, let&#8217;s go to the battle. This was my code<br />
<code><br />
  < % form_tag :controller => 'pages', :action => 'index' , :method => 'get' do %><br />
          Tags : < %= text_field_tag :tags, '', :size => 40 %><br />
          < %= submit_tag 'Search' %><br />
  < %  end %></code></p>
<p>and I didn&#8217;t got the html code what I wanted to obtain, after googling for a while, I found <a href="http://westsworld.dk/blog/2010/01/use-rails-form_tag-with-care/">this post</a> which got me to the right way to see the light. The reason of this problem was that I was not using the right syntax for form_tag, which is </p>
<p><code>form_tag(url_for_options = {}, options = {}, *parameters_for_url, &#038;block)</code></p>
<p>so my code became</p>
<p><code>  < % form_tag({:controller => 'pages', :action => 'index'} , {:method => 'get'}) do %><br />
          Tags : < %= text_field_tag :tags, '', :size => 40 %><br />
          < %= submit_tag 'Search' %><br />
  < %  end %></code></p>
<p>and I was happy again <img src='http://blog.mob1970.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
<p>Hope this silly problem helps not to waste your time (I did it for you <img src='http://blog.mob1970.org/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )</p>
<p>M.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mob1970.org/?feed=rss2&amp;p=319</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Routes in rails</title>
		<link>http://blog.mob1970.org/?p=315</link>
		<comments>http://blog.mob1970.org/?p=315#comments</comments>
		<pubDate>Wed, 25 Aug 2010 21:27:41 +0000</pubDate>
		<dc:creator>Ton</dc:creator>
				<category><![CDATA[Diari]]></category>
		<category><![CDATA[English Linux]]></category>
		<category><![CDATA[Programació]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.mob1970.org/?p=315</guid>
		<description><![CDATA[Two days ago, I was solving bugs in my new professional website (not available yet at http://www.miqueloliete.com) when I stared at the screen and noticed how ugly my url was (something/home/home).
In that moment I remembered that I had read something in Agile Development with rails about how to use routes.rb, so I decided to give [...]]]></description>
			<content:encoded><![CDATA[<p>Two days ago, I was solving bugs in my new professional website (not available yet at <a href="http://www.miqueloliete.com">http://www.miqueloliete.com</a>) when I stared at the screen and noticed how ugly my url was (something/home/home).</p>
<p>In that moment I remembered that I had read something in <a href="http://pragprog.com/titles/rails2/agile-web-development-with-rails">Agile Development with rails</a> about how to use routes.rb, so I decided to give it a go.</p>
<p>I add to this files these sentences<br /><code><br />
  map.connect 'home/', :controller => 'home', :action => 'home'<br />
  map.connect 'about_me/', :controller => 'home', :action => 'about_me'<br />
  map.connect 'cv/', :controller => 'home', :action => 'cv'<br />
  map.connect 'projects/', :controller => 'home', :action => 'projects'</code></p>
<p>and &#8216;home/home&#8217; became &#8216;home&#8217;, &#8216;home/cv&#8217; became &#8216;cv&#8217;, etc</p>
<p>M.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mob1970.org/?feed=rss2&amp;p=315</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby Version Manager (RVM)</title>
		<link>http://blog.mob1970.org/?p=310</link>
		<comments>http://blog.mob1970.org/?p=310#comments</comments>
		<pubDate>Fri, 13 Aug 2010 12:26:43 +0000</pubDate>
		<dc:creator>Ton</dc:creator>
				<category><![CDATA[Diari]]></category>
		<category><![CDATA[English Linux]]></category>
		<category><![CDATA[Programació]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.mob1970.org/?p=310</guid>
		<description><![CDATA[Hi
I was fighting with my installed different ruby versions and I had heard about rvm, but I didn&#8217;t have use it. I decided to do today and I installed it using
gem install rvm
After it I tried installing two different ruby versions but I always obtained the same ruby version (the aptitude installed one). After that [...]]]></description>
			<content:encoded><![CDATA[<p>Hi</p>
<p>I was fighting with my installed different ruby versions and I had heard about <a href="http://rvm.beginrescueend.com/">rvm</a>, but I didn&#8217;t have use it. I decided to do today and I installed it using</p>
<p><code>gem install rvm</code></p>
<p>After it I tried installing two different ruby versions but I always obtained the same ruby version (the aptitude installed one). After that and googling a little I noticed (after typing <code>type rvm | head -n1</code> and doesn&#8217;t read &#8220;rvm is a function&#8221;) that I had forgotten something in my .bashrc file, which was:</p>
<p><code>[[ -s "$HOME/.rvm/scripts/rvm" ]] &#038;&#038; source "$HOME/.rvm/scripts/rvm"</code></p>
<p>And after that and opened a different konsole I could change my ruby version using &#8216;rvm use ruby-version&#8217;</p>
<p>Cool!!!!!</p>
<p>M.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mob1970.org/?feed=rss2&amp;p=310</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git &amp; Debian Etch</title>
		<link>http://blog.mob1970.org/?p=298</link>
		<comments>http://blog.mob1970.org/?p=298#comments</comments>
		<pubDate>Wed, 04 Aug 2010 22:08:21 +0000</pubDate>
		<dc:creator>Ton</dc:creator>
				<category><![CDATA[Diari]]></category>
		<category><![CDATA[English Linux]]></category>
		<category><![CDATA[Programació]]></category>

		<guid isPermaLink="false">http://blog.mob1970.org/?p=298</guid>
		<description><![CDATA[Hi
If you try to initialize a public git repository with an existing one in Debian Etch, you will obtain this message:

$ mkdir public-repo
$ cd public-repo/
$ git --bare init --shared
git: 'init' is not a git-command
The most commonly used git commands are:
    add            [...]]]></description>
			<content:encoded><![CDATA[<p>Hi</p>
<p>If you try to initialize a public git repository with an existing one in Debian Etch, you will obtain this message:<br />
<code><br />
$ mkdir public-repo<br />
$ cd public-repo/<br />
$ git --bare init --shared<br />
git: 'init' is not a git-command</p>
<p>The most commonly used git commands are:<br />
    add            Add files to the index file<br />
    apply          Apply patch on a git index file and a work tree<br />
    archive        Creates a archive of the files in the named tree<br />
    bisect         Find the change that introduced a bug<br />
    branch         List, create, or delete branches.<br />
    checkout       Checkout and switch to a branch<br />
    cherry-pick    Apply the change introduced by an existing commit<br />
    clone          Clones a repository<br />
    commit         Record your changes<br />
    diff           Show changes between commits, commit and working tree, etc<br />
    fetch          Download objects and a head from another repository<br />
    grep           Print lines matching a pattern<br />
    init-db        Creates an empty git repository<br />
    log            Show commit logs<br />
    merge          Grand Unified Merge Driver<br />
    mv             Move or rename a file, directory or symlink<br />
    prune          Prunes all unreachable objects from the object database<br />
    pull           Pull and merge from another repository or a local branch<br />
    push           Update remote refs along with associated objects<br />
    rebase         Rebase local commits to a new head<br />
    reset          Reset current HEAD to the specified state<br />
    revert         Revert an existing commit<br />
    rm             Remove files from the working tree and from the index<br />
    show           Show one commit with difference it introduces<br />
    show-branch    Show branches and their commits<br />
    status         Show working tree status<br />
    tag            Create a tag object signed with GPG<br />
    verify-tag     Check the GPG signature of tag<br />
(use 'git help -a' to get a list of all installed git commands)</p>
<p></code></p>
<p>This is because the git version which is in Debian Etch is too old (current: v1.7.2.1, etc: v1.4.4.4) and this command is not included in it. The first thing you have to do, if you can, is uninstall this git version and install a newer one, but if you can&#8217;t do it, this is the workaround I did.</p>
<ol>
<li>Create an empty git repo in a machine with a newer git version using <code>git --bare init --shared</code>.</li>
<li>Copy the content of this repo in your public repo.</li>
<li>Copy your local project in the machine with the too old git version</li>
<li>Execute the command <code>git --bare fetch $PATH_TO_LOCAL_COPY master:master</code></li>
<li>Voila</li>
</ol>
<p>The next step will be <code>git clone user@server:/path/to/public/repo/</code>.</p>
<p>Hope this helps</p>
<p>M.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mob1970.org/?feed=rss2&amp;p=298</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Netbeans and Git</title>
		<link>http://blog.mob1970.org/?p=293</link>
		<comments>http://blog.mob1970.org/?p=293#comments</comments>
		<pubDate>Tue, 03 Aug 2010 20:59:51 +0000</pubDate>
		<dc:creator>Ton</dc:creator>
				<category><![CDATA[Diari]]></category>
		<category><![CDATA[English Linux]]></category>
		<category><![CDATA[Programació]]></category>

		<guid isPermaLink="false">http://blog.mob1970.org/?p=293</guid>
		<description><![CDATA[When I started to use Netbeans for coding with Ruby and Rails, I tried to use svn with it and it was a mess because I don&#8217;t know why yet I was not able to do commits from Netbeans (I used to do them from command line).
Since I use git instead of svn as my [...]]]></description>
			<content:encoded><![CDATA[<p>When I started to use Netbeans for coding with Ruby and Rails, I tried to use svn with it and it was a mess because I don&#8217;t know why yet I was not able to do commits from Netbeans (I used to do them from command line).</p>
<p>Since I use git instead of svn as my revision control system I have to say that I&#8217;m working with it and Netbeans since the first day I started using Git.</p>
<p>Cool</p>
<p>M.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mob1970.org/?feed=rss2&amp;p=293</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git I</title>
		<link>http://blog.mob1970.org/?p=285</link>
		<comments>http://blog.mob1970.org/?p=285#comments</comments>
		<pubDate>Sun, 01 Aug 2010 20:58:49 +0000</pubDate>
		<dc:creator>Ton</dc:creator>
				<category><![CDATA[Diari]]></category>
		<category><![CDATA[English Linux]]></category>
		<category><![CDATA[Programació]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.mob1970.org/?p=285</guid>
		<description><![CDATA[After one of my Rails group meetings and all the great things somebody explained me about this distributed revision control system, I decided to give it a go and I started reading the Scott Chacon&#8217;s tutorial in order to start using git in one of my personal projects (my own website still in development).
I have [...]]]></description>
			<content:encoded><![CDATA[<p>After one of my Rails group meetings and all the great things somebody explained me about this distributed revision control system, I decided to give it a go and I started reading the <a href="http://book.git-scm.com/book.pdf">Scott Chacon&#8217;s tutorial</a> in order to start using git in one of my personal projects (<a href="http://www.miqueloliete.com">my own website</a> still in development).</p>
<p>I have to say that, after the three or four things I have done until now with it, git has surprised me a lot. It&#8217;s really fast, clear and it covers all my needs in control system tasks. I am svn user at work and I have to say that git is extremely faster than svn in merges (almost in the two I have done using git instead of svn).</p>
<p>Now I have only a repository in my computer but I supose I will have a central repository in the shared server I have with some friends of mine just in case my computer decides to pass away.</p>
<p>This post is named Git I (I don&#8217;t know if I will write more Git related posts) just in case <img src='http://blog.mob1970.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>M. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mob1970.org/?feed=rss2&amp;p=285</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Railscasts</title>
		<link>http://blog.mob1970.org/?p=262</link>
		<comments>http://blog.mob1970.org/?p=262#comments</comments>
		<pubDate>Fri, 19 Mar 2010 13:53:07 +0000</pubDate>
		<dc:creator>Ton</dc:creator>
				<category><![CDATA[Diari]]></category>
		<category><![CDATA[English Linux]]></category>
		<category><![CDATA[Programació]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.mob1970.org/?p=262</guid>
		<description><![CDATA[Hi there
These days I&#8217;m taking advantage of my daily train time watching railscasts episodes with my lenovo netbook. It&#8217;s really awesome all the things you can learn from these screencasts done by Ryan Bates about how to do things using rails.
Thanks a lot Ryan for sharing your knowledge with us.
M.
]]></description>
			<content:encoded><![CDATA[<p>Hi there</p>
<p>These days I&#8217;m taking advantage of my daily train time watching <a href="http://railscasts.com/">railscasts</a> episodes with my lenovo netbook. It&#8217;s really awesome all the things you can learn from these screencasts done by Ryan Bates about how to do things using rails.</p>
<p>Thanks a lot Ryan for sharing your knowledge with us.</p>
<p>M.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mob1970.org/?feed=rss2&amp;p=262</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Override table&#8217;s primary key using migrations in rails.</title>
		<link>http://blog.mob1970.org/?p=245</link>
		<comments>http://blog.mob1970.org/?p=245#comments</comments>
		<pubDate>Sat, 30 Jan 2010 17:00:34 +0000</pubDate>
		<dc:creator>Ton</dc:creator>
				<category><![CDATA[Diari]]></category>
		<category><![CDATA[English Linux]]></category>
		<category><![CDATA[Programació]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.mob1970.org/?p=245</guid>
		<description><![CDATA[Hi
When a migration is created, rails add a column named id, which is defined as an integer, as table&#8217;s primary key column. Sometimes can happen that you don&#8217;t want to name your primary key column id using rails. The way you have to write your migration is this one (rails use integer type by default):

def [...]]]></description>
			<content:encoded><![CDATA[<p>Hi</p>
<p>When a migration is created, rails add a column named id, which is defined as an integer, as table&#8217;s primary key column. Sometimes can happen that you don&#8217;t want to name your primary key column id using rails. The way you have to write your migration is this one (rails use integer type by default):</p>
<p><code><br />
def self.up<br />
  create_table :airport, :primary_key => :airport_id do |t|<br />
    t.string :iso_code, :limit =>3, :null => false<br />
    t.string :name, :limit =>150, :null => false<br />
    t.integer :city_id, :null => false<br />
  end<br />
end<br />
</code></p>
<p>If you have a &#8220;many to many&#8221; table probably you don&#8217;t want to have this id column in your table and you want to define two columns as primary key. This is the way you have to write a migration if you want to define this primary key:</p>
<p><code><br />
def self.up<br />
  create_table :airports_cities, :primary_key => [:airport_id, city_id] do |t|<br />
    t.integer :distance, :null => false<br />
  end<br />
end<br />
</code></p>
<p>In both examples, columns defined as primary key don&#8217;t have to be defined because rails do it for you. Using this, you won&#8217;t have an id column in your table and you&#8217;ll be able to use whatever you want as primary key (even strings).</p>
<p>Hope this helps (to my fish-like memory or to somebody else&#8217;s brain).</p>
<p>M.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mob1970.org/?feed=rss2&amp;p=245</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Things to remember 2010-01-12 (former Something I always forget)</title>
		<link>http://blog.mob1970.org/?p=243</link>
		<comments>http://blog.mob1970.org/?p=243#comments</comments>
		<pubDate>Tue, 12 Jan 2010 20:07:30 +0000</pubDate>
		<dc:creator>Ton</dc:creator>
				<category><![CDATA[Diari]]></category>
		<category><![CDATA[English Linux]]></category>
		<category><![CDATA[Programació]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.mob1970.org/?p=243</guid>
		<description><![CDATA[Howto create the table to store sessions in Rails

     rake db:sessions:create

Howto truncate all *.log files in log/ to zero bytes

      rake log:clear

M.
]]></description>
			<content:encoded><![CDATA[<p>Howto create the table to store sessions in Rails<br />
<code><br />
     rake db:sessions:create<br />
</code></p>
<p>Howto truncate all *.log files in log/ to zero bytes<br />
<code><br />
      rake log:clear<br />
</code></p>
<p>M.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mob1970.org/?feed=rss2&amp;p=243</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Something I always forget II</title>
		<link>http://blog.mob1970.org/?p=238</link>
		<comments>http://blog.mob1970.org/?p=238#comments</comments>
		<pubDate>Sat, 19 Dec 2009 23:16:16 +0000</pubDate>
		<dc:creator>Ton</dc:creator>
				<category><![CDATA[Diari]]></category>
		<category><![CDATA[English Linux]]></category>
		<category><![CDATA[Programació]]></category>

		<guid isPermaLink="false">http://blog.mob1970.org/?p=238</guid>
		<description><![CDATA[I always forget how to dump my blog&#8217;s mysql database. It’s :

mysqldump db_name -u username -p > filename
]]></description>
			<content:encoded><![CDATA[<p>I always forget how to dump my blog&#8217;s mysql database. It’s :<br />
<code><br />
mysqldump db_name -u username -p > filename<br />
</code</p>
<p>That's all</p>
<p>M.</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mob1970.org/?feed=rss2&amp;p=238</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
