<?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>Codegrind</title>
	<atom:link href="http://jordanovski.com/feed" rel="self" type="application/rss+xml" />
	<link>http://jordanovski.com</link>
	<description>Homepage of Dusko Jordanovski</description>
	<lastBuildDate>Fri, 18 Jun 2010 17:37:08 +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>Macromap</title>
		<link>http://jordanovski.com/macromap</link>
		<comments>http://jordanovski.com/macromap#comments</comments>
		<pubDate>Fri, 18 Jun 2010 17:37:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jordanovski.com/?p=269</guid>
		<description><![CDATA[Something I just found in my code archive. A Starcraft 2 build order creation tool! 
Github link: http://github.com/skid/macromap
]]></description>
			<content:encoded><![CDATA[<p>Something I just found in my code archive. A Starcraft 2 build order creation tool! </p>
<p>Github link: <a href="http://github.com/skid/macromap">http://github.com/skid/macromap</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jordanovski.com/macromap/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strobe Templates</title>
		<link>http://jordanovski.com/strobe-templates</link>
		<comments>http://jordanovski.com/strobe-templates#comments</comments>
		<pubDate>Mon, 17 May 2010 21:23:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Node.js]]></category>

		<guid isPermaLink="false">http://jordanovski.com/?p=258</guid>
		<description><![CDATA[I just published a project on github. It's a clone of the django templating engine for Node.js. Check it here: http://github.com/skid/strobe-templates
]]></description>
			<content:encoded><![CDATA[<p>I just published a project on <a href="http://github.com">github</a>. It's a clone of the django templating engine for Node.js. Check it here: <a href="http://github.com/skid/strobe-templates">http://github.com/skid/strobe-templates</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jordanovski.com/strobe-templates/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Canvas Tetris</title>
		<link>http://jordanovski.com/canvas-tetris</link>
		<comments>http://jordanovski.com/canvas-tetris#comments</comments>
		<pubDate>Thu, 21 Jan 2010 00:10:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jordanovski.com/?p=243</guid>
		<description><![CDATA[Here's a Tetris game I wrote during my spare time in the weekend. It's one HTML file and it uses the HTML canvas element only.
You're gonna need a HTML 5 browser to see it in action. That means Firefox 3.5+, Safari 4 or Google Chrome.
I would very much appreciate remarks on the code :)
Here's the [...]]]></description>
			<content:encoded><![CDATA[<p>Here's a Tetris game I wrote during my spare time in the weekend. It's one HTML file and it uses the HTML canvas element only.</p>
<p>You're gonna need a HTML 5 browser to see it in action. That means Firefox 3.5+, Safari 4 or Google Chrome.</p>
<p>I would very much appreciate remarks on the code :)</p>
<p>Here's the <a href="http://jordanovski.com/tetris.html">link</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jordanovski.com/canvas-tetris/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django vs Pylons</title>
		<link>http://jordanovski.com/django-vs-pylons</link>
		<comments>http://jordanovski.com/django-vs-pylons#comments</comments>
		<pubDate>Sun, 29 Nov 2009 02:08:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Pylons]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://jordanovski.com/?p=225</guid>
		<description><![CDATA[This is an attempt to make a non-biased comparison between Django and Pylons. I did a brief comparison of the two at work since we needed a web framework for our new project.
We are making a web application that will serve as a frontend to a bank database. The application is going to allow bank [...]]]></description>
			<content:encoded><![CDATA[<p>This is an attempt to make a non-biased comparison between Django and Pylons. I did a brief comparison of the two at work since we needed a web framework for our new project.</p>
<p>We are making a web application that will serve as a frontend to a bank database. The application is going to allow bank employees to insert and track interbank loans and their repayments. The database is actually abstracted behind a layer built with Twisted, so the web application will only use XMLRPC calls to communicate with the database, hence no ORM.</p>
<p>As of the moment of writing, Django is in version 1.1 and Pylons is in version 0.9.7. Both of the frameworks are mature and tested in production in some major websites. Django has <a href="http://washingtonpost.com">Washington Post</a> and pylons has <a href="http://reddit.com">Reddit</a>.</p>
<p>The frameworks are quite different in philosophy, although both follow the same MVC paradigm. Django has more magic and less code, while pylons has more code and less magic. Pylons is essentially a bare-bones wrapper around the WSGI specification that uses 3rd party modules for templating, database interaction, routing and just about anything else, while Django is aimed towards rapid development of web applications and has everything packed inside of it - it's own template system, routing and ORM. This allows Django to establish high reusability for code between different projects. On the other hand, the developer is limited to one ORM and templating system.</p>
<p>Let's go point by point. These are not all the relevant features in a web framework by any means, but they should give the reader a general overview of the differences and the strengths of the frameworks in the most important areas.</p>
<p><span id="more-225"></span></p>
<h3>Structure</h3>
<p>Pylons reminds on Ruby on Rails here. It keeps all the controllers in one directory, all the models in another directory and all the templates in a third directory. Django is made to be more "pluggable". In Django you create apps that are self-contained, meaning they have their controller, models and possibly templates in one python package that you can easily pull out of the project and put it in another one. The "pluggability" of Django comes from the fact that you're using the same components in every project.</p>
<p>Pylons on the other hand is made to be more "swappable", meaning that you can easily switch a core functionality module, like the templating engine, with another one. This however, limits the reusability of your applications between projects.</p>
<p>I like Django's approach better because the files seem much better organized, but there is a slight disadvantage - the files have the same names. For example: if you have 4 apps, each of them contains a views.py file and it's a bit confusing when you got the mall open at once in an editor. But that's really nitpicking.</p>
<h3>Documentation</h3>
<p>Being a collection of 3rd party modules, Pylons' documentation is scattered all over the internet. You will need to read the SQLAlchemy docs for database, Mako templates' docs for templating, Routes' docs for routing, Paste's docs for general project tasks, Babel's docs for internationalization,  etc. Django on the other hand has very extensive documentation on one place, and I must say it's much more comprehensive. There is one book for Pylons, but there are a dozen books for Django. This doesn't say much, except that Django is clearly more popular. This is a clear advantage to Django.</p>
<h3>Community and Development</h3>
<p>The Django community is huge compared to Pylon's. On <a href="http://stackoverflow.com">Stack Overflow</a> there are 3600 questions tagged "django" and only 100 tagged "pylons". Google trends shows similar results (around 15 times more for Django). I can't really talk about Pylon's community, but Django's is really friendly and helpful. Django also seems to be in much more active development than Pylons, but that's maybe because there is more work to be done. Pylons depends more on the development of the 3rd party modules it uses.</p>
<h3>Learning Curve</h3>
<p>This is somewhat dependent on the previous two points. A larger community, more code samples and better documentations works a long way towards flattening the learning curve. On the other hand we should consider our previous experience with the two frameworks. If you already are familiar with SQLAlchemy and the WSGI spec, then Pylons requires less work to learn. Otherwise if you have experience with just python, then Django would be easier to grasp, only because of the availability of resources.</p>
<h3>Coding required</h3>
<p>Django, in principle, requires less code to do the same task. Less code means more magic and that is not always the best thing. Django was developed in a newspaper publishing environment where deliveries were really time-constrained and the authors created some very impressive tools to enable them to add website features quickly. For instance, Django comes with an automatic administration app  that doesn't require you to write a single line of code. If you, however, strip Django of its ORM - much of this magic goes away.</p>
<h3>Templates</h3>
<p>Pylons the <a href="http://www.makotemplates.org/">Mako</a> templating language by default, but you can also use others, like <a href="http://jinja.pocoo.org/">Jinja</a>. Jinja (as Jon pointed out) is based on Django templates and I find it much cleaner than Mako because it restricts you from running arbitrary python code inside template files (as does Django).</p>
<p>People tend to say that Mako templates are more powerful, but then PHP is also very powerful as a templating language and it always produces illegible tag soup. It's very tempting to start assigning and calculating values inside templates, especially when you're really tired.</p>
<p>Django templates and Jinja give you just enough power to get the job done and not a watt more :) They have only two special constructs - double braces for outputting values and brace followed by percent sign for invoking template tags. In Mako you have:"&lt;%" for opening python blocks, "${variable}" for variable printing, "%" for control structures, "&lt;%!" for module-level blocks and "##" for comments.</p>
<p><strong>Update</strong>: I just had a look at Jinja templates and it looks like they offer some interesting tools on top of Django templates, like simple expressions (e.g. {{2+2}}) inside the template tags. The only way to do some of the stuff that Jinja does out of the box with Django is by writing your own template tag. There is a nice post on why you should use Jinja, even with Django <a href="http://www.davidcramer.net/code/113/using-jinja-with-django.html">here</a>.</p>
<p>Anyway, you have the choice with Pylons.</p>
<h3>Routing</h3>
<p>Pylons uses the <a href="http://routes.groovie.org/">Routes</a> library for routing. Routes is a clone of Ruby on Rails routing which is also inferior to Django's routing. Routes is implicit in a way that you define a route. For example "/{controller}/{action}" routes to the 'action' method of the 'controller' class in your project. There is a possibility to use regular expressions but they come as additional parameters to the route declaration. Django's routes pair a regex to an explicitly specified view. Also they are much less verbose. As far as I can see (I may be wrong) Routes keeps all the routing declarations in a single file, while in Django you can chop off the first part of a URL and pass the rest to another url regex thus decoupling project apps.</p>
<p>Don't get me wrong here; both routing systems are capable, but Django's is just more natural and more pythonic.</p>
<h3>ORM and Database</h3>
<p>I don't have any experience with <a href="http://www.sqlalchemy.org/">SQLAlchemy</a>, but from what I read around it sounds like it's better than Django's ORM. It's the only option if you intend to use SQL Server anyway. Django was developed before SQLAlchemy was around so it uses it's own ORM, which is quite nice really. Coming from PHP, it's light years ahead of anything PHP has (take a look at <a href="http://propel.phpdb.org/trac/">Propel</a>).</p>
<p>Since I can't say too much on this particular point, here's a few links that can fill you in:</p>
<p><a href="http://adam.gomaa.us/blog/2007/aug/1/five-things-i-hate-about-django/">http://adam.gomaa.us/blog/2007/aug/1/five-things-i-hate-about-django/</a></p>
<p><a href="http://reliablybroken.com/b/2008/06/choosing-sqlalchemy-over-django/">http://reliablybroken.com/b/2008/06/choosing-sqlalchemy-over-django/</a></p>
<p><a href="http://outatime.wordpress.com/2008/03/26/django-sqlalchemy/">http://outatime.wordpress.com/2008/03/26/django-sqlalchemy/</a></p>
<p><a href="http://jmoiron.net/blog/about-sqlalchemy-and-djangos-orm/">http://jmoiron.net/blog/about-sqlalchemy-and-djangos-orm/</a></p>
<h3>Choices, Choices</h3>
<p>In the end we went with Pylons. Our problem is not yet completely defined so we have to leave a lot of room for maneuvers. We don't know if the application will be just a single form or it will grow to replace the current desktop banking application. It's not going to have a database backend, no classic administration panel and no classic authentication. These are the areas where Django shines. If you leave them behind, the advantages that Django has fade out. Pylons however, with it's flexibility is a perfect choice for this kind of web applications.</p>
<p>On the other hand, if I had a standard website project I would go with Django all the way. It's really the best at rapid development of web applications and yes, the magic feels good. Sometimes you really don't care about what you are able to do <em>with</em> your framework, rather for what your framework can do <em>for</em> you. And Django can do an awful lot.</p>
<p>If you ask me, the biggest strength is the biggest weakness of both frameworks.</p>
<p>Pylons is a collection of 3rd party libraries. This means that you always get the latest and greatest of the Python world. But this also means that the community is much less compact and there is more manual work. Also, there is the problem of choice - you need to spend time and think about which component you'll use for each task. You don't want to end up with several projects all using different templating engines.</p>
<p>Django has the benefits of a huge, unified community, but it's weakness is that it's components are coupled and interdependent. <a href="http://www.youtube.com/watch?v=i6Fr65PFqfk&amp;feature=player_embedded">Here's a really good talk about the Django problems</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jordanovski.com/django-vs-pylons/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Details are everything</title>
		<link>http://jordanovski.com/details-are-everything</link>
		<comments>http://jordanovski.com/details-are-everything#comments</comments>
		<pubDate>Sun, 01 Nov 2009 21:55:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jordanovski.com/?p=199</guid>
		<description><![CDATA[Attention to details can make or break a product. I was just downloading dropbox and I noticed a facinating thing. On the download page there are instructions for installing. It's just a few images of your browser download window and the installation confirm popup telling you where to click. Now the fascinating thing is that [...]]]></description>
			<content:encoded><![CDATA[<p>Attention to details can make or break a product. I was just downloading <a href="http://dropbox.com">dropbox</a> and I noticed a facinating thing. On the download page there are instructions for installing. It's just a few images of your browser download window and the installation confirm popup telling you where to click. Now the fascinating thing is that those are images of <strong>YOUR </strong>browser. They change depending on the browser or operating system you use to visit the site so that there are no confusions. Now this is what I call attention to detail. That is why Blizzard is making the finest games and Microsoft is making crappy OS-es. Kudos Dropbox!</p>
]]></content:encoded>
			<wfw:commentRss>http://jordanovski.com/details-are-everything/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maybe exceptions are not so awesome after all</title>
		<link>http://jordanovski.com/maybe-exceptions-are-not-so-awesome-after-all</link>
		<comments>http://jordanovski.com/maybe-exceptions-are-not-so-awesome-after-all#comments</comments>
		<pubDate>Sat, 15 Aug 2009 19:32:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://jordanovski.com/?p=188</guid>
		<description><![CDATA[Maybe I got a bit rusty on my 1 month vacation, but today I ran into a simple problem that I spent 2 hours solving. I Am working on a website made in Django and I decided to make some changes to the model in one of the apps in the project. I currently have [...]]]></description>
			<content:encoded><![CDATA[<p>Maybe I got a bit rusty on my 1 month vacation, but today I ran into a simple problem that I spent 2 hours solving. I Am working on a website made in Django and I decided to make some changes to the model in one of the apps in the project. I currently have 3 apps - game, content and members. One of the classes of the content model imports a class from the game model, but I decided to remove that particular class.</p>
<p>After syncing the DB I noticed that the database tables for the content app are missing.This was strange, because no errors were reported. I tried to do a "python manage.py sqlall content" and the shell threw an error that it couldn't find the content app on my PYTHONPATH.</p>
<p>Error: App with label content could not be found. Are you sure your INSTALLED_APPS setting is correct?</p>
<p>I tried all kinds of different stuff until i found a mailing list that said that if you have import errors in some module, you cannot import it, which is to be expected, but the error messages that come up are all but informative. The message that my PYTHONPATH is incomplete in no way suggests that I have an import error.</p>
<p>What does this have to do with exceptions ?</p>
<p>Well, I'll talk about another example first: While I was writing a screen scraper, I used a lot of regular expressions. The regular expressions return a match object if they successfully make a match and None if they don't. If you try and call the .group() method on a Match object - it does the job, but calling it on a None object throws and AtrributeError. I used to catch this exception in the upper layers of my program in order to avoid crashing the script on invalid input. This turned out to be a bad idea since all kinds of other stuff throws an AttributeError and makes the debugging a living hell.</p>
<p>I suspect that the same thing is going on in Django. Failure to import inside a module throws an ImportError which Django interprets as a missing module - only the module isn't missing - its a "submodule" that is missing. But the exceptions are the same, no matter on which level they happen.</p>
<p>Using exceptions correctly requires defining your own classes for every particular error that you may run into. This is a lot of extra code and need's to be weighed against the old-fashioned error codes.</p>
]]></content:encoded>
			<wfw:commentRss>http://jordanovski.com/maybe-exceptions-are-not-so-awesome-after-all/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A recursive django template tag</title>
		<link>http://jordanovski.com/a-recursive-django-template-tag</link>
		<comments>http://jordanovski.com/a-recursive-django-template-tag#comments</comments>
		<pubDate>Fri, 05 Jun 2009 19:37:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[recursive]]></category>
		<category><![CDATA[template tag]]></category>

		<guid isPermaLink="false">http://jordanovski.com/?p=169</guid>
		<description><![CDATA[Here is my attempt to create a "silver bullet" tag for printing tree structures with the Django templating language. It's far from a silver bullet, tho, but it can do basic stuff:
It's a modification of the standard "for" tag and i have kept the counter, counter0, first and last variables, only this time they are [...]]]></description>
			<content:encoded><![CDATA[<p>Here is my attempt to create a "silver bullet" tag for printing tree structures with the Django templating language. It's far from a silver bullet, tho, but it can do basic stuff:</p>
<p>It's a modification of the standard "for" tag and i have kept the counter, counter0, first and last variables, only this time they are not attributes to forloop, but rather to recurseloop. Check the docstring for more info.</p>
<p>For example, if you need to print comments that have other comments as replies, you would want the comments to appear one below the other, but the replies to be indented a bit. Let's say 20 pixels per level. So the code would be:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> load file_that_contains_recurse_tag <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
<span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> recurse comment <span style="color: #ff7700;font-weight:bold;">in</span> comments children=<span style="color: #483d8b;">&quot;replies&quot;</span> indent=<span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>,<span style="color: #ff4500;">20</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
  <span style="color: #66cc66;">&lt;</span>div style=<span style="color: #483d8b;">'margin-left:{{indent}}px;'</span><span style="color: #66cc66;">&gt;</span>
    <span style="color: black;">&#123;</span><span style="color: black;">&#123;</span> comment.<span style="color: black;">text</span> <span style="color: black;">&#125;</span><span style="color: black;">&#125;</span>
  <span style="color: #66cc66;">&lt;</span>/div<span style="color: #66cc66;">&gt;</span>
<span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> endrecurse <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span></pre></div></div>

<p>This tag will expect a list of comments (top-level) that have a property named 'replies' which contain other comments.</p>
<p>indent is an argument that will start with the float value of 0 and get increased by 20 on each depth level of the recursion. You can pass as many variables like indent as you like. They must be in the form</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">name=<span style="color: black;">&#40;</span><span style="color: #008000;">float</span>,<span style="color: #008000;">float</span><span style="color: black;">&#41;</span></pre></div></div>

<p>or strings will also work but must be enclosed in quotes</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">name=<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;string&quot;</span>,<span style="color: #483d8b;">&quot;string&quot;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Caveat: You must not leave blank spaces between the equal signs when assigning children and additional incremented arguments. I will fix this later.</p>
<p>A second scenario is when you need the parent element to <strong>contain </strong>the children, like in unordered/ordered lists. In that case you can use the {% yield %} tag inside the recurse block. This tag will output the HTML between the recurse and endrecurse tags if there are any children in the current iteration item, or it will output nothing if there are no children.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> recurse comment <span style="color: #ff7700;font-weight:bold;">in</span> comments children=<span style="color: #483d8b;">&quot;replies&quot;</span> indent=<span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>,<span style="color: #ff4500;">20</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
<span style="color: #66cc66;">&lt;</span>div style=<span style="color: #483d8b;">'margin-left:20px;'</span><span style="color: #66cc66;">&gt;</span>
  <span style="color: black;">&#123;</span><span style="color: black;">&#123;</span> comment.<span style="color: black;">text</span> <span style="color: black;">&#125;</span><span style="color: black;">&#125;</span>
  <span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> <span style="color: #ff7700;font-weight:bold;">yield</span> <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
  <span style="color: #66cc66;">&lt;</span>/div<span style="color: #66cc66;">&gt;</span>
<span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> endrecurse <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span></pre></div></div>

<p>The yield tag (as for now) can <strong>only </strong>be used directly inside the recurse block, much like the {% else %} tag can only be used directly inside the if-endif block. This means that you can't make code like</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> recurse comment <span style="color: #ff7700;font-weight:bold;">in</span> comments children=<span style="color: #483d8b;">&quot;replies&quot;</span> indent=<span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>,<span style="color: #ff4500;">20</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
<span style="color: #66cc66;">&lt;</span>div style=<span style="color: #483d8b;">'margin-left:{{indent}}px;'</span><span style="color: #66cc66;">&gt;</span>
  <span style="color: black;">&#40;</span><span style="color: black;">&#123;</span><span style="color: black;">&#123;</span> comment.<span style="color: black;">text</span> <span style="color: black;">&#125;</span><span style="color: black;">&#125;</span><span style="color: black;">&#41;</span>
<span style="color: #66cc66;">&lt;</span>/div<span style="color: #66cc66;">&gt;</span>
  <span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> <span style="color: #ff7700;font-weight:bold;">if</span> cond <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
    <span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> <span style="color: #ff7700;font-weight:bold;">yield</span> <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
  <span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> endif <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
<span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> endrecurse <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span></pre></div></div>

<p>This will fail with an invalid block tag exception. You can check the docstring of the do_recurse function inside the code for more info. Also, you may want to check this code for errors since I just wrote it today, and haven't had much time to test it.</p>
<p><a href="http://jordanovski.com/wp-content/uploads/recurse.zip">Download and comment on any errors you find</a> :)</p>
]]></content:encoded>
			<wfw:commentRss>http://jordanovski.com/a-recursive-django-template-tag/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The Leopard 10.5.7 update, the keychain and the clock.</title>
		<link>http://jordanovski.com/os-x-1057-update-the-keychain-and-the-clock</link>
		<comments>http://jordanovski.com/os-x-1057-update-the-keychain-and-the-clock#comments</comments>
		<pubDate>Wed, 20 May 2009 16:22:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[10.5.7]]></category>
		<category><![CDATA[clock reset]]></category>
		<category><![CDATA[keychain]]></category>
		<category><![CDATA[Leopard]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://jordanovski.com/?p=161</guid>
		<description><![CDATA[I installed the 10.5.7 update for Mac OS X Leopard and after logging in i got a prompt that the system date was reset (to 1990-something). I am using the automatic date setting which gets the current date and time from apple.com so I figured that it was no biggie. But after a short while [...]]]></description>
			<content:encoded><![CDATA[<p>I installed the 10.5.7 update for Mac OS X Leopard and after logging in i got a prompt that the system date was reset (to 1990-something). I am using the automatic date setting which gets the current date and time from apple.com so I figured that it was no biggie. But after a short while I noticed that I have no wireless network connection and that the password for the network was blank, which is odd, since I am supposed to have this password saved in the keychain.</p>
<p>I opened up the keychain access and checked the "show password" on the wireless network in my office (I don't remember it, ofc ) and i got a message that "Access to this item is restricted.".</p>
<p>After a lot of digging around (on another laptop) I found out that <strong>if the current system date is earlier than the creation date of your keychain file (~/Library/Keychain/login.keychain) you cannot view the items in it. </strong>So here's a loophole: No internet - can't set correct system date - no correct system date - no internet ....</p>
<p>Luckily for me, I devised an extremely clever plan - I manually set the date to today, got the keychain working, and then switched back to auto-date. Ha-ha.</p>
]]></content:encoded>
			<wfw:commentRss>http://jordanovski.com/os-x-1057-update-the-keychain-and-the-clock/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python 2.6, Leopard 10.5.6 and psycopg 2.0.10</title>
		<link>http://jordanovski.com/python-26-leopard-1056-and-psycopg-2010</link>
		<comments>http://jordanovski.com/python-26-leopard-1056-and-psycopg-2010#comments</comments>
		<pubDate>Tue, 12 May 2009 23:37:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://jordanovski.com/?p=150</guid>
		<description><![CDATA[Psycopg2 is the postgreSQL adapter for Django. If you are trying to set it up on Mac OSX (using the supplied setup.py script) you may run into an error saying
File "setup.py", line 219, in finalize_options
NameError: global name 'w' is not defined

This is a simple thing to fix: open the setup.py file coming with psycopg2 and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://initd.org/pub/software/psycopg/">Psycopg2</a> is the <a href="http://postgresql.org">postgreSQL</a> adapter for Django. If you are trying to set it up on Mac OSX (using the supplied setup.py script) you may run into an error saying</p>
<pre><code>File "setup.py", line 219, in finalize_options
NameError: global name 'w' is not defined
</code></pre>
<p>This is a simple thing to fix: open the setup.py file coming with psycopg2 and edit the line 219 like this:</p>
<pre><code>except (Warning, w):
</code></pre>
<p>Remove the braces</p>
<pre><code>except Warning, w:
</code></pre>
<p>In python 2.6 (at least) putting exceptions in brackets will catch multiple exceptions in this case Warnings and <strong>'w'</strong>s. The author clearly meant to get the Warning instance as 'w'. Also, do not forget to edit the setup.cfg file on line 28 and type in your pg_config path. Mine is</p>
<pre><code>pg_config=/Library/PostgreSQL/8.3/bin/pg_config
</code></pre>
<p>and so should yours be if you used the default installer package for mac OS X. Oh, yeah, you need to install postgres before installing psycopg2.</p>
]]></content:encoded>
			<wfw:commentRss>http://jordanovski.com/python-26-leopard-1056-and-psycopg-2010/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Maze Drawer</title>
		<link>http://jordanovski.com/always-turn-left-draw-mazes</link>
		<comments>http://jordanovski.com/always-turn-left-draw-mazes#comments</comments>
		<pubDate>Wed, 01 Apr 2009 12:56:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[always turn left]]></category>
		<category><![CDATA[code jam]]></category>
		<category><![CDATA[draw maze]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[practice]]></category>

		<guid isPermaLink="false">http://jordanovski.com/?p=126</guid>
		<description><![CDATA[This piece of python code is going to draw some mazes in a .PNG format. It's a side-product of the solution to the Google Code Jam practice problem B called "Always turn left". The script takes the input data sets and draws the mazes described with every test case. You will need Python with Python [...]]]></description>
			<content:encoded><![CDATA[<p>This piece of python code is going to draw some mazes in a .PNG format. It's a side-product of the solution to the <a href="http://code.google.com/codejam/contest">Google Code Jam</a> practice problem B called "Always turn left". The script takes the input data sets and draws the mazes described with every test case. You will need Python with Python Imaging Library (PIL) installed. If you're working on OS X like me, check out <a href="http://passingcuriosity.com/2009/installing-pil-on-mac-os-x-leopard/">this link</a> for some tips on how to install PIL.</p>
<p>To run the script type "python left.py" and it will ask for a file path containing the test cases. It will create a png image for each test case in the directory from which the program is run.</p>
<p><a href="http://jordanovski.com/wp-content/uploads/left.zip">Download script + data set and make some mazes</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jordanovski.com/always-turn-left-draw-mazes/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
