<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><!-- generator="wordpress/wordpress-mu-1.2.4" --><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>A Programmers Perspective</title>
	<link>http://blog.jason-palmer.com</link>
	<description />
	<pubDate>Mon, 10 Mar 2008 14:55:49 +0000</pubDate>
	<generator>http://wordpress.org/?v=wordpress-mu-1.2.4</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/YetAnotherTechnicalBlog" /><feedburner:info uri="yetanothertechnicalblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Indiana Jones is back!  Badass!</title>
		<link>http://feedproxy.google.com/~r/YetAnotherTechnicalBlog/~3/PioKO6k3jXc/</link>
		<comments>http://blog.jason-palmer.com/blog/2008/03/10/indiana-jones-is-back-badass/#comments</comments>
		<pubDate>Mon, 10 Mar 2008 14:55:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://blog.jason-palmer.com/blog/2008/03/10/indiana-jones-is-back-badass/</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.jason-palmer.com/images/indy4finalposter.jpg" alt="Indiana Jones Poster" height="651" width="440" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jason-palmer.com/blog/2008/03/10/indiana-jones-is-back-badass/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.jason-palmer.com/blog/2008/03/10/indiana-jones-is-back-badass/</feedburner:origLink></item>
		<item>
		<title>The Emo Lawn</title>
		<link>http://feedproxy.google.com/~r/YetAnotherTechnicalBlog/~3/AoH7gHnIXUU/</link>
		<comments>http://blog.jason-palmer.com/blog/2008/03/02/the-emo-lawn/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 04:31:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[general]]></category>

		<category><![CDATA[rants]]></category>

		<guid isPermaLink="false">http://blog.jason-palmer.com/blog/2008/03/02/the-emo-lawn/</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.jason-palmer.com/images/emo_lawn.jpg" alt="Emo Lawn" height="350" width="350" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jason-palmer.com/blog/2008/03/02/the-emo-lawn/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.jason-palmer.com/blog/2008/03/02/the-emo-lawn/</feedburner:origLink></item>
		<item>
		<title>FanBoom Launched!</title>
		<link>http://feedproxy.google.com/~r/YetAnotherTechnicalBlog/~3/GxmkU3jWacU/</link>
		<comments>http://blog.jason-palmer.com/blog/2008/02/10/fanboom-launched/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 16:40:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://blog.jason-palmer.com/blog/2008/02/10/fanboom-launched/</guid>
		<description><![CDATA[FanBoom has officially launched and is now accepting new members!
FanBoom puts the power of sports information in your hands. At FanBoom you can track all of your favorite teams, and writers (national and local), read the best of the sports blogs, and interact with robust community of fans of your favorite teams. Our goal is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.fanboom.com" title="FanBoom - Your Sports.  Your Way.">FanBoom</a> has officially launched and is now accepting new members!</p>
<p><a href="http://www.fanboom.com" title="FanBoom - Your Sports.  Your Way.">FanBoom</a> puts the power of sports information in your hands. At <a href="http://www.fanboom.com" title="FanBoom - Your Sports.  Your Way.">FanBoom</a> you can track all of your favorite teams, and writers (national and local), read the best of the sports blogs, and interact with robust community of fans of your favorite teams. Our goal is to build a portal of sports information that serve up Your Sports, Your Way, so you won&#8217;t have to go anywhere else.</p>
<p><a href="http://www.fanboom.com/account/signup/" title="FanBoom - Your Sports.  Your Way."><strong>Sign Up Today!</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jason-palmer.com/blog/2008/02/10/fanboom-launched/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.jason-palmer.com/blog/2008/02/10/fanboom-launched/</feedburner:origLink></item>
		<item>
		<title>Useful Rubyism’s part 1</title>
		<link>http://feedproxy.google.com/~r/YetAnotherTechnicalBlog/~3/BMjrCIaUVMA/</link>
		<comments>http://blog.jason-palmer.com/blog/2008/02/05/useful-rubyisms-part-1/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 15:03:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.jason-palmer.com/blog/2008/02/05/useful-rubyisms-part-1/</guid>
		<description><![CDATA[Ruby is the first language I have programmed in that makes me truly enjoy the programming process.  It&#8217;s infinitely flexible, totally object-oriented, and has a lot of great Rubyism&#8217;s that make it both unique and powerful.  I will demonstrate a few of my favorite Rubyism&#8217;s.
Class Method Overloading
So you say to yourself, while programming, [...]]]></description>
			<content:encoded><![CDATA[<p>Ruby is the first language I have programmed in that makes me truly enjoy the programming process.  It&#8217;s infinitely flexible, totally object-oriented, and has a lot of great Rubyism&#8217;s that make it both unique and powerful.  I will demonstrate a few of my favorite Rubyism&#8217;s.</p>
<p><strong>Class Method Overloading</strong><br />
So you say to yourself, while programming, &#8220;Ruby would be kick @ss if it only had a string method that would shuffle the characters.&#8221;  I know, I&#8217;ve said it myself hundreds of times (man I need a life).  In Ruby, life is good.  See below:<br />
<code><br />
class String<br />
def shuffle<br />
self.split(//).sort_by{rand}.join<br />
end<br />
end</code></p>
<p>puts &#8220;My Life Is Better Because of Ruby&#8221;.shuffle<br />
#=&gt; &#8220;I iya sMeuB  t r ceLoBtfeefuReybs&#8221;</p>
<p>With this approach we can easily create new methods for native classes.  Ruby even allows you to overwrite existing methods of native classes.</p>
<p><strong>One-liners</strong><br />
Ruby is the king (or queen?) of one-liners.  Because nearly everything in Ruby is object-oriented, you can basically write your entire program in one line of code!  While that may be a bit extreme, creating one-liners can make your program much more readable and maintainable.<br />
<code><br />
#Convert sentence to CSV and capitalize each column<br />
tbdata = "Ruby is awesome"<br />
tbdata.split(/ /).map{|word| word.capitalize}.join(',')</code></p>
<p>More to come!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jason-palmer.com/blog/2008/02/05/useful-rubyisms-part-1/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.jason-palmer.com/blog/2008/02/05/useful-rubyisms-part-1/</feedburner:origLink></item>
		<item>
		<title>Richard Stallman, meet Chuck Norris.</title>
		<link>http://feedproxy.google.com/~r/YetAnotherTechnicalBlog/~3/QYEMg6J66W8/</link>
		<comments>http://blog.jason-palmer.com/blog/2008/01/30/richard-stallman-meet-chuck-norris/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 04:31:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[general]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[rants]]></category>

		<guid isPermaLink="false">http://blog.jason-palmer.com/blog/2008/01/30/richard-stallman-meet-chuck-norris/</guid>
		<description><![CDATA[Recently, the developer community has been passing around Chuck Norris&#8217;esque jokes about Richard Stallman.  Being a developer (and thinking it&#8217;s hillarious) I can&#8217;t help but contribute my own.

Richard Stallman doesn&#8217;t code.  He dares the computer to not do his bidding.
Global warming is caused by Richard Stallman&#8217;s rage toward Windows Vista.
Rather than being birthed like a [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, the developer community has been passing around <a href="http://reddit.com/r/programming/info/675jj/comments/" title="Richard Stallman - Chuck Norris Jokes">Chuck Norris&#8217;esque jokes about Richard Stallman</a>.  Being a developer (and thinking it&#8217;s hillarious) I can&#8217;t help but contribute my own.</p>
<ul>
<li>Richard Stallman doesn&#8217;t code.  He dares the computer to not do his bidding.</li>
<li>Global warming is caused by Richard Stallman&#8217;s rage toward Windows Vista.</li>
<li>Rather than being birthed like a normal child, Richard Stallman instead instantiated himself polymorphically. Shortly thereafter he grew a beard.</li>
<li>Richard Stallman discovered extra-terrestrial life but killed them because they used closed-source software.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.jason-palmer.com/blog/2008/01/30/richard-stallman-meet-chuck-norris/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.jason-palmer.com/blog/2008/01/30/richard-stallman-meet-chuck-norris/</feedburner:origLink></item>
		<item>
		<title>Top Five Most Useful Ruby Gems</title>
		<link>http://feedproxy.google.com/~r/YetAnotherTechnicalBlog/~3/7Y6V7tMnMas/</link>
		<comments>http://blog.jason-palmer.com/blog/2008/01/26/top-five-most-useful-ruby-gems/#comments</comments>
		<pubDate>Sun, 27 Jan 2008 01:25:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.jason-palmer.com/blog/2008/01/26/top-five-most-useful-ruby-gems/</guid>
		<description><![CDATA[Check out the top 5 most useful ruby gems that you may not have heard of!
Mailfactory
Mailfactory is a ruby library designed to allow the simple creation of emails. It offers the following features:

Plain text and HTML body parts
Simple attachments
MIME-type guessing for attachments
Attachments from arbitrary IO objects
Custom headers
RFC valid email generation
Simple API

To Install:
gem install mailfactory
Example:

require 'rubygems'
require [...]]]></description>
			<content:encoded><![CDATA[<p>Check out the top 5 most useful ruby gems that you may not have heard of!</p>
<h2>Mailfactory</h2>
<p>Mailfactory is a ruby library designed to allow the simple creation of emails. It offers the following features:</p>
<ul>
<li>Plain text and HTML body parts</li>
<li>Simple attachments</li>
<li>MIME-type guessing for attachments</li>
<li>Attachments from arbitrary IO objects</li>
<li>Custom headers</li>
<li>RFC valid email generation</li>
<li>Simple API</li>
</ul>
<p>To Install:<br />
gem install mailfactory</p>
<p>Example:</p>
<p><code><br />
require 'rubygems'<br />
require 'net/smtp'<br />
require 'mailfactory'</p>
<p>#Connect to SMTP Server<br />
smtp = Net::SMTP.new('mail.host.com', 25)<br />
smtp.start('mydomain.com')</p>
<p>#Construct Mail Message<br />
mail = MailFactory.new()<br />
mail.to = 'foo@monkey.com'<br />
mail.from = 'jason@dzone.com'<br />
mail.subject = 'An email from Ruby'<br />
mail.add_attachment('/path/to/file')<br />
mail.html = "&lt;h1&gt;Hello From Ruby!&lt;/h1&gt;&lt;p&gt;Mailfactory is nice&lt;/p&gt;"</p>
<p>#Construct SMTP Message<br />
smtp.send_message mail.construct, 'foo@monkey.com', 'jason@dzone.com'</p>
<p>#Send this (and all other) message<br />
smtp.finish()<br />
</code></p>
<h2>Feed-Normalizer</h2>
<p>Feed-Normalizer normalizes all RSS Feed formats into a generic class. This allows you to access the same properties from any RSS Feed it parses without worrying about the underlying format of the RSS source.</p>
<p>To Install:<br />
gem install feed-normalizer</p>
<p>See <a href="http://ruby.dzone.com/articles/ruby-rss-aggregator">Ruby RSS Aggregator</a> for example code.</p>
<h2>FasterCSV</h2>
<p>FasterCSV is significantly faster than CSV and arguably has an improved CSV interface.</p>
<p>To Install<br />
gem install fastercsv</p>
<p>Example:<br />
<code><br />
require 'rubygems'<br />
require 'fastercsv'</p>
<p>#Read a CSV File<br />
FasterCSV.foreach('/path/to/file') do |row|<br />
element1 = row[0]<br />
element2 = row[2]<br />
element3 = row[3]<br />
end</p>
<p>#Write a CSV File<br />
FasterCSV.open('/path/to/file') do |csv|<br />
csv &lt;&lt; ["an", "array", "of", "data"]<br />
end<br />
</code></p>
<h2>Bishop</h2>
<p>Bishop is a Bayesian classifier library for Ruby. With Bishop you can effectively train your program to recognize any number of things.</p>
<p>To Install:<br />
gem install bishop</p>
<p>Example:<br />
<code><br />
require 'rubygems'<br />
require 'bishop'</p>
<p>#Initialize the classifier<br />
classifier = Bishop::Bayes.new<br />
classifier.load('spam_or_no_spam.yml') if File.file?('spam_or_no_spam.yml')</p>
<p>#Train the classifier to recognize spam email<br />
classifier.train('spam', 'Amazing results in a few weeks!')<br />
classifier.train('spam', 'Get your free viagra!')<br />
classifier.train('spam', 'A credit card offer!')</p>
<p>#Train the classifier to recognize legit email<br />
classifier.train('not spam', 'Your payment update')<br />
classifier.train('not spam', 'Scheduled Maintenance Reminder')<br />
classifier.train('not spam', 'Can you pick the kids up today?')</p>
<p>#Save classication file so your program can learn<br />
classifier.save('spam_or_no_spam.yml')</p>
<p>#Guess if an email is spam or not<br />
guess = classifier.guess('How would you like a free sample of viagra?')<br />
</code></p>
<h2>Linguistics</h2>
<p>Linguistics is a generic, language-neutral framework for extending Ruby objects with linguistic methods. This is easily one of the coolest gems. There is simply so much you can do with the Linguistics module.</p>
<p>To Install:<br />
gem install linguistics</p>
<p>Example:<br />
<code><br />
require 'rubygems'<br />
require 'linguistics'</p>
<p>"book".en.a<br />
# =&gt; "a book"</p>
<p>"runs".en.present_participle<br />
# =&gt; "running"</p>
<p>5.en.ordinal<br />
# =&gt; "5th"</p>
<p>2004.en.numwords<br />
# =&gt; "two thousand and four"</p>
<p>animals = %w{dog cow ox chicken goose goat cow dog rooster llama<br />
pig goat dog cat cat dog cow goat goose goose ox alpaca}<br />
puts "The farm has: " + animals.en.conjunction</p>
<p># =&gt; The farm has: four dogs, three cows, three geese, three goats,<br />
two oxen, two cats, a chicken, a rooster, a llama, a pig,<br />
and an alpaca<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jason-palmer.com/blog/2008/01/26/top-five-most-useful-ruby-gems/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.jason-palmer.com/blog/2008/01/26/top-five-most-useful-ruby-gems/</feedburner:origLink></item>
		<item>
		<title>Ruby RSS Aggregator</title>
		<link>http://feedproxy.google.com/~r/YetAnotherTechnicalBlog/~3/F9b4SAokZUY/</link>
		<comments>http://blog.jason-palmer.com/blog/2008/01/26/ruby-rss-aggregator/#comments</comments>
		<pubDate>Sat, 26 Jan 2008 18:59:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.jason-palmer.com/blog/2008/01/26/ruby-rss-aggregator/</guid>
		<description><![CDATA[With Ruby we can quickly create an RSS Aggregator using the Feed-Normalizer gem.  First, let&#8217;s install the gem:

gem install feed-normalizer

Now that we have the gem installed, let&#8217;s put together a simple script that will aggregate Slashdot&#8217;s RSS Feed:

require 'rubygems'
require 'feed-normalizer'
#Define URL and Parse Feed
feed_url = 'http://rss.slashdot.org/Slashdot/slashdot'
rss = FeedNormalizer::FeedNormalizer.parse open(feed_url)
#Quit if no articles
exit unless rss.entries.length [...]]]></description>
			<content:encoded><![CDATA[<p>With Ruby we can quickly create an RSS Aggregator using the <a href="http://code.google.com/p/feed-normalizer/" title="Feed-Normalizer - Google Code">Feed-Normalizer</a> gem.  First, let&#8217;s install the gem:</p>
<p><code><br />
gem install feed-normalizer<br />
</code></p>
<p>Now that we have the gem installed, let&#8217;s put together a simple script that will aggregate Slashdot&#8217;s RSS Feed:</p>
<p><code><br />
require 'rubygems'<br />
require 'feed-normalizer'</p>
<p>#Define URL and Parse Feed<br />
feed_url = 'http://rss.slashdot.org/Slashdot/slashdot'<br />
rss = FeedNormalizer::FeedNormalizer.parse open(feed_url)</p>
<p>#Quit if no articles<br />
exit unless rss.entries.length &gt; 0</p>
<p>#Read entries<br />
rss.entries.each do |entry|<br />
title = entry.title<br />
body = entry.content<br />
authors = entry.authors.join(', ') rescue ''<br />
entry_url = entry.urls.first</p>
<p>#Your Logic Here<br />
end<br />
</code><br />
As you can see, it&#8217;s quite simple to aggregate an RSS Feed using Ruby and Feed-Normalizer.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jason-palmer.com/blog/2008/01/26/ruby-rss-aggregator/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.jason-palmer.com/blog/2008/01/26/ruby-rss-aggregator/</feedburner:origLink></item>
		<item>
		<title>Web Application Security - Part 3</title>
		<link>http://feedproxy.google.com/~r/YetAnotherTechnicalBlog/~3/rQNQdBtI-jw/</link>
		<comments>http://blog.jason-palmer.com/blog/2008/01/24/web-application-security-part-3/#comments</comments>
		<pubDate>Thu, 24 Jan 2008 14:54:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.jason-palmer.com/blog/2008/01/24/web-application-security-part-3/</guid>
		<description><![CDATA[Another form of web hacking is called form hijacking.  Form hijacking is not a well-known hack, but it&#8217;s surprisingly effective and web developers should use preventative measures to guard their sites from this form of attack.
Form hijacking is a very simple concept.  So, you have a website which contains a form that submits [...]]]></description>
			<content:encoded><![CDATA[<p>Another form of web hacking is called <strong>form hijacking</strong>.  Form hijacking is not a well-known hack, but it&#8217;s surprisingly effective and web developers should use preventative measures to guard their sites from this form of attack.</p>
<p>Form hijacking is a very simple concept.  So, you have a website which contains a form that submits data to a server-side component which analyzes, processes, and ultimately provides feedback to the user based on his/her selections.   For an example, let&#8217;s pretend we have a real-estate search engine whereby a user enters their zip code &amp; radius and they are presented with available real-estate in that area.   However, they first need to login in order to view this data, so you think it&#8217;s secure.  Wrong!</p>
<p>Ultimately, we want to protect this data because it&#8217;s valuable.  This is why we make a user register/login before seeing it.  However, this is not enough.   With very little effort, I could create a script that logs in (with a cookie), submits data to this form, and screen-scrapes the results.  Your valuable data will effectively be stolen from you.</p>
<p><strong>How can we prevent form hijacking?</strong></p>
<p>While there are many methods to secure data, the best three methods for securing a form are:</p>
<ol>
<li>Server-side Referrer Checks</li>
<li>Server-side random token verification</li>
<li>Ajax forms &amp; results</li>
</ol>
<p><strong>Server-side Referrer Checks</strong></p>
<p>When a user submits the form you would like to secure, you should always check the referrer to make sure the form is being submitted from an expected location(s).  <em>Note: This method should not be the only security measure you rely on.  Referrer data can be easily tampered with and your server-side validations can be fooled.</em></p>
<p><strong>Server-Side Random Token Verification</strong></p>
<p>When displaying your form, generate a random number or a random hash, then create a hidden field in the form where the value of this random number is placed.  Store this random number in session or in a database for later verification.  When the form is submitted, ensure that the value of the hidden field is the same as the value in session/db.   Using this method, it will effectively secure your form from form hijacking.  While this isn&#8217;t the most secure method, it will at least make the job of hacking your site much harder.  A hacker would now have to script the login process via a series of screen-scraping, cookie storage, /etc/host entries, and form posting.  Much harder.</p>
<p><strong>AJAX Forms &amp; Results</strong></p>
<p>This is, by far, the best method of securing your valuable data.  If your form submits to an AJAX component and then the results are displayed via AJAX, a hacker will be unable to write a script that could automatically steal your data.  At this point, only browsers can render javascript.  The only downside to using AJAX is that all the data you are displaying is not easily SEO&#8217;able.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jason-palmer.com/blog/2008/01/24/web-application-security-part-3/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.jason-palmer.com/blog/2008/01/24/web-application-security-part-3/</feedburner:origLink></item>
		<item>
		<title>Web Application Security - part 2</title>
		<link>http://feedproxy.google.com/~r/YetAnotherTechnicalBlog/~3/uOnNj6M7x3I/</link>
		<comments>http://blog.jason-palmer.com/blog/2008/01/20/web-application-security-part-2/#comments</comments>
		<pubDate>Mon, 21 Jan 2008 05:13:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.jason-palmer.com/blog/2008/01/20/web-application-security-part-2/</guid>
		<description><![CDATA[A popular form of web hacking is cross-site scripting.  Cross-site scripting can occur in any site which utilizes user-generated content, whereby allowing users to submit data of some sort that can be visible to other users.
What is Cross-Site Scripting?
Simply put, cross-site scripting is the malicious injection of client-side code (javascript) into web forms, forums, [...]]]></description>
			<content:encoded><![CDATA[<p>A popular form of web hacking is cross-site scripting.  Cross-site scripting can occur in any site which utilizes user-generated content, whereby allowing users to submit data of some sort that can be visible to other users.</p>
<p><strong>What is Cross-Site Scripting?</strong></p>
<p>Simply put, cross-site scripting is the malicious injection of client-side code (javascript) into web forms, forums, and other venues for user-generated content.  A simple example would be a blog.  My blog, for instance, allows users to comment on my articles.  If a user were interested in exploiting a simple (annoying) cross-site scripting hack, they might write a comment like this:</p>
<p><code><br />
&lt;script type="text/javascript" language="javascript"&gt;<br />
&lt;!--<br />
alert("You're a loser");<br />
--&gt;<br />
&lt;/script&gt;<br />
</code></p>
<p>Unless you have protected your site from cross-site scripting, this message would be posted, and the next time a user viewed this particular page that contained this message, an alert box would come up calling them a loser.  Not a good thing to call your readers losers!</p>
<p><strong>How can we stop cross-site scripting?</strong></p>
<p>The easiest way to stop cross-site scripting is to strip all non-text elements (html, javascript, etc) from posts before they are placed in the database.  A more lenient and equally effective solution would involve certain allowed tags.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jason-palmer.com/blog/2008/01/20/web-application-security-part-2/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.jason-palmer.com/blog/2008/01/20/web-application-security-part-2/</feedburner:origLink></item>
		<item>
		<title>Capitalizing Labels Using Ruby</title>
		<link>http://feedproxy.google.com/~r/YetAnotherTechnicalBlog/~3/HTvAD1c0PmI/</link>
		<comments>http://blog.jason-palmer.com/blog/2008/01/15/capitalizing-labels-using-ruby/#comments</comments>
		<pubDate>Tue, 15 Jan 2008 18:39:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.jason-palmer.com/blog/2008/01/15/capitalizing-labels-using-ruby/</guid>
		<description><![CDATA[Recently, I was involved in a project which involved extremely large forms with even larger field names.  One simple request (so we thought) from the client involved showing all the labels in the form in capitalized text.  Being lazy, I put together a ruby script to do the tough work for me.  [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I was involved in a project which involved extremely large forms with even larger field names.  One simple request (so we thought) from the client involved showing all the labels in the form in capitalized text.  Being lazy, I put together a ruby script to do the tough work for me.  So, I share this with you for anyone that is interested.  This particular script will apply this formatting to rails _form.rhtml partial files only, but this restriction can easily be removed to make it work with any file.</p>
<p><code><br />
require 'rubygems'<br />
require 'find'</p>
<p>class String<br />
    def to_caps<br />
      self.split(/ /).map {|word| word.to_s.capitalize }.join(' ')<br />
    end<br />
end</p>
<p>dir = "the/directory/with/the/files/"</p>
<p>Find.find(dir) do |f|<br />
  next if File.directory?(f)<br />
  next unless f =~ /_form.rhtml/</p>
<p>  puts f</p>
<p>  #Open File and Read data<br />
  file = File.open(f)<br />
  data = file.read()<br />
  file.close()</p>
<p>  #Find all labels<br />
  data = data.gsub(/(&lt;label)([^&gt;]*)(&gt;)([^&lt;]*)(&lt;\/label&gt;)/) {|c|<br />
    tmp = c.split('&gt;')[1].split('&lt;')[0]<br />
    c.gsub(tmp, tmp.to_caps)<br />
  }</p>
<p>  newfile = File.new(f, File::CREAT|File::TRUNC|File::RDWR, 0644)<br />
  newfile &lt;&lt; data<br />
  newfile.close()<br />
end<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jason-palmer.com/blog/2008/01/15/capitalizing-labels-using-ruby/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.jason-palmer.com/blog/2008/01/15/capitalizing-labels-using-ruby/</feedburner:origLink></item>
	</channel>
</rss>

