<?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>Mutual Information &#187; programming</title>
	<atom:link href="http://www.mutualinformation.org/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mutualinformation.org</link>
	<description>Measuring the dependency of different variables</description>
	<lastBuildDate>Fri, 21 Oct 2011 14:22:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Linux or Windows for Beira Project</title>
		<link>http://www.mutualinformation.org/2010/05/linux-or-windows-for-beira-project/</link>
		<comments>http://www.mutualinformation.org/2010/05/linux-or-windows-for-beira-project/#comments</comments>
		<pubDate>Fri, 07 May 2010 05:26:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[beiraproject]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.mutualinformation.org/?p=310</guid>
		<description><![CDATA[Cross-posted from Beira Project:

One of our projects in Mozambique will be to set up computer labs for several of the groups there. One of the questions is what operating system to use.
 
I haven’t personally run Windows since Windows 98 was their newest operating system (I did have an dual-booting Linux/XP laptop before you ...]]></description>
			<content:encoded><![CDATA[<p>Cross-posted from <a href="http://beiraproject.org">Beira Project</a>:</p>
<p>One of our projects in Mozambique will be to set up computer labs for several of the groups there. One of the questions is what operating system to use.</p>
<p>I haven’t personally run Windows since Windows 98 was their newest operating system (I did have an dual-booting Linux/XP laptop before you could buy linux laptops, but I rarely used it, this was 6 years ago). I had an Apple laptop for a while, but now all my computers are Linux. Still, I am trying to keep an open mind.</p>
<p>I do know that in these environments it’s not sufficient to just leave them a bunch of computers as they will quickly become unusable with viruses and spamware as kids install all sorts of things to get games to work (or to see pictures of unclad women). I know this from seeing it in other countries and from talking to our partners in Mozambique. Some <a href="http://www.foreignpolicy.com/articles/2010/03/24/africas_cyber_wmd">intellectual tabloids</a>  have even pointed out how this is a problem for the wider internet.</p>
<p>The argument is thus for a Linux based solution where the typical user is allowed to run firefox (and only firefox) and more advanced users can run openoffice. By logging in remotely, a more advanced expert can do maintenance up to the point where the machines stop connecting to the internet.</p>
<p>I can’t probably give you an answer now as to what we will use, but if I found a good Linux distribution for this environment, it would make things much easier.</p>
<p>(And, no, Apple is not under consideration; the machines are too expensive).</p>
<p><small>Follow me on twitter: <a href="http://twitter.com/luispedrocoelho">@luispedrocoelho</a></small></p>
<p class="wp-flattr-button"></p> <p><a href="http://www.mutualinformation.org/?flattrss_redirect&amp;id=310&amp;md5=1050f45ceafa1aeaf4f6b039dd29676a" title="Flattr" target="_blank"><img src="http://www.mutualinformation.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mutualinformation.org/2010/05/linux-or-windows-for-beira-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Release Often</title>
		<link>http://www.mutualinformation.org/2010/04/release-often/</link>
		<comments>http://www.mutualinformation.org/2010/04/release-often/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 20:06:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.mutualinformation.org/?p=305</guid>
		<description><![CDATA[Over the last week, I have made five software releases of my packages:

django-gitcms: This has grown into a real reusable framework. The old adage of it's reusable if you reuse it is true. Setting up pythonvision.org (still in Beta) led me to fix a lot of bugs.
pymorph: This is almost ready to be called ...]]></description>
			<content:encoded><![CDATA[<p>Over the last week, I have made five software releases of my packages:</p>
<ul>
<li><a href="http://luispedro.org/software/git-cms">django-gitcms</a>: This has grown into a real <strong>reusable</strong> framework. The old adage of <cite>it&#8217;s reusable if you reuse it</cite> is true. Setting up <a href="http://pythonvision.org">pythonvision.org</a> (still in Beta) led me to fix a lot of bugs.</li>
<li><a href="http://luispedro.org/software/pymorph">pymorph</a>: This is almost ready to be called 1.0. It still needs more testing. So, if you find bugs, let me know.
</li>
<li><a href="http://luispedro.org/software/mahotas">mahotas</a>: More image processing in Python. This is implemented in C++, so the code is fast (compare the watershed implementation to that in pymorph: 10x faster).
</li>
<li><a href="http://luispedro.org/software/jug">jug</a>: Mostly performance improvements in the last round.
</li>
<li><a href="http://luispedro.org/software/milk">milk</a>: I had called this 0.1-alpha, 0.1-beta1, &#8230; Now, it&#8217;s just 0.1. It also includes a wrapper around the traditional libsvm code (instead of my port). After doing it, I realised that my port is much faster, though (because of the tighter integration with numpy).
</li>
</ul>
<p>It used to be that preparing a software release was a lot of work (build <code>tar.gz</code> file, upload it, test it, announce it,&#8230;). Now, in the Python world it&#8217;s a matter of <code>python setup.py sdist upload</code>). It makes it so much easier and anyone who is using <code>pip</code> can just get the newest version immediately.</p>
<p>Linux distributions still live the old release world where even small packages (such as the ones above) still need to go through a big process before making it into the main trunk. What would a Linux distribution with a release process that was as simple as <code>python setup.py sdist upload</code> look like? Add in unit tests and you should have a nice rolling release distribution.</p>
<p><small>Follow me on twitter: <a href="http://twitter.com/luispedrocoelho">@luispedrocoelho</a></small></p>
<p class="wp-flattr-button"></p> <p><a href="http://www.mutualinformation.org/?flattrss_redirect&amp;id=305&amp;md5=77b555b3f41a7009909efc4e0f883c4a" title="Flattr" target="_blank"><img src="http://www.mutualinformation.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mutualinformation.org/2010/04/release-often/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Few More Thoughts on Django &amp; Pylons</title>
		<link>http://www.mutualinformation.org/2010/03/a-few-more-thoughts-on-django-pylons/</link>
		<comments>http://www.mutualinformation.org/2010/03/a-few-more-thoughts-on-django-pylons/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 21:54:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.mutualinformation.org/?p=290</guid>
		<description><![CDATA[
	Curiously, one of the effects of the wide readership that the post got was heightened interest in my django based package: django-gitcms.This is good. I still plan to put up a couple of websites based on that having spent a few hours two weeks ago making it more general (even as I was switching ...]]></description>
			<content:encoded><![CDATA[<ul>
<li>
<p>Curiously, one of the effects of the wide readership that the post got was heightened interest in my django based package: <a href="http://luispedro.org/software/git-cms">django-gitcms</a>.</p>
<p>This is good. I still plan to put up a couple of websites based on that having spent a few hours two weeks ago making it more general (even as I was switching to Pylons for the other project).</p>
</li>
<li>
<p>Some people pointed out that my criticisms were about the apps and not the full architecture. For example, someone said <cite>doing a photo app that handles twitter is easy with signals. RTFM.</cite><br />
It&#8217;s actually a good idea. The only question is: where is that app?</p>
<p>I think it&#8217;s fair to evaluate a platform based on the tools that are built around it as much as on the full potential. Django has a bit of a culture of releasing any piece of half-finished code that served its purpose once as an app.</p>
</li>
<li>
<p>Let me reformulate a bit of the gist of what I wrote: Part of the django vs. Pylons trade-off as I understood it when I first chose django and still understand it now is that django constrains your website more, but gives you more for free, while Pylons is more build-your-own, but you have a lot more flexibility. When I realised that I was mostly building my own with django while still being constrained, I felt that I had been cheated on.</p>
<p>Other websites might not like the flexibility or not mind the constraints. Fine.</p>
</li>
<li>
<p>We should all unite against the common enemy: <em>Ruby on Rails!</em> I hear. <strong>No, PHP</strong>. <em>Oh, yeah, PHP</em>.</p>
</li>
</ul>
<p><small>Follow me on twitter: <a href="http://twitter.com/luispedrocoelho">@luispedrocoelho</a></small></p>
<p class="wp-flattr-button"></p> <p><a href="http://www.mutualinformation.org/?flattrss_redirect&amp;id=290&amp;md5=e6f86b3cf67c8f24178570d5d41bcd31" title="Flattr" target="_blank"><img src="http://www.mutualinformation.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mutualinformation.org/2010/03/a-few-more-thoughts-on-django-pylons/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Why I switched to Pylons after using Django for six months</title>
		<link>http://www.mutualinformation.org/2010/03/why-i-switched-to-pylons-after-using-django-for-six-months/</link>
		<comments>http://www.mutualinformation.org/2010/03/why-i-switched-to-pylons-after-using-django-for-six-months/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 05:41:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.mutualinformation.org/?p=282</guid>
		<description><![CDATA[Background

I started using Django in June for a side project. A friend told me about it, he wanted to use it for a project we were going to do and it seemed great. Unfortunately, none of those projects went live (for non-technical reasons). A few months later, I am helping another friend with django-based ...]]></description>
			<content:encoded><![CDATA[<h3>Background</h3>
<p>I started using Django in June for a side project. A friend told me about it, he wanted to use it for a project we were going to do and it seemed great. Unfortunately, none of those projects went live (for non-technical reasons). A few months later, I am helping another friend with django-based website, and I also redid my <a href="http://luispedro.org">personal website</a> in django (albeit a very peculiar <a href="http://luispedro.org/software/git-cms">use of django</a>) and I have other plans for django websites based on the framework I built for myself.</p>
<p>Two months ago, I decided to rewrite a website I manage (<a href="http://www.papsonline.org">PAPS</a>) in django. It was drupal-based, which had served us well, but it was, by now too old and inflexible.  One of the things that disturbed me about it was that I had started tweaking the code. Not much, but enough that I was afraid to upgrade and lose those changes.</p>
<p>Also, I wanted recaptcha on signups, openid logins, twitter integration and a bit of a feeling of modernity. I worked on it a few hours per week, in the evenings, but I didn&#8217;t make much progress until I switched to Pylons. By then, I had invested a month into the project, but kept getting stuck and moving forward only at immense effort.</p>
<h3>Django</h3>
<p>First, the good: its documentation is deservedly regarded as impeccable and an example to us all. Its really easy to set up a very simple website and have it just work fast.</p>
<p>Now, the bad: One of the major reasons why I thought that django was so great was the vibrant community of people writing apps. However, I think that this also exposes django&#8217;s basic architectural flaw: the app system is not the right system to break up functionality. This is why there is so much talk of <em>reusable apps</em>: most existing ones are hard to reuse.</p>
<p>I first tried pinax or one of the content management systems. As usual, you get a working website instantly, but then you hit a productivity barrier very fast. Then, I tried a bunch of apps to get the pieces of functionality I wanted and get them to play together. What I wanted to avoid was to fork the code and<br />
adapt it to my project. Then, I would be forced to maintain it and diverging from the main tree.</p>
<p>I tried. I really did. But I could never really get open id to work. I gave up on almost all of the apps I tried too. They would have a structure that didn&#8217;t fit into the rest of my application, I would need to tweak the templates (most  by reading the code to see what was going on, which names it exported). I would need to fix the urls and url names. I would basically be forking each app to work with my desires instead of re-using it. </p>
<p>Fundamentally, the app model is the wrong abstraction for reuse in web-applications. I don&#8217;t have an answer, but I know that the app model does not work. How does, say, recaptcha authentication fit into the app model? What are its models, its views, its templates? It&#8217;s better handled as a different sort of reuse. What if I want to have a photo gallery and have the insertion of new photos trigger a tweet? I always end up taking someone&#8217;s code and modifying when what I wanted was to take someone&#8217;s code and call it.</p>
<p>What finally broke the camels back was when I was working with a django model and thought <cite>Sqlalchemy would be so much better</cite>.  So, I decided to try Pylons.</p>
<p>Later that evening, I had ported almost all my existing work to Pylons. The next day, I had made progress. Also, I finally stopped feeling frustrated.</p>
<h3>Pylons</h3>
<p>Pylons seems to get a bit less attention. The reasoning seems to be: <cite>django is better for simple sites, Pylons for complex sites. Most sites are simple. Therefore, django is more popular.</cite></p>
<p>What I finally figured is that, if you&#8217;re writing most of the code yourself or editing other people&#8217;s stuff so badly that you might as well start from a couple of snippets, what is django buying you?</p>
<p>I can use sqlalchemy and I can use mako as a templating engine. I never really liked django&#8217;s ORM nor its templating engine. I know you can change the template language, but then other apps get very unhappy. Use best of breed for your tools instead of not-invented here is a good principle.</p>
<p>The debugger that comes with Pylons is awesome: if there is an error in your code, you can actually get an HTML+Ajax python shell on the webpage where you can inspect the state of the programme.  SQLAlchemy&#8217;s error messages are beautiful. Here&#8217;s a recent one (from FormAlchemy): <cite>No session found. Either bind a session explicitly, or specify relation options manually so FormAlchemy doesn&#8217;t try to autoload them.</cite></p>
<p>Here&#8217;s a screenshot of the debugger.</p>
<div id="attachment_283" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.mutualinformation.org/wp-content/uploads/2010/03/pylons_error1.png"><img src="http://www.mutualinformation.org/wp-content/uploads/2010/03/pylons_error1-300x91.png" alt="" title="pylons_error" width="300" height="91" class="size-medium wp-image-283" /></a><p class="wp-caption-text">Pylons Error</p></div>
<p>The contrast with django is immense.  After months of daily use, I still feel stumped trying to decipher its error messages. Not always, but enough times that its frustrating. Just yesterday, another friend called me up on a Django problem. manage.py was not finding settings.py anymore because django plays around with the paths and the imports in a weird way and there was an impossible to understand relationships to recent changes because it worked in previous versions.</p>
<p>There is nothing wrong with <strong>magic</strong> in a system (rarely do you hear someone complain that their framework is too magical for working with files, <cite>just let me see the disk sectors</cite>). But <strong>unfinished magic</strong> is very frustrating. Unfinished magic most often manifests when the error messages are not magical. So, it just works or it just doesn&#8217;t work. As if your operating system spat out a bunch of references to virtual file systems and inodes when you mistyped a file name instead of saying <cite>File <strong>mixpelled.txt</strong> not found</cite>. Django has too much unfinished magic: if you make a little typo, then you get an obscure error in a place unrelated to your typo. SQLAlchemy is <strong>finished magic</strong>: half the time it even suggests a solution to<br />
your problem.</p>
<p>Then there are the little irritations in django: the <code>Sites</code> app is obviously something that solved a problem in django&#8217;s original environment, but is a nuisance for the other 99% of cases. The fact that the username cannot be an email: Such a limitation is out of place in a general purpose framework.</p>
<p>I do miss the admin interface.</p>
<h3>Summary</h3>
<p>Django is good if your website is simple and Pylons is better if it is complex. I still agree with this statement, but I have lowered the bar for simple dramatically to mean &#8220;almost static&#8221; webpages. Pylons has a slightly higher learning curve and takes a bit of time to get to something that works well, but, if you know django, you can start writing code very very fast because most of the concepts are so similar.</p>
<p>The debugger on Pylons is so nice it makes it worth the switch.</p>
<p>Right now, unless my site was braindead simple, I would never go back to Django.</p>
<p><small>Follow me on twitter: <a href="http://twitter.com/luispedrocoelho">@luispedrocoelho</a></small></p>
<p class="wp-flattr-button"></p> <p><a href="http://www.mutualinformation.org/?flattrss_redirect&amp;id=282&amp;md5=5ea6c6e61f985d3a582710a751a6f1da" title="Flattr" target="_blank"><img src="http://www.mutualinformation.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mutualinformation.org/2010/03/why-i-switched-to-pylons-after-using-django-for-six-months/feed/</wfw:commentRss>
		<slash:comments>55</slash:comments>
		</item>
	</channel>
</rss>

