<?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>Zen and the Art of Programming &#187; Django</title>
	<atom:link href="http://programmingzen.com/category/django/feed/" rel="self" type="application/rss+xml" />
	<link>http://programmingzen.com</link>
	<description>Meditations on programming, startups, and technology</description>
	<lastBuildDate>Wed, 09 May 2012 07:52:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Installing Python, Django, and DB2 on Ubuntu 11.04</title>
		<link>http://programmingzen.com/2011/05/12/installing-python-django-and-db2-on-ubuntu-11-04/</link>
		<comments>http://programmingzen.com/2011/05/12/installing-python-django-and-db2-on-ubuntu-11-04/#comments</comments>
		<pubDate>Fri, 13 May 2011 09:06:58 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://programmingzen.com/?p=1375</guid>
		<description><![CDATA[Note: This is the Python version of the Ruby guide I just published. In this brief tutorial I’ll show you how to create a complete Python and Django setup for DB2 on Ubuntu. By following my step-by-step instructions, you’ll be able to install the following components: Python easy_install Django DB2 Express-C 9.7.4 The official Python [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p><em>Note: This is the Python version of the <a href="http://programmingzen.com/2011/05/11/installing-ruby-on-rails-and-db2-on-ubuntu-11-04/">Ruby guide</a> I just published.</em></p>
<p>In this brief tutorial I’ll show you how to create a complete Python and Django setup for DB2 on Ubuntu. By following my step-by-step instructions, you’ll be able to install the following components:</p>
<ul>
<li>Python</li>
<li>easy_install</li>
<li>Django</li>
<li><a href="http://db2express.com/download/?S_TACT=ACDB201">DB2 Express-C 9.7.4</a></li>
<li>The official <a href="http://code.google.com/p/ibm-db/">Python driver, dbi module, and Django adapter</a> for DB2</li>
</ul>
<h3 id="installing_python_and_easy_install">Installing Python and easy_install</h3>
<p>Technically Python is already installed on Ubuntu, so we don’t have to install it. However, we need the <code>python-dev</code> package in order to build the DB2 driver from source. We’ll also need easy_install which is included in the <code>python-setuptools</code> Ubuntu .deb:</p>
<pre class="highlight">$ sudo apt-get install python-dev python-setuptools</pre>
<p></p>
<h3 id="installing_django">Installing Django</h3>
<p>Now that we have easy_install available, we can easily install Django by running:</p>
<pre class="highlight">$ sudo easy_install django</pre>
<p>You can verify the installed version by running:</p>
<pre class="highlight">$ python</pre>
<p>And then executing the following snippet in the REPL:</p>
<pre class="highlight">>>> import django
>>> django.VERSION
(1, 3, 0, 'final', 0)</pre>
<p>At this time, version 1.3.0 should get installed as shown above.</p>
<h3 id="installing_db2">Installing DB2</h3>
<p>We can now download and install DB2 Express-C 9.7.4. <a href="http://db2express.com/download/?S_TACT=ACDB201">Download the .tar.gz file</a> to a location that’s convenient for you. Then proceed to unpack it:</p>
<pre class="highlight">$ cd ~/Downloads/
$ tar xvfz db2exc_974_LNX_x86.tar.gz
$ cd expc</pre>
<p>We’ll install one required library and then proceed with the setup:</p>
<pre class="highlight">$ sudo apt-get install libaio1
$ sudo ./db2setup</pre>
<p>Follow the GUI wizard on screen to continue with the installation. Pay close attention to two steps:</p>
<ul>
<li>When prompted <strong>select a custom installation</strong>, and when choosing the components, select all of them. We’ll need the <strong>Application Development Tools</strong> in order to build the Python driver later on (and these are unchecked by default).</li>
<li>When asked if you’d like to <strong>create an instance user</strong>, go with that option. It greatly simplifies the setup process.</li>
</ul>
<p>When the setup of DB2 is completed, you should receive a confirmation message informing you about the successful installation</p>
<p>For good measure, add the following line to your <code>~/.bashrc</code> file:</p>
<pre class="highlight">. /home/db2inst1/sqllib/db2profile</pre>
<p>This ensures that even your regular, non-DB2, user will be able to connect and interact with the database.</p>
<h3>Installing the Python driver and Django adapter</h3>
<p>The last step we need to take is to install the <code>ibm_db</code> Python driver and the <code>ibm_db_dbi</code> module, as well as the Django adapter for DB2. These are all IBM supported, open source releases.</p>
<p>Open a new shell and run:</p>
<pre class="highlight">$ sudo -s
$ export IBM_DB_DIR=/home/db2inst1/sqllib
$ export IBM_DB_LIB=/home/db2inst1/sqllib/lib
$ . /home/db2inst1/sqllib/db2profile
$ easy_install ibm_db ibm_db_django
$ exit</pre>
<h3 id="a_quick_sanity_test">A quick sanity test</h3>
<p>To ensure that all is well with your setup, run the following command:</p>
<pre class="highlight">$ django-admin.py startproject db2test
$ cd db2test</pre>
<p>Now edit <code>settings.py</code> so ENGINE is set to <code>ibm_db_django</code>, NAME to a database like <code>db2test</code>, USER to <code>db2inst1</code>, PASSWORD to the same password you specified for the db2inst1 user during the installation of DB2. Use <code>localhost</code> for the HOST, and <code>50000</code> as the port number:</p>
<pre class="highlight">DATABASES = {
    'default': {
        'ENGINE': 'ibm_db_django',
        'NAME': 'db2test',
        'USER': 'db2inst1',
        'PASSWORD': 'secret',
        'HOST': 'localhost',
        'PORT': '50000',
    }
}</pre>
<p>Create the database <code>db2test</code> by running:</p>
<pre class="highlight">$ su - db2inst1
$ db2start
$ db2 create db db2test
$ exit</pre>
<p>Depending on your hardware specs, the infrequent operation of creating a database can take a bit of time (e.g., several minutes).</p>
<p>We will now run the actual test:</p>
<pre class="highlight">$ python manage.py test</pre>
<p>Unless exceptions are raised during this last step, you should be all set to use Django with DB2.</p>
<h3 id="if_you_need_help">If you need help</h3>
<p>IBM is the only database vendor to officially provide and support its Python driver and Django adapter. While commercial DB2 support is available and relatively <a href="http://www.db2teamblog.com/2010/12/treat-yourself-to-db2-this-holiday.html">inexpensive</a>, your first line of defense is posing your questions in the <a href="http://groups.google.com/group/ibm_db?pli=1">support forum</a> over at Google. Alternatively, if the question is DB2-specific and not related to Python/Django, you can use the <a href="http://www.ibm.com/developerworks/forums/forum.jspa?forumID=805">DB2 Express-C forum</a> over at developerWorks instead.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2011/05/12/installing-python-django-and-db2-on-ubuntu-11-04/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DB2 support for Django 1.2 is here</title>
		<link>http://programmingzen.com/2010/03/30/db2-support-for-django-1-2-is-here/</link>
		<comments>http://programmingzen.com/2010/03/30/db2-support-for-django-1-2-is-here/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 02:32:02 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1135</guid>
		<description><![CDATA[The latest release of the IBM Adapter for Django now supports Django 1.2. Aside from enabling you to use the most recent version of Django, this release adds a few new goodies into the mix, that I&#8217;m sure many will appreciate. For example, IBM&#8217;s adapter (through the underlying DBI wrapper) now uses persistent connections, which [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://code.google.com/p/ibm-db/">latest release</a> of the <span class="caps">IBM</span> Adapter for Django now supports <a href="http://code.djangoproject.com/wiki/Version1.2Roadmap">Django 1.2</a>. Aside from enabling you to use the most recent version of Django, this release adds a few new goodies into the mix, that I&#8217;m sure many will appreciate.</p>
<p>For example, IBM&#8217;s adapter (through the underlying <span class="caps">DBI</span> wrapper) now uses persistent connections, which are especially helpful when dealing with Django &#8211; as it lacks connection pooling. (Of course DB2 also has the Connection Concentrator to aid in reducing the usage of server resources and improving scalability.)</p>
<p>Furthermore, the adapter adds support for the <span class="caps">DECIMAL</span> datatype, a necessary feature when dealing with money and currencies. Various enhancements and bug fixes were included too; <a href="http://groups.google.com/group/ibm_db/browse_thread/thread/c842df0e8803e517">check</a> <a href="http://groups.google.com/group/ibm_db/browse_thread/thread/2cb45b1b966f8a8c">them</a> out on Google Groups.</p>
<p>As a reminder, <a href="http://www.ibm.com/software/data/db2/express/download.html?S_CMP=ECDDWW01&amp;S_TACT=ACDB201">DB2 Express-C</a> is an absolutely free of charge version of DB2 and it&#8217;s production ready (not a toy version). You can <a href="http://www.ibm.com/software/data/db2/express/download.html?S_CMP=ECDDWW01&amp;S_TACT=ACDB201">download it from here</a>. Take it for a spin, experiment &#8211; chances are you&#8217;ll like it. If you need a guide to getting started, be sure to check out this <a href="http://www.ibm.com/developerworks/wikis/display/db2/free+book-+getting+started+with+db2+express-c">free e-book</a> by my colleagues Raul, Ian, and Rav.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2010/03/30/db2-support-for-django-1-2-is-here/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Enabling support for DB2 and Python/Django/SQLAlchemy on Mac OS X Snow Leopard</title>
		<link>http://programmingzen.com/2009/09/08/enabling-support-for-db2-and-pythondjangosqlalchemy-on-mac-os-x-snow-leopard/</link>
		<comments>http://programmingzen.com/2009/09/08/enabling-support-for-db2-and-pythondjangosqlalchemy-on-mac-os-x-snow-leopard/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 23:39:34 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1099</guid>
		<description><![CDATA[This article is obsolete. Please refer to the following articles for up do date instructions: Ruby/Rails and DB2 &#124; Python/Django and DB2. Thank you! This is the Python version of a post I made about Ruby a few days ago. Now that Mac OS X 10.6 is out, it’s time to leave the world of [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p></p>
<p style="font-size: 16px; padding: 10px; border: 3px solid #ff8833; text-align: center;">This article is obsolete. Please refer to the following articles for up do date instructions: <a href="/ruby-rails-db2">Ruby/Rails and DB2</a> | <a href="/python-django-db2">Python/Django and DB2</a>. Thank you!</p>
<p><em>This is the Python version of </em><a href="http://antoniocangiano.com/2009/09/03/installing-the-ruby-driver-for-db2-on-mac-os-x-snow-leopard/"><em>a post I made about Ruby</em></a><em> a few days ago.</em></p>
<p>Now that Mac OS X 10.6 is out, it’s time to leave the world of 32 bit computing behind. The pre-installed Python interpreter will run in 64 bit mode by default, so you may need to pay attention when installing some C-based eggs.</p>
<p>Assuming you have <a href="http://www.ibm.com/software/data/db2/express/download.html?S_CMP=ECDDWW01&amp;S_TACT=ACDB201">DB2 Express-C</a> installed already, the ibm_db Python egg for DB2 can easily be installed by following these simple steps:</p>
<div class="highlight">
<pre><span class="nv">$ </span>sudo -s
<span class="nv">$ </span><span class="nb">export </span><span class="nv">IBM_DB_LIB</span><span class="o">=</span>/Users/&lt;username&gt;/sqllib/lib64
<span class="nv">$ </span><span class="nb">export </span><span class="nv">IBM_DB_DIR</span><span class="o">=</span>/Users/&lt;username&gt;/sqllib
<span class="nv">$ </span><span class="nb">export </span><span class="nv">ARCHFLAGS</span><span class="o">=</span><span class="s2">"-arch x86_64"</span>
<span class="nv">$ </span>easy_install ibm_db</pre>
</div>
<p>This will install the ibm_db C driver, and the ibm_db_dbi Python module that complies to the DB-API 2.0 specification.</p>
<p>You can verify that the installation was successful my running the following:</p>
<div class="highlight">
<pre><span class="nv">$ </span>python
<span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">ibm_db</span>
<span class="o">&gt;&gt;&gt;</span></pre>
</div>
<p>Now, for the Django adapter, install Django first (if you haven&#8217;t done so already):</p>
<div class="highlight">
<pre><span class="nv">$ </span>sudo easy_install django</pre>
</div>
<p>The Django adapter can then be installed as follows:</p>
<div class="highlight">
<pre><span class="nv">$ </span>sudo easy_install ibm_db_django</pre>
</div>
<p>Finally, if have installed SQLAlchemy and wish to install the DB2 adapter for it, run:</p>
<div class="highlight">
<pre><span class="nv">$ </span>sudo easy_install ibm_db_sa</pre>
</div>
<p>Please let me know if you encounter any issues, I’d be glad to help you.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/09/08/enabling-support-for-db2-and-pythondjangosqlalchemy-on-mac-os-x-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Startup for sale on eBay (and it&#8217;s a great deal)</title>
		<link>http://programmingzen.com/2009/08/31/startup-for-sale-on-ebay-a-great-deal/</link>
		<comments>http://programmingzen.com/2009/08/31/startup-for-sale-on-ebay-a-great-deal/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 14:59:32 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Startup]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1092</guid>
		<description><![CDATA[One of the best programmers I know is selling a web application on eBay, that he&#8217;s been developing and running for the past three years. Given the starting price and considering what one lucky person or company will walk away with, I must say, it&#8217;s an amazing deal. I&#8217;m writing about his auction here so [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p>One of the best programmers I know is <a href="http://cgi.ebay.it/ws/eBayISAPI.dll?ViewItem&amp;item=300343155414#ht_1769wt_1167">selling a web application on eBay</a>, that he&#8217;s been developing and running for the past three years. Given the starting price and considering what one lucky person or company will walk away with, I must say, it&#8217;s an amazing deal. I&#8217;m writing about his auction here so that I can help it get the proper exposure it deserves and because I think it&#8217;s an incredible bargain for anyone who is interested!</p>
<p align="center"><img src="http://antoniocangiano.com/wp-content/uploads/2009/08/BlogBabel1.png" alt="BlogBabel on eBay" /></p>
<p><a href="http://it.blogbabel.com">BlogBabel</a>, the aforementioned site/web app, is a blog indexing and aggregation service that began in 2006. Amongst its features are the ability to detect and show the most popular blog discussions, weekly posts, <a href="http://it.blogbabel.com/content/books/">books</a>, <a href="http://it.blogbabel.com/content/videos/">videos</a>, and even popular blog entries based on their location (through geotagging). It also features <a href="http://it.blogbabel.com/metrics/">leaderboards</a> of the most popular blogs.</p>
<p>Its codebase uses Python and Django, and consists of 27,359 physical lines of code (roughly equivalent to 6.46 person-years, according to sloccount). The R&amp;D alone makes this application worthwhile to an interested party.</p>
<p>At this stage, BlogBabel has an Italian interface (located at it.blogbabel.com) and aggregates almost 15,000 Italian blogs and 5 million posts. Changing the interface to make it an international project that&#8217;s available in several languages, or switching to English (solely), would not be challenging in the least (they used to run a Spanish version as well, for example, but decided to discontinue it so as to focus on the Italian one).</p>
<p>BlogBabel has been featured in the mainstream Italian media and has had a noticeable influence on the Italian blogosphere. One could argue that it has been the yellow pages of the Italian blogosphere. Because of this, Ludovico Magnocavallo (the site&#8217;s creator) received substantial offers to buy BlogBabel in the past, but he turned them down because he wanted to continue building this site. Now however, due to personal circumstances and lack of time/resources, he&#8217;s willing to sell this application for what may amount to far less than its true value. And here&#8217;s the real bargain, the starting price, without a reserve, is 4,999 Euros. This is of course, a ridiculously low price for the value being offered. But Ludovico believes in letting the market decide.</p>
<p>If I had the funds lying around, I would buy it myself and gear it towards the English speaking world (in conjunction with the pre-existing Italian version). It&#8217;s a prepackaged, virtually ready-made startup with a great deal of potential both in its current state and in terms of what it could grow to become.</p>
<p>To recap, the auction includes:</p>
<ul>
<li> The domain name blogbabel.com (it.blogbabel.com has a pagerank of 6);</li>
<li>The full codebase (almost 30,000 lines of code);</li>
<li>A database containing 3 years worth of data relating to the Italian blogosphere (more than 30 GB, lots of data-mining opportunities);</li>
<li>4 hours of work to help you with setting up the site on your own servers.</li>
</ul>
<p>BlogBabel has been running smoothly for three years, and is currently under-marketed. Optimizing ads, affiliates, and similar sources of revenue wouldn&#8217;t be hard at all, especially if one were to aim this site at the English speaking world.</p>
<p>Also, Ludovico has already implemented most of the code that&#8217;s necessary to allow users to have accounts (through OpenID), but since these &#8220;social features&#8221; are not fully implemented yet, they have not been deployed in production. A buyer could decide to disregard them or finish implementing them and roll out a technorati-like service. The winner of this auction could decide to implement support for Twitter, comments on social networks, sentiment analysis, etc, on their own. The possibilities are really limitless when you start with a solid engine and crawler, and already have a great deal of data at your fingertips.</p>
<p>I know Ludovico and he&#8217;s a stand-up guy. If you are interested in this great deal, you can <a href="http://cgi.ebay.it/ws/eBayISAPI.dll?ViewItem&amp;item=300343155414#ht_1769wt_1167">bid here</a>. If you have technical questions about this auction, please feel free to contact him directly through eBay.</p>
<p>UPDATE (September 8, 2009): Ludovico received an undisclosed offer for the site and a few years of maintenance work, so the auction for the site alone was suspended.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/08/31/startup-for-sale-on-ebay-a-great-deal/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The DB2 adapter now supports Django 1.1</title>
		<link>http://programmingzen.com/2009/08/06/the-db2-adapter-now-supports-django-1-1/</link>
		<comments>http://programmingzen.com/2009/08/06/the-db2-adapter-now-supports-django-1-1/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 17:27:57 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1009</guid>
		<description><![CDATA[This article is obsolete. Please refer to the following articles for up do date instructions: Ruby/Rails and DB2 &#124; Python/Django and DB2. Thank you! I&#8217;m glad to announce that the API team has just released version 1.0.2 of the adapter for Django. And on my birthday to boot, what a nice present. This version extends [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p></p>
<p style="font-size: 16px; padding: 10px; border: 3px solid #ff8833; text-align: center;">This article is obsolete. Please refer to the following articles for up do date instructions: <a href="/ruby-rails-db2">Ruby/Rails and DB2</a> | <a href="/python-django-db2">Python/Django and DB2</a>. Thank you!</p>
<p>I&#8217;m glad to announce that the API team has <a href="http://groups.google.com/group/ibm_db/browse_frm/thread/98c2c700412688">just released</a> version 1.0.2 of the adapter for Django. And on my birthday to boot, what a nice present. This version extends its support to the recently released Django 1.1, as well as incorporating <a href="http://antoniocangiano.com/2009/06/19/db2-express-c-97-and-the-django-adapter-released/#comments">the feedback</a> that was received earlier on. <img src='http://programmingzen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (For installation instructions, take a look at the <a href="http://code.google.com/p/ibm-db/wiki/ibm_db_django_README">README file</a>.)</p>
<p>IBM confirms its commitment to support Python and Django, and gives Django well deserved credentials in environments where having IBM&#8217;s support counts. Django is becoming an increasingly mature web framework with the potential to do well within the Enterprise world. Having support for <a href="http://www.ibm.com/software/data/db2/express/download.html?S_CMP=ECDDWW01&#038;S_TACT=ACDB201">DB2</a> will surely help.</p>
<p>The next step will be working with the Django team to bake DB2 support directly into Django&#8217;s releases. The code for the adapter is released under a liberal OSI-compliant license that is compatible with Django&#8217;s own BSD, and the API team is more than willing to work on the development and support of the adapter should it become part of Django. We love Django and <a href="http://djangopony.com/">ponies</a>. Let&#8217;s make this happen, guys.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/08/06/the-db2-adapter-now-supports-django-1-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Serving Django Static Files through Apache</title>
		<link>http://programmingzen.com/2009/07/22/serving-django-static-files-through-apache/</link>
		<comments>http://programmingzen.com/2009/07/22/serving-django-static-files-through-apache/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 03:27:28 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Quick Tips]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=860</guid>
		<description><![CDATA[Django&#8217;s development server is capable of serving static (media) files thanks to the view django.views.static.serve. Popular web servers like Apache, Lighttpd or NGINX are much faster though, and as such should be used in production mode. Our goal is to bypass Django and let Apache (or other valid alternatives) directly serve static files like images, [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p>Django&#8217;s development server is capable of serving static (media) files thanks to the view <span class="n">django</span><span class="o">.</span><span class="n">views</span><span class="o">.</span><span class="n">static</span><span class="o">.</span><span class="n">serve</span>. Popular web servers like Apache, Lighttpd or NGINX are much faster though, and as such should be used in production mode. Our goal is to bypass Django and let Apache (or other valid alternatives) directly serve static files like images, videos, CSS, JavaScript files, and so on, for us.</p>
<p>Generally speaking, for performance reasons, it&#8217;s advised that you have two different webservers serving your dynamic requests and static files. In practice, for smaller sites, people often opt to simply use one webserver. In this article, I&#8217;ll discuss how to serve the static files within your Django project, through Apache.</p>
<p>The first thing we need to do is distinguish between development and production mode. We can do so by simply specifying DEBUG = True (development), or DEBUG = False (production) within our settings.py file.</p>
<p>settings.py may include (among others) the following declarations:</p>
<div class="highlight">
<pre><span class="c"># Absolute path to the project directory</span>
<span class="n">BASE_PATH</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">__file__</span><span class="p">))</span>

<span class="c"># Main URL for the project</span>
<span class="n">BASE_URL</span> <span class="o">=</span> <span class="s">&#39;http://example.org&#39;</span>

<span class="n">DEBUG</span> <span class="o">=</span> <span class="bp">False</span>

<span class="c"># Absolute path to the directory that holds media</span>
<span class="n">MEDIA_ROOT</span> <span class="o">=</span> <span class="s">&#39;</span><span class="si">%s</span><span class="s">/media/&#39;</span> <span class="o">%</span> <span class="n">BASE_PATH</span>

<span class="c"># URL that handles the media served from MEDIA_ROOT</span>
<span class="n">MEDIA_URL</span> <span class="o">=</span> <span class="s">&#39;</span><span class="si">%s</span><span class="s">/site_media/&#39;</span> <span class="o">%</span> <span class="n">BASE_URL</span>

<span class="c"># URL prefix for admin media -- CSS, JavaScript and images.</span>
<span class="n">ADMIN_MEDIA_PREFIX</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">admin/&quot;</span> <span class="o">%</span> <span class="n">MEDIA_URL</span>
</pre>
</div>
<p>*PATH constants indicate paths on your filesystem (e.g., /home/myuser/projects/myproject), while *URL constants indicate the actual URL needed to reach a given page or file.</p>
<p>Notice that it&#8217;s not unusual to have a /site_media URL that corresponds to a /media folder. In the example above, I opted to separate regular media files for the project from the standard ones that ship with Django for the admin section. To do this, all we have to do is create a symbolic link as follows:</p>
<div class="highlight">
<pre>ln -s /usr/lib/python2.5/site-packages/django/contrib/admin/media /path/to/myproject/media/admin
</pre>
</div>
<p>When you&#8217;re in development mode, and DEBUG = True, you want to let Django serve your static files. This can be done by adding the following snippet (or similar) to your urls.py:</p>
<div class="highlight">
<pre><span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">DEBUG</span><span class="p">:</span>
    <span class="n">urlpatterns</span> <span class="o">+=</span> <span class="n">patterns</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">,</span>
        <span class="p">(</span><span class="s">r&#39;^site_media/(?P&lt;path&gt;.*)$&#39;</span><span class="p">,</span> <span class="s">&#39;django.views.static.serve&#39;</span><span class="p">,</span> <span class="p">{</span><span class="s">&#39;document_root&#39;</span><span class="p">:</span> <span class="n">settings</span><span class="o">.</span><span class="n">MEDIA_ROOT</span><span class="p">}),</span>
    <span class="p">)</span>
</pre>
</div>
<p>In production mode, the code contained within the if clause will not be executed as we&#8217;ve set DEBUG to False within settings.py.</p>
<p>From the Django side of things, we are good. We now need to instruct Apache. Within your virtual host file, you can specify something along the lines of:</p>
<div class="highlight">
<pre><span class="nt">&lt;VirtualHost</span> <span class="s">*:80</span><span class="nt">&gt;</span>

  <span class="c">#...</span>

  <span class="nb">SetHandler</span> python-program
  <span class="nb">PythonHandler</span> django.core.handlers.modpython
  <span class="nb">SetEnv</span> DJANGO_SETTINGS_MODULE myproject.settings
  <span class="nb">PythonDebug</span> <span class="k">On</span>
  <span class="nb">PythonAutoReload</span> <span class="k">Off</span>
  <span class="nb">PythonPath</span> <span class="s2">&quot;[&#39;/usr/lib/python2.5/site-packages/django&#39;, &#39;/path/to/myproject&#39;] + sys.path&quot;</span>

  <span class="c">#...</span>

  <span class="nb">Alias</span> <span class="sx">/site_media</span> <span class="s2">&quot;/path/to/myproject/media&quot;</span>
  <span class="nt">&lt;Location</span> <span class="s">&quot;/site_media&quot;</span><span class="nt">&gt;</span>
    <span class="nb">SetHandler</span> <span class="k">None</span>
  <span class="nt">&lt;/Location&gt;</span>
<span class="nt">&lt;/VirtualHost&gt;</span>
</pre>
</div>
<p>The first group of declarations essentially tells Apache to use mod_python to handle any incoming requests. However, we don&#8217;t want Django to deal with static files, so the second group of declarations, aliases/maps the /site_media URL with the actual media directory on the server, and tells Apache to threat it as static content (with SetHandler None) bypassing de facto Django.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/07/22/serving-django-static-files-through-apache/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>DB2 Express-C 9.7 and the Django adapter released</title>
		<link>http://programmingzen.com/2009/06/19/db2-express-c-97-and-the-django-adapter-released/</link>
		<comments>http://programmingzen.com/2009/06/19/db2-express-c-97-and-the-django-adapter-released/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 20:29:04 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=825</guid>
		<description><![CDATA[This is a great day for those of us who love DB2, as DB2 Express-C 9.7 has just been released. As mentioned before, this is the best DB2 ever, and an extremely important release. To learn more about what&#8217;s new in this release, please check out the recording of our latest webinar: If you run [...]
Possibly related posts:<ol>
<li><a href='http://programmingzen.com/2008/02/13/ibm-releases-db2-adapter-for-sqlalchemy/' rel='bookmark' title='IBM releases DB2 adapter for SQLAlchemy'>IBM releases DB2 adapter for SQLAlchemy</a></li>
<li><a href='http://programmingzen.com/2008/09/14/django-turns-10/' rel='bookmark' title='Django turns 1.0'>Django turns 1.0</a></li>
<li><a href='http://programmingzen.com/2009/02/18/db2-support-for-django-is-coming/' rel='bookmark' title='DB2 support for Django is coming'>DB2 support for Django is coming</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This is a great day for those of us who love DB2, as <a href="http://www.ibm.com/services/forms/preLogin.do?source=swg-db2expressc&#038;S_CMP=ECDDWW01&#038;S_TACT=ACDB201">DB2 Express-C 9.7</a> has just been released. As mentioned before, this is <a href="http://antoniocangiano.com/2009/04/22/the-best-db2-ever/">the best DB2 ever</a>, and an extremely important release.</p>
<p>To learn more about what&#8217;s new in this release, please check out the recording of our latest webinar:</p>
<div align="center">
<object width="400" height="270"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5035884&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5035884&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="600" height="405"></embed></object>
</div>
<p><br/></p>
<p>If you run Linux, Unix or Windows, <a href="http://www.ibm.com/services/forms/preLogin.do?source=swg-db2expressc&#038;S_CMP=ECDDWW01&#038;S_TACT=ACDB201">download it</a> while it&#8217;s hot.</p>
<p><strong>DB2 9.7 on the Cloud</strong></p>
<p>Another great aspect of this release is that for the first time ever, DB2 has been released both as a product and as a deployment on the Cloud. If you pop over to <a href="http://rightscale.com">RightScale</a>, you can get a trial account for free and should see DB2 Express-C 9.7 on both CentOS and Ubuntu within the partner catalog. RightScale has been an amazing partner and they really do wonders to simplify Cloud Computing. In ten minutes time you can be up and running on the Cloud, thanks to the templates provided.</p>
<p align="center">
<a href="http://antoniocangiano.com/images/rightscale-big.png" target="_blank"><img src="http://antoniocangiano.com/images/rightscale.jpg" border="0" alt="DB2 on the Cloud" title="Click to enlarge" /></a>
</p>
<p><strong>DB2 support for Django</strong></p>
<p>But the good times don&#8217;t stop there, we are also announcing the first official release of the Django adapter for DB2. It sounded crazy when I first proposed the idea within IBM back in 2006, but now it&#8217;s a reality.</p>
<p>You can download the .tar.gz archive from the <a href="http://code.google.com/p/ibm-db/">Google Code homepage for the project</a>, or simply by <a href="http://ibm-db.googlecode.com/files/ibm_db_django-0.1.0.tar.gz">clicking here</a>. This version fully supports the Django 1.0.2 API. For instructions on how to install it, please read the <a href="http://code.google.com/p/ibm-db/wiki/ibm_db_django_README">Getting started with the IBM DB Django adapter</a> guide. The current version supports DB2 for Linux, Unix, Windows and MAC OS X, version 8.2 or higher (9.5 FP2 or higher for MAC OS X). In the future, IBM Cloudscape, Apache Derby, Informix (IDS) and both System i &#038; z/OS will be supported.</p>
<p><strong>ibm_db gem updated to 1.1</strong></p>
<p>I&#8217;ll conclude this DB2-centric post with a smaller, but still interesting announcement. <a href="http://rubyforge.org/projects/rubyibm/">The ibm_db gem</a> has been updated to version 1.1. This release includes support for ActiveRecord&#8217;s QueryCache mechanism, enhanced support for BigInt (and BigSerial), support for rename_column (requires DB2 9.7), parametrization of the timestamp datatype (requires DB2 9.7), and a few fixes and performance enhancements as well. It is recommended that you upgrade to this version.</p>
<p>Possibly related posts:<ol>
<li><a href='http://programmingzen.com/2008/02/13/ibm-releases-db2-adapter-for-sqlalchemy/' rel='bookmark' title='IBM releases DB2 adapter for SQLAlchemy'>IBM releases DB2 adapter for SQLAlchemy</a></li>
<li><a href='http://programmingzen.com/2008/09/14/django-turns-10/' rel='bookmark' title='Django turns 1.0'>Django turns 1.0</a></li>
<li><a href='http://programmingzen.com/2009/02/18/db2-support-for-django-is-coming/' rel='bookmark' title='DB2 support for Django is coming'>DB2 support for Django is coming</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/06/19/db2-express-c-97-and-the-django-adapter-released/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Of labels and limits</title>
		<link>http://programmingzen.com/2009/05/27/of-labels-and-limits/</link>
		<comments>http://programmingzen.com/2009/05/27/of-labels-and-limits/#comments</comments>
		<pubDate>Wed, 27 May 2009 17:26:53 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=797</guid>
		<description><![CDATA[In an attempt to satisfy our need for identity and belonging, we desperately try to wear as many labels as possible, and to a certain extent labels are a necessity. When people ask you what you do for a living, it&#8217;s far easier to reply &#8220;I&#8217;m a computer programmer&#8221; than to try and explain the [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p>In an attempt to satisfy our need for identity and belonging, we desperately try to wear as many labels as possible, and to a certain extent labels are a necessity. When people ask you what you do for a living, it&#8217;s far easier to reply &#8220;I&#8217;m a computer programmer&#8221; than to try and explain the plurality and complexity of the exact criteria of your job.</p>
<p>The problem with labels is that they can place you in a box, at times greatly limiting who and what you are. So while it&#8217;s okay to use labels to efficiently communicate with other people, it&#8217;s important not to fall into the trap of taking them too seriously, thus letting them become who you are &#8211; or are not.</p>
<p>It&#8217;s not the label per se, but rather our perception of what our identification with a given role implies. If I identify myself too strongly as a &#8220;rubyist&#8221; I may not be inclined to recognize the good that is found elsewhere in other programming languages, or worse still, reject such good in an attempt to defend the choice I opted to identify myself with. This inclination is the basis of many of the &#8220;religious wars&#8221; you see online.</p>
<p>I sometimes find myself in the odd predicament of limiting myself because of some label or assumption of what &#8220;a person like me&#8221; can and cannot do. In such instances though I&#8217;m reminded of a few stories about courageous individuals who went beyond labels, above the layer of conventionality, breaking what common sense would have considered a &#8220;difficult to challenge&#8221; limit. I&#8217;m reminded of <a href="http://www.time.com/time/photogallery/0,29307,1897093_1883570,00.html">blind people who took on photography</a> and managed to be successful at it, or of a black kid of Kenyan origins who managed to become the <a href="http://en.wikipedia.org/wiki/Barack_Obama">President of the United States of America</a>. But there is one story in particular that always gets me, it&#8217;s the story of <a href="http://en.wikipedia.org/wiki/Django_Reinhardt">Django Reinhardt</a>, after whom the the <a href="http://www.djangoproject.com/">popular Python framework</a> was named.</p>
<p>Django was a Gypsy jazz guitarist who was severely injured in a fire when he was eighteen. As a result of this accident his right leg was paralyzed and the third and fourth fingers on his left hand were severely burned. Doctors recommended amputating his leg and were pretty darn sure that he would never play guitar again due to the extensive damage to his hand. Django refused the amputation though and left the hospital as soon as he could. Within a year he was able to walk again, albeit with the aid of a cane. Even more surprisingly, despite being &#8220;disabled&#8221; in his left hand, he persisted through the pain to practice his beloved instrument. He went on to reinvent the conventional approach to guitar playing by performing solos with the use of only two fingers, using his half-paralyzed fingers for chord work. Today Django is considered one of the most influential guitarists of the 20th century.</p>
<p>I&#8217;ve learned to consciously fight the urge to limit myself. Whatever labels you feel may be cutting your potential short or holding you back, I encourage you to break free and rise above them. Does doing so mean you&#8217;ll reinvent the way a musical instrument is played, reshape the course of history or become a hero in your field? Perhaps, but even if it doesn&#8217;t, your own life stands to become richer and freer because you decided not to live within the confines of a label.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/05/27/of-labels-and-limits/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>DB2 support for Django is coming</title>
		<link>http://programmingzen.com/2009/02/18/db2-support-for-django-is-coming/</link>
		<comments>http://programmingzen.com/2009/02/18/db2-support-for-django-is-coming/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 22:09:36 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=587</guid>
		<description><![CDATA[This article is obsolete. Please refer to the following articles for up do date instructions: Ruby/Rails and DB2 &#124; Python/Django and DB2. Thank you! Online Surveys&#160;&#38;&#160;Market Research A few weeks after DB2 Express-C for Mac OS X was announced, I&#8217;m here to let you in on another great scoop. DB2 support for the Django web [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p></p>
<p style="font-size: 16px; padding: 10px; border: 3px solid #ff8833; text-align: center;">This article is obsolete. Please refer to the following articles for up do date instructions: <a href="/ruby-rails-db2">Ruby/Rails and DB2</a> | <a href="/python-django-db2">Python/Django and DB2</a>. Thank you!</p>
<p>
<!-- Altering or removing this link is a breach of the Vizu Terms and Conditions -->
<div style="font-family:Arial, Helvetica, sans-serif; font-size:9px;height:20px;text-align:center;width:160px;margin:0;padding:0;letter-spacing:-.5px"><a href="http://www.vizu.com" target="_blank"><span style="color:#999;text-decoration:underline;font-size:9px;">Online Surveys</span></a><span style="color:#999;">&nbsp;&amp;&nbsp;</span><a href="http://answers.vizu.com/market-research.htm" target="_blank"><span style="color:#999;text-decoration:underline;font-size:9px;">Market Research</span></a></div>
<p><embed src="http://wp.vizu.com/vizu_poll.swf" quality="high" scale="noscale" wmode="transparent" bgcolor="#ffffff" width="160" height="525" name="vizu_poll" align="right" hspace="10" allowScriptAccess="always" type="application/x-shockwave-flash" FlashVars="js=false&#038;pid=147844&#038;ad=false&#038;vizu=true&#038;links=true&#038;mainBG=006600&#038;questionText=FFFFFF&#038;answerZoneBG=EEEEEE&#038;answerItemBG=FFFFFF&#038;answerText=000000&#038;voteBG=00cc00&#038;voteText=000000"></embed></p>
<p>A few weeks after <a  href="http://www.ibm.com/software/data/db2/express/download.html?S_CMP=ECDDWW01&#038;S_TACT=ACDB201">DB2 Express-C for Mac OS X</a> was announced, I&#8217;m here to let you in on another great scoop. DB2 support for the Django web framework is going to be available soon to the community, under the permissive Apache 2.0 License. We are presently waiting for clearance from our lawyers, but the code has been written and tested, and Django is finally working with DB2. This comes on the heels  of a new release of the <a href="http://code.google.com/p/ibm-db/">Python driver for DB2</a>, version 0.6.0, which adds full support for Unicode.</p>
<p>The Django community will soon be able to use the rock solid database management system which is DB2, and enjoy all the advantages that it provides. Would you like to introduce Django into your enterprise environment, where DB2 is already in use? If so, you&#8217;ll now have an easier time with this. Want to use DB2 as a competitive advantage for your startup? Now you can, whether you opt to use Django/Python, Rails/Ruby, Zend Framework/PHP or Perl.</p>
<p>I have been pushing for Django&#8217;s ORM support since 2006, and I distinctly remember the initial reactions of some people at IBM, they were along the lines of, &#8220;Djan&#8230; what?&#8221;. Unlike Rails, Django was much less known back then, especially among IT managers, and in all fairness, while powerful and very productive,  the inherited Python philosophy that &#8220;explicit is better than implicit&#8221; made it look more complex &#8211; or at least less impressive &#8211; than Rails during 10 minute demos. But I insisted that it was important for our DB2 strategy and for the Django community, and now it&#8217;s finally a reality, thanks to the hard work of the IBM API team. Just like for Rails and Ruby, IBM will be the first and only vendor to officially support a Python driver, SQLAlchemy and Django&#8217;s ORM adapters.</p>
<p>I can&#8217;t help but think, what&#8217;s next? What language and/or framework truly needs some DB2 love? I&#8217;m definitely interested in a few languages and frameworks, and have already advocated for some of these as well, but I&#8217;d like to hear your opinions on this topic. I have created a poll that asks you which, among the technologies that we don&#8217;t currently support, do you think it would be most beneficial to have DB2 support for. Feel free to express your opinions in the comment section, as well as in the poll.</p>
<p>  <br/> <br/>
<p><em>Disclaimer: The opinions expressed in this post are mine and mine alone, and do not necessarily represents the opinions of my employer, IBM. The poll is not an official IBM survey.</em></p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/02/18/db2-support-for-django-is-coming/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Merb, Rails Myths, Language Popularity and other Zenbits</title>
		<link>http://programmingzen.com/2008/11/14/merb-rails-myths-language-popularity-and-other-zenbits/</link>
		<comments>http://programmingzen.com/2008/11/14/merb-rails-myths-language-popularity-and-other-zenbits/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 23:50:53 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[DB2]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Merb]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby Benchmark Suite]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Zenbits]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=381</guid>
		<description><![CDATA[Zenbits are posts which include a variety of interesting subjects that I&#8217;d like to talk about briefly, without writing a post for each of them. Merb: A few days ago Merb 1.0 was released. Congratulations to Ezra Zygmuntowicz on this important milestone, the Merb community and Engine Yard (who finances the project). Merb 1.0 wasn&#8217;t [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p><em><strong>Zenbits</strong> are posts which include a variety of interesting subjects that I&#8217;d like to talk about briefly, without writing a post for each of them.</em></p>
<p><strong>Merb:</strong> A few days ago <a href="http://brainspl.at/articles/2008/11/08/merb-1-0">Merb 1.0</a> was released. Congratulations to Ezra Zygmuntowicz on this important milestone, the Merb community and <a href="http://engineyard.com">Engine Yard</a> (who finances the project). Merb 1.0 wasn&#8217;t even out yet when some people had already started commenting on the fracturing of the Ruby community that this new framework might bring with this, and the impact that this high visibility &#8220;competitor&#8221; might have on Rails. I believe that having more than one widely adopted web framework will only benefit the Ruby community. Furthermore, it&#8217;s important to remember that this is not a zero-sum game. Ruby programmers are perfectly capable of learning two frameworks and using one or the other, depending on the project at hand. This is particularly true if we consider that Merb, for all of its advantages &#8211; and disadvantages &#8211; when compared to Rails, is not totally different from its forerunner. If you are an expert Rails programmer, you should be able to become proficient in Merb in very little time. To help with this process, the Merb community needs to concentrate on the documentation now, given that the API is finally stable.</p>
<p><strong>Rails Myths:</strong> David Heinemeier Hansson began <a href="http://www.loudthinking.com/posts/29-the-rails-myths">a series of posts about Rails Myths</a>. I like the idea of seeing common myths addressed straight from the horse&#8217;s mouth. Over the past two years, Rails has received quite a bit of backslash and old fashion FUD, so it&#8217;s important to set the record straight, whether the myths are entirely fabricated or if there is some element of truth to them. Whether you agree with David or not, it&#8217;s also nice to hear two sides of the same story. In fact, at the beginning of <a href="http://antoniocangiano.com/my_ruby_on_rails_book.php">my book</a> I debunk a few myths, just to set the record straight regarding what some readers may have heard surrounding the framework. It was a fun part to write.</p>
<p><strong>My Book:</strong> Speaking of my book, <a href="http://antoniocangiano.com/my_ruby_on_rails_book.php">Ruby on Rails for Microsoft Developers</a>, I&#8217;m getting closer to the finish line. I&#8217;m about to complete Chapter 9 (out of eleven chapters). The initial schedule I was provided with has been extended slightly so that there will be sufficient time to properly review the content and ensure that it&#8217;s up to date with the final release of Rails 2.2. Some people wondered what the &#8220;Microsoft Developers&#8221; part means. Is it for people that work at Microsoft? Is it for .NET programmers? Is it for people who develop on Windows?</p>
<p>The truth is that &#8220;Microsoft Developers&#8221; is probably just a marketing term that Wrox selected as a catch-all for of the aforementioned categories of programmers. As an author I&#8217;m trying to serve all of them well, by providing a guide that sneaks in much of the Rails culture and softens the migration path by using an Operating System, and to a certain extent, tools that they&#8217;re already familiar with. In my opinion one of the major obstacles when switching to, or trying, Rails when coming from the Microsoft world, is the culture shock. The documentation and most books assume that you are familiar with *nix systems and tools, and this can be frustrating for those who are forced not only to learn a new language and framework, but also an entirely new set of tools. As it&#8217;s targeted at Microsoft developers, the book obviously makes quite a few references and comparisons to the .NET world, where they fit. This is done so that the many .NET programmers amongst the group of so called &#8220;Microsoft Developers&#8221; will find the book particularly useful. Yet the book remains generic enough so that it can be used by any programmer (particularly Windows users), even those without any knowledge of the Microsoft .NET Framework or ASP.NET.</p>
<p><strong>Python books:</strong> While on the subject of books, I wanted to mention that the final version of the <a href="http://pylonsbook.com/alpha1/toc">Pylons book</a> is available online. Despite the much less fancy UI, the book pretty much does what the <a href="http://djangobook.com/en/1.0/">Django Book</a> did in the past. And both are available in print as well (<a href="http://www.amazon.com/gp/product/1590597257?ie=UTF8&#038;tag=zenruby-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=1590597257">The Definitive Guide to Django: Web Development Done Right</a> and <a href="http://www.amazon.com/gp/product/1590599349?ie=UTF8&#038;tag=zenruby-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=1590599349">The Definitive Guide to Pylons</a>). <a href="http://pylonshq.com/">Pylons</a> is a Python web framework that can be viewed as a Ruby on Rails clone, in a far greater way than Django could ever be considered.</p>
<p>Another thing I want to mention is that I received a copy of <a href="http://www.amazon.com/gp/product/184719494X?ie=UTF8&#038;tag=zenruby-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=184719494X">Expert Python Programming</a>. I haven&#8217;t gotten to far into it yet, but from what I&#8217;ve seen so far, things look good. I hope to be able to read it through, over a weekend in the near future and then provide a proper review. Stay tuned.</p>
<p><strong>Language Popularity:</strong> If you take a look at the <a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html">TIOBE Index</a>, you&#8217;ll notice a few interesting things: Ruby has dropped two positions since last year, and it&#8217;s now the 11th most popular language in the world. This shouldn&#8217;t be cause for concern though, as shown by this <a href="http://www.tiobe.com/index.php/paperinfo/tpci/Ruby.html">Ruby graph</a>. Python on the other hand is increasing in popularity and moved from the 7th to the 6th most popular language. Interestingly, according to the index (the results of which are educated guesses only), Python would seem to be more popular than C#. I find this to be true, in terms of online activity within an increasingly vibrant community, but in my opinion, the job market hasn&#8217;t caught up yet. In fact, at least in Toronto, when there&#8217;s a Python opening it&#8217;s pretty much an event that&#8217;s worthy of being discussed on the local Python mailing list. C# openings are much more common. This may be different in Silicon Valley, of course. It would also seem that Delphi has experienced a huge come back, moving from the 11th position last year to the 8th one this time around. It&#8217;s hard to imagine that Delphi has had a similar level of adoption as C# and thus has become more popular than Perl, JavaScript and Ruby. Delphi is a great solution for Win32 programming, but I don&#8217;t quite believe this overly optimistic outlook. And if this is the case, where are all the Delphi jobs and buzz?</p>
<p><strong>DB2:</strong> <a href="http://www.youtube.com/watch?v=W69zLWjpzEo">This interview</a> shows a few good reasons why even smaller and medium sized companies are increasingly adopting DB2. And while the video doesn&#8217;t mention it, IBM is coming out with <a href="http://www.ibm.com/software/data/db2/express/download.html?S_CMP=ECDDWW01&#038;S_TACT=ACDB201">an updated version of DB2 Express-C 9.5</a>. This new version, 9.5.2 or 9.5 FixPack 2, is going to introduce exciting new features, including an engine for full text search.</p>
<p><strong>The Great Ruby Shootout</strong> These days you hear a lot of talk about parallel programming. Intel <a href="http://software.intel.com/en-us/blogs/2008/10/22/sequential-programming-is-dead-so-stop-teaching-it/">promotes it</a> and despite their bias, it&#8217;s plausible that parallel programming will become important as the CPU market heads towards an increasingly larger number of cores, as opposed to focusing on the frequency of said CPUs. In the world of Ruby, this translates into <a href="http://www.igvita.com/2008/11/13/concurrency-is-a-myth-in-ruby/">multiprocessing, as opposed to multithreading</a> due to the infamous GIL (Global Interpreter Lock). This means that Ruby will most likely approach the problem similarly to how Python 2.6 did with the <a href="http://docs.python.org/dev/library/multiprocessing.html">multiprocessing module</a>, which is a process-based interface. The obvious exceptions are JRuby and IronRuby, which establish a 1 to 1 relationship between green threads and OS threads.</p>
<p>For the shootout, it would be interesting to see some multithreaded code, so as to get a better sense of how well JRuby and IronRuby compare to MRI and 1.9, when more cores are available. In fact, the long-promised shootout will be performed on a quad-core machine with 8GB of RAM. If Charles Nutter, John Lam, or any of their team members would like to contribute some programs that are able to take advantage of &#8220;native&#8221; multithreading, I&#8217;d be very happy to include them in the <a href="http://groups.google.com/group/ruby-benchmark-suite?pli=1">Ruby Benchmark Suite</a>, to be used for my shootout.</p>
<p>The repository requires some love and refactoring, since it needs to be split in two types of benchmarks. The simpler one will evaluate the execution time minus the startup time, while the more advanced benchmark will also exclude the time required for parsing and loading modules, classes and methods in the AST. It would also be nice to test each program with variable input sizes and report these results accordingly. Right now I&#8217;m very busy with the book, but as I become more available, I&#8217;ll start working on this.</p>
<p>Finally, I want to point out <a href="http://unweary.com/2008/11/specifying-performance.html">a very interesting article</a> about performance and UIs. Slow is indeed a very relative concept, and it&#8217;s important to understand how to analyze and respond to the user requirements when it comes to the responsiveness of an application as a user interacts with it.</p>
<p><strong>Hardware:</strong> I finally bought a <a href="http://www.amazon.com/gp/product/B00006B9CR?ie=UTF8&#038;tag=zenruby-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B00006B9CR">Trackball made by Logitech</a> and the <a href="http://www.amazon.com/gp/product/B000OOY4S6?ie=UTF8&#038;tag=zenruby-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B000OOY4S6">Microsoft Ergonomic Keyboard</a> (Microsoft makes great hardware). I don&#8217;t have wrist problems, but I&#8217;d like to see how these two affect my extensive computer usage. I plan to report my experience as soon as I&#8217;ve had a chance to use these input devices for a while, since I know this is a topic that interests lots programmers (many of whom end up being victims of <a href="http://en.wikipedia.org/wiki/Repetitive_strain_injury">RSI</a>, and some of the IRS <img src='http://programmingzen.com/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> ). I also bought <a href="http://www.amazon.com/gp/product/B000XZ79ME?ie=UTF8&#038;tag=zenruby-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B000XZ79ME">a bad-ass color laser printer</a> which is quite handy when you&#8217;re a programmer and you are writing a book. I&#8217;ll let you know how it goes. What I didn&#8217;t buy, but still think is awesome, is the <a href="http://www.amazon.com/gp/product/B001HSOFI2?ie=UTF8&#038;tag=zenruby-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B001HSOFI2">Flip minoHD</a>. It&#8217;s the equivalent of an iPod for the world of camcorders. $235 for a camcorder that&#8217;s so perfectly compact, and yet that can record in HD, is a pretty sweet deal. I&#8217;m considering it for Christmas, assuming it reaches Canada by then.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2008/11/14/merb-rails-myths-language-popularity-and-other-zenbits/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

