<?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>Reinventar &#187; tutorial</title>
	<atom:link href="http://reinventar.com/tag/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://reinventar.com</link>
	<description></description>
	<lastBuildDate>Tue, 05 Apr 2011 13:25:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Install Imagemagick on Centos 5.5</title>
		<link>http://reinventar.com/2011/03/04/install-imagemagick-on-centos-5-5/</link>
		<comments>http://reinventar.com/2011/03/04/install-imagemagick-on-centos-5-5/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 13:17:14 +0000</pubDate>
		<dc:creator>Pedro Sousa</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[imagemagick]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://reinventar.com/?p=1054</guid>
		<description><![CDATA[Another quick post with some tips on installing the ImageMagick library on CENTOS 5. First, install some needed libraries with yum: sudo yum install tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel Then create a directory and download the latest source. mkdir sources cd /sources wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.6.7-0.tar.gz Untar the compressed file and compile it using dark [...]]]></description>
			<content:encoded><![CDATA[<p>Another quick post with some tips on installing the ImageMagick library on CENTOS 5.<span id="more-1054"></span></p>
<p>First, install some needed libraries with yum:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> yum <span style="color: #c20cb9; font-weight: bold;">install</span> tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel</div></div>
<p>Then create a directory and download the latest source.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> sources<br />
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>sources<br />
<span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>ftp.imagemagick.org<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>ImageMagick<span style="color: #000000; font-weight: bold;">/</span>ImageMagick-6.6.7-<span style="color: #000000;">0</span>.tar.gz</div></div>
<p>Untar the compressed file and compile it using dark magic:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf ImageMagick-6.6.7-<span style="color: #000000;">0</span>.tar.gz<br />
<span style="color: #7a0874; font-weight: bold;">cd</span> ImageMagick-6.6.7-<span style="color: #000000;">0</span></div></div>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #660033;">--with-bzlib</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #660033;">--with-fontconfig</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #660033;">--with-freetype</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #660033;">--with-gslib</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #660033;">--with-gvc</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #660033;">--with-jpeg</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #660033;">--with-jp2</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #660033;">--with-png</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #660033;">--with-tiff</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span><br />
<span style="color: #c20cb9; font-weight: bold;">make</span> clean<br />
<span style="color: #c20cb9; font-weight: bold;">make</span><br />
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></div></div>
<p>grab a coffee while it&#8217;s doing it&#8217;s work and that&#8217;s it.</p>
<p>To test if it works run:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">run identify <span style="color: #660033;">-version</span></div></div>
<p>and it should confirm that it&#8217;s installed.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://reinventar.com/2011/03/04/install-git-on-centos-5/" rel="bookmark" class="crp_title">Install GIT on CENTOS 5</a></li><li><a href="http://reinventar.com/2011/04/05/install-imagemagick-on-ubuntu-with-delegates/" rel="bookmark" class="crp_title">Install Imagemagick on Ubuntu with delegates</a></li><li><a href="http://reinventar.com/2008/02/16/rmagick-on-mac-os-x-made-simple/" rel="bookmark" class="crp_title">RMagick on Mac OS X made simple</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://reinventar.com/2011/03/04/install-imagemagick-on-centos-5-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install GIT on CENTOS 5</title>
		<link>http://reinventar.com/2011/03/04/install-git-on-centos-5/</link>
		<comments>http://reinventar.com/2011/03/04/install-git-on-centos-5/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 13:13:38 +0000</pubDate>
		<dc:creator>Pedro Sousa</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://reinventar.com/?p=1052</guid>
		<description><![CDATA[Quick post with some notes on how to install GIT on CENTOS 5 easily. First install some needed libraries for dev: sudo yum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel Create a directory, switch to it and download the latest git source. mkdir sources cd /sources wget http://kernel.org/pub/software/scm/git/git-1.6.6.tar.gz Untar the compressed file, switch to the [...]]]></description>
			<content:encoded><![CDATA[<p>Quick post with some notes on how to install GIT on CENTOS 5 easily.</p>
<p><span id="more-1052"></span></p>
<p>First install some needed libraries for dev:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> yum <span style="color: #660033;">-y</span> <span style="color: #c20cb9; font-weight: bold;">install</span> zlib-devel openssl-devel <span style="color: #c20cb9; font-weight: bold;">cpio</span> expat-devel gettext-devel</div></div>
<p>Create a directory, switch to it and download the latest git source.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> sources<br />
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>sources<br />
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>kernel.org<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>software<span style="color: #000000; font-weight: bold;">/</span>scm<span style="color: #000000; font-weight: bold;">/</span>git<span style="color: #000000; font-weight: bold;">/</span>git-1.6.6.tar.gz</div></div>
<p>Untar the compressed file, switch to the folder and compile it manually.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">tar</span> xvzf git-1.6.6.tar.gz<br />
<span style="color: #7a0874; font-weight: bold;">cd</span> git-1.6.6</div></div>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.<span style="color: #000000; font-weight: bold;">/</span>configure<br />
<span style="color: #c20cb9; font-weight: bold;">make</span><br />
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></div></div>
<p>and that&#8217;s it. Now, something as simple as:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> testgit<br />
<span style="color: #7a0874; font-weight: bold;">cd</span> testgit<br />
<span style="color: #c20cb9; font-weight: bold;">git</span> init</div></div>
<p>should work and you just created your first local repository.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://reinventar.com/2011/03/04/install-imagemagick-on-centos-5-5/" rel="bookmark" class="crp_title">Install Imagemagick on Centos 5.5</a></li><li><a href="http://reinventar.com/2011/04/05/install-imagemagick-on-ubuntu-with-delegates/" rel="bookmark" class="crp_title">Install Imagemagick on Ubuntu with delegates</a></li><li><a href="http://reinventar.com/2008/02/16/rmagick-on-mac-os-x-made-simple/" rel="bookmark" class="crp_title">RMagick on Mac OS X made simple</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://reinventar.com/2011/03/04/install-git-on-centos-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upload files using Paperclip on Ruby on Rails</title>
		<link>http://reinventar.com/2009/03/19/upload-files-with-paperclip-on-ruby-on-rails/</link>
		<comments>http://reinventar.com/2009/03/19/upload-files-with-paperclip-on-ruby-on-rails/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 10:25:15 +0000</pubDate>
		<dc:creator>Pedro Sousa</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[file upload]]></category>
		<category><![CDATA[paperclip]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://reinventar.com/?p=543</guid>
		<description><![CDATA[Paperclip is an awesome plugin to handle file uploads in Ruby on Rails. I&#8217;ve been using in a couple of projects lately and I thought I&#8217;d talk a bit about it. First of all, you need to install the plugin on your project by doing: script/plugin install git://github.com/thoughtbot/paperclip.git from your project main directory. After this, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://thoughtbot.com/projects/paperclip">Paperclip</a> is an awesome plugin to handle file uploads in Ruby on Rails. I&#8217;ve been using in a couple of projects lately and I thought I&#8217;d talk a bit about it.</p>
<p>First of all, you need to install the plugin on your project by doing:</p>
<pre>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">script/plugin install git://github.com/thoughtbot/paperclip.git</div></div>
</pre>
<p>from your project main directory. After this, usage is very simple.</p>
<p>Let&#8217;s imagine I have a user model and I want to have a avatar attribute to include a picture of the user and let&#8217;s say we want that avatar to be resized to 3 different sizes (120&#215;120, 48&#215;48 and 26&#215;26). Paperclip does this using ImageMagick.</p>
<p>We&#8217;re first going to create a migration to hold all this information:</p>
<pre>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">class AddAttachmentsAvatarToUser &amp;lt; ActiveRecord::Migration<br />
&nbsp; def self.up<br />
&nbsp; &nbsp; add_column :users, :avatar_file_name, :string<br />
&nbsp; &nbsp; add_column :users, :avatar_content_type, :string<br />
&nbsp; &nbsp; add_column :users, :avatar_file_size, :integer<br />
&nbsp; &nbsp; add_column :users, :avatar_updated_at, :datetime<br />
&nbsp; end<br />
<br />
&nbsp; def self.down<br />
&nbsp; &nbsp; remove_column :users, :avatar_updated_at<br />
&nbsp; &nbsp; remove_column :users, :avatar_file_name<br />
&nbsp; &nbsp; remove_column :users, :avatar_content_type<br />
&nbsp; &nbsp; remove_column :users, :avatar_file_size<br />
&nbsp; end<br />
end</div></div>
</pre>
<p>Then we define the attribute in the model:</p>
<pre>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">class User &amp;lt; ActiveRecord::Base<br />
has_attached_file :avatar, :styles =&amp;gt; { :large =&amp;gt; &quot;120x120&amp;gt;&quot;, :medium =&amp;gt; &quot;48x48&amp;gt;&quot;, :thumb =&amp;gt; &quot;26x26&amp;gt;&quot; }<br />
end</div></div>
</pre>
<p>Here&#8217;s an example on how your form should be:</p>
<pre>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&amp;lt;% form_for :user, @user, :url =&amp;gt; user_path, :html =&amp;gt; { :multipart =&amp;gt; true } do |form| %&amp;gt;<br />
&nbsp; &nbsp; &amp;lt;%= form.file_field :avatar %&amp;gt;<br />
&nbsp; &amp;lt;% end %&amp;gt;</div></div>
</pre>
<p>Your controller doesn&#8217;t have to do anything specific to handle the avatar, just save the user as usual.</p>
<pre>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; def create<br />
&nbsp; &nbsp; @user = User.create( params[:user] )<br />
&nbsp; end</div></div>
</pre>
<p>And finally, if you want to show the avatar in your view, here&#8217;s some examples:</p>
<pre>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &amp;lt;%= image_tag @user.avatar.url %&amp;gt;<br />
&nbsp; &amp;lt;%= image_tag @user.avatar.url(:medium) %&amp;gt;<br />
&nbsp; &amp;lt;%= image_tag @user.avatar.url(:thumb) %&amp;gt;</div></div>
</pre>
<p>That wasn&#8217;t very difficult. There&#8217;s some advance stuff you can do with <a href="http://thoughtbot.com/projects/paperclip">Paperclip</a>, like<a href="http://almosteffortless.com/2008/12/11/easy-upload-via-url-with-paperclip/"> upload via a URL</a> or upload your files to Amazon&#8217;s S3 or define post processing operations on your files.</p>
<p>So get creative and use it in your projects. <img onError="javascript: wp_404_images_fix = window.wp_404_images_fix || function(){}; wp_404_images_fix(this);"  src='http://reinventar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Update:<a href="http://thewebfellas.com/blog/2008/11/2/goodbye-attachment_fu-hello-paperclip"> The WebFellas</a> have a very deep and interesting article about Paperclip, <a href="http://thewebfellas.com/blog/2008/11/2/goodbye-attachment_fu-hello-paperclip">check it out</a>.</p>
<p><a href="http://bookworms.sapo.pt"><img onError="javascript: wp_404_images_fix = window.wp_404_images_fix || function(){}; wp_404_images_fix(this);"  class="alignleft size-full wp-image-544" title="picture-52" src="http://reinventar.com/wp-content/uploads/2009/03/picture-52.png" alt="picture-52" width="468" height="320" /></a></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://reinventar.com/2007/07/27/using-file_column-in-ruby-on-rails/" rel="bookmark" class="crp_title">using file_column in Ruby on Rails</a></li><li><a href="http://reinventar.com/2011/04/05/install-imagemagick-on-ubuntu-with-delegates/" rel="bookmark" class="crp_title">Install Imagemagick on Ubuntu with delegates</a></li><li><a href="http://reinventar.com/2009/11/25/baseapp-orange-updated-v4/" rel="bookmark" class="crp_title">Baseapp-orange updated v4</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://reinventar.com/2009/03/19/upload-files-with-paperclip-on-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

