Thursday, August 27, 2009

Automatic Django Template Directory adjustment

Django is that hot new MVC framework on the block that's kept me sleeping at night, quite unlike PHP. Yup, its that good! :) It's got wonderful features that make me feel - Yeah! Development for the web is still worth the grind! By the way, if you're not into Web Development and don't care two hoots about the difference between a framework and a library, this post is not for you - Mosey along now! Nothing to see here. ;)

Anyway, one of my few n00b questions to which I've never actually got a satisfactory answer is - How do you specify the template directory so that you can send your code to others and have it execute by manage.py runserver without any changes? The primary problem is the hardcoding of directories that is done in the settings.py file at the root of the project. After a bit of searching, I've come to a satisfactory solution and lest I forget it, I've decided to post it to my blog. Here's the code snippet.


TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
# os.path.realpath(os.path.curdir).replace("\\", "/") + "/templates",
os.path.abspath(os.path.dirname(__file__)).replace("\\", "/") + "/templates"
)

This seems to work most of the time, just let me know how it works out for you!

Geeky Stuff - The Linux Kernel Implementation of Pipes, FIFOs and other Filesystems

I had to create a presentation on the implementation of Pipes and FIFOs on GNU/Linux for my Network Programming class (we're doing some background on IPC). Since I couldn't find any decent documentation online, I decided to dive deep into the Linux kernel code and see what devils were lurking beneath the pipe() and the mkfifo() system calls. The end result? A rather organized documentation of how pipes and FIFOs are implemented on linux (including some stuff about the pipefs filesystem). You can use this documentation in a variety of ways (including creating your own, new filesystem, for linux), but beware, I've made this complete documentation by reading the code. It elides a lot of informative stuff and might be incorrect in places. I would love to hear about anything wrong or misleading in this documentation. I undertake no responsibility if something happens to you, your computer or someone else's computer if you use/misuse the information provided. Please feel free to use the information as you see fit, but keep your eyes open and your mind working. I release this presentation into the public domain. However, I would love to hear if you liked it and used it somewhere.

The presentation is located here.

Life Updates after the internship

Hello Web Surfer,
Firstly - Apologies! Its been a really long time since my last (reasonable) post and I've been neglecting my blog a lot. Mostly, this can be attributed to my internship at Microsoft which sapped me for over 2 months and then the brilliant work I've been doing at Zigndog. Forgive me for all the neglect and thank you for your brilliant patience. Given the long absence of updates, it is only fair that I give you a peek into the inner workings of my life (If you're not really interested, just skip on to the next post, you just might like spicy letters to the Dean :D ).
I've been tweeting a lot about DesignChef and Zigndog. If you don't already know of it, Zigndog is Puneet Jaggi's brainchild startup that working in the Web Development and Print Design space. Its working out well - Zigndog got 2 special mentions at the first DesignChef Logo Challenge and Second Place at the DesignChef UX Challenge. That's bagged us a cool Rs. 10,000 as a cash prize, not to mention a lot of positive publicity. (Hey! DirectI got so impressed by our work, we got contacted by them to do some work on rush basis). Of course, needless to mention that I was involved in the creation of the UX. But, collars up comments apart, serious kudos should go the entire team - Sampath, Rishabh, Sanat, Vikesh, Puneet and Priyanka Mdm. This was the outcome of our team effort and nothing significant could have been achieved without each one playing his part. Besides this, we've been working hard at ensuring that all our clients get satisfied. Something that's rather tough to achieve. (Trust me... Specially if you're planning to go for a startup someday)
Ok, here's the deal - I need to post some meaningful stuff that will document my internship and not leave you bored to death... First, some tech stuff: http://tinyurl.com/luc2zo - That's my internship presentation on Coalescing. Don't even bother reading about it if you're not interested (I don't have a transcript of my speech, so the slides are rather empty). It suffices to say that people liked it and I met my personal goal of getting across 60% of my work. Most people failed in their early twenties... :)
On the non tech front, here are a few images that document the really fun time I had in Hyderabad while sampling restaurants and enjoying the weekends. Thanks a lot everyone! It was great fun. Oh, and as a parting note - Happy Birthday Umesh!
This photo was taken at the Ramoji Film City. Its located about 2 hours away from Hyderabad but its a "must visit" for any tourist.
Taken at Tirupati. The golden cupola at the center is the sanctum sanctorum of Lord Balaji at the Tirupati temple. Many many thanks to P. Abhyuday and his family for making our trip such a memorable experience.

Thursday, August 20, 2009

[Cinema Club] Appeal

Dear Sir,
   I would like to inform you about a number of irregularities that have taken place in the selection and subsequent notification of the secretary of the Cinema Club. The professors in charge have refused to consider my case and hence I am resorting to this final recourse of appeal to you.

To give you a little background, I would like to state my version of events. You may wish to verify this with any you deem suitable:-
1. A notice was issued wherein applications were requested for application to the post of Secretary, Cinema club on Monday/Tuesday - 17th/18th August.
2. The notice clearly stated that applications must be deposited in the office of the undersigned Prof. R. Prasad (of Electrical Department) by 20th August 2009. I complied with the same, having slipped in my application to his room at about 4:45 PM on 20th August 2009 (today). He was not present in his room and the timetable in his office showed that he was in a Lab. I visited some Labs in the department but was unable to locate him.
3. Just before 6 PM, I am informed, in casual conversation, by one of my batchmates that interviews for the post of Secretary Cinema Club have already taken place at 5 PM in the office of Professor R. C. Mittal (of Mathematics Department) and that he has already notified the selected candidate by issuing a letter to Mr. Somya Mohan.
4. I immediately rush to the office of Prof. R. Prasad where I meet him and ask him whether he has received my application for the post. I am informed by him that he has received the application but that it is too late as he has already conducted the interviews, the result of which has already been  declared.
5. I appeal to him by stating that I have complied with all directions of the notices and all  the information that was available with me. He refuses to consider my case. 
7. At 6:30 PM at his behest, I have a telephonic conversation with Prof. R C Mittal wherein he states that he was made aware of my application by Prof. Prasad but was not willing to consider it.
8. On further conversation with Prof. Prasad, I come to know that information about the interviews was passed on to the applicants through a single person - Mr. Somya Mohan via the phone during the afternoon.

I would like to make the following representation:
1. I was not given a chance to represent myself at the interview for the post.
2. My application, though within time and present at the requested place was not accepted by the concerned Professor.
3. The interviews were scheduled before the deadline for applications had elapsed.
4. Only oral notification of the interviews was made and that too via a single student, who was also an applicant for the post and thus had significant self interest in the matter.
5. The results were declared before the deadline for applications had elapsed.
6. I was given no valid reason for the rejection of my application and my request for revoking/modifying/holding the earlier order in abeyance were summarily dismissed.

I feel that I have been unfairly discriminated against in this process.
Due process was not followed for the notification of interviews which were conducted without considering all applicants and before the expiry of the application deadline. Further, I wish to state that the interview procedure followed was arbitrary, unfair and opaque.

I request you to hear me out and take corrective measures as necessary so that my grievances are redressed. I shall be depositing a hardcopy of this application in your office tomorrow.

Thanking you,

Yours sincerely,
Divye Kapoor
4th Year
B.Tech (IDD) CSI
IIT Roorkee

--
At bottom, every man knows perfectly well that he is a unique being, only once on this earth; and by no extraordinary chance will such a marvelously picturesque piece of diversity in unity as he is, ever be put together a second time. -Friedrich Nietzsche, philosopher (1844-1900)