Skip to main content

Posts

Showing posts from 2012

Correct way to structure your Django 1.4 projects

PS: This post is written assuming you're familiar with Django and at-least have some basic experience trying to set-up a Django project (for learning or for some cool project). Purpose: To show how to properly set-up your Django1.4 project after seeing other developers getting it wrong (seen it wrongly structured by my mentee, senior developers and junior developers at my firm.). Django 1.3 Project structure: Initial structure followed by two apps added to the project. Refer above picture, where I shown a Django < 1.4 project structure. (I know, at least Django 1.2 & 1.3 follows this structure). First tree view is of the initial structure that you will get by calling $ django-admin startproject Proj Take a note that manage.py, settings.py, urls.py are in the main folder. Following  tree display is after creating two apps named app1 & app2. You'll do it as follows $ ./manage.py startapp app1 $ ./manage.py startapp app2 Those apps are c

Finding per user contributions in an SVN repo

There was a need to get per user contributions in a project last year. That project was versioned using Subversion (svn). At last we came up with the following script, which surely is not fool proof, provides an over all per user contribution. Here it's: However, I left it to you to improve further; who knows the unmodified version might be good enough for you.

Set difference: Data provided from two big files with one number at a line

Today, I had to find out difference between two huge lists of numbers. Numbers are 17 digits long and list are of around 1 lac. PS: I'm documenting both versions here for my future reference. I used python, because diff doesn't felt good for me. because it will print both ins and outs of both files. Also, I ruled out diff's possibility, because I didn't felt it will work at that time. Later, at home: I give diff a try. Yes, it's not that beautiful as in python. I'd cut and sed a bit. But still, it's a "one liner" and I like 'em a lot.