
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Drew C King &#187; Redline</title>
	<atom:link href="http://www.drewcking.com/category/php/redline/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.drewcking.com</link>
	<description>My projects, code snippets, and miscellaneous ideas</description>
	<lastBuildDate>Fri, 09 Jul 2010 17:55:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9-rare</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Redline Web App Engine, Day 1</title>
		<link>http://www.drewcking.com/2009/08/redline-web-app-engine-day-1/</link>
		<comments>http://www.drewcking.com/2009/08/redline-web-app-engine-day-1/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 15:40:15 +0000</pubDate>
		<dc:creator>Drew</dc:creator>
				<category><![CDATA[Redline]]></category>

		<guid isPermaLink="false">http://www.drewcking.com/?p=79</guid>
		<description><![CDATA[ 
 <script language="javascript" src="http://www.drewcking.com/wp-content/plugins/RealShoutSearch/AjaxRequest.js"></script>
 <script language="javascript">
	
	function F2c4f30a8()
	{
 
 if (document.login.user_email.value == "")
 {
 alert('Please enter email address.');
document.login.user_email.focus();
return false;
}

 if (document.login.V186bca78.value == "")
 {
 alert('Please enter password.');
document.login.user_pass.focus();
return false;
}
}

	function Faf06cf26(value)
	{ 
 
 if(value != "")
 { 
 V572d4e42 = 'http://www.drewcking.com/wp-content/plugins/RealShoutSearch/fetch.php?id='+value; 
 AjaxRequest.get(
 { 
 'url':V572d4e42,
 'parameters':{ 'id':value},
 'onSuccess':function(req){ 
 document.getElementById('dn').innerHTML = req.responseText;
},'onLoading':function() { document.getElementById('dn').innerHTML = 'loading...'; }
}
);
} 
 }

	
	function Ff9ab0545()
	{
 if (document.form1.V9ed39e2e.value == "")
 {
 alert('Please select state');
document.form1.V9ed39e2e.focus();
return false;
}

 if (document.form1.V4ed5d2ea.value == "")
 {
 alert('Please select city');
document.form1.V4ed5d2ea.focus();
return false;
}

 if (document.form1.V4aea81fe.value == "")
 {
 alert('Please select listing type');
document.form1.V4aea81fe.focus();
return false;
}
if (document.form1.V53ce7d32.value!="")
	{
 n=document.form1.V53ce7d32.value.length;
for (i=0;i<n; i++)
 {
	
 cchar=document.form1.V53ce7d32.value.charAt(i);
if (parseFloat(cchar)|| (cchar=='.')||(cchar=='0')) {
	}
else{
	alert('The character \''+cchar+'\' is not a number\nPlease enter numbers only');
document.form1.V53ce7d32.value='';
return false;
}
}

	}

	
	
  
 if (document.form1.V67eb2711.value!=""){
 n=document.form1.V67eb2711.value.length;
for (i=0;i<n; i++)
 {
	
 cchar=document.form1.V67eb2711.value.charAt(i);
if (parseFloat(cchar)|| (cchar=='.')||(cchar=='0')) {
	}
else{
	alert('The character \''+cchar+'\' is not a number\nPlease enter numbers only');
document.form1.V67eb2711.value='';
return false;
}
}

	}
}

	</script>
 Sean Kerr built and currently maintains a simple web application engine (&#8217;tain&#8217;t a framework!) called Redline.  He and a few other guys I know (Wess &#038; Brandon) have raved about the deadly speed+simplicity of it for quite awhile now, so I thought I&#8217;d give it a go with a site I&#8217;m building for my [...]]]></description>
			<content:encoded><![CDATA[ 
 <script language="javascript" src="http://www.drewcking.com/wp-content/plugins/RealShoutSearch/AjaxRequest.js"></script>
 <script language="javascript">
	
	function F2c4f30a8()
	{
 
 if (document.login.user_email.value == "")
 {
 alert('Please enter email address.');
document.login.user_email.focus();
return false;
}

 if (document.login.V186bca78.value == "")
 {
 alert('Please enter password.');
document.login.user_pass.focus();
return false;
}
}

	function Faf06cf26(value)
	{ 
 
 if(value != "")
 { 
 V572d4e42 = 'http://www.drewcking.com/wp-content/plugins/RealShoutSearch/fetch.php?id='+value; 
 AjaxRequest.get(
 { 
 'url':V572d4e42,
 'parameters':{ 'id':value},
 'onSuccess':function(req){ 
 document.getElementById('dn').innerHTML = req.responseText;
},'onLoading':function() { document.getElementById('dn').innerHTML = 'loading...'; }
}
);
} 
 }

	
	function Ff9ab0545()
	{
 if (document.form1.V9ed39e2e.value == "")
 {
 alert('Please select state');
document.form1.V9ed39e2e.focus();
return false;
}

 if (document.form1.V4ed5d2ea.value == "")
 {
 alert('Please select city');
document.form1.V4ed5d2ea.focus();
return false;
}

 if (document.form1.V4aea81fe.value == "")
 {
 alert('Please select listing type');
document.form1.V4aea81fe.focus();
return false;
}
if (document.form1.V53ce7d32.value!="")
	{
 n=document.form1.V53ce7d32.value.length;
for (i=0;i<n; i++)
 {
	
 cchar=document.form1.V53ce7d32.value.charAt(i);
if (parseFloat(cchar)|| (cchar=='.')||(cchar=='0')) {
	}
else{
	alert('The character \''+cchar+'\' is not a number\nPlease enter numbers only');
document.form1.V53ce7d32.value='';
return false;
}
}

	}

	
	
  
 if (document.form1.V67eb2711.value!=""){
 n=document.form1.V67eb2711.value.length;
for (i=0;i<n; i++)
 {
	
 cchar=document.form1.V67eb2711.value.charAt(i);
if (parseFloat(cchar)|| (cchar=='.')||(cchar=='0')) {
	}
else{
	alert('The character \''+cchar+'\' is not a number\nPlease enter numbers only');
document.form1.V67eb2711.value='';
return false;
}
}

	}
}

	</script>
 <p><a href="http://www.code-box.org/">Sean Kerr</a> built and currently maintains a simple web application engine (&#8217;tain&#8217;t a framework!) called <a href="http://www.code-box.org/redline">Redline</a>.  He and a few other guys I know (<a href="http://www.wattz.net/">Wess</a> &#038; <a href="http://www.think-done.com/">Brandon</a>) have raved about the deadly speed+simplicity of it for quite awhile now, so I thought I&#8217;d give it a go with a site I&#8217;m building for my day job.<br />
<span id="more-79"></span><br />
To begin, I set up a basic vhost container in Apache in which to drop the RL code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">&lt;VirtualHost *:80&gt;
    ServerName redline.local
    DocumentRoot /sites/redline.local/www
&nbsp;
    &lt;Directory /sites/redline.local/www&gt;
        Options -Indexes, FollowSymLinks
        AllowOverride All
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;</pre></td></tr></table></div>

<p>Then I create the site directory, download the Redline package from Sean&#8217;s site, and unzip it:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="text" style="font-family:monospace;"> drew@server$  mkdir -p /sites/redline.local
 drew@server$  cd /sites/redline.local
 drew@server$  wget http://code-box.org/work/redline-0.1.zip
 drew@server$  unzip redline-0.1.zip
 drew@server$  cp -R redline-0.1/* .
 drew@server$  rm -rf redline-0.1/</pre></td></tr></table></div>

<p>At this point, the contents of my <code>/sites/redline.local/</code> directory is:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="text" style="font-family:monospace;"> cache/
 config.xml
 docs/
 lib/
 modules/
 tags/
 www/</pre></td></tr></table></div>

<p>Redline expects all requests to be rewritten through the document root&#8217;s <code>www/index.php</code> script in order to properly dispatch each request.  To get that running right, I create the following  <code>.htaccess</code> file under <code>www/</code>:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">RewriteEngine On
&nbsp;
# don't rewrite the index script, or any CSS, javascript, or image files
RewriteRule ^(index\.php|js|css|images) - [NC,L]
&nbsp;
# everything else goes through the index bootstrap
RewriteRule (.*) index.php/$1 [L]</pre></td></tr></table></div>

<p>Another problem I ran into is that the dispatcher parses <code>$_SERVER['PATH_INFO']</code> in order to determine what&#8217;s being requested, but for some reason on my VirtualBox server (Ubuntu 8.10, Apache2) I don&#8217;t have that variable available.  I googled a bit to find out how to get it set, but the most sensible solution (AcceptPathInfo On) didn&#8217;t pan out either.  Instead, I cracked open Redline&#8217;s <code>config.xml</code> and told it to use <code>REQUEST_URI</code> instead of <code>PATH_INFO</code>:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">...
    &lt;!-- request path details --&gt;
    &lt;define name=&quot;RL_PATH_INFO&quot;&gt;REQUEST_URI&lt;/define&gt;
..</pre></td></tr></table></div>

<p>Redline is built to parse that XML config and generate a PHP script that gets stored under the <code>cache/</code> directory, which means that directory will need to be writable for the user that Apache runs as (www-data, nobody, apache, etc). There are a few ways to handle this, but the quick and dirty option is to just <code>chmod 777 cache</code>, which effectively gives every user on the server read/write access to everything in that directory.  Since I own the whole machine it&#8217;s not a security concern, but in a shared environment you&#8217;d want to take a slightly less shotgun approach (assuming it&#8217;s an issue at all).</p>
<p>Next I edit my hosts file so that <code>redline.local</code> resolves to my server&#8217;s IP address, and I give it a test run by pointing my browser to <code>http://redline.local/redline</code>, which loads up the example redline module provided in the package. And what do I see?</p>
<blockquote>
<h1>Welcome to Redline</h1>
</blockquote>
<p>Yay!  Next I&#8217;ll set up another module and explain what I&#8217;ve learned so far about routing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.drewcking.com/2009/08/redline-web-app-engine-day-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
