<?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>James Badger's Personal Site &#187; Development</title>
	<atom:link href="http://jamesbadger.ca/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://jamesbadger.ca</link>
	<description></description>
	<lastBuildDate>Sat, 13 Jun 2009 23:59:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Lighttpd + Mongrel + Rails + Windows</title>
		<link>http://jamesbadger.ca/2009/04/25/lighttpd-mongrel-rails-windows/</link>
		<comments>http://jamesbadger.ca/2009/04/25/lighttpd-mongrel-rails-windows/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 04:31:26 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Local Talk]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[LightTPD]]></category>
		<category><![CDATA[Mongrel]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://jamesbadger.ca/?p=77</guid>
		<description><![CDATA[I recently worked on a project that required me to host a rails application on Windows XP Home, something I had no experience with but took on as our options were limited. We wanted a load-balanced server running a Rails app with a MySQL database. An XAMPP install was also being used by another group [...]]]></description>
			<content:encoded><![CDATA[<p>I recently worked on a project that required me to host a rails application on Windows XP Home, something I had no experience with but took on as our options were limited. We wanted a load-balanced server running a Rails app with a MySQL database. An XAMPP install was also being used by another group on the server, through which we had MySQL access.</p>

<p>I learned quite a bit trying to get it working, and I hope I can help someone else with how I did it. I started this last fall, so some of the software may have been updated. Also, I would like to thank Joseph Jaramillo for his post on <a href="http://www.mightyinteractive.com/ruby-on-rails/deploying-to-iis-on-windows/">Deploying to IIS with lighttpd and Mongrel</a> which was a huge help setting this up.</p>

<span id="more-77"></span>
<h2 class="heading">1. Install Ruby</h2>
<p>For Ruby, I used the 1.8.6 <a href="http://www.ruby-lang.org/en/downloads/">one-click installer</a>. Download, and install.</p>

<h2 class="heading">2. Install Ruby Gems</h2>
<p>Hop on over to RubyForge and grab the <a href="http://rubyforge.org/frs/?group_id=126">latest zip file</a> (rubygems-1.3.2.zip as of this article). Download, and install.</p>

<h2 class="heading">3. Install Rails and Mongrel</h2>
<p>Open a command prompt and run <strong>gem install rails</strong> to get rails installed. Next, run <strong>gem install mongrel mongrel_service</strong> which will install the <a href="http://mongrel.rubyforge.org/">Mongrel</a> server.

<h2 class="heading">4. Setup a Rails Application</h2>
<p>I will assume you have setup a Rails application before, and know how to create one from scratch or that you have one ready to drop in to be served. If you are not that experienced with Rails yet, I would recommend starting with Mongrel only for development.</p>
<p>Try out your Rails install by opening a command prompt to your Rails directory and running <strong>script\server</strong> (note the backslash), and then see if rails loads at <a href="http://localhost:3000/">http://localhost:3000/</a>. You may get a Windows Security Alert that you need to unblock to allow outgoing connections. At this point, you have enough to run a Rails server for development, but the aim of this article is to be more robust.</p>

<h2 class="heading">5. Install lighttpd</h2>
<p>Lighttpd is a great lightweight server that will be an excellent load-balancing proxy for this setup. We could have hooked into the Apache install from XAMPP, but I did not want to cause any problems for the group running that server.<br />
To install lighttpd, download the most recent lighttpd installer from the <a href="http://code.google.com/p/wlmp-project/">WLMP project</a> (I used LightTPD-1.4.22-1-Win32-SSL.exe). I had major problems with a Cygwin1.dll from an openSSH install conflicting with the ones for lighttpd, and had to remove the openSSH Cygwin1.dll before lighttpd would work properly; you can check for this error by running lighttpd from a command prompt and seeing if you get an error.</p>

<h2 class="heading">6. Install Windows Server 2003 Resource Kit</h2>
<p>To get lighttpd running as the kind of service we need, download and install the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&#038;displaylang=en">Windows Server 2003 Resource Kit</a>.</p>

<h2 class="heading">7. Install Mongrel Rails Service</h2>
<p>We are going to have two Mongrel servers serving our Rails application, although you can run more (See <a href="http://mongrel.rubyforge.org/wiki/Tuning">How Many Mongrel Instances Should I Run?</a>). To do this, open a command prompt and goto your Rails app directory. For each Mongrel server you want to run, enter the following command:<br />
<strong>mongrel_rails service::install -N rails_app_4001 -p 4001</strong><br />
Increase the number by one for each service (4002, 4003, etc) as you run the command. This command will install Windows services that will run our Mongrel servers in the background. To start these servers, run the following command for each server, incrementing the number for each server (4001, 4002, etc.):<br />
<strong>net start rails_app_4001</strong><br />
To make it easy to start and stop these servers, create a mserver.bat file in your Rails directory with the following contents:<br />
<blockquote>
@echo off<br />
net %1 rails_app_4001<br />
net %1 rails_app_4002
</blockquote>
Add additional lines for each extra Mongrel server, again incrementing the number. This script will allow you to start/stop all the servers by opening a command prompt, going to the Rails directory, and typing <strong>mserver.bat start</strong> or <strong>mserver.bat stop</strong> , which will come in handy when restarting your Rails app. To test if these servers are running, open a web browser and navigate to ports <a href="http://localhost:4001/">4001</a>, <a href="http://localhost:4002/">4002</a>, etc on your server and see if your Rails app shows up.
</p>

<h2 class="heading">8. Setup lighttpd Proxy</h2>
<p>Download and install <a href="http://www.mightyinteractive.com/ruby-on-rails/deploying-to-iis-on-windows/lighttpd.conf">Joseph Jaramillo&#8217;s lighttpd conf file</a> to your Rails directory, and put it in your config directory.
<br />Edit the file with an app that supports UNIX-style line endings (not notepad), changing the following values:</p>
<p><strong>var.basedir = &#8220;C:/Rails/myrailsapp&#8221;</strong> (point to your Rails app directory, use forward slashes)<br />
<strong>server.bind = &#8220;&#8221;</strong> (do not bind to a specific address)<br />
<strong>server.port = 3000</strong> (the port you want your users to use. 80 is a good default, or if already used as in my case, 3000)<br />
and under <strong>proxy.server</strong>, add extra entries for any additional Mongrel servers you are running.</p>
<p>Next, setup lighttpd to run as a Windows service. <a href="http://www.mightyinteractive.com/ruby-on-rails/deploying-to-iis-on-windows/index3.shtml">Follow Joseph&#8217;s instructions on step 3,</a> of course changing the AppParameters to use the path to your lighttpd config file in your rails directory. Test your setup by pointing your browser at your server&#8217;s main address (or other port if you chose one other than 80), and you should see your Rails application!</p>
<br />
<p>If you have any comments, suggestions, or problems let me know in the comments.</p>]]></content:encoded>
			<wfw:commentRss>http://jamesbadger.ca/2009/04/25/lighttpd-mongrel-rails-windows/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Welcome Back</title>
		<link>http://jamesbadger.ca/2006/10/28/welcome-back/</link>
		<comments>http://jamesbadger.ca/2006/10/28/welcome-back/#comments</comments>
		<pubDate>Sun, 29 Oct 2006 01:23:10 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Local Talk]]></category>

		<guid isPermaLink="false">http://jamesbadger.ca/?p=27</guid>
		<description><![CDATA[Although it seems dead, my development work has not stopped. It just has not produced anything final, yet.

I am planning on getting some things up on the site by mid-November, not only because I have many unfinished projects on the go, but because it gives me motivation to update this site. If that is finished [...]]]></description>
			<content:encoded><![CDATA[Although it seems dead, my development work has not stopped. It just has not produced anything final, yet.

I am planning on getting some things up on the site by mid-November, not only because I have many unfinished projects on the go, but because it gives me motivation to update this site. If that is finished on time, I will try to get something else out by the end of the year, too.

Updates on progress to come soon!]]></content:encoded>
			<wfw:commentRss>http://jamesbadger.ca/2006/10/28/welcome-back/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DMS and Radians</title>
		<link>http://jamesbadger.ca/2006/03/06/dms-and-radians/</link>
		<comments>http://jamesbadger.ca/2006/03/06/dms-and-radians/#comments</comments>
		<pubDate>Tue, 07 Mar 2006 01:51:31 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Local Talk]]></category>

		<guid isPermaLink="false">http://jamesbadger.ca/?p=25</guid>
		<description><![CDATA[Javascript is great solution for a simple problem.]]></description>
			<content:encoded><![CDATA[I didn&#8217;t have a calculator for converting from radians to Degrees Minutes Seconds (e.g. 34-55-04), and also in the opposite direction. Initially, I thought I would do this with PHP, but I could do it instantaneously with Javascript instead.
<span id="more-25"></span>
Feel free to give it a try, if you enter an approximation of π/2 ≅ 1.570796, you will get a value close to 90˚.
<script type="text/javascript" src="/wp-downloads/dms.js"></script>
<div id="calculator" style="text-align: center;  background-color: #CCBA8F; padding: 2em; margin: 5em 2em auto 2em; color: #807459;">
	<h3>DMS to Radians Calculator</h3>
		<form name="dms" id="dms">
		<table>
			<tr>
				<td>radians:</td>
					<td><input type="text" name="radians" value="" id="radians" onkeyup="doDMS();" onfocus="doDMS();" /> to degrees</td>
			</tr>
				<tr>
				<td>degrees:</td>
					<td><input type="text" name="degrees" value="" id="degrees" onkeyup="doRads();" onfocus="doRads();" /> to radians</td>
			</tr>
		</table>
	</form>
	<p id="output" style="text-align: center;">&nbsp;</p>
</div>

<a href="http://en.wikipedia.org/wiki/Radian" title="Radians">Radian &#8211; Wikipedia</a><br />
<a href="http://en.wikipedia.org/wiki/Angle#Units_of_measure_for_angles" title="DMS">DMS &#8211; Wikipedia</a><br />]]></content:encoded>
			<wfw:commentRss>http://jamesbadger.ca/2006/03/06/dms-and-radians/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
