<?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>Sean&#039;s Blog &#187; parsing</title>
	<atom:link href="http://seanbehan.com/tag/parsing/feed/" rel="self" type="application/rss+xml" />
	<link>http://seanbehan.com</link>
	<description>Web Programming, Ruby on Rails, Wordpress, PHP from Burlington, Vermont</description>
	<lastBuildDate>Wed, 18 Jan 2012 21:44:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Installing Feedzirra RSS Parser on Ubuntu 8</title>
		<link>http://seanbehan.com/ruby-on-rails/installing-feedzirra-rss-parser-on-ubuntu-8/</link>
		<comments>http://seanbehan.com/ruby-on-rails/installing-feedzirra-rss-parser-on-ubuntu-8/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 17:18:18 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[feedzirra]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[railscasts]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=428</guid>
		<description><![CDATA[I recently watched a RailsCasts episode (http://railscasts.com/episodes/168-feed-parsing) on parsing and persisting RSS feeds using Feedzirra. It took a little setting up on Ubuntu because it relies on some libraries that aren&#8217;t included with Ubuntu > 8. The gem will fail right off the bat gem sources -a http://gems.github.com # if you haven't already gem install [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby-on-rails%2Finstalling-feedzirra-rss-parser-on-ubuntu-8%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Installing Feedzirra RSS Parser on Ubuntu 8" data-url="http://seanbehan.com/ruby-on-rails/installing-feedzirra-rss-parser-on-ubuntu-8/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>I recently watched a RailsCasts episode (http://railscasts.com/episodes/168-feed-parsing) on parsing and persisting RSS feeds using Feedzirra. It took a little setting up on Ubuntu because it relies on some libraries that aren&#8217;t included with Ubuntu > 8.</p>
<p>The gem will fail right off the bat</p>
<pre class="wp-code-highlight prettyprint">
gem sources -a http://gems.github.com # if you haven't already
gem install pauldix-feedzirra
</pre>
<p>Here is what I needed before I could install the gem</p>
<pre class="wp-code-highlight prettyprint">
apt-get install libcurl3
apt-get install libxml2 libxml2-dev
apt-get install libxslt1-dev
</pre>
<p>Then go ahead and</p>
<pre class="wp-code-highlight prettyprint">
gem install pauldix-feedzirra
</pre>
<p>Here are some other useful resources</p>
<p>http://github.com/pauldix/feedzirra/tree/master</p>
<p>http://ruby.zigzo.com/2009/02/15/feedzirra-installation-errors/</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-on-rails/installing-feedzirra-rss-parser-on-ubuntu-8/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Email Obfuscation and Extraction from Text with Rails</title>
		<link>http://seanbehan.com/ruby-on-rails/email-obfuscation-and-extraction-from-text-with-rails/</link>
		<comments>http://seanbehan.com/ruby-on-rails/email-obfuscation-and-extraction-from-text-with-rails/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 16:50:29 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[hyperlinking]]></category>
		<category><![CDATA[obfuscation]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[recipes]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=423</guid>
		<description><![CDATA[There is a helper method for handling the obfuscation of email addresses in Rails. mail_to &#34;me@domain.com&#34;, &#34;My email&#34;, :encode =&#62; &#34;hex&#34; # =&#62; &#60;a href=&#34;mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d&#34;&#62;My email&#60;/a&#62; If you want to then extract an email address(or all email addresses) from a block of text here is the code. I created a helper function called &#8220;emailitize&#8221; and [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby-on-rails%2Femail-obfuscation-and-extraction-from-text-with-rails%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Email Obfuscation and Extraction from Text with Rails" data-url="http://seanbehan.com/ruby-on-rails/email-obfuscation-and-extraction-from-text-with-rails/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>There is a helper method for handling the obfuscation of email addresses in Rails.</p>
<pre class="wp-code-highlight prettyprint">
mail_to &quot;me@domain.com&quot;, &quot;My email&quot;, :encode =&gt; &quot;hex&quot;
 # =&gt; &lt;a href=&quot;mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d&quot;&gt;My email&lt;/a&gt;
</pre>
<p>If you want to then extract an email address(or all email addresses) from a block of text here is the code. I created a helper function called &#8220;emailitize&#8221; and put it in the ApplicationHelper module inside helpers/application_helper.rb</p>
<pre class="wp-code-highlight prettyprint">
module ApplicationHelper
  #takes a string and will return the same string but with email addresses encoded and hyperlinked
  def emailitize(text)
    text.gsub(/([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})/i) {|m|
        mail_to(m, m.gsub(&quot;@&quot;, &quot;&lt;small&gt;[at]&lt;/small&gt;&quot;), :encode=&gt;:hex)
    }
  end
end
</pre>
<p>It&#8217;s important to remember that you&#8217;ll need to pass a block to the gsub method. You can&#8217;t do something like this instead</p>
<pre class="wp-code-highlight prettyprint">
text.gsub( /([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})/i, mail_to('\\1@\\2', '\\1@\\2', :encode=&gt;:hex) )
</pre>
<p>It will work except the encode will fail. It will evaluate the &#8216;\\1@\\2&#8242; strings rather than as dynamic variables.</p>
<p>You can then use this function in your views</p>
<pre class="wp-code-highlight prettyprint">
&lt;%= emailitize @job.how_to_apply %&gt;
</pre>
<p>More information is available in the Rails and Ruby docs:</p>
<p>http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#M001887</p>
<p>http://ruby-doc.org/core/classes/String.html#M000817</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-on-rails/email-obfuscation-and-extraction-from-text-with-rails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

