<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2" -->
<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/"
	>

<channel>
	<title>finally{}</title>
	<link>http://www.jjude.com</link>
	<description>In the end, everything will be fine; if it is not fine, it is not the end</description>
	<pubDate>Mon, 05 May 2008 16:53:57 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2</generator>
	<language>en</language>
			<item>
		<title>Learning to test</title>
		<link>http://www.jjude.com/index.php/archives/75</link>
		<comments>http://www.jjude.com/index.php/archives/75#comments</comments>
		<pubDate>Mon, 05 May 2008 16:53:57 +0000</pubDate>
		<dc:creator>Joseph Jude</dc:creator>
		
		<category><![CDATA[Django]]></category>

		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.jjude.com/index.php/archives/75</guid>
		<description><![CDATA[Along with learning Python, I am learning other components of web development - most importantly testing.]]></description>
			<content:encoded><![CDATA[<p>I started programming in C. Then moved to VB and VC++. Then I moved to packaged software solutions like Vantive and Peoplesoft. In all these days, I managed not to write automated test cases. It is not that I didn&#8217;t want to, but it wasn&#8217;t the practice. I spent most of my time, learning and programming tools, languages and other similar aspects but never concentrated on automated testing.</p>
<p>But when one starts to write an application on their own, their perspective differ. More so when it is an open source. Now I want to test my software enough to avoid embarrassment in the community. I don&#8217;t want to release a (open-source) software without testing. It is not that the application will not contain any bugs; but I&#8217;ve taken all the steps that I know to make the application bug-free.</p>
<p>When one treads on an unknown territory any kind of hand-holding is appreciated. With detailed documentation, Django makes it easier to get into testing territory. Because of the fear of unknown, I&#8217;ve been postponing writing test cases for days. Then one evening, I sat down, read through Django&#8217;s documentation on test cases, browsed few more sample test cases (that is the beauty of open source) and I started to write test cases. It wasn&#8217;t scared of writing test cases any more. It came in so easily!</p>
<p>Okay! I haven&#8217;t yet done the full test suite. I&#8217;ve understood and managed to write test cases to test the views alone (Django Test Client). I still need to write detailed unit test cases and in-browser testing.</p>
<p>But at least this is a good start.</p>
<p>P.S: You can browse the the tests as part of <a title="http://code.google.com/p/s-o-l/" href="http://code.google.com/p/s-o-l/">http://code.google.com/p/s-o-l/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jjude.com/index.php/archives/75/feed</wfw:commentRss>
		</item>
		<item>
		<title>Whats on my reading list</title>
		<link>http://www.jjude.com/index.php/archives/74</link>
		<comments>http://www.jjude.com/index.php/archives/74#comments</comments>
		<pubDate>Sun, 27 Apr 2008 15:19:13 +0000</pubDate>
		<dc:creator>Joseph Jude</dc:creator>
		
		<category><![CDATA[Management]]></category>

		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.jjude.com/index.php/archives/74</guid>
		<description><![CDATA[List of blogs that I keep returning to]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a voracious reader. I spend a lot (both money and time) on books. Blogs bring in a lot of flexibility and casualness to such a habit. I keep modifying my reading list according to perceived benefits. Here are some of them:</p>
<p><strong>Management Thoughts</strong></p>
<p><a href="http://hbswk.hbs.edu/" target="_blank">HBS Working Knowledge</a>: From Harvard Business School. Academic discussions on management.</p>
<p><a href="http://www.insidecrm.com/blog/" target="_blank">InsideCRM - The CRM Industry&#8217;s Web Resource</a>, <a href="http://the56group.typepad.com/pgreenblog/" target="_blank">PGreenblog</a> &amp; <a href="http://www.mareeba.co.uk/blog/index.htm" target="_blank">The CRM Consultant</a>: Being a CRM consultant, I look for blogs providing decent CRM information. I added these blogs recently on my reading list. So far I am happy with them.</p>
<p><a href="http://ravenyoung.spaces.live.com/" target="_blank">Raven&#8217;s Brain</a>: She has good information on project management. Not only that she collates pretty good articles on project management too.</p>
<p><a href="http://www.scottberkun.com" target="_blank">Scottberkun.com</a>: Scott Berkun&#8217;s <a href="http://www.amazon.com/Project-Management-Theory-Practice-OReilly/dp/0596007868" target="_blank">The Art of Project Management</a> is a must-read for all project managers. His web page is a collection of information on his books and essays. Be sure to check out his <a href="http://lists.scottberkun.com/listinfo.cgi/pmclinic-scottberkun.com" target="_blank">mailing list</a> (you need to register) for very active discussions on project and people management.</p>
<p><a href="http://www.linkedin.com/answers/browse/management/MGM" target="_blank">LinkedIn Answers: Management</a>: Another very professional and active discussions on anything related to management - projects, people, outsourcing and so on. I&#8217;ve found these discussions to be focused and stimulating, to say the least.</p>
<p><a href="http://elementaltruths.com" target="_blank">ElementalTruths.Com</a>: Reg Adkins is a behavioral consultant. I found his early writings to be very informative. I feel that recently, he has deviated from his core strengths. But I still keep reading him.</p>
<p><strong>Technical</strong>:</p>
<p><a href="http://blog.greysparling.com/index.htm" target="_blank">Grey Sparling PeopleSoft Expert&#8217;s Corner</a>: I&#8217;m from <a href="http://en.wikipedia.org/wiki/Vantive" target="_blank">Vantive</a> world who moved on to Peoplesoft world. I don&#8217;t develop in Peoplesoft but manage two projects (with some excellent team leads) in Peoplesoft. Tips from Grey Sparling helps me understand Peoplesoft little better.</p>
<p><a href="http://www.djangoproject.com/community/" target="_blank">The Django community aggregator</a>: I&#8217;ve recently started with Django, a web framework in Python. I find Django easy to learn and Python easy to code. Hopefully I can develop some decent, useful applications in Django. I already developed <a href="http://code.google.com/p/s-o-l/" target="_blank">SOL</a>, a Twitter clone for our department use.</p>
<p><a href="http://www.joelonsoftware.com" target="_blank">Joel on Software</a>: I&#8217;m not sure if this should be under Technical or under Management, because Joel speaks authoritatively on both topics. Whatever be the topic, his articles are very informative of the subject.</p>
<p><a href="http://reddit.com/r/programming/" target="_blank">programming: what&#8217;s new online</a>: Reddit&#8217;s collection of articles of interest on Programming. These articles are rated socially and hence generally worth reading.</p>
<p><a href="http://www.hanselman.com/blog/" target="_blank">Scott Hanselman&#8217;s Computer Zen</a>: I stumbled on Scott Hanselman&#8217;s blog while looking for useful tools. He not only blogs about useful utilities but about .NET as well.</p>
<p><a href="http://www.yourdonreport.com" target="_blank">The Yourdon Report</a>: Ed Yourdon is the authority on System Analysis and Design. Those concepts introduced by him are still so relevant. I admire his energy - he blogs, travels a lot, <a href="http://twitter.com/yourdon" target="_blank">micro-blogs</a> and still come out with good articles.</p>
<p><a href="http://www.linkedin.com/answers/browse/technology/TCH" target="_blank">LinkedIn Answers: Technology</a>: Related to LinkedIn Management Answers. I don&#8217;t find this discussion forum that useful like the other one. Yet, time to time I get some valuable tips from this forum.</p>
<p><strong>Indian blogs</strong>:</p>
<p><a href="http://www.anitabora.com/blog" target="_blank">Just a little something</a>:I envy Anita&#8217;s photography skills and admire her nomadic spirit. Every time I see one of her photos, I wish to shoot like that. I visited her Photography Exhibition too.</p>
<p><a href="http://ouchmytoe.com" target="_blank">Ouch My Toe!</a>: Jammy can make you laugh. Sometimes louder. With all the sarcasm, I wonder how he is not yet put in jail or divorced (his wife is the point of jokes in most of the entries).</p>
<p><a href="http://prabhukrish.net" target="_blank">Prabhu n Ferrari</a>: If you understand Tamil, be sure to read his He-She series. They are humorous. He should publish his series using the Depot&#8217;s self-publish service.</p>
<p><a href="http://tastypalettes.blogspot.com/" target="_blank">Tasty Palettes</a>: Food blog of an ex-colleague. I&#8217;ve not yet had the opportunity to taste her work; but looking at her photos I am sure they are a treat.</p>
<p><a href="http://walkindaclouds.blogspot.com/" target="_blank">Walk in the clouds</a>: I can&#8217;t understand all of Seema&#8217;s poems; I am no good in literature. But the ones I understand are fantastic; most of them are romantic; few others are inspiring.</p>
<p><a href="http://www.gauravonomics.com/offconsumption" target="_blank">The Marketer Who Went Off Consumption</a>: I&#8217;ve added this newly on the list. Gaurav is on an experiment for a year - trying to be off consumption. He has a definition for it. But it is interesting to follow.</p>
<p><strong>Others</strong>:</p>
<p><a href="http://www.quotationspage.com/qotd.html" target="_blank">Quotes of the Day</a>: List of famous quotes. Not just inspiring quotes; but funny ones too.</p>
<p><a href="http://geekandpoke.typepad.com/" target="_blank">Geek &amp; Poke</a>: Cartoons on IT folks. I know Dilbert is a famous one. But some how I like Geek &amp; Poke.</p>
<p><a href="http://www.comedycentral.com/jokes/index.jhtml" target="_blank">Joke of the day</a>: Another site for relaxation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jjude.com/index.php/archives/74/feed</wfw:commentRss>
		</item>
		<item>
		<title>I am no bag of potatoes</title>
		<link>http://www.jjude.com/index.php/archives/73</link>
		<comments>http://www.jjude.com/index.php/archives/73#comments</comments>
		<pubDate>Sat, 26 Apr 2008 15:18:20 +0000</pubDate>
		<dc:creator>Joseph Jude</dc:creator>
		
		<category><![CDATA[Management]]></category>

		<category><![CDATA[Nothing Official]]></category>

		<guid isPermaLink="false">http://www.jjude.com/index.php/archives/73</guid>
		<description><![CDATA[Don't generalize; Differentiate the people]]></description>
			<content:encoded><![CDATA[<p>&#8216;<strong>Products should be generalized; People should be differentiated</strong>&#8216;</p>
<p>This is a paraphrased form of what Jack Welch says in his book, &#8216;Straight from the Gut&#8217;, about people and products. Coming from someone who managed both labor-intensive organizations and knowledge-intensive organizations, this is a valuable advice to manage people. Yet, often organizations get this wrong.</p>
<p>We build specialized products for customers but generalize employees by labeling them as those who belong to &#8216;last year batch&#8217; or &#8216;2 year batch&#8217; or &#8216;non-BE batch&#8217; or something similar. Though employees are encouraged to compete across these &#8216;labels&#8217;, they are limited to their batches while deciding for promotion and compensation. Such continued labeling and restrictions frustrates even the highly motivated employees.</p>
<p>Let us say a &#8216;fresher&#8217; demonstrates the quality of a team lead and does well in that role as well. However when the time of reckoning (appraisal time) comes in, she can&#8217;t be promoted because she hasn&#8217;t yet completed two years in the firm!</p>
<p>I face this issue year after year, both for myself and for those in my team. In my opinion the compensations and promotions should be based on merits and not on seniority. Wouldn&#8217;t that be misused? Of course yes. May be there should be few parameters on which a candidate should be evaluated for the role rather than seniority. And may be there should be a panel too.</p>
<p>I used to think that this issue pertains to Indian IT companies as most in the HR department are from government positions. However recently I read few posts on the same topic from <a href="http://lists.scottberkun.com/listinfo.cgi/pmclinic-scottberkun.com" target="_blank">Scott Berken PM Clinic Forums</a> (you need to register to read posts) and I was surprised that this is a global issue.</p>
<p>As I said earlier, I don&#8217;t know the best answer for this issue. I&#8217;m like the guy who goes to a million dollar budget movie with a hundred rupees ticket and feels that the movie is not that good. Can I direct a better movie? Hell no. But I can differentiate a good movie and a bad movie. So is this issue. Do I know a better solution? No. But I know that current solution is not the right one. It needs to change.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jjude.com/index.php/archives/73/feed</wfw:commentRss>
		</item>
		<item>
		<title>A tale of two customer services</title>
		<link>http://www.jjude.com/index.php/archives/72</link>
		<comments>http://www.jjude.com/index.php/archives/72#comments</comments>
		<pubDate>Mon, 21 Apr 2008 16:37:08 +0000</pubDate>
		<dc:creator>Joseph Jude</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.jjude.com/index.php/archives/72</guid>
		<description><![CDATA[How does customer service impact the opinion that the end users make of the online business? I present my experience with two vendors - I will probably go back to one vendor; and definitely not to the other.]]></description>
			<content:encoded><![CDATA[<p>I believe that as businesses become virtual, it is not only necessary to ensure that customers have good experience during pre-buying (as they browse through product catalogue) and buying (shopping cart) but post-buying (customer service) as well.</p>
<p><strong>A positive one</strong></p>
<p>I was introduced to <a href="http://www.zoom.in" target="_blank">Zoom In</a> by a colleague. He said that among the many online photo printing sites that he visited, he liked Zoom In. I decided to try it out because of his strong recommendation.</p>
<p>I had to agree with him because every thing was as easy as it could be - signing up, uploading photos and ordering photos. Uploading photos took sometime, but otherwise the site was quite fast; Utilizing their 25 free prints, I ordered few prints. The prints were neat and were delivered through courier. Neither the prints nor the delivery was expensive.</p>
<p>That was not the best part. I wanted to order few calendar prints that they advertised. When I tried to use one of the uploaded photos, it showed an red exclamation mark but didn&#8217;t throw up any message. I was bit confused and sent them an email. Promptly came the reply with proper explanation. I agree it could&#8217;ve been set in their page in the first place; but I was forgiving considering all the other pleasant experience that I had with <a href="http://www.zoom.in/index.aspx" target="_blank">Zoom In</a>.</p>
<p>When I shared this with my colleague, he informed that, <a href="http://www.zoom.in" target="_blank">Zoom In</a> claims that they read every e-mail and respond. There should be cost involved, but probably <a href="http://www.zoom.in" target="_blank">Zoom In</a> considers that it is worth. Good for them!</p>
<p><strong>A bad one</strong></p>
<p>I&#8217;ve been looking to purchase, &#8216;<a href="http://en.wikipedia.org/wiki/Peopleware" target="_blank">Peopleware</a>&#8216; by Tom. I searched in most of the &#8216;real&#8217; bookshops and whatever online bookshops that I knew, but without any success. So when I saw &#8216;Available&#8217; against &#8216;<a href="http://en.wikipedia.org/wiki/Peopleware" target="_blank">Peopleware</a>&#8216; in <a href="http://www.nbcindia.com/" target="_blank">NBC bookshop</a>, I was glad and immediately ordered one. I ordered one more book along with it and the amount was immediately debited.</p>
<p>However, I got only one book and when I sent them a mail they said the shipping time is 3-4 weeks for &#8216;<a href="http://en.wikipedia.org/wiki/Peopleware" target="_blank">Peopleware</a>&#8216; and it will be shipped in that duration. Since it was a normal time duration, I didn&#8217;t bother. But not so when that became 6 weeks. I sent them a reminder and I got a response:</p>
<blockquote><p><strong>Your book is dispatched from the international stores. We will inform you once it reaches us.</strong></p>
</blockquote>
<p>That seemed a reasonable response and I decided to wait for few more days. However after 8 weeks, I sent them a &#8217;strong&#8217; message. Then they replied saying:</p>
<blockquote><p><strong>The book you ordered is out-of-stock. We will pay you back.</strong></p>
</blockquote>
<p>I&#8217;m not surprised that the book is out-of-stock or that they agreed to pay back, but the way they provided misleading information put me off. Had they told me in the first place that the book was out-of-stock, probably I would&#8217;ve continued to do business with them.&#160; But not after providing wrong information. (By the way, I am still waiting to get their refund).</p>
<p>When I have to print some more photos, I&#8217;ll surely go to <a href="http://www.zoom.in" target="_blank">Zoom In</a>; when I want to buy a book, I will definitely look at some other online shop.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jjude.com/index.php/archives/72/feed</wfw:commentRss>
		</item>
		<item>
		<title>Django application as a stand-alone desktop application</title>
		<link>http://www.jjude.com/index.php/archives/70</link>
		<comments>http://www.jjude.com/index.php/archives/70#comments</comments>
		<pubDate>Sun, 13 Apr 2008 15:38:29 +0000</pubDate>
		<dc:creator>Joseph Jude</dc:creator>
		
		<category><![CDATA[Django]]></category>

		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.jjude.com/index.php/archives/70</guid>
		<description><![CDATA[After frustration comes success. I made SOL (a Twitter clone) a stand-alone desktop application]]></description>
			<content:encoded><![CDATA[<p>There are few options available to package Django as a stand-alone desktop apps. They are:</p>
<ul>
<li>cx_freeze </li>
<li>PyInstaller </li>
<li>Py2exe </li>
<li>dbuilder.py </li>
</ul>
<p><a href="http://www.silverstripesoftware.com/blog/archives/51" target="_blank">Siddharta</a> already packaged Django as a windows application using cx_freeze. I based my experiment on his entry. Though he has explained it pretty well, being a python/django newbie, I needed a lot more than what he explained in his article.</p>
<p>I read pages after pages and spent about a week in making a desktop app of SOL. I didn&#8217;t make much progress and was very frustrated. (I wrote about it <a href="http://www.jjude.com/index.php/archives/69" target="_blank">here</a>). After a time, I switched to py2exe, as I was not able to locate much info about cx_freeze.</p>
<p>I used py2exe, sqlite and cherrypy for packaging as a desktop app. As it is only for demo purpose, I would&#8217;ve preferred to have the default development server itself. But I don&#8217;t know how to do it; and info about cherrypy was readily available.</p>
<p>Fundamentally, you need to import all of the required Django modules. That takes the most of the time. Whenever I got, &#8216;module&#8217; object has no attribute &#8216;xxxx&#8217;, I had to trace it to one of Django&#8217;s module and import it.</p>
<p>Once I got all of the modules, I had to integrate with CherryPy. It wasn&#8217;t difficult as info was already available. However, admin css were not delivered. I read through &#8216;AdminMediaHandler&#8217; code and understood that I had to pass an absolute path for admin media folder. That got me both local media and admin media done.</p>
<p>I had to make only one change to settings.py. I replaced</p>
<pre>os.path.dirname(os.path.abspath(__file__))</pre>
<p>with </p>
<pre>sys.argv[0]</pre>
<p>I was glad that I persevered to make this. Here I post the setup, imports and the build script with the hope that it might be useful for others.</p>
<p>This is the first file - sol.py</p>
<pre>#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os, sys

os.environ['DJANGO_SETTINGS_MODULE'] = &quot;settings&quot;
#these pertain to your application
import sol.models
import sol.views
import urls
import manage
import settings
#these are django imports
import django.template.loaders.filesystem
import django.template.loaders.app_directories
import django.middleware.common
import django.contrib.sessions.middleware
import django.contrib.auth.middleware
import django.middleware.doc
import django.contrib.auth
import django.contrib.contenttypes
import django.contrib.sessions
import django.contrib.sessions.backends.db
import django.contrib.sites
import django.contrib.admin
import django.core.cache.backends
import django.db.backends.sqlite3.base
import django.db.backends.sqlite3.introspection
import django.db.backends.sqlite3.creation
import django.db.backends.sqlite3.client
import django.template.defaulttags
import django.template.defaultfilters
import django.template.loader_tags

import django.contrib.admin.urls
from django.conf.urls.defaults import *
import django.contrib.admin.views.main
import django.core.context_processors
import django.contrib.auth.views
import django.contrib.auth.backends
import django.views.static
import django.contrib.admin.templatetags.adminmedia
import django.contrib.admin.templatetags.adminapplist
import django.contrib.admin.templatetags.admin_list
import django.contrib.admin.templatetags.admin_modify
import django.contrib.admin.templatetags.log
import django.contrib.admin.views.auth
import django.contrib.admin.views.doc
import django.contrib.admin.views.template
import django.conf.urls.shortcut
import django.views.defaults

#dont need to import these pkgs
#need to know how to exclude them
import email.mime.audio
import email.mime.base
import email.mime.image
import email.mime.message
import email.mime.multipart
import email.mime.nonmultipart
import email.mime.text
import email.charset
import email.encoders
import email.errors
import email.feedparser
import email.generator
import email.header
import email.iterators
import email.message
import email.parser
import email.utils
import email.base64mime
import email.quoprimime
import django.core.cache.backends.locmem
import django.templatetags.i18n
import django.views.i18n

#let us hook up cherrypy
#is it possible to hook up the dev server itself?
from cherrypy import wsgiserver
import cherrypy
from django.core.handlers.wsgi import WSGIHandler
from django.core.servers.basehttp import AdminMediaHandler

if __name__ == &quot;__main__&quot;:
    print '*****************************************************'
    print 'Open your browser and point to http://localhost:8000'
    print 'To close, press ctrl-c'
    print ''
    print 'local user id is: jjude; password is also jjude'
    print 'admin user id is: admin; password is also admin'
    print '*****************************************************'
    os.environ[&quot;DJANGO_SETTINGS_MODULE&quot;] = &quot;settings&quot;
    # Set up site-wide config first so we get a log if errors occur.

    cherrypy.config.update({'environment': 'production',
                            'log.error_file': 'site.log',
                            'log.screen': False})

    try:
        sys.path.insert(0,&quot;..&quot;)
        #2nd param to AdminMediaHandler should be absolute path to the admin media files
        cherrypy.tree.graft(AdminMediaHandler(WSGIHandler(),media_dir=os.path.dirname(os.path.abspath(sys.argv[0])) + settings.ADMIN_MEDIA_PREFIX), '/')
        cherrypy.server.socket_port = 8000
        cherrypy.server.quickstart()
        cherrypy.engine.start()

    except KeyboardInterrupt:
        cherrypy.server.stop()</pre>
<p>This is setup.py</p>
<pre>from distutils.core import setup
import py2exe
import glob

setup(
    options = {&quot;py2exe&quot;: {&quot;compressed&quot;: 1,
                          &quot;optimize&quot;: 2,
                          &quot;ascii&quot;: 1,
                          &quot;bundle_files&quot;: 1,
                          &quot;packages&quot;:[&quot;encodings&quot;],
                           &quot;excludes&quot; : [&quot;pywin&quot;, &quot;pywin.debugger&quot;, &quot;pywin.debugger.dbgcon&quot;,&quot;pywin.dialogs&quot;,
                                       &quot;pywin.dialogs.list&quot;,&quot;Tkconstants&quot;,&quot;Tkinter&quot;,&quot;tcl&quot;],

                            }},
    #these are the data files like templates, site media and admin media
    data_files = [(&quot;.&quot;,[&quot;sol.db&quot;]),
        (&quot;templates&quot;,glob.glob(&quot;templates\*.*&quot;)),
        #(&quot;files&quot;,glob.glob(&quot;files\*.*&quot;)),
        (&quot;media&quot;,glob.glob(&quot;media\*.*&quot;)),
        (&quot;media\css&quot;,glob.glob(&quot;media\css\*.*&quot;)),
        (&quot;templates\admin&quot;,glob.glob(&quot;C:\Python25\Lib\site-packages\django\contrib\admin\templates\admin\*.*&quot;)),
        (&quot;templates\admin\auth\user&quot;,glob.glob(&quot;C:\Python25\Libsite-packages\django\contrib\admin\templates\admin\auth\user\*.*&quot;)),
        (&quot;templates\admin_doc&quot;,glob.glob(&quot;C:\Python25\Lib\site-packages\django\contrib\admin\templates\admin_doc\*.*&quot;)),
        (&quot;templates\widget&quot;,glob.glob(&quot;C:\Python25\Lib\site-packages\django\contrib\admin\templates\widget\*.*&quot;)),
        (&quot;templates\registration&quot;,glob.glob(&quot;C:\Python25\Lib\site-packages\django\contrib\admin\templates\registration\*.*&quot;)),
        (&quot;adminmedia\css&quot;,glob.glob(&quot;C:\Python25\Lib\site-packages\django\contrib\admin\media\css*.*&quot;)),
        (&quot;adminmedia\js&quot;,glob.glob(&quot;C:\Python25\Lib\site-packages\django\contrib\admin\media\js\*.*&quot;)),
        (&quot;adminmedia\img&quot;,glob.glob(&quot;C:\Python25\Lib\site-packages\django\contrib\admin\media\img\*.*&quot;)),
        ],
    zipfile = None,
    console=['sol.py'],
    )</pre>
<p>This is the build script.</p>
<pre>python -OO setup.py py2exe --b 2 --optimize 2 --dist-dir y:sol
rd /s /q build</pre>
<p>You can download the demo from <a href="http://code.google.com/p/s-o-l/" target="_blank">code.google.com</a>. I&#8217;ll keep updating these scripts as I learn more. So get the updated scripts from <a href="http://code.google.com/p/s-o-l/" target="_blank">code.google.com</a>.</p>
<p>If you are to engage in such a exercise, you need lot of patience. </p>
<p>Next steps:</p>
<ul>
<li>Integrate with UPX </li>
<li>Integrate with Inno Setup (or some other windows setup makers) </li>
</ul>
<p>I&#8217;m sure this can be done in a better way. Feel free to comment.</p>
<p>Reference:</p>
<ul>
<li><a href="http://www.silverstripesoftware.com/blog/archives/51" target="_blank">Deploying a Django app on the desktop</a> </li>
<li><a href="http://www.jjude.com/index.php/archives/69" target="_blank">My frustration with packaging django</a> </li>
<li><a href="http://www.gordontillman.info/Development/DjangoCherryPy" target="_blank">Django Cherry Py</a> </li>
<li><a href="http://www.eflorenzano.com/blog/post/hosting-django-site-pure-python/" target="_blank">Hosting a Django Site with Pure Python</a> </li>
<li><a href="http://www.py2exe.org/" target="_blank">Py2exe</a> </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jjude.com/index.php/archives/70/feed</wfw:commentRss>
		</item>
		<item>
		<title>My frustration with packaging django</title>
		<link>http://www.jjude.com/index.php/archives/69</link>
		<comments>http://www.jjude.com/index.php/archives/69#comments</comments>
		<pubDate>Thu, 10 Apr 2008 15:46:20 +0000</pubDate>
		<dc:creator>Joseph Jude</dc:creator>
		
		<category><![CDATA[Django]]></category>

		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.jjude.com/index.php/archives/69</guid>
		<description><![CDATA[I'm frustrated with myself for not being able to package django app as windows executable.]]></description>
			<content:encoded><![CDATA[<p>I have been trying to package django application as a windows executable. I know it might sound ridiculous to most of the web-apps developers. Most of Windows users are not used to &#8217;svn&#8217; a source. Add to it that Python is not a default installation in any of windows installation. So it would be better, if I could make a self-contained executable version. This will be useful for demo purposes. If I can make this work, I can even create desktop applications on Django. How cool that would be!</p>
<p>I might be doing something really stupid, because there are at least three utilities available for this purpose.</p>
<p>First, I tried, dbuilder.py, which try to package django apps. There I got the below error. </p>
<pre>Unknown command: 'runserver'
Type 'manage.pyc help' for usage. </pre>
<p>When I asked around in irc, I was told that it will not work. Nothing can be done. <img src='http://www.jjude.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>Then I tried cx_freeze. I couldn&#8217;t find much of documentation for cx_freeze. Yea, I can make a hello.py as an executable. That is easy but including some packages and other stuff is difficult. By searching around, I finally wrote a script that compiled. But when I executed the output, I got the below error:</p>
<pre>WindowsError: [Error 3] The system cannot <span style="color: #0000ff">find</span> the <span style="color: #0000ff">path</span> specified: &#8216;C:\Documents and Settings\Joseph\Desktop\SOL\sol.exe\django\db\backends<span style="color: #008000">/*.*&#8217;</span></pre>
<p>Being a Python newbie, probably I am expecting too much of myself! But after 5 evening of reading and trying, I am frustrated now. I know there is py2exe and pyinstaller. But I am not sure if I can figure out to make them work. So I&#8217;m going to shut down now with lots of frustration.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jjude.com/index.php/archives/69/feed</wfw:commentRss>
		</item>
		<item>
		<title>Wayanad</title>
		<link>http://www.jjude.com/index.php/archives/68</link>
		<comments>http://www.jjude.com/index.php/archives/68#comments</comments>
		<pubDate>Mon, 07 Apr 2008 06:36:22 +0000</pubDate>
		<dc:creator>Joseph Jude</dc:creator>
		
		<category><![CDATA[Travel]]></category>

		<guid isPermaLink="false">http://www.jjude.com/index.php/archives/68</guid>
		<description><![CDATA[A memorable trip to God's own country]]></description>
			<content:encoded><![CDATA[<p>Kerala is a popular tourist destination in south India. With pleasant climate and equally pleasant people, it is rightly named as &#8216;god&#8217;s own country&#8217;. </p>
<p>Wayanad is one such popular destination on the north-east of the state. Being part of <a href="http://en.wikipedia.org/wiki/Western_Ghats" target="_blank">Western Ghats</a>, it boasts of excellent natural beauty - wild life sanctuaries, mountain ranges, islands and lakes. </p>
<p>Three days are not sufficient enough to enjoy all of Wayanad; but unfortunately that was all the time that we had. We planned to utilize the best of these three days - we had detailed plans of what to see on each day.</p>
<p><a href="http://www.jjude.com/wp-content/uploads/image8.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="141" alt="image" src="http://www.jjude.com/wp-content/uploads/image8-thumb.png" width="260" align="left" border="0" /></a>We started at about 6 am. from Bangalore in Toyota Qualis. We traveled via Mandya and reached <a href="http://www.raincountryresort.com/" target="_blank">Rain Country Resorts</a> at about 1 pm., ready for lunch. It was an indicator of what we were going to have in the coming days - it was an excellent lunch.</p>
<p>After lunch, we left to Pookot Lake. We took a boat ride and then strolled along the lake for sometime.</p>
<p>Later in the day, at the resort, we were informed that a bandh was organized the next day to protest against the recent fuel hike. We didn&#8217;t like it; but what is a travel plan, if it doesn&#8217;t change during its course?</p>
<p>Though all of us took a book with us, I didn&#8217;t want to spend a whole day sitting in the resort. I discussed with the resort staff for options. One of them offered to be a guide to walk us through the woods to the near-by peak. My brother-in-law and I gladly agreed.</p>
<p>I was excited at change of plan. Walking through woods was not in our initial plan. We had planned to hop from one tourist spot to the other. But this sudden change will give us an opportunity to spend much more time with the nature.</p>
<p>I was excited for another reason too - I was reading Bill Bryson&#8217;s adventurous walk through the Appalachian Trail&#8217; in his book &#8216;<a href="http://en.wikipedia.org/wiki/A_Walk_in_the_Woods:_Rediscovering_America_on_the_Appalachian_Trail" target="_blank">A Walk in the woods</a>&#8216;.&#160; Obviously I was thrilled to take a walk through the woods; of course my brother-in-law is no match for Katz (Bryson&#8217;s partner in the walk), but he is closer.</p>
<p>We left after breakfast. The initial climb was a steep one and tiring. While BIL (brother-in-law) and I were panting and falling behind (much like Katz), the guide went on walking as if it was anything normal. I was afraid that our hike will end much before it started! But we survived.</p>
<p>The woods were wild and unspoiled. It was a fantastic feeling to be in the woods listening to the birds chirp and to the rustling sound of dry leaves on the ground. The rest of the walk was not so much steep as the initial one and we were glad about it.</p>
<p>The guide warned us that there were leeches along the route and he took a bottle of salt water in case it was needed. We didn&#8217;t use it though.</p>
<p>The final piece was a steep climb on the hill. While the guide climbed up without much effort, it took us a lot of sweat. But when we stood on top of the hill, we felt such an elation - not just because we made it to the top of the hill, but the scenery was splendid. We were on a hill surrounded on all directions by mountains with layers of natural beauty. Having done a basic degree in geology, BIL went about giving me information of the rocks that were surrounding us. Though it was mid noon with sun scorching, we stayed back as long as we could.</p>
<p>We did have a concern that we will be bored for the rest of the day. But we were wrong. As my sister was flying frequently and all of us were caught up in the pace of our work, we didn&#8217;t have any family time for few months. So this gave us a chance to sit down as a family and talk. We talked - talked about our childhood; dad&#8217;s and mom&#8217;s childhood days; our growing up; how life has changed and all else. We didn&#8217;t realize how fast time went by until one of the staff came in to call us for dinner. We resumed the family chit-chat after dinner too. All of us felt pretty good about the day.</p>
<p>Next day we left to Tholpatty wild life sanctuary. We were the first ones to take the safari and we expected a thrilling one; but we didn&#8217;t see any animals on the way. It was a disappointing one.</p>
<p>Immediately after breakfast, we went to Kuruva island, an uninhibited group of small islands. We were in the absolute tranquil with the nature. Having developed a liking for un-spoilt nature, I was enjoying each moment of the walk through the tall trees.</p>
<p>Kuruva island is not just a long stretch of tall trees; but it is made up of many rivulets, if I remember there are around 64 of them. Crossing each of them was dangerous - we had to cross on rocky bed as the stream flows through them. In some places water was knee deep. We were debating if we need to return without taking a risk on these rivulets, as my mom and dad were with us. But my mother surprised us saying, let us do it boys! We carefully crossed about 9 rivulets; in each my mother surprising us with her strength and stamina.</p>
<p>Every good thing comes to an end and so was this trip. But the trek through the woods, Crossing of rivulets with my parents and the quality time we had with each other will make us to remember our trip to Wayanad stay in our mind for a long time to come.</p>
<p>Enjoy some of the photos here. More photos in <a href="http://flickr.com/photos/jjude/tags/wayanad/" target="_blank">Flickr</a>.</p>
<p><a title="biker" href="http://www.flickr.com/photos/22003141@N00/2279639252/" target="_blank"><img alt="biker" src="http://static.flickr.com/2254/2279639252_e066ab33c4.jpg" border="1" /></a></p>
<p style="text-align: center">Group of bikers followed us.</p>
<p>&#160;<a title="abandoned boat" href="http://www.flickr.com/photos/22003141@N00/2279641618/" target="_blank"><img alt="abandoned boat" src="http://static.flickr.com/2014/2279641618_1957c261a9.jpg" border="1" /></a></p>
<p style="text-align: center">In Pookot Lake</p>
<p>&#160;<a title="motherly care" href="http://www.flickr.com/photos/22003141@N00/2278850293/" target="_blank"><img alt="motherly care" src="http://static.flickr.com/2062/2278850293_bbffd7dfd2.jpg" border="1" /></a></p>
<p style="text-align: center">Cute, isn&#8217;t it?</p>
<p>&#160;<a title="a natural pool" href="http://www.flickr.com/photos/22003141@N00/2278856397/" target="_blank"><img alt="a natural pool" src="http://static.flickr.com/2127/2278856397_d9d4ca94b2.jpg" border="0" /></a></p>
<p style="text-align: center">Natural Swimming Pool in the Resort</p>
<p><a title="in rain country resort" href="http://www.flickr.com/photos/22003141@N00/2279643224/" target="_blank"><img alt="in rain country resort" src="http://static.flickr.com/2169/2279643224_0b57a87946.jpg" border="1" /></a></p>
<p style="text-align: center">Shot during the Camp-fire in the Resort</p>
<p>&#160;<a title="deer poached?" href="http://www.flickr.com/photos/22003141@N00/2279646944/" target="_blank"><img alt="deer poached?" src="http://static.flickr.com/2208/2279646944_3f8bea0fd7.jpg" border="0" /></a></p>
<p style="text-align: center">Deer skull found on our trek</p>
<p>&#160; <a title="wild mushroom" href="http://www.flickr.com/photos/22003141@N00/2278852913/" target="_blank"><img alt="wild mushroom" src="http://static.flickr.com/2209/2278852913_6f88e2f181.jpg" border="1" /></a></p>
<p style="text-align: center">Wild Mushroom. There were many more wild flowers</p>
<p>&#160;<a title="scenic beauty" href="http://www.flickr.com/photos/22003141@N00/2279645496/" target="_blank"><img alt="scenic beauty" src="http://static.flickr.com/2216/2279645496_635e68cb1d.jpg" border="1" /></a></p>
<p style="text-align: center">From the top of the hill</p>
<p>&#160;<a title="on the way down" href="http://www.flickr.com/photos/22003141@N00/2278854855/" target="_blank"><img alt="on the way down" src="http://static.flickr.com/2142/2278854855_3da1262b8f.jpg" border="0" /></a></a></p>
<p style="text-align: center">BIL and the guide walking down from the hill</p>
<p>&#160;<a title="ubiquitous vehicle" href="http://www.flickr.com/photos/22003141@N00/2279650516/" target="_blank"><img alt="ubiquitous vehicle" src="http://static.flickr.com/2067/2279650516_23f2f71fd6.jpg" border="0" /></a></p>
<p style="text-align: center">Jeep is an economical vehicle owing to the hilly surroundings</p>
<p>Related Post:</p>
<p><a href="http://www.jjude.com/index.php/archives/45" target="_blank">Airtel + Twitter = an easy, effective travel blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jjude.com/index.php/archives/68/feed</wfw:commentRss>
		</item>
		<item>
		<title>A simple &#8216;Twitter&#8217; clone in Django</title>
		<link>http://www.jjude.com/index.php/archives/64</link>
		<comments>http://www.jjude.com/index.php/archives/64#comments</comments>
		<pubDate>Sat, 05 Apr 2008 17:56:33 +0000</pubDate>
		<dc:creator>Joseph Jude</dc:creator>
		
		<category><![CDATA[Django]]></category>

		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.jjude.com/index.php/archives/64</guid>
		<description><![CDATA[I discuss here about my first application in Django - a twitter clone for our department.]]></description>
			<content:encoded><![CDATA[<p>It started when my boss challenged me to write a twitter/orkut for our department. Having already decided to learn web development with Django (read about it <a href="http://www.jjude.com/index.php/archives/48" target="_blank">here</a>), I jumped into action over the weekend.</p>
<p>As it was my first application and it was for internal use, I limited myself to the below feature list:</p>
<ul>
<li>multi-user system with login/logoff </li>
<li>micro-blog (&lt;= 150 characters per blog) </li>
<li>groups (something similar to threads; a provision for related conversation) </li>
<li>Active Directory authentication (so there was no need for user registration) </li>
</ul>
<p>I decided to take up AD authentication later. I understood from Django forum that it was possible to plug-in that feature.</p>
<p>I looked for a &#8216;cool&#8217; name for the application. Being a micro-blog, I wanted a simple, single syllable word that represents word or conversation or talk. I settled with &#8216;SOL&#8217; - it is a Tamil word representing what I expected.</p>
<p>Typical Django applications consists of models (classes), views (logic) and templates (presentation). URLs bind all of these components together. </p>
<p><strong>Models</strong></p>
<p>It seemed logical to start with models - one for SOLs and another one for group. There is nothing complex here; pretty simple models. I also built form models for each of these. So here is models.py:</p>
<pre><span style="color: #0000ff">class</span> <span style="color: #0000ff">group</span>(models.Model):
	desc = models.TextField(max_length=25)

	<span style="color: #0000ff">def</span> __unicode__(self):
		<span style="color: #0000ff">return</span> unicode(self.id)

	<span style="color: #0000ff">def</span> get_absolute_url(self):
		<span style="color: #0000ff">return</span> &quot;<span style="color: #8b0000">/g/%s</span>&quot; % unicode(self.id)

	<span style="color: #0000ff">class</span> Admin:
		list_display = (&#8217;id&#8217;,'desc&#8217;)
	<span style="color: #0000ff">class</span> Meta:
		ordering = [&#8217;-id&#8217;]

<span style="color: #0000ff">class</span> sol(models.Model):
	body = models.TextField(max_length=150)
	author = models.ForeignKey(auth.User)
	date = models.DateTimeField(&#8217;Date&#8217;)
	<span style="color: #0000ff">group</span> = models.ForeignKey(<span style="color: #0000ff">group</span>)

	<span style="color: #0000ff">def</span> __unicode__(self):
		<span style="color: #0000ff">return</span> unicode(self.id)

	<span style="color: #0000ff">def</span> get_absolute_url(self):
		<span style="color: #0000ff">return</span> &quot;<span style="color: #8b0000">/sol/%s/</span>&quot; % unicode(self.id)

	<span style="color: #0000ff">def</span> get_author_url(self):
		<span style="color: #0000ff">return</span> &quot;<span style="color: #8b0000">/u/%s/p/0</span>&quot; % (self.author)

	<span style="color: #0000ff">class</span> Admin:
		list_display = (&#8217;author&#8217;, &#8216;body&#8217;, &#8216;date&#8217;)
		date_hierarchy = &#8216;date&#8217;
	<span style="color: #0000ff">class</span> Meta:
		ordering = [&#8217;-date&#8217;]

<span style="color: #0000ff">class</span> solForm(ModelForm):

	body = forms.CharField(max_length=150, widget=forms.Textarea(attrs={&#8217;rows&#8217;:2, &#8216;cols&#8217;: 40}),label= &#8216;Your Sol:&#8217;)
	author = forms.CharField(widget=forms.HiddenInput)
	date = forms.CharField(widget=forms.HiddenInput)
	<span style="color: #0000ff">group</span> = forms.CharField(widget=forms.HiddenInput)

	<span style="color: #0000ff">class</span> Meta:
		model = sol

<span style="color: #0000ff">class</span> grpForm(ModelForm):

	desc = forms.CharField(max_length=25, label= &#8216;Create Your Group:&#8217;)

	<span style="color: #0000ff">class</span> Meta:
		model = <span style="color: #0000ff">group</span></pre>
<p><strong>Views</strong></p>
<p>There are only three functions (or views):</p>
<ul>
<li>create a group </li>
<li>create a SOL </li>
<li>display list of SOLs (for groups, users, and all) </li>
</ul>
<p>It is so simple to display list of SOLs (for that matter any objects). Django provides generic views for that. However I used my own views. All that is needed is the template name and a dictionary of values to be passed to the template.</p>
<p>Object (user or group or a default home page), object id, template name, and page number are passed to the view function; each variable also have default values. Using ObjectPaginator, these objects are paginated. Here is my views.py:</p>
<pre>#for pagination: http:<span style="color: #008000">//www.slideshare.net/simon/the-django-web-application-framework/#</span>

#generic view <span style="color: #0000ff">function</span> for homepage (solhome), userhome and <span style="color: #0000ff">group</span> home
#object is one of the param; object=&quot;<span style="color: #8b0000">u</span>&quot; -&gt; <span style="color: #0000ff">user</span>; g-&gt;<span style="color: #0000ff">group</span>; s-&gt;sol, which is default home page
#object id : for u &amp; g the respective ids; for sol nothing; defaults to sol(0)
#pagenum : for pagination; default is 0 otherwise the pagenumber to be displayed in the input

<span style="color: #0000ff">def</span> home(request, model=&quot;<span style="color: #8b0000">s</span>&quot;,objectId=&quot;<span style="color: #8b0000">0</span>&quot;,page_num=0, template=&#8217;home.html&#8217;):
	paginate_by = settings.PAGINATE_BY
	#what we get as parameter is always a <span style="color: #0000ff">string</span>
	page_num = int(page_num)
	<span style="color: #0000ff">if</span> model == &#8216;u&#8217;: #for <span style="color: #0000ff">user</span> we need to filter for the <span style="color: #0000ff">user</span>
		info_list = ObjectPaginator(sol.objects.all().filter(author__username=objectId),paginate_by)
	elif model== &#8217;s&#8217;: #for sol; home page
		info_list = ObjectPaginator(sol.objects.all(),paginate_by)
	elif model ==&#8217;g': #for <span style="color: #0000ff">group</span>
		<span style="color: #0000ff">if</span> objectId == &#8216;0&#8242;:
			info_list = ObjectPaginator(<span style="color: #0000ff">group</span>.objects.all(),paginate_by)
		<span style="color: #0000ff">else</span>:
			info_list = ObjectPaginator(sol.objects.all().filter(<span style="color: #0000ff">group</span>=<span style="color: #0000ff">group</span>.objects.get(id=objectId)),paginate_by)

	has_previous = info_list.has_previous_page(page_num)
	has_next = info_list.has_next_page(page_num)

	info_dict = {
		&#8216;query_list&#8217; : info_list.get_page(page_num),
		&#8216;has_previous&#8217; : has_previous,
		&#8216;previous_page&#8217; : page_num - 1,
		&#8216;has_next&#8217; : has_next,
		&#8216;next_page&#8217; : page_num + 1,
		&#8217;site_name&#8217; : &#8217;sol&#8217;,
		&#8216;<span style="color: #0000ff">user</span>&#8216; : request.<span style="color: #0000ff">user</span>,
	}

	<span style="color: #0000ff">if</span> model == &#8217;s&#8217;:
		form = solForm()
		#this is how you append to a dict
		info_dict[&#8217;solForm&#8217;] = form

	<span style="color: #0000ff">if</span> model == &#8216;u&#8217;:
		#this is how you append to a dict
		info_dict[&#8217;u_id&#8217;] = objectId
		info_dict[&#8217;nickname&#8217;] = userprofile.objects.get(user__username=objectId).nickname

	<span style="color: #0000ff">if</span> model == &#8216;g&#8217;:
		info_dict[&#8217;grpForm&#8217;] = grpForm()
		<span style="color: #0000ff">if</span> objectId == &#8216;0&#8242;:
			info_dict[&#8217;solForm&#8217;] = solForm()
		<span style="color: #0000ff">else</span>:
			info_dict[&#8217;solForm&#8217;] = solForm(initial={&#8217;<span style="color: #0000ff">group</span>&#8216;: <span style="color: #0000ff">group</span>.objects.get(id=objectId)})
			info_dict[&#8217;grpName&#8217;] = <span style="color: #0000ff">group</span>.objects.get(id=objectId).desc

	<span style="color: #0000ff">return</span> render_to_response(template, info_dict)

<span style="color: #0000ff">def</span> logout(request):
		auth.logout(request)
		<span style="color: #0000ff">return</span> HttpResponseRedirect(&#8217;/')

<span style="color: #0000ff">def</span> createsol(request):
	#<span style="color: #0000ff">if</span> there is nothing in the text field, do nothing
	<span style="color: #0000ff">if</span> request.POST[&#8217;body&#8217;] == &quot;<span style="color: #8b0000"></span>&quot;:
		<span style="color: #0000ff">return</span> HttpResponseRedirect(&#8217;/')

	newsol = sol()
	newsol.author = request.<span style="color: #0000ff">user</span>
	newsol.date = datetime.datetime.today()
	newsol.body = request.POST[&#8217;body&#8217;]
	<span style="color: #0000ff">if</span> request.POST[&#8217;<span style="color: #0000ff">group</span>&#8216;] &lt;&gt; &#8221;:
		newsol.<span style="color: #0000ff">group</span> = <span style="color: #0000ff">group</span>.objects.get(id=request.POST[&#8217;<span style="color: #0000ff">group</span>&#8216;])
	newsol.save()
	<span style="color: #0000ff">return</span> HttpResponseRedirect(&#8217;/')

<span style="color: #0000ff">def</span> creategroup(request):
	<span style="color: #0000ff">if</span> request.POST[&#8217;desc&#8217;] == &quot;<span style="color: #8b0000"></span>&quot;:
		<span style="color: #0000ff">return</span> HttpResponseRedirect(&#8217;/<span style="color: #0000ff">groups</span>/&#8217;)

	newgrp = <span style="color: #0000ff">group</span>()
	newgrp.desc = request.POST[&#8217;desc&#8217;]
	newgrp.save()
	<span style="color: #0000ff">return</span> HttpResponseRedirect(&#8217;/<span style="color: #0000ff">groups</span>/&#8217;)

<span style="color: #0000ff">def</span> help(request):
	<span style="color: #0000ff">return</span> render_to_response(&#8217;help.html&#8217;)</pre>
<p><strong>SOL URLs</strong>:</p>
<p>URLs are the routing engines connecting both models and views. The URLs for SOL are:</p>
<ul>
<li>homepage (of sol) - listing all SOLs </li>
<li>user&#8217;s homepage - SOLs of a particular user </li>
<li>group homepage - SOLs belonging to a particular group </li>
<li>creation of new sol </li>
<li>creation of new group </li>
</ul>
<p>With support for pagination and admin, url.py is like:</p>
<pre>urlpatterns = patterns('cool.sol.views',
     #default page number is 0;
     #url like: http:<span style="color: #008000">//sol.com/</span>
     (r&#8217;^$&#8217;, &#8216;home&#8217;),

     #homepage for sol with pagination enabled
     #url like: http:<span style="color: #008000">//sol.com/p/0</span>
     (r&#8217;^p/(?P&lt;page_num&gt;d+)/$&#8217;, &#8216;home&#8217;,{&#8217;template&#8217;:'home.html&#8217;, &#8216;model&#8217;:&#8217;s&#8217;}),

     #<span style="color: #0000ff">user</span> homepage - employees with employee ids as numbers;
     #url like: http:<span style="color: #008000">//sol.com/u/1029/p/0</span>
     (r&#8217;^u/(?P&lt;objectId&gt;d+)/p/(?P&lt;page_num&gt;d+)/$&#8217;, &#8216;home&#8217;,{&#8217;template&#8217;:'user_home.html&#8217;, &#8216;model&#8217;:'u&#8217;}),

     #<span style="color: #0000ff">groups</span> homepage
     #url like: http:<span style="color: #008000">//sol.com/groups/ or http://sol.com/groups/p/0 </span>
     (r&#8217;^<span style="color: #0000ff">groups</span>/$&#8217;, &#8216;home&#8217;,{&#8217;template&#8217;:'groups_home.html&#8217;, &#8216;model&#8217;:'g&#8217;}),
     (r&#8217;^<span style="color: #0000ff">groups</span>/p/(?P&lt;page_num&gt;d+)/$&#8217;, &#8216;home&#8217;,{&#8217;template&#8217;:'groups_home.html&#8217;, &#8216;model&#8217;:'g&#8217;}),

     #homepage for a particular <span style="color: #0000ff">group</span>
     #url like: http:<span style="color: #008000">//sol.com/g/100/p/0</span>
     (r&#8217;^g/(?P&lt;objectId&gt;d+)/$&#8217;, &#8216;home&#8217;,{&#8217;template&#8217;:'group_home.html&#8217;, &#8216;model&#8217;:'g&#8217;}),
     (r&#8217;^g/(?P&lt;objectId&gt;d+)/p/(?P&lt;page_num&gt;d+)/$&#8217;, &#8216;home&#8217;,{&#8217;template&#8217;:'group_home.html&#8217;, &#8216;model&#8217;:'g&#8217;}),

     #logoff
     (r&#8217;^logout/$&#8217;, &#8216;logout&#8217;),

     #create a sol; called by form action
     (r&#8217;^createsol/$&#8217;, &#8216;createsol&#8217;),

     #create a sol; called by form action
     (r&#8217;^creategroup/$&#8217;, &#8216;creategroup&#8217;),

     #help
     (r&#8217;^help/$&#8217;, &#8216;help&#8217;),
)

#these are derived from admin
urlpatterns += patterns(&#8221;,
        #login page
        (r&#8217;^login/$&#8217;, &#8216;django.contrib.auth.views.login&#8217;, {&#8217;template_name&#8217;: &#8216;login.html&#8217;}),

        #admin page
        (r&#8217;^admin/&#8217;, include(&#8217;django.contrib.admin.urls&#8217;)),

)</pre>
<p><strong>Templates</strong></p>
<p>Only thing left are templates. Django templates can be inherited. Hence first you define the basic template with placeholder blocks - for html headers, page headers like navigation menus and footer - then build upon that template until the final template. It is okay to fill-in only few blocks.</p>
<p>Here is a snippet from base.html.</p>
<pre>            &lt;<span style="color: #0000ff">div</span> id=&quot;<span style="color: #8b0000">content</span>&quot;&gt;
                &lt;<span style="color: #0000ff">div</span> id=&quot;<span style="color: #8b0000">left</span>&quot;&gt;
                    {% block content %}
                        {% block newgroup %} {% endblock %}
                        {% block newsol %} {% endblock %}
                        {% block entries%} {% endblock %}
                        {% block paginate %} {% endblock %}
                    {% endblock %}
                &lt;/<span style="color: #0000ff">div</span>&gt;
                &lt;<span style="color: #0000ff">div</span> id=&quot;<span style="color: #8b0000">footer</span>&quot;&gt;
                    {% block footer %}{% endblock %}
                &lt;/<span style="color: #0000ff">div</span>&gt;
            &lt;/<span style="color: #0000ff">div</span>&gt;</pre>
<p>Now in home.html, I derive from base.html and define what is needed:</p>
<pre>{# Template for home page for sol; it lists all the sols #}
{% extends &quot;<span style="color: #8b0000">base.html</span>&quot; %}

{% block newsol %}
{% <span style="color: #0000ff">if</span> <span style="color: #0000ff">user</span>.is_authenticated %}
&lt;<span style="color: #0000ff">div</span> <span style="color: #0000ff">class</span>=&quot;<span style="color: #8b0000">form</span>&quot;&gt;
	&lt;form action=&quot;<span style="color: #8b0000">/createsol/</span>&quot; method=&quot;<span style="color: #8b0000">post</span>&quot; enctype=&quot;<span style="color: #8b0000">multipart/form-data</span>&quot;&gt;
	  &lt;table&gt;
		{{ solForm }}
	  &lt;/table&gt;
	  &lt;input type=&quot;<span style="color: #8b0000">submit</span>&quot; value=&quot;<span style="color: #8b0000">Update</span>&quot; /&gt;
	&lt;/form&gt;
&lt;/<span style="color: #0000ff">div</span>&gt;
{% endif %}
{% endblock newsol%}</pre>
<p>Once you get these concepts (model, view, template and urls), it is extremely easy to put together a website.</p>
<p>The complete code can be downloaded from <a href="http://code.google.com/p/s-o-l/" target="_blank">google code</a> page.</p>
<p><em>(Note: There might be a better way to do all of this. As I read more and write more of Django, I hope to figure them out. However, if there is a better way, there is no harm in leaving a comment about the same.)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jjude.com/index.php/archives/64/feed</wfw:commentRss>
		</item>
		<item>
		<title>Serving media and static contents in Django</title>
		<link>http://www.jjude.com/index.php/archives/62</link>
		<comments>http://www.jjude.com/index.php/archives/62#comments</comments>
		<pubDate>Mon, 31 Mar 2008 17:58:25 +0000</pubDate>
		<dc:creator>Joseph Jude</dc:creator>
		
		<category><![CDATA[Django]]></category>

		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.jjude.com/index.php/archives/62</guid>
		<description><![CDATA[I present here what I learnt regarding serving css, js of the site that you develop and admin site; also about static files - like image files etc that user can upload.]]></description>
			<content:encoded><![CDATA[<p>Django makes me write web application pretty easily. It is so fast that I could write my first web application in about 30 minutes - including downloading &#8216;Instant Django&#8217; and setting it up.</p>
<p>On the other hand, understanding MEDIA_ROOT, MEDIA_URL and ADMIN_MEDIA - the ones in settings.py - was confusing. I read the documents, tutorials, comments and forums. Every time I read one of the above, it would appear that &#8216;voila, that is it; it is so easy&#8217;. But when I apply that into the program, it didn&#8217;t work. I was missing something seriously.</p>
<p>It was so frustrating to search, read and to code/re-code/re-re-code, only to find out that if admin css are served properly, the site&#8217;s css are not served properly. What follows below is how I got all of the pieces together. Surely, this information is available in Django Forums and other documents (which I refer at the end). I am writing this as a reference to myself and also with a hope that it might be useful to other such suffering souls.</p>
<p><strong>Serving Admin CSS/JS (called Admin media)</strong></p>
<p>This is represented in settings.py by ADMIN_MEDIA. It is better to serve this from Django&#8217;s admin folder itself, so that you don&#8217;t have to copy files, when you &#8217;svn update&#8217; Django.</p>
<p>If ADMIN_MEDIA = &#8216;/adminmedia/&#8217;, then the development server interprets it to be served from the admin folder of Django (like \Python25\Lib\site-packages\django\contrib\admin\media). I preferred to keep it that way.</p>
<p>Coming to production, I use Apache alias as discussed in my other <a href="http://www.jjude.com/index.php/archives/57" target="_blank">article</a>. Here &#8216;/adminmedia&#8217; should point to Django&#8217;s admin media folder. It goes as below:</p>
<pre>&lt;Location &quot;/adminmedia&quot;&gt;
SetHandler None
&lt;/Location&gt;

Alias /adminmedia &quot;C:/Python25/Lib/site-packages/django/contrib/admin/media&quot;
&lt;Directory &quot;C:/Python25/Lib/site-packages/django/contrib/admin/media&quot;&gt;
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
&lt;/Directory&gt;</pre>
<p>This is for Apache under Windows. I understand from the forums that the &#8216;Directory&#8217; directive is not needed under Linux.</p>
<p><strong>Serving site&#8217;s media</strong></p>
<p><a href="http://www.jjude.com/wp-content/uploads/image3.png"><img height="103" alt="image" src="http://www.jjude.com/wp-content/uploads/image-thumb2.png" width="128" align="right" /></a>Now let us come to serving media for your site. Most probably you have this stored in a folder called &#8216;media&#8217;. My folder structure as in the picture.</p>
<p>To serve site&#8217;s media, I define a variable called &#8216;SITE_MEDIA&#8217; as below:</p>
<pre>import os
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
SITE_MEDIA = '%s' % PROJECT_DIR</pre>
<p>and in urls.py, I include this at the end:</p>
<pre>if settings.DEBUG:
	urlpatterns += patterns('',
		(r'^media/(?P&lt;path&gt;.*)$', 'django.views.static.serve', {'document_root': settings.SITE_MEDIA + '/media/'}),
	)</pre>
<p>and in base.html</p>
<pre>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/media/css/sol.css&quot; /&gt;</pre>
<p>This fundamentally means that the UrlHandler of Django will serve the &#8216;media/&#8217; files from the SITE_MEDIA + &#8216;/media/&#8217; directory.</p>
<p>Coming to production, alias comes to aid. I got the below alias for &#8216;/media/&#8217;.</p>
<pre>
&lt;Location &quot;/media&quot;&gt;
SetHandler None
&lt;/Location&gt;

Alias /media &quot;C:/django_projects/cool/media&quot;
&lt;Directory &quot;C:/django_projects/cool/media&quot;&gt;
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
&lt;/Directory&gt;</pre>
<p>And of course you need to set DEBUG = False so that media files are served by Apache and not by Django.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jjude.com/index.php/archives/62/feed</wfw:commentRss>
		</item>
		<item>
		<title>As I drive through chaotic Bangalore Traffic&#8230;</title>
		<link>http://www.jjude.com/index.php/archives/59</link>
		<comments>http://www.jjude.com/index.php/archives/59#comments</comments>
		<pubDate>Wed, 26 Mar 2008 17:35:43 +0000</pubDate>
		<dc:creator>Joseph Jude</dc:creator>
		
		<category><![CDATA[Management]]></category>

		<category><![CDATA[Nothing Official]]></category>

		<category><![CDATA[Life Matters]]></category>

		<guid isPermaLink="false">http://www.jjude.com/index.php/archives/59</guid>
		<description><![CDATA[It is a known fact that Bangalore Traffic is chaotic. Is it possible to learn something from it?]]></description>
			<content:encoded><![CDATA[<p>Bangalore is associated with growth of Indian IT industry. Unable to cope with such a tremendous growth, its roads are known for maddening, chaotic traffic. Ask any Bangalorian and they will tell you (horror) stories of &#8216;getting stuck in traffic for hours&#8217;. </p>
<p>When I moved in two years back, I used to get irritated with such traffic jams. Now I sit in my car and listen to new CDs; or make that pending call; or if nothing to do, observe the mad crowd around.</p>
<p>I have spent such unbelievable amount of time in traffic jams that I draw parallels to the traffic around and the corporate world that I drive to, once such traffic jams clear. They might sound wacky; they should be since I thought over them stuck in traffic jams. Next time you are in a traffic jam, give a thought for this.</p>
<p><strong>Risks, Risks, Risks</strong></p>
<p>Regularly the main route becomes congested that every one has an alternate route. Whatever number of routes that you have, all &#8216;variables&#8217; can come together to laugh at your high planning and cripple you!</p>
<p>It can so happen that on a Monday morning, you decide to leave early to beat the traffic (1st risk mitigation). On the way you find that the &#8217;state roadways dept&#8217; dug the road in a way that you can&#8217;t take it. You tell yourself, &quot;Don&#8217;t worry; I got time and an alternate route&quot; and take an alternate route (2nd mitigation). As you drive along you find that the &#8216;telephone dept&#8217; is busy laying cables and there is a diversion. Hmm&#8230;you start to get irritated. Yet not to loose your cool, you think of another alternate route (3rd mitigation) and there you are happily driving through. Not long buddy; there is an accident with a &#8216;Tata Sumo&#8217; cab that is completely blocking the only route that is left. Now you are stranded. You are so close to office; yet you are so far!</p>
<p>This isn&#8217;t further from the truth. Okay, it may not happen on a Monday morning; but it can happen on any day.</p>
<p>Being in IT, I keep relating to risk registers that we maintain and the multiple mitigation plans that we come up with. Even if you&#8217;ve been a smart project manager (or a corporate leader) to have thought of multiple mitigation plans, all &#8216;variables&#8217; can hit you (or your project or your firm) and slide you out of control. Only by keeping &#8216;cool&#8217; at those times, you can come out of the disaster.&#160; </p>
<p><strong>Be Lean</strong></p>
<p>As I get stuck in the traffic, I switch of the engine and watch in despair the cyclist and bike riders wade through the traffic and keep moving. I sit there with a powerful engine in a luxurious car, but I make no progress!&#160; With all the luxury and power, I remain without any progress; but these guys make progress, however small it may be, and they reach their destination before me! Don&#8217;t get me wrong - I am not saying luxury is not needed; it is of no use in a crisis.</p>
<p>When the going is good, you can have hundreds reporting to you. But when you have to salvage a project in crisis, you need &#8216;two strong oxen; not hundred chickens&#8217;. Unfortunately you can find so many who just doesn&#8217;t want to leave their power and luxury even at crisis. It only serves their ego; the group makes no progress.</p>
<p><strong>Effective Enforcement</strong></p>
<p>You will notice the chaos unleashed in its fullest possibility on the Bangalore roads -Jumping signals, Violating one-way and many other lawlessness. What amazes me is that whenever this is discussed by politicians or police, they seem to favor &#8216;more-rules&#8217;; as if there are not enough laws.</p>
<p>As long as police think that every law is an opportunity for black money, any number of law will not achieve orderliness.</p>
<p>And as long as every politician want themselves to be an exception to the same rules that they devise, the common man continue to suffer.</p>
<p>Instead of devising &#8216;more laws&#8217;, enforce the existing ones firmly, effectively and without an exception. I&#8217;ve heard of one Kiren Bedi towing the illegally parked vehicle of a Prime Minister. She is retired and we have only that incident (and only one Crane Bedi) to celebrate!</p>
<p>I see a similar thought process in the corporate management. Despite their claims of employee-friendly and building family-like environment, the current corporates have so many restrictions - one can&#8217;t take a photo of the campus; one can&#8217;t bring their parents to show their workplace; one can&#8217;t browse to social network sites and so on and so forth. </p>
<p>Google earth (and similar other sites) could be your security threat; not the photos that I take inside the campus. If you want me to feel proud of the company that I work for, I want to bring my family members and show them where I work; and if I decide to be unproductive, there are many ways of doing so; not just by browsing to social networking sites.</p>
<p>I know I&#8217;m making it sound so simple and there is another side of the story. But my point is instead of having a simple and effective guideline, the corporate culture is driven (in a madly fashion) with all restrictions. No wonder there is no creative solutions coming from here!</p>
<p>In a smaller scale, it is true of the design of enterprise systems and applications. There are so many restrictions placed on these systems that they have become so complex to use for end users while the management get away with exceptions.</p>
<p><strong>Active Participation - the other side of the coin</strong></p>
<p>I&#8217;ve watched with contempt those &#8216;recently returned onsite&#8217; guys violating the well known rules without missing a heart beat. These guys will not stop a second praising the fantastic American/Singaporean/European roads as they zoom past the red signal. I&#8217;ve come to believe that infrastructure is not the major cause of chaos but we, the road users are. There are times that I go highly irritated and loose my cool, but mostly I say to myself, &#8216;just because the other guy behaves as a son-of-a-bitch doesn&#8217;t mean I need to behave one myself&#8217;. I&#8217;m convinced that if at least 10% of the road users become responsible users, the chaos will reduce to a large extent.</p>
<p>Coming to the corporate side, do you enjoy your work? Do you love what you do? I do. However, this is not true of so many of the millions in IT.</p>
<p>I keep telling my guys, either find a job that you enjoy or you enjoy the job that you get. Instead of complaining, you either quit or initiate or participate in activities that make your work and other&#8217;s work enjoyable. Make yourself a better person to work with and make your workplace a better place to work for. I&#8217;m talking from experience and let me tell you it is possible. </p>
<p>This has been a long ramble. I&#8217;ve not attempted, either to solve Bangalore traffic woes or to bring a better corporate culture. I just drew parallel to each other.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jjude.com/index.php/archives/59/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
