<?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"?><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: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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Studio Sedition » Blog</title>
	
	<link>http://www.studiosedition.com</link>
	<description>A full-service web design and software development studio specializing in the fusion of form and function.</description>
	<lastBuildDate>Thu, 19 Jan 2012 00:34:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/krishadlocksblog" /><feedburner:info uri="krishadlocksblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>krishadlocksblog</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Sending mail to an SMTP server with authentication using JavaMail</title>
		<link>http://feedproxy.google.com/~r/krishadlocksblog/~3/yalGH6HYa3s/</link>
		<comments>http://www.studiosedition.com/labs/javamail-smtp-with-authentication/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 23:14:37 +0000</pubDate>
		<dc:creator>hansengel</dc:creator>
				<category><![CDATA[Labs]]></category>

		<guid isPermaLink="false">http://www.studiosedition.com/?p=940</guid>
		<description>Many SMTP servers use an authentication system as an extra layer of security in their mail transport. If you need to send email to such a server with JavaMail, the library provides a convenient abstraction of the process. First, create an anonymous inner class that implements javax.mail.Authenticator and contains the password authentication information:



Next, create instances of [...]</description>
			<content:encoded><![CDATA[Many SMTP servers use an <a href="http://en.wikipedia.org/wiki/SMTP_Authentication">authentication system</a> as an extra layer of security in their mail transport. If you need to send email to such a server with JavaMail, the library provides a convenient abstraction of the process.<span id="more-940"></span> First, create an anonymous inner class that implements <code><a href="http://download.oracle.com/javaee/6/api/javax/mail/Authenticator.html" target="_blank">javax.mail.Authenticator</a></code> and contains the password authentication information:

<div id="gist-1114931" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="n">Authenticator</span> <span class="n">authenticator</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Authenticator</span><span class="o">()</span> <span class="o">{</span></div><div class='line' id='LC2'>	<span class="kd">private</span> <span class="n">PasswordAuthentication</span> <span class="n">authentication</span><span class="o">;</span></div><div class='line' id='LC3'><br/></div><div class='line' id='LC4'>	<span class="o">{</span></div><div class='line' id='LC5'>		<span class="n">authentication</span> <span class="o">=</span> <span class="k">new</span> <span class="n">PasswordAuthentication</span><span class="o">(</span><span class="s">&quot;username&quot;</span><span class="o">,</span> <span class="s">&quot;password&quot;</span><span class="o">);</span></div><div class='line' id='LC6'>	<span class="o">}</span></div><div class='line' id='LC7'><br/></div><div class='line' id='LC8'>	<span class="kd">protected</span> <span class="n">PasswordAuthentication</span> <span class="nf">getPasswordAuthentication</span><span class="o">()</span> <span class="o">{</span></div><div class='line' id='LC9'>		<span class="k">return</span> <span class="n">authentication</span><span class="o">;</span></div><div class='line' id='LC10'>	<span class="o">}</span></div><div class='line' id='LC11'><span class="o">};</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1114931/b24e144c7a3f90e878cd384c18ec6b173dfcb3cb/Part_1-Authenticator.java" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1114931#file_part_1_authenticator.java" style="float:right;margin-right:10px;color:#666">Part_1-Authenticator.java</a>
            <a href="https://gist.github.com/1114931">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>


Next, create instances of <code><a href="http://download.oracle.com/javase/6/docs/api/java/util/Properties.html" target="_blank">java.util.Properties</a></code> and <code><a href="http://download.oracle.com/javaee/6/api/javax/mail/Session.html" target="_blank">javax.mail.Session</a></code> that will be used to build the message transport. The important differences from JavaMail usage here are the extra <code>auth</code> property and the passing of the <code>authenticator</code> object to the mail session. (Note that all values of the <code>Properties</code> instance are strings — this is required by the class. Booleans, integers, et cetera should be passed as strings to this object.)

<div id="gist-1114931" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="n">Properties</span> <span class="n">props</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Properties</span><span class="o">();</span></div><div class='line' id='LC2'><span class="n">props</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;mail.transport.protocol&quot;</span><span class="o">,</span> <span class="s">&quot;smtp&quot;</span><span class="o">);</span></div><div class='line' id='LC3'><span class="n">props</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;mail.smtp.host&quot;</span><span class="o">,</span> <span class="s">&quot;smtp.somewhere.com&quot;</span><span class="o">);</span></div><div class='line' id='LC4'><span class="n">props</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;mail.smtp.port&quot;</span><span class="o">,</span> <span class="s">&quot;587&quot;</span><span class="o">);</span></div><div class='line' id='LC5'><span class="n">props</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;mail.smtp.auth&quot;</span><span class="o">,</span> <span class="s">&quot;true&quot;</span><span class="o">);</span></div><div class='line' id='LC6'><br/></div><div class='line' id='LC7'><span class="n">Session</span> <span class="n">session</span> <span class="o">=</span> <span class="n">Session</span><span class="o">.</span><span class="na">getDefaultInstance</span><span class="o">(</span><span class="n">props</span><span class="o">,</span> <span class="n">authenticator</span><span class="o">);</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1114931/35a35d8ccea21a535e6b9b759c7ab17805c4096d/Part_2-Properties_and_Session.java" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1114931#file_part_2_properties_and_session.java" style="float:right;margin-right:10px;color:#666">Part_2-Properties_and_Session.java</a>
            <a href="https://gist.github.com/1114931">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>


Now that our <code>Session</code> is prepared, we can send the message as normal. The authentication model is carried within the mail session, so each message can take it in and reuse its information.

