Archive for the ‘Ruby’ Category
How to stip tags, script and style off the HTML
September 21st, 2008
Havn’t you just wished sometimes that all the html, script and style tags would just vanish from the html pages and all you get is pure text (for fun and profit). Well, here’s how I am managing it
require "open-uri"
require "hpricot"
require "sanitize"
html = open("http://www.google.com")
hp = Hpricot(html.read)
hp.search("script").remove
hp.search("style").remove
sanitize(hp.innerHTML, okTags="")
And output?
“GoogleWeb Images News Orkut Groups Gmail more ▼ Books Scholar Blogs YouTube Calendar Photos Documents Reader even more » iGoogle | Sign inIndia Advanced Search Preferences Language ToolsSearch: the web pages from India Google.co.in offered in: Hindi Bengali Telugu Marathi Tamil Gujarati Kannada Malayalam Punjabi Advertising Programs - About Google - Go to Google.com©2008 - Privacy”
Now you can use this text to any imaginable use - as I mentioned earlier - maybe fun & profit
Libraries - hpricot, sanitize, open-uri
Have fun!
Posted in Ruby | Comments (1)
Getting back to the drawing board…
August 3rd, 2008

Drawing boards are so much more fun than paper’n pencil ![]()
Posted in ApnaBill, OpenSocial, Rails, Ruby, Startups, Web 2.0 | Comments (0)
Zarro boogs found!
July 31st, 2008
This is the sweetest possible message Bugzilla can ever show a developer ![]()
Tonight, I’ll be syncing live ApnaBill.com with the most stable version we ever had - the operations are still getting formalized but the code-base looks awesome!
If you come across any bug @ ApnaBill.com, feel free to ping us at our support channel - who knows, you might just save the day for thousands of users ![]()
Posted in ApnaBill, Ruby, Startups, Web 2.0 | Comments (0)
A teaser from ApnaBill.com
May 30th, 2008
The current week is just halfway through, but it has already been one of the most eventful week for ApnaBill.com - with some definite advances towards the release. We’ll be launching the live pilot mode release in just days time.
More good news - we’ve expanded our network coverage from a handful of operators/cities to a pan India coverage.

We’ll be supporting 16 different prepaid vendors across 14 different geographical locations - I must say, that is a mighty list!
And to give you a small hint with what’s in the store, I present to you, bits and pieces from ApnaBill.com UI - all this and much more is just waiting to go live!

All the hard work that has gone into cross browser support…

A self-explanatory teaser on the front page

Another teaser

The prepaid coupon types we’ll be selling…
![]()
Secure transactions - with subtle hints on the UI

And of course, the ubiquitous help!
Please do signup for our Beta Release if you have not done so. The Beta Signup is still open.
Posted in ApnaBill, Ruby, Startups, Web 2.0 | Comments (2)
Giving wings to RAKA - graphing ability!
May 28th, 2008
Brightest ideas hit you when you least expect them. I was trying so hard all evening to put RAKA’s output into a format Graphviz could understand - but had no luck. I tried arrays, hashes, stack and what not - but nothing seemed right (or I wasn’t doing it right
) - and at 4am - right at the moment when I was packing up for the night - it hit me! - Just like a big bright Bulb!
Why not XML? Graphviz can very well render an XML (Some examples from ruby-graphviz gem) - and I was already able to output my tree in much similar format - whoa! 5 more minutes and I had this…

Read the graph - left to right, top to bottom. If X is displayed before Y in the graph, X is coded before Y.
And this is the code it corresponds to…
-
-
require "pp"
-
-
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
-
puts ""
-
puts ""
-
end
-
end
-
-
end
Here is a side-by-side comparison of the output
The graph seems more like in vertical direction - however a more horizontal direction would look much better - what say?
Oh yes, I have a new expansion for RAKA - “A Ruby Klass Analyzer” ![]()
Posted in RAKA, Ruby | Comments (2)

