<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>dambalah &#187; Search Results  &#187;  gedit</title>
	<atom:link href="http://dambalah.com/search/gedit/feed/rss2/" rel="self" type="application/rss+xml" />
	<link>http://dambalah.com</link>
	<description>thoughts of a haitian hacker...</description>
	<lastBuildDate>Sat, 10 Mar 2012 16:53:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='dambalah.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>dambalah &#187; Search Results  &#187;  gedit</title>
		<link>http://dambalah.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://dambalah.com/osd.xml" title="dambalah" />
	<atom:link rel='hub' href='http://dambalah.com/?pushpress=hub'/>
		<item>
		<title>Five Rails Tips</title>
		<link>http://dambalah.com/2008/05/06/five-rails-tips/</link>
		<comments>http://dambalah.com/2008/05/06/five-rails-tips/#comments</comments>
		<pubDate>Tue, 06 May 2008 01:32:19 +0000</pubDate>
		<dc:creator>Luc Castera</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby rails railscasts]]></category>

		<guid isPermaLink="false">http://dambalah.wordpress.com/?p=70</guid>
		<description><![CDATA[I&#8217;m a big fan of Ryan Bates&#8217; Railscasts. He is holding a contest and I thought I would participate and share 5 Rails tips with the community. Without further ado, here are my five tips. Tip 1: Rake task to remove tildes (~) added by text editors My favorite text editors (emacs or gedit) create [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dambalah.com&#038;blog=779357&#038;post=70&#038;subd=dambalah&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a big fan of Ryan Bates&#8217; <a>Railscasts</a>. He is holding a <a href="http://railscasts.com/contest">contest</a> and I thought I would participate and share 5 Rails tips with the community.</p>
<p>Without further ado, here are my five tips.</p>
<h3>Tip 1: Rake task to remove tildes (~) added by text editors</h3>
<p>My favorite text editors (emacs or gedit) create files that end with a tilde character (~) as backup copies when I modify a file. Thus, after working on my rails project for a while, I have a bunch of files ending with ~ that are hanging around. At times, it can be annoying to have my directories filled with these files so I use a rake tasks to get rid of them all.</p>
<p>Put the following in a file called <em>&#8217;tilde.rake&#8217;</em> and save this file in your rails project under the <em>lib/tasks/</em> directory.</p>
<p><code><br />
desc 'Deletes all files that end with tilde (~)'<br />
task 'tilde' do<br />
files = []<br />
Dir.glob('**/*~').each do |file|<br />
File.delete(file)<br />
files &lt;&lt; file<br />
end<br />
puts "Deleted the following files: #{files.join(', ')}"<br />
end<br />
</code></p>
<p>To run the task, simply run the following rake tasks from your shell:</p>
<p><code>rake tilde</code></p>
<p><strong>Update: </strong>See Dominic&#8217;s comment. Rake already includes a task to clean-up files. Just need to include &#8216;rake/clean&#8217;. Thanks Dominic.</p>
<h3>Tip 2: Small Erb Tip</h3>
<p>Did you ever need to display <em>&lt;%</em> or <em>%&gt;</em> in an erb template but didn&#8217;t know how to do it? I&#8217;ve been there!</p>
<p>It&#8217;s quite easy actually, all you have to do is use <em>&lt;%%</em> and <em>%%&gt;</em> instead and the erb templating engine will replace them with the appropriate <em>&lt;%</em> and <em>%&gt;</em>.</p>
<h3>Tip 3: Detect Cross-Script Scripting (XSS) Attacks &#8216;Holes&#8217;</h3>
<p>If you do not know about XSS attacks, panic and go read <a href="http://manuals.rubyonrails.com/read/chapter/44">this chapter</a> of the Rails manual to learn about them.</p>
<p>Rails provide the h() helper method for HTML meta-character conversion in views. It&#8217;s important to use it whenever you are inserting dynamic data in your erb templates.</p>
<p>Sometimes, I want to double check that I&#8217;ve been using the h() helper methods everywhere so I want a list of everywhere I&#8217;ve used <em>&lt;%=</em> in my views. I use the following command to scan through all the <em>&lt;%=</em> where I&#8217;m missing the helper method:</p>
<p><code>grep -R '&lt;%=' app/views/* | grep -v '&lt;%=h' | grep -v '.svn' | more</code></p>
<p>Rather than typing that command everytime, I simply created an alias for it by saving the following in my <em>.bash_aliases</em> file:</p>
<p><code>alias xss_erb_scan="grep -R '&lt;%=' app/views/* | grep -v '&lt;%=h' | grep -v '.svn' | more"</code></p>
<h3>Tip 4: gEdit on Rails</h3>
<p>My laptop runs Ubuntu so I use gedit for doing Rails development. gedit is highly configurable and you can turn it into a bad-ass Rails-IDE with a few tweaks.</p>
<p>First follow the steps on <a href="http://grigio.org/pimp_my_gedit_was_textmate_linux">this tutorial</a>. This will make your gedit environment pretty much ready for rails development.</p>
<p>Then, you can add the ability for gedit to execute Ruby code that you have in your currently open document by just using a keyboard shortcut. To do this, first install the &#8216;External Tools&#8217; plugin. Go to &#8216;Edit&#8217;, then &#8216;Preferences&#8217;, and select the &#8216;Plugins&#8217; tab. Find and select the &#8216;External Tool&#8217; plugin and click on &#8216;Configure this plugin&#8217;. The following window should popup.</p>
<p><a href="http://dambalah.files.wordpress.com/2008/05/gedit1.png"><img class="alignnone size-medium wp-image-71" src="http://dambalah.files.wordpress.com/2008/05/gedit1.png?w=300&h=190" alt="" width="300" height="190" /></a></p>
<p>Click on the &#8216;New&#8217; button and create an &#8216;Execute Ruby&#8217; tool by filling in the information as shown below:</p>
<p><a href="http://dambalah.files.wordpress.com/2008/05/gedit2.png"><img class="alignnone size-medium wp-image-72" src="http://dambalah.files.wordpress.com/2008/05/gedit2.png?w=300&h=190" alt="" width="300" height="190" /></a></p>
<p>That&#8217;s it. You can close the window and test by writing some ruby code in a new document and pressing F5. The code will execute and the output will be shown at the bottom of the editor.</p>
<p><a href="http://dambalah.files.wordpress.com/2008/05/gedit3.png"><img class="alignnone size-medium wp-image-73" src="http://dambalah.files.wordpress.com/2008/05/gedit3.png?w=300&h=175" alt="" width="300" height="175" /></a></p>
<h3>Tip 5: Explore Other Ruby Web Frameworks</h3>
<p>My last tip is to explore other ruby web frameworks. There are a lot of other web frameworks written in Ruby and you can learn a lot by just exploring them. Even if you do not plan to use them for a production site, try using them for a small project, look inside their codebase and try to understand the code. Since Rails is a more mature and more complex framework, it can be scary to look inside the Rails code but the same can&#8217;t be said for some of the newer, lighter frameworks out there. Furthermore, exploring these other frameworks can give you new ideas when working on Rails projects. So just like the <a href="http://www.pragprog.com">pragmatic programmers</a> advocate learning one new language a year, I recommend learning a few web frameworks in that language during that year to expand your knowledge of the language and avoid tunnel vision. So go start exploring <a href="http://www.merbivore.com">Merb</a>, <a href="http://ramaze.net">Ramaze</a>, <a href="http://code.whytheluckystiff.net/camping">Camping</a>, <a href="http://sinatrarb.com/Welcome">Sinatra</a>, etc&#8230; Check <a href="http://ramaze.net/#other-frameworks">here</a> for a full list of Ruby web frameworks.</p>
<p>I hope you will find some of these tips useful. I look forward to read the tips submitted by the other <a href="//railscasts.com">railscast</a> readers.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dambalah.wordpress.com/70/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dambalah.wordpress.com/70/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dambalah.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dambalah.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dambalah.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dambalah.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dambalah.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dambalah.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dambalah.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dambalah.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dambalah.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dambalah.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dambalah.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dambalah.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dambalah.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dambalah.wordpress.com/70/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dambalah.com&#038;blog=779357&#038;post=70&#038;subd=dambalah&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dambalah.com/2008/05/06/five-rails-tips/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/569c407bedaba2ad3b91dc8b3e0837b4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dambalah</media:title>
		</media:content>

		<media:content url="http://dambalah.files.wordpress.com/2008/05/gedit1.png?w=300" medium="image" />

		<media:content url="http://dambalah.files.wordpress.com/2008/05/gedit2.png?w=300" medium="image" />

		<media:content url="http://dambalah.files.wordpress.com/2008/05/gedit3.png?w=300" medium="image" />
	</item>
		<item>
		<title>Install Java On Ubuntu</title>
		<link>http://dambalah.com/2007/09/21/install-java-on-ubuntu/</link>
		<comments>http://dambalah.com/2007/09/21/install-java-on-ubuntu/#comments</comments>
		<pubDate>Fri, 21 Sep 2007 00:44:02 +0000</pubDate>
		<dc:creator>Luc Castera</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://dambalah.com/2007/09/21/install-java-on-ubuntu/</guid>
		<description><![CDATA[It is so easy to install Java on Ubuntu now. On Ubuntu 7.04 (Feisty Fawn), follow these steps: 1) Make sure you have the right repositories on your sources.list file. Edit your sources.list file the following way: sudo gedit /etc/apt/sources.list or if you are not using gnome (e.g. you are logged in through ssh): sudo [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dambalah.com&#038;blog=779357&#038;post=39&#038;subd=dambalah&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It is so easy to install Java on Ubuntu now. On Ubuntu 7.04 (Feisty Fawn),  follow these steps:</p>
<p><strong>1) Make sure you have the right repositories on your sources.list file.</strong></p>
<p>Edit your sources.list file the following way:</p>
<p><code>sudo gedit /etc/apt/sources.list</code></p>
<p>or if you are not using gnome (e.g. you are logged in through ssh):</p>
<p><code>sudo nano /etc/apt/sources.list</code></p>
<p>If the following lines are not already there, add them:</p>
<p><code>deb <a href="http://us.archive.ubuntu.com/ubuntu" target="_blank">http://us.archive.ubuntu.com/ubuntu</a> feisty main restricted<br />
deb <a href="http://us.archive.ubuntu.com/ubuntu" target="_blank">http://us.archive.ubuntu.com/ubuntu</a> feisty universe multiverse</code></p>
<p>Save the file (in nano use Control-O to save and then Control-X to exit).<br />
Now you need to tell the package manager to update it&#8217;s database:</p>
<p><code>sudo apt-get update</code></p>
<p><strong>2) Install Java using apt-get</strong></p>
<p>I currently have both Java 5 and Java 6 installed on my machine and it&#8217;s very easy to switch between the two. Java 6 has some nice goodies such as JSR-223 and better jconsole that I like to use.</p>
<p><em>For Java 5:</em></p>
<p><code>sudo apt-get install sun-java5-jre sun-java5-jdk sun-java5-plugin</code></p>
<p><em>For Java 6:</em></p>
<p><code>sudo apt-get install sun-java6-jre sun-java6-jdk sun-java6-plugin</code></p>
<p>There are other packages that you might be interested in:</p>
<ul>
<li>sun-java6-demo</li>
<li>sun-java6-doc</li>
<li>sun-java6-source</li>
</ul>
<p><strong>3) Verify installation</strong></p>
<p>Verify that you have the correct version of java running:</p>
<p><code>java -version</code></p>
<p>For example, on my machine (yes, I call it <em>tiwouj</em>):</p>
<p><a href="http://dambalah.files.wordpress.com/2007/09/version.png" title="Ubuntu Java Version"><img src="http://dambalah.files.wordpress.com/2007/09/version.png?w=510" alt="Ubuntu Java Version" /></a></p>
<p>To see a list of the java versions that you have installed, you can use the following command (it&#8217;s a letter L at the end of the command):</p>
<p><code>update-java-alternatives -l</code></p>
<p>Here is my list:</p>
<p><a href="http://dambalah.files.wordpress.com/2007/09/javalist.png" title="Ubuntu Java List"><img src="http://dambalah.files.wordpress.com/2007/09/javalist.png?w=510" alt="Ubuntu Java List" /></a></p>
<p>This should show you a list of all the java alternatives you have installed. java-gcj is the free version of Java from the GNU project and comes installed by default with Ubuntu so you should see it. To switch to a different version, use the following command:</p>
<p><code>sudo update-java-alternatives -s &lt;version-desired&gt;</code></p>
<p>e.g:</p>
<p><code>sudo update-java-alternatives -s java-1.5.0-sun</code></p>
<p>Make sure it worked:</p>
<p><code>java -version</code></p>
<p>That&#8217;s it! How easy was that? You have to love apt-get.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dambalah.wordpress.com/39/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dambalah.wordpress.com/39/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dambalah.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dambalah.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dambalah.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dambalah.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dambalah.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dambalah.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dambalah.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dambalah.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dambalah.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dambalah.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dambalah.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dambalah.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dambalah.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dambalah.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dambalah.com&#038;blog=779357&#038;post=39&#038;subd=dambalah&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dambalah.com/2007/09/21/install-java-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/569c407bedaba2ad3b91dc8b3e0837b4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dambalah</media:title>
		</media:content>

		<media:content url="http://dambalah.files.wordpress.com/2007/09/version.png" medium="image">
			<media:title type="html">Ubuntu Java Version</media:title>
		</media:content>

		<media:content url="http://dambalah.files.wordpress.com/2007/09/javalist.png" medium="image">
			<media:title type="html">Ubuntu Java List</media:title>
		</media:content>
	</item>
	</channel>
</rss>
