Archive for the ‘It calls for a blog…’ Category
Proto.in July 08 Edition
July 21st, 2008
The atmosphere was electrifying at Proto4 - and the talks were doing everything to make the conference even more interesting!
The presenting startups didn’t got much time to attend the conference talks - we were quickly rushed for the rehersals which were to prepare us for the upcoming showcase on 2nd day of the event. Helping us all along was the great team of Proto - which made sure that we had everything we needed to be ready for those 6 minutes of showcase - a big thanks to the Proto Team.
A quick presentation from ApnaBill kicked off the rehearsals - we fumbled alot, were mixed up alot - and the feedback was all worth it. Just a quick work of advice - never go to a presentation unprepared. ANY preparation is better than NO preparation
After the day of reharsals, we mutually decided that Sameer would head our pack onstage. He did a nice job with the presentation and I guess our point got communicated across to the audience pretty well.

Sameer presenting ApnaBill.com to a hall packed of audience

ApnaBill.com team (Sameer in front (second from start), Me and Sandy)
Before the day ended, each startup demo’d their products on the stalls. Checking out the stalls were potential users and investors alike.

Me posing with ApnaBill.com (ghosh! that right click…)
Here are some goodblog articles which described the event pretty well.
Rishabh from Mutiny.in - Proto.in goes North
Amit Ranjan from Webyantra - Proto IV at New Delhi: Impressive show for startups, entrepreneurship & technology
Slideshare - A list of startups showcasing at Proto4, Proto4 pictures
AlooTechie - Proto 4- A Winner’s Showcase
* More pictures and videos to follow…
**Pictures courtesy Amit from Slideshare.
Posted in ApnaBill, It calls for a blog..., Proto.in, Startups, Web 2.0 | Comments (5)
Static call graphs for Ruby code
May 27th, 2008
Ever since my bug list for ApnaBill.com started to go down, I was worried that what am I going to do in all the free time which will suddenly be created. So much so, I was even creating unnecessary tasks and them scratching them out upon realizing that they are just not needed - sure shot symptoms of working too lately!
While working on ApnaBill, I felt a huge urge to document my code - specially the libraries I wrote and some of the complex controllers. Surely enough the code is very well documented - infact, at times makes pun and even tells stories - but I was always missing a call graph generation tool, which when given my Rails project, can graph out all the calls each of the actions make. I am not talking about profile time graphs - but something pretty static, which just looks at your ruby code and draws a graph.
…And just why is it needed? Documentation - ofcourse! A colored and connected graph, which can take you directly to the source code is alot easier to digest than just the code - specially for those who have not written that piece of code. This can be real useful in many scenarios.
Ok, so I started my search two days ago, on Saturday night - and for all night, I was crawling web pages like a googlebot - trying to find the relevant pieces of information. I did came across some fantastic projects like RailRoad, RCov and ruby-prof - but there was nothing that could satisfy my need. I even tried Doxygen (which is still to support Ruby), rdoc and almost all the other doc tools mentioned at “Other tools” seciton on Doxygen’s website.
Continuing my {re}search, I came across ParseTree. Its a C extension which churns out Sexp representation of Ruby code. You can parse ruby code in classes or methods or strings format. The library (apart from other stuff) - basically gives you a callback like access to various parts of the Ruby language. So “process_defn” would be invoked when any “def my_method()” is encountered.
There isn’t much on the internet about how to use ParseTree but the code samples and RDoc included in the gem are a good start. And then there’s the code installed by the gem - which you can always read at leisure. Another document worth checking out is Ryan’s Dependency Analyzer - where he does a bit of explaining as well.
Okay, back to the problem in hand - How can I draw a call graph of my code without actually executing it. I don’t want to execute it because it cannot guarantee 100% path coverage. Further, my objective is to document the code rather than profile it.
After my initial attempts, I was finally able to create a hierarchical structure of the code (which is utterly basic as of now).
-
-
# Target code which is to be graphed
-
# Save as "mini.rb" in your current directory
-
module Junk
-
-
class Maku
-
-
def say_hello(str)
-
puts "hello #{str}"
-
a = 1+1
-
if a == 2
-
if a == 1
-
puts "Yahoo"
-
if a == 10
-
puts "Microsoft"
-
else
-
puts "Google"
-
end
-
end
-
pp a
-
else
-
puts "bye"
-
end
-
end
-
end
-
-
end
Introducing RAKA
-
-
#!/usr/bin/env ruby
-
# RAKA - A Ruby Kode Analyzer
-
# Save in same directory as mini.rb
-
-
require "pp"
-
require ‘rubygems’
-
require ‘parse_tree’
-
require ’sexp_processor’
-
-
class Raka < SexpProcessor
-
-
attr_accessor :tabber
-
-
def initialize
-
super
-
@tabber = 0
-
self.strict = false
-
self.auto_shift_type = true
-
end
-
-
# Just a wrapper for s method.
-
# Usefull in decrementing tabbing structure once processing is done.
-
def s(*args)
-
result = super(*args)
-
@tabber -= 1
-
return result
-
end
-
-
def process_fcall(exp)
-
@tabber += 1
-
name = exp.shift
-
display "CALL #{name}"
-
return s(:fcall, exp.shift)
-
end
-
-
def process_if(exp)
-
@tabber += 1
-
display "IF"
-
test = exp.shift
-
process(test)
-
left = exp.shift
-
process(left)
-
display "ELSE"
-
right = exp.shift
-
process(right)
-
display "END"
-
return s(:if, test, left, right)
-
end
-
-
def process_defn(exp)
-
@tabber += 1
-
name = exp.shift
-
display "DEF #{name}"
-
args = process exp.shift
-
body = process exp.shift
-
display "END"
-
return s(:defn, name, args, body)
-
end
-
-
private
-
-
def display(str)
-
@tabber.times{ print "\t" }
-
puts "#{str}"
-
end
-
-
end
-
-
require "mini"
-
puts "============Junk::Maku============"
-
Raka.new.process(*ParseTree.new.parse_tree(Junk::Maku))
The result
Woha! As you can see, I am able to relate the code structure with the calls and if statements. If I can output this into a format which Graphviz can understand, we’ll have exactly what we want!
Too bad, its almost 6am - and I have to catch up on some sleep
I’ll have to stop here - more on the project as things with RAKA proceed.
Comments and suggestions are more than welcome
Posted in It calls for a blog..., Ruby | Comments (2)
Running IE6 on Linux
October 17th, 2007
I had to run an IE only app in office today but didnt wanted to boot into Windows!
Two reasons for that
- I hate Windows
- I have forgotten my login password from past 3 weeks
:D
Ask google on what can be done for the situation & it’ll redirect you to a script called ies4linux. This is one helluva job! It downloads all the required components and installs them too. Only prerequisites to run it are cabextract and wine. Check out this nice tutorial. IE6 was up and running on my Ubuntu box in less than 2 minutes (I am sitting on a fat pipe
)
MTNL’s customer care website is known for its ugliness… this is how it rendered on my FF 2.0.0.6 and the IE6 running on Ubuntu Gutsy Gibbon RC

