IdeaMonk

thoughts, ideas, code and other things...

Wednesday, September 30, 2009

PyCon India 2009!



Before I forget, I must pen down this energizing experience at India's first ever PyCon that happened in IISc Bangalore on 26th and 27th September, 2009. I also happened to find Amit from GSoC 09's Delhi meetup and @hnprashanth.
Day 1, we were a little late, "My adventures with Python" was a miss. I, along with Rohan and Prabhat moved to much needed "Introduction to Python". It cleared a lot of doubts I had and we tried out some List Comprehensions, Dictionaries, etc. I knew that xrange is faster than range, but I had not cared to explore why. The myth was busted when Noufal talked about generators which are like functions frozen in time, no other words can better explain them. I immediately remembered how cool was the Prime generator I had seen months back.
The next talk we attended was "Test driven development in Python", again an eye opener to quality code, which is less error prone and easy to maintain. I got bored by the time they compared different test frameworks, I guess for a beginner, knowledge of a concept is enough, the latter part of talk was beneficial to actual practitioners.
The next talk - Idiomatic Python and other language features - What an excellent talk on the language by Sykora. Like, did you know a try... except block could be faster than an if.. else in a loop. This has been tested by Sykora. Differences between upcoming Python 3.x and 2.x were clearly highlighted, and I personally loved the way Sykora presents.
I headed for "Django: A blessed webframework for perfectionists with deadlines", I guess it overflew schedule or something, I just saw the same talk over youtube yesterday, and have been waiting to try Django soon. Btw, I just realized I had seen the guy giving the intro somewhere on twitter, it happened to be @scorpion032 !
Coming up next was "National Mission on Education through ICT & Python", Wow! what an awesome plan! Imagine being actually able to use a computer to solve your daily problems, thanks to Python. MHRD has planned to embed in Python into college curriculum. They distributed Ubuntu live DVDs customized for Python, along with video tutorials on Python. Python being the only human readable programming language unarguably suits the purpose. Maybe I won't see such a day, but future generations would do :) It led me to think about why not Python at Schools, which has become an ongoing discussion on ilugb and bangpypers mailing list. So many are pissed off with non standard TurboC++ which belongs to pre-historic ages of 4kb RAM luxury as Robert Lafore put it. I personally feel Python is excellent replacement for GWBASIC.
Its sad that we missed those fossee.in T-Shirts, with that cool antigravity xkcd comic strip all over on the back of it. PyCon's T is too good enough. Well, that was day 1 of PyCon. The IISc area was so clean that we could'nt find any cigarettes at all. I guess we made Amit wait a lot at majestic while fagging, thanks to Rohan for engaging him over in-depth discussion on KDE and GNOME dev. Back home Prabhat was really excited about Python, and tried it out whole night. Btw, also found out bpython, which happens to be an excellent Python interpreter ( a mod of ipython actually ) for any beginner.

Day 2 was lighter, again we missed the first talk on Mayavi/TVTK. Road To InPyCon 2009, but Noufal was a much needed talk on how it all happened. I wish it was scheduled as last talk. The we headed over to Test Driven Development by @sai_venkat from TW. Yes, it was entertaining, but as I don't develop softwares as a profession, the latter part of the talk didn't make much sense. But it did make sense of Software Engineering as a subject, I've been questioning its existence ever since this semester started, now I don't for I can relate it to things in real life. Today's S/w Engg lecture on Unit Testing at college was much more interesting than usual.
Come Lightning sessions to be ended in BOF. Various lightning talks, Pyglet one worth the mention. Friends pushed me to show web2hunter and I wondered whats there to present in it. Having pushed over and over I had to yield, so we talked with Mr. Senthil who humbly gave me permission, and to my surprise, he actually knew about web2hunter! Ahh damn, having not spoken to a huge crowd ever was making me feel nervous. But I finally gave it, a short one for 10-15 mins I guess. Some found it really lightening, others found it neat. I still have to watch it again, I feel I was too fast while explaining the code, some people were yawning... but by end I could hear some loud claps, I guess that did it, 'taste of food lies in eating'. What I wished to stress was code-re-usability made easy in python. You know, web2hunter is a small script which evolved from a small terminal script to a webapp on the fly, thanks to Python. Btw, while making web2hunter, I also realized that the if __name__=='__main__': block can actually come handy when writing tests for modules.

We moved to airport after that, Ishan had flight to Delhi that evening, hectic trip though. Ah we also worked on some PHP script, got trapped with a 0770 /etc/sudoers, resetting the password from GNOME helped... while at airport and had the usual anime exchange.



The snakes who made it possible

A memorable experience indeed, an invigorating, energizing one! A truly Pythonic one :)
Looking forward to PyCon 2010 with great expectations.

Labels: ,

Wednesday, September 16, 2009