<div id="gist-1114931" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="n">Message</span> <span class="n">message</span> <span class="o">=</span> <span class="k">new</span> <span class="n">MimeMessage</span><span class="o">(</span><span class="n">session</span><span class="o">);</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'><span class="n">message</span><span class="o">.</span><span class="na">setFrom</span><span class="o">(</span><span class="k">new</span> <span class="n">InternetAddress</span><span class="o">(</span><span class="s">&quot;from@somewhere.com&quot;</span><span class="o">));</span></div><div class='line' id='LC4'><span class="n">message</span><span class="o">.</span><span class="na">addRecipient</span><span class="o">(</span><span class="n">RecipientType</span><span class="o">.</span><span class="na">TO</span><span class="o">,</span> <span class="k">new</span> <span class="n">InternetAddress</span><span class="o">(</span><span class="s">&quot;john@doe.com&quot;</span><span class="o">));</span></div><div class='line' id='LC5'><br/></div><div class='line' id='LC6'><span class="n">message</span><span class="o">.</span><span class="na">setSubject</span><span class="o">(</span><span class="s">&quot;Hello world!&quot;</span><span class="o">);</span></div><div class='line' id='LC7'><span class="n">message</span><span class="o">.</span><span class="na">setContent</span><span class="o">(</span><span class="s">&quot;Sent via an SMTP server with authentication.&quot;</span><span class="o">,</span> <span class="s">&quot;text/plain&quot;</span><span class="o">);</span></div><div class='line' id='LC8'><br/></div><div class='line' id='LC9'><span class="n">Transport</span><span class="o">.</span><span class="na">send</span><span class="o">(</span><span class="n">message</span><span class="o">);</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1114931/fbce5a83c65c39c205fc0776d2bbe4eeffda6d0c/Part_3-Sending.java" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1114931#file_part_3_sending.java" style="float:right;margin-right:10px;color:#666">Part_3-Sending.java</a>
            <a href="https://gist.github.com/1114931">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>


That&#8217;s it! When put together, this code successfully sends mail messages to SMTP servers with authentication. A test can be found below.

