<?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>Focus the Web Tech Blog &#187; rails</title>
	<atom:link href="http://tech.focustheweb.com/tag/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.focustheweb.com</link>
	<description>Programmazione, web, internet, howtos, etc.</description>
	<lastBuildDate>Sat, 24 Apr 2010 09:16:53 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rails, configurazione base di ActionMailer</title>
		<link>http://tech.focustheweb.com/programmazione/ruby-programmazione/rails-configurazione-base-di-actionmailer/</link>
		<comments>http://tech.focustheweb.com/programmazione/ruby-programmazione/rails-configurazione-base-di-actionmailer/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 10:08:39 +0000</pubDate>
		<dc:creator>Giovanni Cappellotto</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[actionmailer]]></category>
		<category><![CDATA[configurazione]]></category>
		<category><![CDATA[mailer]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[smtp]]></category>

		<guid isPermaLink="false">http://tech.focustheweb.com/?p=333</guid>
		<description><![CDATA[







Mandare email con rails è semplice grazie al modulo ActionMailer.
Una configurazione base del modulo da inserire nel file config/environments/production.rb per mandare mail in ambiente di produzione è:

config.action_mailer.smtp_settings = &#123;
  :address =&#62; &#34;domain.of.smtp.host.net&#34;,
  :port =&#62; 25,
  :domain =&#62; &#34;domain.of.sender.net&#34;,
  :user_name =&#62; &#34;user&#34;,
  :password =&#62; &#34;password&#34;,
  :authentication =&#62; :login,
  :enable_starttls_auto [...]]]></description>
			<content:encoded><![CDATA[<p>
<!-- Begin Google Adsense code -->
<script type="text/javascript"><!--
google_ad_client = "pub-7194529311513014";
/* 468x60, creato 21/11/09 */
google_ad_slot = "8123373738";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- End Google Adsense code -->
<br />
Mandare email con rails è semplice grazie al modulo <strong>ActionMailer</strong>.</p>
<p>Una <strong>configurazione base</strong> del modulo da inserire nel file <code>config/environments/production.rb</code> per mandare mail in ambiente di produzione è:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">config.<span style="color:#9900CC;">action_mailer</span>.<span style="color:#9900CC;">smtp_settings</span> = <span style="color:#006600; font-weight:bold;">&#123;</span>
  <span style="color:#ff3333; font-weight:bold;">:address</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;domain.of.smtp.host.net&quot;</span>,
  <span style="color:#ff3333; font-weight:bold;">:port</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">25</span>,
  <span style="color:#ff3333; font-weight:bold;">:domain</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;domain.of.sender.net&quot;</span>,
  <span style="color:#ff3333; font-weight:bold;">:user_name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;user&quot;</span>,
  <span style="color:#ff3333; font-weight:bold;">:password</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;password&quot;</span>,
  <span style="color:#ff3333; font-weight:bold;">:authentication</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:login</span>,
  <span style="color:#ff3333; font-weight:bold;">:enable_starttls_auto</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">false</span>
<span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>dove:</p>
<dl>
<dt><code>:address =&gt;</code>, <code>:port =&gt;</code>
<dt/>
<dd>determinano l&#8217;indirizzo e la porta del server SMTP utilizzato per inviare le emails (di default impostati a <code>localhost</code> e 25)</dd>
<dt><code>:domain =&gt;</code>
<dt/>
<dd>il dominio utilizzato dal mailer per identificarsi al server SMTP. Normalmente viene usato il <em>top-level domain name</em> della macchina che manda le email, ma dipende anche dalla configurazione del server SMTP</dd>
<dt><code>:authentication =&gt;</code>
<dt/>
<dd>il valore può essere: <code>:plain</code>, <code>:login</code> o <code>:cram_md5</code>. Per scegliere il giusto valore da assegnare alla configurazione bisogna conoscere le impostazioni del server SMTP. Il parametro può essere omesso per server SMTP che non necessitano autenticazione (nel qual caso saranno inutili anche i parametri <code>:user_name</code> e <code>:password</code>)</dd>
<dt><code>:user_name =&gt;</code>, <code>:password =&gt;</code>
<dt/>
<dd>nome utente e password di autenticazione al server SMTP</dd>
<dt><code>:enable_starttls_auto =&gt;</code>
<dt/>
<dd>dalla versione 2.3 di rails ActionMailer cerca di stabilire in modo automatico una connessione al server attraverso il protocollo <em>tls</em> (Transport Layer Security), questo parametro ci permette di modificare il comportamento di default di ActionMailer (<a href="https://rails.lighthouseapp.com/projects/8994/tickets/1731-make-enable_starttls_auto-opt-in-in-actionmailer">https://rails.lighthouseapp.com/projects/8994/tickets/1731-make-enable_starttls_auto-opt-in-in-actionmailer</a>)</dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://tech.focustheweb.com/programmazione/ruby-programmazione/rails-configurazione-base-di-actionmailer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Risolvere un nome host da un indirizzo IP in Ruby</title>
		<link>http://tech.focustheweb.com/programmazione/ruby-programmazione/risolvere-un-nome-host-da-un-indirizzo-ip-in-ruby/</link>
		<comments>http://tech.focustheweb.com/programmazione/ruby-programmazione/risolvere-un-nome-host-da-un-indirizzo-ip-in-ruby/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 16:19:25 +0000</pubDate>
		<dc:creator>Giovanni Cappellotto</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[host]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://tech.focustheweb.com/?p=327</guid>
		<description><![CDATA[
Ecco un altro promemoria: come risolvere un nome host da un indirizzo IP in Ruby.
Per eseguire l&#8217;operazione viene in nostro aiuto la class Resolv.
Esempio (usando Rails):

hostname = Resolv.new.getname&#40;request.env&#91;'REMOTE_ADDR'&#93;&#41;

Risorse utili:
 http://ruby-doc.org/stdlib/libdoc/resolv/rdoc/index.html
]]></description>
			<content:encoded><![CDATA[<p><br />
Ecco un altro promemoria: come <em>risolvere un nome host da un indirizzo IP</em> in Ruby.</p>
<p>Per eseguire l&#8217;operazione viene in nostro aiuto la class <code><strong>Resolv</strong></code>.</p>
<p>Esempio (usando Rails):</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">hostname = Resolv.<span style="color:#9900CC;">new</span>.<span style="color:#9900CC;">getname</span><span style="color:#006600; font-weight:bold;">&#40;</span>request.<span style="color:#9900CC;">env</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'REMOTE_ADDR'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>Risorse utili:<br />
<a title="Resolv class documentation" href="http://ruby-doc.org/stdlib/libdoc/resolv/rdoc/index.html"> http://ruby-doc.org/stdlib/libdoc/resolv/rdoc/index.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tech.focustheweb.com/programmazione/ruby-programmazione/risolvere-un-nome-host-da-un-indirizzo-ip-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Waveform, mp3 to png</title>
		<link>http://tech.focustheweb.com/programmazione/ruby-programmazione/waveform-mp3-to-png/</link>
		<comments>http://tech.focustheweb.com/programmazione/ruby-programmazione/waveform-mp3-to-png/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 15:01:19 +0000</pubDate>
		<dc:creator>Giovanni Cappellotto</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[png]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rmagick]]></category>
		<category><![CDATA[sox]]></category>
		<category><![CDATA[waveform]]></category>

		<guid isPermaLink="false">http://tech.focustheweb.com/?p=307</guid>
		<description><![CDATA[
Waveform è una piccola applicazione rails per visualizzare la forma d&#8217;onda (waveform) di un file audio in formato mp3.
Si accede all&#8217;indirizzo http://waveform.focustheweb.com.
Come usare l&#8217;applicazione:

selezionare il file mp3 dall&#8217;hd
premere il pulsante &#8220;Create&#8221;

dopo pochi secondi, nella lista degli ultimi dieci uploads, comparirà una nuova riga in corrispondenza del file appena caricato con una piccola anteprima della forma [...]]]></description>
			<content:encoded><![CDATA[<p><br />
<strong>Waveform</strong> è una piccola <strong>applicazione rails</strong> per visualizzare la <em>forma d&#8217;onda</em> (waveform) di un file audio in formato <strong>mp3</strong>.</p>
<p>Si accede all&#8217;indirizzo <a title="Waveform" href="http://waveform.focustheweb.com">http://waveform.focustheweb.com</a>.</p>
<p>Come usare l&#8217;applicazione:</p>
<ol>
<li>selezionare il file mp3 dall&#8217;hd</li>
<li>premere il pulsante &#8220;Create&#8221;</li>
</ol>
<p>dopo pochi secondi, nella lista degli ultimi dieci uploads, comparirà una nuova riga in corrispondenza del file appena caricato con una piccola anteprima della forma d&#8217;onda.</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.focustheweb.com/programmazione/ruby-programmazione/waveform-mp3-to-png/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installare Ruby on Rails 2.3 su Debian &#8216;lenny&#8217;</title>
		<link>http://tech.focustheweb.com/information-technology/ruby-on-rails-23-su-debian-lenny/</link>
		<comments>http://tech.focustheweb.com/information-technology/ruby-on-rails-23-su-debian-lenny/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 10:22:06 +0000</pubDate>
		<dc:creator>Giovanni Cappellotto</dc:creator>
				<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.arzanadv.it/blog/2009/04/20/ruby-on-rails-23-su-debian-lenny/</guid>
		<description><![CDATA[
Ruby on Rails è un open-source web framework per il linguaggio di programmazione ruby basato sul pattern architetturale Model-View-Controller.
Nel corso degli anni Rails ha aumentato in modo esponenziale il suo pubblico grazie a caratteristiche (scaffolding, implemetazione ORM pattern con ActiveRecord, rake, ecc&#8230;) che rendono veloce ed elegante lo sviluppo di applicazioni web con questo strumento.
Installazione:

installare [...]]]></description>
			<content:encoded><![CDATA[<p><br />
<img src="http://www.arzanadv.it/blog/wp-content/uploads/2009/rails.png" alt="Ruby on Rails logo" style="float: left; margin-right: 15px; margin-bottom: 5px" /><a href="http://rubyonrails.org/" title="Ruby on Rails - sito ufficiale" target="_blank">Ruby on Rails</a> è un open-source web framework per il linguaggio di programmazione <a href="http://www.ruby-lang.org/" title="ruby - linguaggio di programmazione" target="_blank">ruby</a> basato sul pattern architetturale <a href="http://en.wikipedia.org/wiki/Model-View-Controller" title="MVC - Wikipedia" target="_blank">Model-View-Controller</a>.</p>
<p>Nel corso degli anni Rails ha aumentato in modo esponenziale il suo pubblico grazie a caratteristiche (scaffolding, implemetazione ORM pattern con ActiveRecord, rake, ecc&#8230;) che rendono veloce ed elegante lo sviluppo di applicazioni web con questo strumento.<span id="more-13"></span></p>
<p>Installazione:</p>
<ol>
<li>installare ruby (è preferita la versione 1.8.7)

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ruby libzlib-ruby rdoc libopenssl-ruby</pre></div></div>

</li>
<li>installare <a href="http://rubygems.org/" title="RubyGems - sito ufficiale" target="_blank">RubyGems</a> (gestore di pacchetti ruby)
<ol>
<li>scaricare l&#8217;ultima versione stabile di RubyGems (attualmente la 1.3.2)

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>rubyforge.org<span style="color: #000000; font-weight: bold;">/</span>frs<span style="color: #000000; font-weight: bold;">/</span>download.php<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">55066</span><span style="color: #000000; font-weight: bold;">/</span>rubygems-1.3.2.tgz</pre></div></div>

</li>
<li>scompattare l&#8217;archivio rar

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> xzvf rubygems-1.3.2.tgz</pre></div></div>

</li>
<li>avviare lo script di installazione

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> ruby rubygems-1.3.2<span style="color: #000000; font-weight: bold;">/</span>setup.rb</pre></div></div>

</li>
<li>lo script di installazione crea il file eseguibile <tt>gem1.8</tt>, ma in tutta la documentazione questo file viene citato come <tt>gem</tt> quindi aggiungiamo un collegamento per mantenere intatte le convenzioni

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem1.8 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem</pre></div></div>

</li>
</ol>
</li>
<li>installare Rails come pacchetto gem

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem <span style="color: #c20cb9; font-weight: bold;">install</span> rails</pre></div></div>

</li>
</ol>
<p>A questo punto il nostro sistema è pronto per ospitare la nostra prima web application basata su Rails.</p>
<p>Con il comando <tt>rails test_app</tt> creiamo la nostra web application.</p>
<p>Per far partire il server eseguire il comando <tt>ruby test_app/script/server</tt>.</p>
<p>Una versione funzionante della nostra prima applicazione in Rails dovrebbe essere accessibile all&#8217;indirizzo <a href="http://localhost:3000" target="_blank">http://localhost:3000</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tech.focustheweb.com/information-technology/ruby-on-rails-23-su-debian-lenny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
