PyCon India 2009!




Last weekend I was there for a 3 hour battle of brains for ICPC-Amritapuri prelims. Though our team did not qualify this time, and only one team would be going onsite, I had a really good time debugging with gdb and helping out others debug fast. The problem looked something like this -
#include <iostream>
using namespace std;
#define ull unsigned long long
ull a,b;
ull f( ull n){
if (n == 0)
return 1;
else
return a*f(n-1) + b;
}
int main (){
ull n;
cin >> a >> b >> n;
cout << f(n) << endl;
return 0;
}
$ g++ -g fn.cpp
$ ./a.out
2 3 4
61
$ ./a.out
10000 100203 2323
11085757089601029659
$ ./a.out
100000000 100000000 100000000
Segmentation fault
ideamonk@sacea:~$ gdb ./a.out
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) run
Starting program: /home/ideamonk/a.out
1000000000 100000000 100000000
Program received signal SIGSEGV, Segmentation fault.
0x08048738 in f (n=99825467) at fn.cpp:12
12 return a*f(n-1) + b;
(gdb)
apt-get source tilda .... OK
./configure
..
...
.....
hmm I dont have vte something... okay lets get it....
apt-get source vte ... OK
cd vte-0.20.0
./configure
..
..
....
.....
Nopes.. what's this tgetent thing... Google... okay so I need to get libncurses-dev before I compile vte.
Thank god they packaged libncurses-dev :)
sudo apt-get install libncurses-dev
Then I make and install vte, and finally make tilda with debugging flag on as -
$ ./configure CFLAGS="-g"
$ make
// lets debug
$ gdb ./src/tilda
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) run
Starting program: /home/ideamonk/Desktop/tilda-0.9.6/src/tilda
[Thread debugging using libthread_db enabled]
[New Thread 0xb7132710 (LWP 1549)]
tilda: No such file or directory
Unable to set tilda's icon: /usr/local/share/pixmaps/tilda.png
[New Thread 0xb6f0eb90 (LWP 1557)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7132710 (LWP 1549)]
0x08051365 in tilda_keygrabber_bind (keystr=0x0, tw=0x9855bd8) at key_grabber.c:260
260 if (strcmp ("", keystr) == 0)
Carrying on with the sketchy and simplistic look to my blog, I removed the old header and drew some logo+monk+rocket with the iBall pen tablet I bought today.

<form action='/search' method='get'>
<input name='q' type='text' />
<input type='submit' />
</form>
Labels: timepass
Many websites and blog mention about how creatively has Dragon Interactive used cross fade to give that amazing hover effect on their navigation bar.


<div class='content'>
<div class='overlay'>
</div>
</div>

.content{
width:500px;
height:300px;
background: url(images/frame2.png) no-repeat;
margin:0px auto;
}
.overlay{
width:500px;
height:300px;
background: url(images/frame7.png) no-repeat;
}
<script type='text/javascript' src='jq.js'></script>
<script language='javascript'>
$(document).ready( function() {
$(".overlay").hover(
function() {
$(this).stop().fadeTo(400,0);
},
function () {
$(this).stop().fadeTo(300,1);
}
);
});
</script>
Labels: css, effects, javascript, jquery
char foo[] = { '0', '1', '2', '3', '4', '5' .... 'a', 'b', 'c' .... 'Y', 'Z' };
foo = [k for k in "0123456789abcdefghijklmnopqrstuv....Z"]
import random
random.shuffle (foo)
# want to get a string out of it? here it is
randomcombination = ''.join(foo)
>>> string.printable
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
>>> string.letters
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
>>> string.digits
'0123456789'
>>> print string.digits + string.letters
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
>>>
listing = [k for k in string.digits+string.letters]

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

Labels: Google App Engine, python, web2hunter
I wonder if the bandwidth limits on App Engine are actually enough! While this blog, my lunarpages shared hosting, byethost's free hosting easily survive sudden surge in traffic due to their high bandwidth limits, Web2Hunter on App Engine on other hand, almost reached incoming bandwidth quota yesterday after many visits from HN post -
and today's scene -

Labels: bandwidth, Google App Engine, web2hunter
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: Google App Engine, projects, python, startups, web2.0

Labels: javascript, jquery

$ wget http://www.gringod.com/wp-upload/MONACO.TTF -O /tmp/monaco.ttf
$ sudo cp /tmp/monaco.ttf /usr/share/fonts/truetype/freefont/
$ sudo chmod o+r /usr/share/fonts/truetype/freefont/monaco.ttf
$ fc-cache -f -v

Who wants a thinking speaking configurable cow! I wonder if anyone has found a good use for it. As for me, its just another fun tool like fortune and fish. You can make cow speak anything from stdin, it's fun making it speak some fortune for you.ideamonk@sacea:~$ sudo apt-get isntall cowsay
ideamonk@sacea:~$ fortune | cowspeak
ideamonk@sacea:~$ fortune | cowthink | cowsay
ideamonk@sacea:~$ fortune | cowsay | cowthink
_________________________________________
( _____________________________________ )
( / All the troubles you have will pass \ )
( \ away very quickly. / )
( )
( ------------------------------------- )
( )
( \ ^__^ )
( )
( \ (oo)\_______ )
( )
( (__)\ )\/\ )
( )
( ||----w | )
( )
( || || )
-----------------------------------------
o ^__^
o (oo)\_______
(__)\ )\/\
||----w |
|| ||
ideamonk@sacea:~$
ideamonk@sacea:~$ fortune | cowsay -f tux
______________________________________
/ Windows and DOS -- a turtle and it's \
\ shell. /
--------------------------------------
\
\
.--.
|o_o |
|:_/ |
// \ \
(| | )
/'\_ _/`\
\___)=(___/
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!