<div id="gist-1114931" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="kn">import</span> <span class="nn">java.util.Properties</span><span class="o">;</span></div><div class='line' id='LC2'><span class="kn">import</span> <span class="nn">javax.mail.Authenticator</span><span class="o">;</span></div><div class='line' id='LC3'><span class="kn">import</span> <span class="nn">javax.mail.Message</span><span class="o">;</span></div><div class='line' id='LC4'><span class="kn">import</span> <span class="nn">javax.mail.MessagingException</span><span class="o">;</span></div><div class='line' id='LC5'><span class="kn">import</span> <span class="nn">javax.mail.PasswordAuthentication</span><span class="o">;</span></div><div class='line' id='LC6'><span class="kn">import</span> <span class="nn">javax.mail.Session</span><span class="o">;</span></div><div class='line' id='LC7'><span class="kn">import</span> <span class="nn">javax.mail.Transport</span><span class="o">;</span></div><div class='line' id='LC8'><span class="kn">import</span> <span class="nn">javax.mail.internet.InternetAddress</span><span class="o">;</span></div><div class='line' id='LC9'><span class="kn">import</span> <span class="nn">javax.mail.internet.MimeMessage</span><span class="o">;</span></div><div class='line' id='LC10'><span class="kn">import</span> <span class="nn">javax.mail.internet.MimeMessage.RecipientType</span><span class="o">;</span></div><div class='line' id='LC11'><br/></div><div class='line' id='LC12'><span class="kd">public</span> <span class="kd">class</span> <span class="nc">SMTPAuthEmail</span> <span class="o">{</span></div><div class='line' id='LC13'>	<span class="kd">private</span> <span class="n">Session</span> <span class="n">session</span><span class="o">;</span></div><div class='line' id='LC14'><br/></div><div class='line' id='LC15'>	<span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">MessagingException</span> <span class="o">{</span></div><div class='line' id='LC16'>		<span class="k">new</span> <span class="nf">SMTPAuthEmail</span><span class="o">().</span><span class="na">send</span><span class="o">();</span></div><div class='line' id='LC17'>	<span class="o">}</span></div><div class='line' id='LC18'><br/></div><div class='line' id='LC19'>	<span class="kd">public</span> <span class="nf">SMTPAuthEmail</span><span class="o">()</span> <span class="o">{</span></div><div class='line' id='LC20'>		<span class="n">Authenticator</span> <span class="n">authenticator</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Authenticator</span><span class="o">()</span> <span class="o">{</span></div><div class='line' id='LC21'>			<span class="kd">private</span> <span class="n">PasswordAuthentication</span> <span class="n">authentication</span><span class="o">;</span></div><div class='line' id='LC22'><br/></div><div class='line' id='LC23'>			<span class="o">{</span></div><div class='line' id='LC24'>				<span class="n">authentication</span> <span class="o">=</span> <span class="k">new</span> <span class="n">PasswordAuthentication</span><span class="o">(</span><span class="s">&quot;username&quot;</span><span class="o">,</span> <span class="s">&quot;password&quot;</span><span class="o">);</span></div><div class='line' id='LC25'>			<span class="o">}</span></div><div class='line' id='LC26'><br/></div><div class='line' id='LC27'>			<span class="kd">protected</span> <span class="n">PasswordAuthentication</span> <span class="nf">getPasswordAuthentication</span><span class="o">()</span> <span class="o">{</span></div><div class='line' id='LC28'>				<span class="k">return</span> <span class="n">authentication</span><span class="o">;</span></div><div class='line' id='LC29'>			<span class="o">}</span></div><div class='line' id='LC30'>		<span class="o">};</span></div><div class='line' id='LC31'><br/></div><div class='line' id='LC32'>		<span class="n">Properties</span> <span class="n">props</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Properties</span><span class="o">();</span></div><div class='line' id='LC33'>		<span class="n">props</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;mail.transport.protocol&quot;</span><span class="o">,</span> <span class="s">&quot;smtp&quot;</span><span class="o">);</span></div><div class='line' id='LC34'>		<span class="n">props</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;mail.smtp.host&quot;</span><span class="o">,</span> <span class="s">&quot;smtp.somewhere.com&quot;</span><span class="o">);</span></div><div class='line' id='LC35'>		<span class="n">props</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;mail.smtp.port&quot;</span><span class="o">,</span> <span class="s">&quot;587&quot;</span><span class="o">);</span></div><div class='line' id='LC36'>		<span class="n">props</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;mail.smtp.auth&quot;</span><span class="o">,</span> <span class="s">&quot;true&quot;</span><span class="o">);</span></div><div class='line' id='LC37'><br/></div><div class='line' id='LC38'>		<span class="n">session</span> <span class="o">=</span> <span class="n">Session</span><span class="o">.</span><span class="na">getDefaultInstance</span><span class="o">(</span><span class="n">props</span><span class="o">,</span> <span class="n">authenticator</span><span class="o">);</span></div><div class='line' id='LC39'>	<span class="o">}</span></div><div class='line' id='LC40'><br/></div><div class='line' id='LC41'>	<span class="kd">private</span> <span class="kt">void</span> <span class="nf">send</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">MessagingException</span> <span class="o">{</span></div><div class='line' id='LC42'>		<span class="n">Message</span> <span class="n">message</span> <span class="o">=</span> <span class="k">new</span> <span class="n">MimeMessage</span><span class="o">(</span><span class="n">session</span><span class="o">);</span></div><div class='line' id='LC43'><br/></div><div class='line' id='LC44'>		<span class="n">message</span><span class="o">.</span><span class="na">setFrom</span><span class="o">(</span><span class="k">new</span> <span class="n">InternetAddress</span><span class="o">(</span><span class="s">&quot;from@somewhere.com&quot;</span><span class="o">));</span></div><div class='line' id='LC45'>		<span class="n">message</span><span class="o">.</span><span class="na">addRecipient</span><span class="o">(</span><span class="n">RecipientType</span><span class="o">.</span><span class="na">TO</span><span class="o">,</span> <span class="k">new</span> <span class="n">InternetAddress</span><span class="o">(</span><span class="s">&quot;john@doe.com&quot;</span><span class="o">));</span></div><div class='line' id='LC46'><br/></div><div class='line' id='LC47'>		<span class="n">message</span><span class="o">.</span><span class="na">setSubject</span><span class="o">(</span><span class="s">&quot;Hello world!&quot;</span><span class="o">);</span></div><div class='line' id='LC48'>		<span class="n">message</span><span class="o">.</span><span class="na">setContent</span><span class="o">(</span><span class="s">&quot;Sent via an SMTP server with authentication.&quot;</span><span class="o">,</span> <span class="s">&quot;text/plain&quot;</span><span class="o">);</span></div><div class='line' id='LC49'><br/></div><div class='line' id='LC50'>		<span class="n">Transport</span><span class="o">.</span><span class="na">send</span><span class="o">(</span><span class="n">message</span><span class="o">);</span></div><div class='line' id='LC51'>	<span class="o">}</span></div><div class='line' id='LC52'><span class="o">}</span></div><div class='line' id='LC53'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1114931/b1e58e909446ada40829b50bdd23b77d78422a73/JavaMail_SMTP_with_authentication.java" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1114931#file_java_mail_smtp_with_authentication.java" style="float:right;margin-right:10px;color:#666">JavaMail_SMTP_with_authentication.java</a>
            <a href="https://gist.github.com/1114931">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p><a href="http://feedads.g.doubleclick.net/~a/ngpSnBeF1YrR9TMpTg_mB4s--j0/0/da"><img src="http://feedads.g.doubleclick.net/~a/ngpSnBeF1YrR9TMpTg_mB4s--j0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ngpSnBeF1YrR9TMpTg_mB4s--j0/1/da"><img src="http://feedads.g.doubleclick.net/~a/ngpSnBeF1YrR9TMpTg_mB4s--j0/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/krishadlocksblog/~4/yalGH6HYa3s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.studiosedition.com/labs/javamail-smtp-with-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.studiosedition.com/labs/javamail-smtp-with-authentication/</feedburner:origLink></item>
		<item>
		<title>Getting started with Node.js: writing a simple “Hello World” application</title>
		<link>http://feedproxy.google.com/~r/krishadlocksblog/~3/V2WE1AfBV7k/</link>
		<comments>http://www.studiosedition.com/labs/getting-started-with-node-js-writing-a-simple-hello-world-application/#comments</comments>
		<pubDate>Sat, 19 Mar 2011 22:37:04 +0000</pubDate>
		<dc:creator>jgauthier</dc:creator>
				<category><![CDATA[Labs]]></category>

		<guid isPermaLink="false">http://www.studiosedition.com/?p=890</guid>
		<description>Node.js is an exciting, multi-platform framework built around the JavaScript programming language which has been gaining support by developers over the past few months. In this article, I&amp;#8217;ll give a summary of why this platform is so attractive to a growing number of programmers, and guide you through a brief example application.