Who stole all that bandwidth? or was it a design accident, was it a python ... ?



That's what happened to Web2Hunter yesterday. Downtime due to quota exceed, I never thought 1 Gb a day would ever exceed... but now I actually have to think about saving every possible bit. Here is my explanation to the downtime of Web2Hunter -



  1. I post about Web2Hunter on HN. Drives good deal of traffic to Web2Hunter.
  2. Many users throw requests simultaneously, thanks to 5 second ajax loop which never ends for sake of Web2Hunter's simplicity/chaos or randomness.
  3. Web2Hunter validates domains using Google, this contributes much less to the outgoing bandwidth, no problem so far.
  4. Google gives back html, each roughly 3-4 KB in size. Given a surge in traffic, and the 5 second ajax loop, this means a lot of incoming bandwidth.
  5. Again, the response to ajax request is minute (a domain name), so nothing much to do with outgoing bandwidth quotas.
  6. So, even if things are ajaxified, the poor design used to suck up lot of bandwidth internally
Solutions - things have been working fine now, and incoming bandwidth quota isn't climbing every 5 minute as it used to do yesterday.
  • Ajaxwhois API came out as a life saver. It returns a few bytes of JSON instead of chunk of html, and I don't even need to parse the JSON for it is too simple to make out from it's contents.
  • ΒΆIt could be possible for someone to misuse/proxy the domain finding url that ajax loop fetches every 5 seconds. For that I've tried to filter the requesting client by referer information. This would reduce the chances of hotlinking/sucking

    if (self.request.headers.get('Referer') != None):
    if (self.request.headers.get('Referer').find('web2hunter.appspot.com')!=-1):
    # show your content
    .
    .
    .

  • Images to be converted to jpeg, obviously every bit counts, and we really don't need fancy png without any need of translucency.
  • Another one yet to be implemented - since web2hunter does magic of random-combination to get you cool names, one good idea to save some more bandwidth would be to store all the domains that are unavailable so as to not to lookup again for them. Hmmm... but that means we lose out on any domain marked today, if it expires tomorrow. Hmm... I guess this idea would also need monthly truncation/refreshment of domains stored in unavailable list. Not good for maintenance...
So, till then I hope Web2Hunter runs smoothly on the Engine without any glitches. So far, even a one hour test has not been able to do anything to 12% incoming bandwidth :)

Labels: , ,

Tuesday, September 15, 2009

Web2Hunter - grab those domains before they vanish

Last weekend I was trying to make a more useful app over Google App Engine... at least better than the first one. So here's what I got for you - Web2Hunter, yet another one that brings up some randomized yet organized information to you, thanks to urllib2 and Python in the back. Here is the intro article I wrote for it -

How many times you have been stuck for hours thinking of that new name for your startup? How many times have you come up with that awesome name and you found out that all your imagination was on sale by a domain squatter? Don't worry, for Web2Hunter is here for rescue. It not only saves you from spending extra hours over thinking a new name, but also from the dismay of not finding a domain for the name you liked.

Simply put, Web2Hunter shows you a list of random trendy names which are actually available for purchase. It's about assisting your creativity. It throws up randomness, strange names of any kind. It's fun to watch because it opens your mind to new possibilities when trying to name your service, or even have new ideas.

Let Web2Hunter hunt down some cool names for you before you spend your precious time over a new name. Web2Hunter runs over Google App Engine and tried to be minimalistic. Do you have any suggestions to improve Web2Hunter ?

The original article can be found on The Indian Startup - Tools blog.

Feel free to fork Web2Hunter's source code on github. I also happened to give a short talk on it at PyCon India 2009, which was very impromptu and organized, for all I had to show was code, no slides. Have a look (youtube).

Labels: , , , ,

Saturday, September 05, 2009

ILUG-B meetup #2

Well, it was a pleasant Saturday with 50-cent playing on the auto in which I sped towards TW office - for ilug-b meet. This one was a total gyan session and even though there was even more OHP than last time, I'm glad that I pulled up till the end. After all I can definitely say BeleniX and ZFS are the next two things on my tryout list. Ram's presentation was awesome and in the end we got to see some seriously cool stuff people made through Virtualization and Crossbow on Solaris. Hats off to the $350 magic box guys!
And, oh the discussion over GPG finally ended I suppose! Finally when things were light under beer, I could observe some less OHP... 4chan, LOLcat, Mitnick, first-time-on-linux and what not. I guess I've had my usual amount of beer that invites me for a nice sleep. Even mom has guessed it as she puts it "ette der katte lagalao? daru peeke elhi yay ki...?" damn! How do I respond to that :P

Afterthoughts -
  • Linux is more about loving the OS, than just being an enthusiastic user...
  • Determination is even more important as pg puts it.

Labels: , , ,