Monthly Archives: June 2012

Hosted!

  • Deployed ‘DJPlus’ @ joelewis.pythonanywhere.com
  • Yes, I accept its not a charming domain, but I love the simplicity of ‘pythonanywhere’
  • It runs on Django 1.3, ported it backwards from Django 1.4 !
  • Still searching for Hosting Django projects in GAE, and it seems I can never get anywhere nearer. non-rel and django-appengine project is obselete and dead. 
  • Till GAE directly extends its support for Django 1.4, I have to make do with what I have. PythonAnywhere is no worser.
Advertisements

Spreading awareness? – Bullshit! you just turned a Geek into a Dumb Ass.

This fine women, a mother, proudly boasts in “Neeya Naana”, a Television Program, how she managed to keep her son, good and fertile, by cutting off his internet connection and access to mobile. And the reason was worth it, “I was afraid he would be exposed to ‘unnecessary content and adult sites’ and so I did “. That almost held my breath for a while. So, here’s another rant that I couldn’t keep it myself.

She was given a award in the show. Well, she just turned a Geek into a Dumb-ass. And by awarding her, Vijay Tv had just, seeded every parent to do the same.

Internet is not a source of knowledge, for Indian Parents (Well, most of), its just a source of pornography and bad contents that will turn their innocent children into spoiled animals. Hats off- to their immovable confidence on their children. Well done, You just, saved your child.

You saved your child from asking questions. You saved your child from searching for answers to feed his curiosity. You saved your child from everything, that would teach him more than any of your classroom walls and the salary-conscious teachers and lecturers will do. You saved him from becoming a Geek. You did it.

To all my respected ‘a-generation-old’ People and Parents, You had never Googled or Blogged in your sweet sixteen. You had never seen what The Real World of Internet is. You have just heard of something called ‘e-mails’ , which you blame for killing ‘letter writing’ while, you yourself use it and heard of exotic sites and pornographic contents available in the Internet. Believe me Internet has a whole other side that could potentially turn every curious guy into a genius.

Next time you hear somebody spreading ‘awareness’ that Internet to young minds is Evil, go tell him ‘I don’t want my son become a dumb-box like you, I Believe in my son’.

The brightest minds, I’ve come across till date, they had something in common. They were surfing the Internet, when they had to go to their Hindi tutions.

P.S That was for most of the parents in my state, In case you are a parent yourself and you are reading this, well, you know the power of Internet already and you won’t hide it from your child.

This bug held my night

Even though wrote my own view for returning a list of relevant months, having posts, it never showed up correct.

Digging in deep, found that <utc> stamped datetime objects in python when passed through django’s templating system ends up with a wrong result.

>>> date_list[6]
datetime.datetime(2012, 6, 1, 0, 0, tzinfo= <utc>)

The month indicates June, but when rendered with a template, the month is decreased by one i.e ‘may’

>>> t = Template(“The month is {{ month|date:’m’ }} “)
>>> c = Context({“month”: date_list[6]})
>>> t.render(c)
u’The month is 05

whereas the real value is

>>> date_list[6].month
6

Made notification with Stackoverflow to find out whether it’s really a bug. or I myself am missing out something.
Worked it out by converting the datetime object into a date object and then passing to the template.
That costed a saturday night sleep!

Anna University GPA Calculator

Just finished v1.0 of GPA Calculator

Honestly, I’m tired of searching for django-appengine solutions! That was one hell of a try, worth nothing.

This is how it went.
I intended to keep the app simple and fast. Obviously, I’m not going to need any database, for an app that just calculates and returns GPA.

Thus Django might not be the best option, with it’s full exploitation lying in high level database abstraction. So, instead of barking up the wrong tree, I tried to work out the Job using the webapp2 Framework, which comes bundled with GAE SDK itself!

Surprisingly, it was fairly easy understanding the framework.

The next Big Thing was Fetching an awful lot of data from the wrapped page and using it without using db.
It needed to design a specific datastructure that could hold all those data, while keeping them simple to extract when necessary. Well, a python ‘Object’ might have sufficed, but again that adds a bit of complexity. Then, I had to solve it using ‘A List of Dictionaries’.
for eg. to fetch a row of data for a particular subject in a python dictionary

{"subject":"CS2301", "credit":4, "grade": "A", "result":"PASS"}

and to fetch the whole table, build a list of dictionaries for all corresponding subjects.
for eg.

     
     lis=[] 
     for each dictionary fetched: 
       lis.append(dic)

This gave me the complete result table in a single datastructure!

Almost done, had a bit of trouble passing the list variable to template. Working it out, it was done, Finally! The One Click Anna University GPA Calculator now, faster and better!
Code @ http://github.com/joelewis/getgpa

Oh, and Don’t ask me that question! Without db why Python, why not Javascript? I wanted to learn something. I got it.

Going GNU

Few months back, My friend Raguvaran, introduced me his brother Murugesan.

Murugesan is a fresher and looking for learning something to get a job.
I suggested him to learn whatever he is interested in.

After some discussions, I suggested him to learn python programming  or linux administration.
He chose python and started learning it.

After some time of learning the basics, he asked me on how to proceed now to become a better python programmer.

Here are the answers for him.

0. Solve these 46 problems:

http://www.ling.gu.se/~lager/python_exercises.html

 

1. Start writing small programs yourself

You might be coded some snippets when you learn python. Using the knowledge of python, try to write small commandline applications.

Some examples:
1. A simple diary to store all your notes
2. An Address book to store/edit/search/delete address,phone,email of friends
3. Simple financial app to manage the income/expense
4. create all these using text…

View original post 709 more words

DevLog: GPA Calculator v1.1

  • Came across this interesting code from vigneshmoha‘s and tried to write an optimized one myself.
  • This is something between a ‘Program’ and an ‘App’.
  • Used python to write a web-wrapper to retrieve latest result from anna university servers, parse the output, and end up with a finalized GPA.
  • Still, its just a raw python program and to make it accessible by the mass it has to be made into a web application.
  • I’m so poor, that I couldn’t host it with a domain and server. Well, I’ll use Google App Engine. Will have to stick to a framework. ‘webapp2’ is a bit complicated. Searching for django-app-engine solutions. Once done, It’ll be hosted in google’s infrastructure.
  • Shouldn’t take more than a few hours.
  • Find the code at github

DevLog: Added Fb Comments to DJPlus

Tried adding Comments feature via native contrib.comments application, but it looked messy and moreover comments using openID will be much more cleaner.

Had to go through with ‘disqus’ and I wouldn’t know, no matter how many Unique Identifiers I specify, every comment appears in every post and that was totally weird! I dismissed it as a bug with ‘disqus’ itself,just as many bad programmers satisfy themselves.

So Finally I ended up using fb-comments-plugin and it works pretty well. Has openID support for facebook,yahoo and a couple more. Totally messes up the look of the page, but its OK! as far as it works.

Have to come up with a django specific app for comments with openID. I’ll get into that after I finish off with this.

Fought at Home: Going Into Sathyagraha Mode

Fought at home.
This one is serious.
Likely, may end up in an “info-suicide”.
I’m going to stop my dependence on my home. I don’t need anything. Just Food, Shelter and Home. I’ll try to find these on my own. I can live without this computer they bought. I can live without the Internet they pay for. Yes, I can sit there idle at the corner of the wall all day long, doing nothing at all. Let’s see who is at loss.