A chat application (Now.js [...]</description>
			<content:encoded><![CDATA[<strong>Node.js</strong> is an exciting, multi-platform framework built around the <a title="Wikipedia article for JavaScript" href="http://en.wikipedia.org/wiki/JavaScript">JavaScript</a> programming language which has been gaining support by developers over the past few months. In this article, I&#8217;ll give a summary of why this platform is so attractive to a growing number of programmers, and guide you through a brief example application.

<span id="more-890"></span>
<div class="alignright" style="width: 260px; text-align: center;"><iframe src="http://player.vimeo.com/video/20936525" width="260" height="213" frameborder="0"></iframe>
<strong>A chat application (Now.js + Node.js) — 12 lines of code</strong></div>
More and more developers are choosing to build their server-side applications in Node.js / JavaScript. Here are a few very good reasons why you should give Node.js a chance.
<ul>
	<li><strong>It&#8217;s unbelievably fast.</strong> Built around Google&#8217;s <a href="http://code.google.com/p/v8/">V8 JavaScript Engine</a>, Node scripts manage to blow scripts of pretty much every other interpreted language out of the water. Check out some benchmarks to see what I mean: JavaScript V8 <a href="http://shootout.alioth.debian.org/u32/benchmark.php?test=all&amp;lang=v8&amp;lang2=php#faster-programs-measurements">versus PHP</a>, <a href="http://shootout.alioth.debian.org/u32/benchmark.php?test=all&amp;lang=v8&amp;lang2=yarv#faster-programs-measurements">vs. Ruby</a>, <a href="http://shootout.alioth.debian.org/u32/benchmark.php?test=all&amp;lang=v8&amp;lang2=php#faster-programs-measurements">vs. Python</a>, and <a href="http://shootout.alioth.debian.org/u32/benchmark.php?test=all&amp;lang=v8&amp;lang2=perl#faster-programs-measurements">vs. Perl</a>.</li>
	<li><strong>The core code is designed to run asynchronously / in parallel.</strong> Most, if not all, of the Node.js standard library can be used asynchronously. This means that all sorts of operations — file reads and writes, database queries and updates, et cetera — can run in parallel, independent of each other. Node.js, therefore, is extremely capable when low response times and high concurrency are necessary.</li>
	<li><strong>The back-end language matches the front-end language.</strong> Node.js sites are able to use the JavaScript language in both the front-end and the back-end. This feature has led to all sorts of interesting inventions. For example, I recently discovered <a href="http://nowjs.com/">Now.js</a>, a library which allows code running in the browser to directly call functions defined in the server code, without any explicit AJAX or JSON requests. I recommend you check out the <a href="http://nowjs.com/">Now.js site</a> and see for yourself the power of this feature of Node.js.</li>
</ul>
Okay, let&#8217;s get started with a short demonstration of a Node.js server. To demonstrate some of the language features, we&#8217;ll establish several goals:
<ul>
	<li><strong>Respond to HTTP requests.</strong> Obviously, since this is a server, right?</li>
	<li><strong>Send HTTP headers in responses.</strong> This is necessary to have the client&#8217;s browser parse and display our response correctly.</li>
	<li><strong>Serve a file in the HTTP response.</strong> This will demonstrate Node.js&#8217;s asynchronous I/O design.</li>
</ul>
We&#8217;ll start by using the <em>require</em> method to import some necessary libraries:
<ul>
	<li><strong>fs</strong> (filesystem), which allows us to perform basic asynchronous file I/O operations</li>
	<li><strong>http</strong>, which establishes a basic HTTP server</li>
</ul>
<div id="gist-877867" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="kd">var</span> <span class="nx">fs</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;fs&#39;</span><span class="p">);</span></div><div class='line' id='LC2'><span class="kd">var</span> <span class="nx">http</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;http&#39;</span><span class="p">);</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/877867/d7171302d1bf73453b3d3319d62408d4df433c4f/server_1.js" style="float:right;">view raw</a>
            <a href="https://gist.github.com/877867#file_server_1.js" style="float:right;margin-right:10px;color:#666">server_1.js</a>
            <a href="https://gist.github.com/877867">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>


Simple, right? This is basically the same as requires / imports in common high-level languages like Python and Ruby. The principal difference is the assignment that occurs in each of these statements. To put it simply, importing each module like so keeps all of its contents in a namespace of sorts. By placing all of the <strong>fs</strong> module&#8217;s attributes and methods inside a variable called <em>fs</em>, we can be certain that nothing in the global scope will be overwritten. For example, if we included two modules which had classes with the same names, they would not overwrite each other, as they would be stored inside different variables. For this reason, modules are imported into local variables rather than into the global scope.

Phew! After that lengthy explanation, it&#8217;s time to get to the meat of our little web app here.

<div id="gist-877867" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="kd">var</span> <span class="nx">fs</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;fs&#39;</span><span class="p">);</span></div><div class='line' id='LC2'><span class="kd">var</span> <span class="nx">http</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;http&#39;</span><span class="p">);</span></div><div class='line' id='LC3'><br/></div><div class='line' id='LC4'><span class="nx">http</span><span class="p">.</span><span class="nx">createServer</span><span class="p">(</span> <span class="kd">function</span><span class="p">(</span><span class="nx">request</span><span class="p">,</span> <span class="nx">response</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">// do something here</span></div><div class='line' id='LC6'><span class="p">}).</span><span class="nx">listen</span><span class="p">(</span><span class="mi">8080</span><span class="p">,</span> <span class="s1">&#39;127.0.0.1&#39;</span><span class="p">);</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/877867/abb509d4423bb9a1f7ec389ace55d991e45f3914/server_2.js" style="float:right;">view raw</a>
            <a href="https://gist.github.com/877867#file_server_2.js" style="float:right;margin-right:10px;color:#666">server_2.js</a>
            <a href="https://gist.github.com/877867">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>


We&#8217;ve added a call to the <em>createServer</em> function of the <strong>http</strong> module. This simple function accepts a single parameter: a callback function which is called whenever a request to the server is received. You can see that the anonymous function we provide has two parameters: <em>request</em> and <em>response</em>.<em> </em>When the server invokes this function, the provided <em>request</em> variable will contain information about the HTTP request (headers, data, and so on), while the given <em>response</em> variable will contain several methods that we can use to reply to the HTTP request.

We then chain this <em>createServer</em> call to the <em>listen</em> method, which tells the created HTTP server to begin listening on a certain host and port — in this case, <em>127.0.0.1:8080</em>.

<div id="gist-877867" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="kd">var</span> <span class="nx">fs</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;fs&#39;</span><span class="p">);</span></div><div class='line' id='LC2'><span class="kd">var</span> <span class="nx">http</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;http&#39;</span><span class="p">);</span></div><div class='line' id='LC3'><br/></div><div class='line' id='LC4'><span class="nx">http</span><span class="p">.</span><span class="nx">createServer</span><span class="p">(</span> <span class="kd">function</span><span class="p">(</span><span class="nx">request</span><span class="p">,</span> <span class="nx">response</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">response</span><span class="p">.</span><span class="nx">writeHead</span><span class="p">(</span><span class="mi">200</span><span class="p">,</span> <span class="p">{</span><span class="s1">&#39;Content-Type&#39;</span><span class="o">:</span> <span class="s1">&#39;text/plain&#39;</span><span class="p">});</span></div><div class='line' id='LC6'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">response</span><span class="p">.</span><span class="nx">end</span><span class="p">(</span><span class="s1">&#39;Hello world!&#39;</span><span class="p">);</span></div><div class='line' id='LC7'><span class="p">}).</span><span class="nx">listen</span><span class="p">(</span><span class="mi">8080</span><span class="p">,</span> <span class="s1">&#39;127.0.0.1&#39;</span><span class="p">);</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/877867/3f41cb418d11dfc436fe881f3c29decb290a1d39/server_3.js" style="float:right;">view raw</a>
            <a href="https://gist.github.com/877867#file_server_3.js" style="float:right;margin-right:10px;color:#666">server_3.js</a>
            <a href="https://gist.github.com/877867">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>


We now have added some basic calls to the <em>response</em> object. In short:
<ul>
	<li><em>writeHead</em> begins the HTTP response to the client by sending a <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> code, along with a <em>Content-Type</em> header that lets the client know that we&#8217;ll be sending plain text as a response.</li>
	<li><em>end</em> sends any last data, closes the response, lets the server know that we&#8217;re all done here.</li>
</ul>
Okay, this is good stuff, but let&#8217;s push things a little further by returning the contents of a file rather than a simple static string.

<div id="gist-877867" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="kd">var</span> <span class="nx">fs</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;fs&#39;</span><span class="p">);</span></div><div class='line' id='LC2'><span class="kd">var</span> <span class="nx">http</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;http&#39;</span><span class="p">);</span></div><div class='line' id='LC3'><br/></div><div class='line' id='LC4'><span class="nx">http</span><span class="p">.</span><span class="nx">createServer</span><span class="p">(</span> <span class="kd">function</span><span class="p">(</span><span class="nx">request</span><span class="p">,</span> <span class="nx">response</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">fs</span><span class="p">.</span><span class="nx">readFile</span><span class="p">(</span><span class="s1">&#39;./response.txt&#39;</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">data</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC6'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span> <span class="nx">err</span> <span class="p">)</span> <span class="k">throw</span> <span class="nx">err</span><span class="p">;</span></div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">response</span><span class="p">.</span><span class="nx">writeHead</span><span class="p">(</span><span class="mi">200</span><span class="p">,</span> <span class="p">{</span><span class="s1">&#39;Content-Type&#39;</span><span class="o">:</span> <span class="s1">&#39;text/plain&#39;</span><span class="p">});</span></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">response</span><span class="p">.</span><span class="nx">end</span><span class="p">(</span><span class="nx">data</span><span class="p">.</span><span class="nx">toString</span><span class="p">());</span></div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">});</span></div><div class='line' id='LC11'><span class="p">}).</span><span class="nx">listen</span><span class="p">(</span><span class="mi">8080</span><span class="p">,</span> <span class="s1">&#39;127.0.0.1&#39;</span><span class="p">);</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/877867/430f99c0b67d82a30eb1082c28c31df8bee9a309/server_4.js" style="float:right;">view raw</a>
            <a href="https://gist.github.com/877867#file_server_4.js" style="float:right;margin-right:10px;color:#666">server_4.js</a>
            <a href="https://gist.github.com/877867">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>


Now we have the previous response code enclosed inside a second callback function. This function is provided to <strong>fs</strong>&#8216;s <em>readFile</em> method, which reads a given file asynchronously and calls the provided function when it&#8217;s finished. Notice that the anonymous function here accepts two parameters here: <em>err</em>, which we throw if it is defined, and <em>data</em>, which contains the raw file contents. All that changed in the response code was in the <em>write</em> call: we now provide the file data (converted to a string) as the response instead of a static string.

That&#8217;s it! As long as we have a file named <em>response.txt</em> in the same file as our server JavaScript, this will work perfectly.

Want to try this out? Here are the steps:
<ul>
	<li><strong>Download <a href="http://nodejs.org/">Node.js</a></strong> (not currently available for Windows)</li>
	<li><strong>Prepare a directory for the necessary files.</strong></li>
	<li><strong>Create the files.</strong> Use the final server code from above and place it in a JavaScript file. Name it whatever you&#8217;d like — <em>server.js</em>, maybe? Create a file called <em>response.txt</em> in the same directory as the server script, and put some text in it, like &#8220;Hello world from a text file!&#8221;</li>
	<li><strong>Launch the server in your terminal.</strong> Change to the directory you created and run <em>node server.js</em>
(Change &#8220;server.js&#8221; to the name you used for your server code.)</li>
	<li><strong>Try it out!</strong> Visit <a href="http://127.0.0.1:8080">127.0.0.1:8080</a> in a web browser and you should see the contents of the <em>response.txt</em> file you created appear on the page.</li>
</ul>
I hope you enjoyed and learned something from this introduction to Node.js. I understand that 99% of web applications are not this simple, and we will be creating tutorials in the near future that will cover more complicated tasks, such as URL routing and database access. Please subscribe to the Labs blog to receive updates about our future Node.js tutorials. Leave a comment below as well if you&#8217;d like to let us know what you think about this article!
<p><a href="http://feedads.g.doubleclick.net/~a/AQ8BFSsM_Xe2ZVbfjZFQA2Udk3g/0/da"><img src="http://feedads.g.doubleclick.net/~a/AQ8BFSsM_Xe2ZVbfjZFQA2Udk3g/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/AQ8BFSsM_Xe2ZVbfjZFQA2Udk3g/1/da"><img src="http://feedads.g.doubleclick.net/~a/AQ8BFSsM_Xe2ZVbfjZFQA2Udk3g/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/krishadlocksblog/~4/V2WE1AfBV7k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.studiosedition.com/labs/getting-started-with-node-js-writing-a-simple-hello-world-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.studiosedition.com/labs/getting-started-with-node-js-writing-a-simple-hello-world-application/</feedburner:origLink></item>
		<item>
		<title>How to access query string arguments with AS3</title>
		<link>http://feedproxy.google.com/~r/krishadlocksblog/~3/AhB7YJethoY/</link>
		<comments>http://www.studiosedition.com/actionscript/query-string-as3/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 11:49:40 +0000</pubDate>
		<dc:creator>khadlock</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://blog.studiosedition.com/?p=130</guid>
		<description>Found a great blog post with an ActionScript 2 class that parses the current URL and creates accessible properties out of query string arguments: http://blog.circlecube.com/2008/03/20/get-current-url-and-query-string-parameters-to-flash-tutorial/

I needed something to parse any URL, so I made a few adjustments and converted the class to AS3. Here&amp;#8217;s the updated code:
package
{
	import flash.external.*;

	public class QueryString
	{
		private var _queryString:String;
		private var _all:String;
		private var [...]</description>
			<content:encoded><![CDATA[Found a great blog post with an ActionScript 2 class that parses the current URL and creates accessible properties out of query string arguments: <a href="http://blog.circlecube.com/2008/03/tutorial/get-current-url-and-query-string-parameters-to-flash-tutorial/trackback/" target="_blank">http://blog.circlecube.com/2008/03/20/get-current-url-and-query-string-parameters-to-flash-tutorial/</a>

I needed something to parse any URL, so I made a few adjustments and converted the class to AS3. Here&#8217;s the updated code:
<pre lang="actionscript">package
{
	import flash.external.*;

	public class QueryString
	{
		private var _queryString:String;
		private var _all:String;
		private var _params:Object;

		public function QueryString(url:String='')
		{
			readQueryString(url);
		}
		public function get getQueryString():String
		{
			return _queryString;
		}
		public function get url():String
		{
			return _all;
		}
		public function get parameters():Object
		{
			return _params;
		}

		private function readQueryString(url:String=''):void
		{
			_params = new Object();
			try
			{
				_all = (url.length > 0) ? url : ExternalInterface.call("window.location.href.toString");
				_queryString = (url.length > 0) ? url.split("?")[1] : ExternalInterface.call("window.location.search.substring", 1);
				if(_queryString)
				{
					var allParams:Array = _queryString.split('&#038;');
					//var length:uint = params.length;

					for(var i:int=0, index=-1; i < allParams.length; i++)
					{
						var keyValuePair:String = allParams[i];
						if((index = keyValuePair.indexOf("=")) > 0)
						{
							var paramKey:String = keyValuePair.substring(0,index);
							var paramValue:String = keyValuePair.substring(index+1);
							_params[paramKey] = paramValue;
						}
					}
				}
			}
			catch(e:Error)
			{
				trace("Some error occured. ExternalInterface doesn't work in Standalone player.");
			}
		}
	}
}</pre>

Here&#8217;s an example of how to use the updated version:
<pre lang="actionscript">
var myPath:QueryString = new QueryString("http://www.studiosedition.com/?page=articles");
trace(myPath.parameters.page);
</pre>

It&#8217;s as simple as passing a URL with a query string and then just use the parameters object to access the specific query argument, in this case we&#8217;re accessing the page argument, which will give us a value of &#8220;articles&#8221;.
<p><a href="http://feedads.g.doubleclick.net/~a/9DP36aGxsUjCpigbnpGB4EpZEzM/0/da"><img src="http://feedads.g.doubleclick.net/~a/9DP36aGxsUjCpigbnpGB4EpZEzM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/9DP36aGxsUjCpigbnpGB4EpZEzM/1/da"><img src="http://feedads.g.doubleclick.net/~a/9DP36aGxsUjCpigbnpGB4EpZEzM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/krishadlocksblog/~4/AhB7YJethoY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.studiosedition.com/actionscript/query-string-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.studiosedition.com/actionscript/query-string-as3/</feedburner:origLink></item>
		<item>
		<title>How to convert audio to mp3 with iTunes</title>
		<link>http://feedproxy.google.com/~r/krishadlocksblog/~3/2Xe57H7REx4/</link>
		<comments>http://www.studiosedition.com/audio/convert-mp3-itunes/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 23:11:24 +0000</pubDate>
		<dc:creator>khadlock</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[mp3]]></category>

		<guid isPermaLink="false">http://blog.studiosedition.com/?p=120</guid>
		<description>I know mp3 conversion has been possible in iTunes forever, but I never needed it until today and I figured others may find it useful. If you need to convert an audio file to an mp3 you can use iTunes by following these steps:

	Open &amp;#8220;Preferences&amp;#8220;, click &amp;#8220;Import Settings&amp;#8230;&amp;#8221; and choose &amp;#8220;MP3 encoder&amp;#8221; as the Import [...]</description>
			<content:encoded><![CDATA[I know mp3 conversion has been possible in iTunes forever, but I never needed it until today and I figured others may find it useful. If you need to convert an audio file to an mp3 you can use iTunes by following these steps:
<ol>
	<li>Open &#8220;<strong>Preferences</strong>&#8220;, click &#8220;<strong>Import Settings&#8230;</strong>&#8221; and choose &#8220;<strong>MP3 encoder</strong>&#8221; as the Import Format.</li>
	<li>Now you can right-click on any of the songs in your library and choose &#8220;<strong>Create MP3 Version</strong>&#8220;.</li>
</ol>
<img class="alignnone size-full wp-image-122" title="itunes-mp3" src="http://www.studiosedition.com/wp-content/uploads/2010/02/itunes-mp3.png" alt="itunes-mp3" width="510" height="272" />

[ad#GoogleAdsenseTextLinks]
<p><a href="http://feedads.g.doubleclick.net/~a/yXHKhuMS59tlPuUpZ2OS8R-LJfo/0/da"><img src="http://feedads.g.doubleclick.net/~a/yXHKhuMS59tlPuUpZ2OS8R-LJfo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/yXHKhuMS59tlPuUpZ2OS8R-LJfo/1/da"><img src="http://feedads.g.doubleclick.net/~a/yXHKhuMS59tlPuUpZ2OS8R-LJfo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/krishadlocksblog/~4/2Xe57H7REx4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.studiosedition.com/audio/convert-mp3-itunes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.studiosedition.com/audio/convert-mp3-itunes/</feedburner:origLink></item>
		<item>
		<title>OVO Creative Group launched their new web site</title>
		<link>http://feedproxy.google.com/~r/krishadlocksblog/~3/i4skhjgbz28/</link>
		<comments>http://www.studiosedition.com/javascript/ovo-creative-group-launch/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 01:22:35 +0000</pubDate>
		<dc:creator>khadlock</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[JSON]]></category>

		<guid isPermaLink="false">http://blog.studiosedition.com/?p=116</guid>
		<description>OVO is a branding consultancy specializing in naming, visual identity and integrated marketing for organizations seeking to launch, grow or reinvent themselves. We developed OVO&amp;#8217;s web site based on their original designs. Using PHP and MySQL we created a content management system (CMS) for OVO to manage their client projects and organize their project slideshows. [...]</description>
			<content:encoded><![CDATA[OVO is a branding consultancy specializing in naming, visual identity and integrated marketing for organizations seeking to launch, grow or reinvent themselves. We developed OVO&#8217;s web site based on their original designs. Using PHP and MySQL we created a content management system (CMS) for OVO to manage their client projects and organize their project slideshows. We also developed a custom JavaScript slideshow widget that randomizes and animates OVO&#8217;s projects based on a custom JSON feed. <a href="http://www.studiosedition.com/application/OVO-Creative">Read more&#8230;</a>
<p><a href="http://feedads.g.doubleclick.net/~a/7IMdIjf8fjLV2mFi_Uu5exZX20o/0/da"><img src="http://feedads.g.doubleclick.net/~a/7IMdIjf8fjLV2mFi_Uu5exZX20o/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/7IMdIjf8fjLV2mFi_Uu5exZX20o/1/da"><img src="http://feedads.g.doubleclick.net/~a/7IMdIjf8fjLV2mFi_Uu5exZX20o/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/krishadlocksblog/~4/i4skhjgbz28" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.studiosedition.com/javascript/ovo-creative-group-launch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.studiosedition.com/javascript/ovo-creative-group-launch/</feedburner:origLink></item>
		<item>
		<title>The One Less Flight website has been released</title>
		<link>http://feedproxy.google.com/~r/krishadlocksblog/~3/4wBVQ8xp9WU/</link>
		<comments>http://www.studiosedition.com/graphic-design/one-less-flight-release/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 12:24:07 +0000</pubDate>
		<dc:creator>khadlock</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Graphic Design]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[refback]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blog.studiosedition.com/?p=113</guid>
		<description>Miskeeto, a world-class user experience strategy and evaluation consultancy led by Robert Hoekman, Jr. recently released the web site One Less Flight (OLF). We designed and developed OLF based on Robert&amp;#8217;s concept of getting companies and individuals to commit to reducing carbon emissions by taking one less flight each year. The concept was to offer [...]</description>
			<content:encoded><![CDATA[<a href="http://miskeeto.com">Miskeeto</a>, a world-class user experience strategy and evaluation consultancy led by <a href="http://rhjr.net">Robert Hoekman, Jr.</a> recently released the web site One Less Flight (OLF). We designed and developed OLF based on Robert&#8217;s concept of getting companies and individuals to commit to reducing carbon emissions by taking one less flight each year. The concept was to offer badges/banners for people to put on their web site to show their commitment to the cause. By adding the badge to a web site the domain of that web site would appear on the OLF web site to feature the commitment.

I looked into a few ways of making the domain addition work; trackbacks, pingbacks and refbacks. I ended up choosing refbacks because pingbacks and trackbacks are limited to working only with other trackback-enabled or pingback-enabled web sites, which essentially limited the site to working with other blogs. On the other hand, the refback method allows anyone to use a  badge on their site and automatically appear on OLF regardless of how their site is set up.

The custom refback method works through the actual image request. The image request goes through php, which does the following:
<ol>
	<li>It verifies that the domain has not already been added to a list of linked domains.</li>
	<li>It adds it to the list if it does not already exist.</li>
	<li>It then returns the image based on the banner requested.</li>
	<li>When someone comes to OLF the list is read and the domains are displayed.</li>
</ol>
Here&#8217;s the result: <a href="http://www.onelessflight.org">One Less Flight</a>

Special thanks to <a href="http://www.w3conversions.com">Stephanie Sullivan</a> for her beautiful CSS coding of my original design!

[ad#GoogleAdsenseTextLinks]
<p><a href="http://feedads.g.doubleclick.net/~a/RcPVc3T0-PvvMXd3uWoUSzYfOEQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/RcPVc3T0-PvvMXd3uWoUSzYfOEQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/RcPVc3T0-PvvMXd3uWoUSzYfOEQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/RcPVc3T0-PvvMXd3uWoUSzYfOEQ/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/krishadlocksblog/~4/4wBVQ8xp9WU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.studiosedition.com/graphic-design/one-less-flight-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.studiosedition.com/graphic-design/one-less-flight-release/</feedburner:origLink></item>
		<item>
		<title>Download any video from YouTube</title>
		<link>http://feedproxy.google.com/~r/krishadlocksblog/~3/Mnx9RzsLt5M/</link>
		<comments>http://www.studiosedition.com/video/download-youtube-video/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 14:20:30 +0000</pubDate>
		<dc:creator>khadlock</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://blog.studiosedition.com/?p=103</guid>
		<description>Found this site that lets you download any video from YouTube by simply entering the URL to the video you want to download. http://keepvid.com

[ad#GoogleAdsenseTextLinks]</description>
			<content:encoded><![CDATA[Found this site that lets you download any video from YouTube by simply entering the URL to the video you want to download. <a href="http://keepvid.com">http://keepvid.com</a>

[ad#GoogleAdsenseTextLinks]
<p><a href="http://feedads.g.doubleclick.net/~a/qIgqkvUmF66PsPxMupsVLOl06ow/0/da"><img src="http://feedads.g.doubleclick.net/~a/qIgqkvUmF66PsPxMupsVLOl06ow/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/qIgqkvUmF66PsPxMupsVLOl06ow/1/da"><img src="http://feedads.g.doubleclick.net/~a/qIgqkvUmF66PsPxMupsVLOl06ow/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/krishadlocksblog/~4/Mnx9RzsLt5M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.studiosedition.com/video/download-youtube-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.studiosedition.com/video/download-youtube-video/</feedburner:origLink></item>
		<item>
		<title>How to delay a header redirect with PHP</title>
		<link>http://feedproxy.google.com/~r/krishadlocksblog/~3/CQE6CqyrZbM/</link>
		<comments>http://www.studiosedition.com/uncategorized/delayed-header-redirects-php/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 12:27:42 +0000</pubDate>
		<dc:creator>khadlock</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.studiosedition.com/?p=92</guid>
		<description>Sometimes you need to show some page content before redirecting a page, like a successful login message, etc. Here&amp;#8217;s an easy way to delay a header redirect with PHP without using a Meta tag to refresh the page.

header("Refresh: 1; URL=http://www.studiosedition.com");</description>
			<content:encoded><![CDATA[Sometimes you need to show some page content before redirecting a page, like a successful login message, etc. Here&#8217;s an easy way to delay a header redirect with PHP without using a Meta tag to refresh the page.

<pre lang="php">header("Refresh: 1; URL=http://www.studiosedition.com");</pre>
<p><a href="http://feedads.g.doubleclick.net/~a/U2ZGdLcEOyAQh3ELa3JeyJz3n8Y/0/da"><img src="http://feedads.g.doubleclick.net/~a/U2ZGdLcEOyAQh3ELa3JeyJz3n8Y/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/U2ZGdLcEOyAQh3ELa3JeyJz3n8Y/1/da"><img src="http://feedads.g.doubleclick.net/~a/U2ZGdLcEOyAQh3ELa3JeyJz3n8Y/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/krishadlocksblog/~4/CQE6CqyrZbM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.studiosedition.com/uncategorized/delayed-header-redirects-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.studiosedition.com/uncategorized/delayed-header-redirects-php/</feedburner:origLink></item>
		<item>
		<title>403 forbidden with WordPress</title>
		<link>http://feedproxy.google.com/~r/krishadlocksblog/~3/bMeYB7iScN0/</link>
		<comments>http://www.studiosedition.com/wordpress/403-forbidden-with-wordpress/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 13:56:51 +0000</pubDate>
		<dc:creator>khadlock</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blog.studiosedition.com/?p=87</guid>
		<description>After hours of debugging a 403 forbidden error with a WordPress blog we finally found the issue. Some servers require the following line of code before the default mod_rewrite code provided by WordPress:

Options +FollowSymLinks

So your updated mod_rewrite will look similar to this:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]</description>
			<content:encoded><![CDATA[After hours of debugging a 403 forbidden error with a WordPress blog we finally found the issue. Some servers require the following line of code before the default mod_rewrite code provided by WordPress:

<pre lang="apache">Options +FollowSymLinks</pre>

So your updated mod_rewrite will look similar to this:

<pre lang="apache">Options +FollowSymLinks
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]</pre>
<p><a href="http://feedads.g.doubleclick.net/~a/hHs2Q2R7DqozrHQEOp6ZnTTVduo/0/da"><img src="http://feedads.g.doubleclick.net/~a/hHs2Q2R7DqozrHQEOp6ZnTTVduo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/hHs2Q2R7DqozrHQEOp6ZnTTVduo/1/da"><img src="http://feedads.g.doubleclick.net/~a/hHs2Q2R7DqozrHQEOp6ZnTTVduo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/krishadlocksblog/~4/bMeYB7iScN0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.studiosedition.com/wordpress/403-forbidden-with-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.studiosedition.com/wordpress/403-forbidden-with-wordpress/</feedburner:origLink></item>
		<item>
		<title>Change directory index using .htaccess</title>
		<link>http://feedproxy.google.com/~r/krishadlocksblog/~3/iVbYCt4DxrE/</link>
		<comments>http://www.studiosedition.com/uncategorized/change-directory-index-using-htaccess/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 13:50:14 +0000</pubDate>
		<dc:creator>khadlock</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[htaccess]]></category>

		<guid isPermaLink="false">http://blog.studiosedition.com/?p=85</guid>
		<description>Here&amp;#8217;s a quick way to change your directory index using htaccess:

DirectoryIndex index.html index.php</description>
			<content:encoded><![CDATA[Here&#8217;s a quick way to change your directory index using htaccess:

<pre lang="apache">DirectoryIndex index.html index.php</pre>
<p><a href="http://feedads.g.doubleclick.net/~a/aIkTjhQG-aeOgsl0kf_5HCTKrxM/0/da"><img src="http://feedads.g.doubleclick.net/~a/aIkTjhQG-aeOgsl0kf_5HCTKrxM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/aIkTjhQG-aeOgsl0kf_5HCTKrxM/1/da"><img src="http://feedads.g.doubleclick.net/~a/aIkTjhQG-aeOgsl0kf_5HCTKrxM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/krishadlocksblog/~4/iVbYCt4DxrE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.studiosedition.com/uncategorized/change-directory-index-using-htaccess/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.studiosedition.com/uncategorized/change-directory-index-using-htaccess/</feedburner:origLink></item>
	</channel>
</rss>