Firefox 2.0.0.6

IE6 on Ubuntu
Wine has considerably improved over the time. Just last weekend I was trying to install the UT3 Demo Win32 version on my Ubuntu box (after successfully installing DirectX 9) but couldn’t go through as I ran out of disk space. I am all praise for Wine atm!
Posted in It calls for a blog... | Comments (0)
Whats up with GPRS speeds in Delhi?
June 24th, 2007

No, I am not connected to any Wifi access point - its a plain old GPRS connection from Idea Cellular!!!
I took this screenshot a few days ago when I managed to stream a full 12 MB video off the GPRS connection! The speeds I was getting were mind boggling - averaging 15K per second, touching even 20K!!!
Is Idea Cellular in Delhi poviding EDGE services? I’m curious because I get pathetic 1-3KBps speeds in Pune
Good, I have a flat rental plan - downloads can be unlimited for me ![]()
Posted in It calls for a blog... | Comments (1)
Page 3! Yay!
May 15th, 2007
Being on the day’s Page 3 brings a different feeling all together!
Check out the Reader’s Speak coloumn!
Direct link to access the Epaper & this is what I had said - I had thought that everyone would have a same thinking - but oddly enough, the others had a different opinion to sound. Hmm!
Posted in Blog, It calls for a blog... | Comments (6)


