Skip to main content

Posts

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 start...

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.

Finally, I have my hands on them

It had been so long, since I started to think about buying a book titled " The C Programming Language " by Bryan W. Kernighan and Dennis M. Ritchie . If I put it as accurately I can as possible now a days, It'll be 3 year after I learned how to program (Obviously, In C, we initiated). This book is a standard reference for "C" language till the date, a gift from authors of the language, themselves. It wasn't available at local book stalls. (I do think, that's the case, even now.) The other book shown here, Is called " Hacker's Delight .". Well, it's no immediate use to me. But I liked the content of that Book. It's a bible of Bit level Algorithms and techniques. What I already know about bit arithmetic become nothing in front of this Excellent book. A must have, If you want to know your machine. Want to become a Embedded expert and so on.  And If I say, these are first Computer Science books that I'm buying wit...

Software Engineering - Continues refinement

Every programmer wishes to write some code, which is both elegant, and readable. A master piece to reference to... And there may not be a single programmer, who said at least once in their life time that, "If I had time, I'd rewrite it" or any similar one. Today, let's discuss, how the idea of sorting a list of list went on,   I had to sort a list of lists, that's the result of a search, comes from Web Service. After that, the result is extracted from the XML document that's returned and formatted for front end. So, now all the data is in the form of strings. And I'm ended up with the task of sorting a list of list of strings, based on different items in the inner lists @ different times. And Obviously we can't compare the data as strings, we have to convert them into their proper data type before comparison. Since, I works on a Python based project, First thing, that came to mind is to use, sorted inbuilt function, and pass it a functi...

Start on Microchip programming... for hobby or for money

One of my friend asked me today the following question,  I'm often asked about this, someway or other. Let me answer this now for all.... Q: " I want to start programming on chip.. Can you suggest a good chip and a device to program it? Also tell me any sites which can help me ." A:" Simple one is Arduino. You will get it packaged with a programmer. If you want some more powerful and commercial one, Go for Microchip's PIC family of processors. After you are familiar with those, and need even more power, try AVR from ATMEL ." Some resources from my Bookmarks is given below: http://www.voti.nl/swp/ http://www.embedds.com/ http://www.instructables.com/id/Business-Card-PIC-Programmer/step2/Parts/ http://www.arduino.cc/playground/Main/ElectroInfoResources http://www.piclist.com/techref/microchip/index.htm My bookmarks become so messy now a days, and I'm not getting time to organize them. So, these are the quickest ones that I pic...

Tic Tac Toe in python - Just for fun

The other day, I was looking for some GNU/Linux administration reference, I ended up viewing a "tic tac toe" program in Ruby at a Linux admin's blog. He wrote that in ruby and took him 90mins. That was written using class. But "Zen of Python in mind", I wrote my own version without class. I prefer this way (sparse is better than dense), and I enjoy Python more when, I think of my Java days.  I haven't read ruby code before hand so, I did not wrote a clone of ruby code. And this took me around 40min. Because, I realized some missing features only when I played it several times. Then only I added those. Specifically, drawing complete board after someone wins and stopping the game when all fields are filled out. I'll not say, the program is beautiful and very readable. However, it's good enough for playing with it.

Structures: C -> Java -> Python -> Erlang

With C we had structures and unions. I like them, because, I don't always need to embed behaviors with data(class). So you'll do something like With Java, I'm forced to use classes, because that's how java is structured. They are purely object oriented. (eg: in C++) In python, you can take java's approach; but since Python is not Java ;-) and we tend to write less, We'll use dictionaries (or hashes in Perl) I'm a newbie to earlang (and to functional programming), I think there's no dictionaries, but tuples. Here's how we use tuples to achieve same (also applicable to python) much like json, isn't it? notice, there are no quotes around someone, that's an atom (this is erlang dude). This in python: Well, how do we understand what's what? hmm, ok, we can tag them with atoms, (this is a programming practice in erlang world) so our earlier example becomes, That's it. You can do this with python too, like...

My Desktop setup

  Here goes my desktop. Operating System : GNU/Linux Flavour : Ubuntu (Debian Derivative) Version : 10.10 (kept up to date) Kernel : 2.6.35-28-generic-pae Hardware(striped down) : Intel C2D, 4GB, 320GB.  Manufacture & Model: Toshiba Satellite Pro. Desktop Manager : Gnome Compositing Manager : Compiz Gnome-panel : set to be hidden always and removed all that I can from the panel. (ie., panel is empty now, but we can't remove last panel completely.) Icon Theme :  Fenza Dark.  (see link for ppa) Dock : Avant (trunk)  Menu : Cardapio Menu (using ppa)  it even have awn applet.  Conky : for configuration look here Dock theme : Divergence-IV A New Hope Other gtk themes in use : Elegent , Equinox , A new hope. Other Icon theme in use: awoken Cursor theme : X11-Gear  (Sorry, I can't find exact package now, but it's there) File Manager:   nautilus-elementary   (nautilus isn't complete with this, sleek elegant look,breadcru...

My Conky Configuration File

Edit :                         (Aug 17, 2013) All my configurations including conky's are now hosted at  https://github.com/kra3/dot_files I've been hearing about this conky for a long time. I think I tried it once in my 5 years of linux experience. But, I haven't experienced it till last day. Conky is a system monitor originally based on torsmo! What the heck is this "torsomo"? Honestly, I don't know. Le me google that for you.... Torsmo is a system monitor that sits in the corner of your desktop. It's very simple, customizable and it renders only text on the desktop (and percentagebars if you want it to ;) and the only lib it uses is Xlib. Torsmo can show various information about your system and it's peripherals, including: Kernel version Uptime System time Network interface information Memory and swap usage Hostname Machine, i686 for example System name, Linux for exampl...

AJAX File Upload with Web2py

It was not that long, since I experienced a problem while trying to upload a file using an ajax  trapped form. I thought, it must be me doing something wrong. I was using web2py  to embed another page into a page via ajax. That is better known to web2py folk as LOADing a component. It's just happened that one of such component contains a file upload form. It was my first time using LOAD function provided by web2py. Basically it make use of jQuery to load the page via ajax into a target div and traps input of any form in that page, so that page doesn't reload. Oh, I forgot to say that web2py is bundled with jQuery. It's always boring and tedious to understand a problem without experiencing it. So, Let's play with an example, (PS: I"m using web2py a full stack python framework, but you can use any language at server side and this problem will be there because, it's a problem with ajax) My mod...

Rich Internet Application & GWT : Angel of Java Programmers

We all are hearing the buzz about Rich Internet Applications (RIA) about a year or so. But, what the heck is that beast ? You may ask. For the user's perspective, it's the desktop like experience delivered over web. Yes, you feel like you are using a real desktop application (well, at least sort of). The richness of desktop controls is transferred to web. How RIA is build? Arise another question. These all started with that amazing kid called AJAX (Asynchronous JavaScript And XML). Then more and more tools become available, like Java FX , Adobe Air , Adobe Flex (and Adobe Flash ), Microsoft Silverlight . But these tools, though it gives rapid and organized web application development, required some kind of plug-ins to be installed on your browser. There is the importance of AJAX based RIAs, because JavaScript is enabled in almost all browsers in use today. However, It's not a fool proof solution, because there are people who switch off JavaScript for some reason, lik...

XML: Is it worth

  [ Source is from http://harmful.cat-v.org/software/xml/ ] Yes, I confess, I don't like XML at all. Reason, It's way too complication and I personally feels like it's a waste of storage space. Please, don't tell me that storage(be it memory or disk) is so cheap now a days. I still care. May be because, I started my programming (Computer Science) education with mighty "C". I always prefer to squeeze memory and make my programs as small as possible, (reason, why I changed from C++ to Java, then to Python: not to mention rapid development.) . Why use XML at all. There are good old RDBMS. Well if you find buzz about ODBMS, use them. Or use simple JSON . Or better, go for Google's ProtocolBuffers. Web programming in Java, now days become full of xml configuration files.And it'll go on, getting multiplied as your system gets bigger, web services included and so on. So much work, if some one ask me about it! Thanks to web2py , I can make the same applicat...

SDLC: No more words....

My Strength : What I think I possess!

I love to learn new things throughout my life, and it seems that’s my greatest strength. Also I’m a quick learner once I feel interest in things.And willingness to work hard to achieve my goals is certainly with me.I must say, I’m technical proficient. Also, I have great problem-solving skills and am willing to learn new things to get the job done. I’m an open minded person. In most situations, I maintain a positive attitude & outlook. One of my greatest strength is that I’m a good listener. I think, I possess the ability to think and evaluate situations in other person’s point of view. I think I can work under pressure well enough and take wise decisions. The belief in myself is strong for me. So this self-confidence must be accounted as my greatest strength. I’m a good helper towards those who need it. I’m a slow starter but once started I’ll be fully committed and dedicative. I like to organize things and like to be neat with anything that I do. Certainly I’m c...

Dilemma

For the first time in my life, I started to feel dilemma about my future. Do I've to pursue MBA now or Is it better to go for WASE program of WIPRO or as System associate in iGATE Global Solutions. I don't know. My mind is swinging like a pendulum. I've hope, 'cause it's not swinging hard. Reasons are many, I know I can do well with Computers and I love them. My friends keep saying that Computer is good for me. Teachers are saying that, Join for the job and do higher studies as part-time. But in both interviews sessions, the HR's told me to pursue higher studies after seeing my score. My Family and relatives says that,  do higher studies now. And do I need any more reasons to be confused. Can I perform well as a businessman. As a manager or as a financial consultant., etc., I've such doubts too. I know I don't like to be a marketing guy. So the finance and HR are my hopes. Yes systems, IT and operations are not there in the institute ...

Hopes: all are different

Hope doesn't have any ends. It have wings; and it's so mesmerizing. My hopes are no different. But they all aims a different set of targets than most of the people out there.

Files in C++

I know all of you, who tried to learn C++, someday wishes to have a good understanding on Files in C++. But It's not easy to find all that stuff in one place. Today I completed writing a seminar paper on the same topic. Although it's for my collage, and is a work given by my C++ lecturer, I decided to publish it for interested audience. So I uploaded it to my Google Docs account. You can find it here . But still you may find that it's not so explanatory or there is not so enough examples., etc. But don't worry, I am going to write a series on the same topic. So wait for it. And I guarantee to provide many examples too. One more thing this document is published under Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

Contact Manager Extended

The program I wrote recently. That I posted here in an early post. Now I made some changes. That is now you can add as many emails and phone contacts. Also you can add a new email or phone after a contact is created. ie., missing form previous version. But one ToDo is still not done. It's verifying whether email is correct format. It can be done another day. But not now. You can download source here . contact manager by Arun.K.R is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License . cb.py cm.py

My First Python Program

I am very glad today. Because I finally wrote a python program all by myself. I am programming for about 3 years. Of which 2 are using C++ (Old standard and using Turbo C++ IDE ver 3.0 and yet to master Templates and STL. [:-p]) and After starting python using Dive into Python an excellent book by Mark Pilgrim during my 1st year summer vacation, and I only completed Data Structure section. Then I found an excellent Java tutorial by Sang Shin and obtained a certificate by completing First and basic course in Java. Now I am working with My Friend to develop applications in java. We established a web site already. He started programming when he is in 10, ie. more than 2 years of experience. He has Visual Basic too in his side. Now he is doing with JSP and I am concentrating on Python, Ruby (yet to start) and CSS. Today My pleasure is that I completed a python program myself. Which is asked to do in ' A byte of Python ' by Swaroop.C.H. Which is a command line program; and he...