<?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>The Braindonor Network &#187; Projects</title>
	<atom:link href="http://www.braindonor.net/browse/projects/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.braindonor.net</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 01 Jun 2010 17:42:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Updated mod_python Mako Handler</title>
		<link>http://www.braindonor.net/projects/updated-mod_python-mako-handler/127/</link>
		<comments>http://www.braindonor.net/projects/updated-mod_python-mako-handler/127/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 17:43:43 +0000</pubDate>
		<dc:creator>John Hoff</dc:creator>
				<category><![CDATA[Coding Blog]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Mako]]></category>
		<category><![CDATA[mod_python]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SQLAlchemy]]></category>

		<guid isPermaLink="false">http://www.braindonor.net/?p=127</guid>
		<description><![CDATA[I have been using the mod_python handler to parse Mako templates for about a month now in a personal project. As I have done more and more development on my project, I have naturally encountered shortcomings and errors in my handler. The first thing I encountered when using the handler was the incorrect status being [...]]]></description>
			<content:encoded><![CDATA[I have been using the mod_python handler to parse Mako templates for about a month now in a personal project.  As I have done more and more development on my project, I have naturally encountered shortcomings and errors in my handler.<span id="more-127"></span><br /><br />

The first thing I encountered when using the handler was the incorrect status being returned after a template was parsed.  Initially, I was not aware of the 500 status attached to all of the responses because the content came through correctly.  Once I started to implement some AJAX features, everything came crashing down.  While content was indeed returned, the ajax request looked at the status in the response header first, and started erring out all of my AJAX calls.  I tracked this down to how I was previously setting the status so that it could be updated inside of the template:<br /><br />

<code>req.status = apache.OK
req.write(template.render(req=req))
return req.status</code><br />

After some digging, I discovered that the reason for the 500 status was that I was attempting to set the status of the request.  Instead of attempting to use the request status, I needed to make a temporary place-holder:<br /><br />

<code>req.mako_status = apache.OK
req.write(template.render(req=req))
return req.mako_status</code><br />

After that fix, it was smooth sailing until I started integrating <a href="http://www.sqlalchemy.org/" target="_blank">SQLAlchemy</a> into my application.  The moment I imported SQLAlchemy into my template file, mod_python started throwing error pages concerning the directory to cache eggs into.  Because I had already been testing my ORM objects through the command line, this came as a surprise.  The quick fix was to create a directory for it, and add it to the environment from within the handler.  Once that was done, everything imported cleanly.<br /><br />

Now that I had my ORM objects imported, it was time to use them.  As i was implementing a form-handling routine, I ran into another issue.  When I passed in the raw value from the util.FieldStorage object provided by mod_python, I started receiving ProgrammingError exceptions from SQLAlchemy indicating that it was unable to adapt the select statements.  After some digging, I found one little reference pointing back to the behavior of FieldStorage.  I found the reason for the error <a href="http://osdir.com/ml/python.sqlalchemy.user/2006-08/msg00084.html" target="_blank">here</a>.  FieldStorage was returning StringField objects instead of raw strings when I parsed the form inputs.  When I placed those into the orm calls, it was unable to perform the needed type-matches.  For the solution, I created a wrapper object for FieldStorage to implement some additional methods that <i>did</i> return string values.<br /><br />]]></content:encoded>
			<wfw:commentRss>http://www.braindonor.net/projects/updated-mod_python-mako-handler/127/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>mod_python Handler for Mako</title>
		<link>http://www.braindonor.net/projects/mod_python-handler-for-mako/116/</link>
		<comments>http://www.braindonor.net/projects/mod_python-handler-for-mako/116/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 06:32:49 +0000</pubDate>
		<dc:creator>John Hoff</dc:creator>
				<category><![CDATA[Coding Blog]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Mako]]></category>
		<category><![CDATA[mod_python]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.braindonor.net/?p=116</guid>
		<description><![CDATA[One of my personal goals this Winter has been to learn and start using Python. Learning new languages and putting them to use is something I try to do about every year. Like so many others out there, messing around with Perl in college really has had an impact on my professional career. Being a [...]]]></description>
			<content:encoded><![CDATA[One of my personal goals this Winter has been to learn and start using <a href="http://www.python.org" target="_blank">Python</a>.  Learning new languages and putting them to use is something I try to do about every year.  Like so many others out there, <a href="http://xkcd.com/519/" target="_blank">messing around with Perl</a> in college really has had an impact on my professional career.  Being a professional web developer who uses Perl&#8212;especially through Apache/mod_perl&#8212;it was only natural that I began looking at building out a small site using <a href="http://www.modpython.org/" target="_blank">mod_python</a>. Little did I understand how much of a minefield I was stepping into!<span id="more-116"></span><br /><br />

Whenever I'm learning a new language, I inevitably explore how others are using it.  This means trying out many of the Python-based web development frameworks that are out there.  One of the biggest surprises for me was the reliance that nearly all of the frameworks place on custom Python application servers, bypassing Apache.  This also extends to most of the template libraries.  It all really depends on a pure Python application server.  That would be fine if my goal was to learn Django or Zope. I'm interested in learning Python...and learning a new language for me has always been very dependent on reinventing a known wheel.  For me, that really meant focusing on mod_python.<br /><br />

So I dive in, get mod_python installed on a system of mine and start working.  Time from apt-get install mod_python to a working Hello World handler: about 15 minutes.  All confident in my ability to get things moving, I start taking another look at Python template libraries.  Everything grinds to a halt again for me almost immediately.  The libraries all have documentation on how to call them from within python programs, but very little information on how to call them from within mod_python.  Two exceptions stood out: <a href="http://www.cheetahtemplate.org/">Cheetah</a> and <a href="" target="_blank">Mako</a>.  Cheetah had a couple of handler examples on their wiki...but I was never able to get any of them to work well.  Mako had a working WSGI handler that I was able to study and learn very quickly how to use their library from within mod_python.<br /><br />

Now, everything is up and running, and I'm building a couple of small web applications using mod_python and Mako.  To help fill some of the vacuum out there with respect to mod_python handlers, I decided that I wanted to share the handler I have been working with.  I wouldn't call it production-worthy, but I am enjoying using it a lot.  The Apache configurations required are below and I have attached the handler Python script.  Enjoy!<br /><br />

Apache Configuration:<br />
<code>&lt;Files ~ "\.html$"&gt;
    PythonPath "sys.path+['/var/www/braindonor.net/lib']"
    PythonDebug On
    SetHandler mod_python
    PythonHandler MakoHandler
&lt;/Files&gt;</code>]]></content:encoded>
			<wfw:commentRss>http://www.braindonor.net/projects/mod_python-handler-for-mako/116/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Breaking in a New Laptop</title>
		<link>http://www.braindonor.net/projects/breaking-in-a-new-linux-laptop/88/</link>
		<comments>http://www.braindonor.net/projects/breaking-in-a-new-linux-laptop/88/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 17:44:50 +0000</pubDate>
		<dc:creator>John Hoff</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.braindonor.net/?p=88</guid>
		<description><![CDATA[Buying a laptop can be quite an adventure. Buying a laptop that you intend on running Linux on is guaranteed to be an adventure! I have been running Linux on laptops for about 8 years now with mixed results. I was very pleased with my previous laptop, but it was time to replace it. It [...]]]></description>
			<content:encoded><![CDATA[Buying a laptop can be quite an adventure.  Buying a laptop that you intend on running Linux on is guaranteed to be an adventure! I have been running Linux on laptops for about 8 years now with mixed results.  I was very pleased with my previous laptop, but it was time to replace it.  It had been used to the point that the it was literally falling apart. So it was time to start hitting the forums and the shopping websites.<span id="more-88"></span><br /><br />

<b>What did I get?</b><br />
I purchased an <a href="http://www.msimobile.com/DetailPage.aspx?model=GX630-028US" target="_blank">MSI GX630-028US</a> from Amazon.  AMD Turion Dual-Core Processor; NVIDIA GeForce9600MGT; 4GB RAM;  320GB HD<br /><br />

<b>Why did I get it?</b><br />
The primary reason I went with this laptop was the AMD64 processor and the nVidia graphics card.  My previous laptop was AMD64 but with an ATI graphics card&#8212;the graphics card gave me the most installation and maintenance problems.  The fact that Cedega supports only nVidia cards also had a lot to do with the decision.<br /><br />

I did take a gamble on the Wifi chipset.  Since I am not new to Linux Wifi issues thanks to Broadcom cards, I was confident that I could get the details worked out.  I also knew that I could pop in a Wifi card into the expansion slot if I had to give up on it.<br /><br />

<b>Linux Installation</b><br />
I installed Ubuntu 8.10 onto the laptop.  I used the alternative AMD64 install disk to set up whole disk encryption along with several LVM snapshot partitions.<br /><br />

<b>What Worked?</b><br />
Almost everything!  More importantly, all of the hardware worked in the native AMD64 environment&#8212;which means you get to use all of the 4GB of RAM!  The webcam and bluetooth buttons worked like a charm.  Even the touchpad was recognized and had the scrolling gestures enabled.<br /><br />

<b>What Didn't Work?</b><br />
The only thing I have managed to find that doesn't work are the some of the special keys.  The laptop has "Eco" and "Turbo" buttons that can be used to over- and under-clock the laptop that do not work in Linux.  The brightness buttons also were not recognized.  Because everything that isn't working can be adjusted via gnome applets, I haven't missed them.<br /><br />

<b>Resources For Others</b><br />
Because of my overwhelmingly positive experience with this laptop, it is one that I would recommend to people interested in purchasing a new laptop to run Linux.  If you have this laptop or wish to get one in the future, you need to know of a couple of issues.<br /><br />

The wireless drivers are not yet included with the Linux kernel.  According to the development blogs, it should be there soon.  The card is used in quite a few netbooks, so there is a very high demand for it to be included.  In the meantime, you can find more information <a href="http://ubuntuforums.org/showthread.php?t=967525" target="_blank">here</a>.  You can also <a href="http://www.google.com/search?q=linux+ralink+0781" target="_blank">Google "linux ralink 0781"</a>. The card is an Ralink RT2860, it's PCI ID is 0781. Also not that the Wifi special button turns off the radio, but does not otherwise notify the OS.  Don't make the mistake I made of installing everything and then not enabling the radio before I tested to make sure it worked.<br /><br />

The nVidia drivers have a redraw issue when Compiz is enabled.  I encountered this when I enabled compiz and all my terminals started acting up.  Editing a file with VIM really brought the issue to the forefront.  The current fix for this is to manually set the powermizer settings on the card.  The best explanation I was able to find of this issue was <a href="https://lists.ubuntu.com/archives/ubuntu-users/2008-November/166660.html" target="_blank">here</a>.<br /><br />

The laptop does not ship with Vista installation media.  When you turn the laptop on for the first time, it proceeds to install Windows Vista.  You then have the ability to create a pair of rescue disks that can be used to reset the laptop back to the factory state.  You cannot use these rescue disks to create a virtual machine image to run Vista.  You are provided with a working Vista key that can be used with the standard Vista install disk.  This means you can grab an ISO, burn an install disk, and use your key to legitimately install Vista into a virtual machine image.]]></content:encoded>
			<wfw:commentRss>http://www.braindonor.net/projects/breaking-in-a-new-linux-laptop/88/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
