My Perls of wisdom

12 10 2006

Here is my first contribution to the Open Source community,

Its a command-line google search tool written in Perl. I did not use their API, just used browser agent…

## google-parser-command-line.pl By Saifullah Mahmud Sumon : 2006-Jul-12
## use multiple search topic in comma-sepatared arguments.
## Sample run, >perl google-parser-command-line.pl one search topic, another search topic
use strict;
use warnings;
use LWP; # use this module for access to webpages
my $browser; # create new object from LWP module
my $args = join(" ",@ARGV);
my @keywords = split /,/ , $args;
foreach my $keyword (@keywords){ # loop through the keywords
my $url = 'http://www.google.com/search?hl=en&lr=&ie=UTF-8&q="'.$keyword.'"&hl=en&lr=&start=0&sa=N&filter=0';
print "searching... [$keyword]\n [$url]\n";
# perform the search and return the page source to the $doc variable
my ($doc, undef, undef, undef) = do_GET($url);
while(($doc !~ /repeat the search with the omitted results included/)
and ($doc !~ /did not match any documents/)
and ($doc =~ /Next/ )){
chomp $doc;
$doc =~ s/]*>//g;
$doc =~ s/.*seconds\)//g;
$doc =~ s/12345678910.*//g;
my $results = $doc ;
while ( $results =~ /(.+?)

(.+?)
(.+?)\s+-\s+(\d+k)+/mgsi) {
my($title, $desc, $url, $size) = ($1||'',$2||'',$3||'',$4||'');
$url = 'http://'.$url;
#regex the text out, KISS rule ;) Keeping It Simple
$title =~ s/\&quot\;/"/g;
$title =~ s/\&amp\;/&/g;
$title =~ s/\&\#\d+\;/'/g;
$title =~ s!!!g;
$title =~ s!,!;!g;
$title =~ s!\s+! !g;

$url =~ s/\&quot\;/"/g;
$url =~ s/\&amp\;/&/g;
$url =~ s/\&\#\d+\;/'/g;
$url =~ s!!!g; # drop all HTML tags
$url =~ s!,!;!g;
$url = $1 if ($url =~ /(.+?)\s+/);
$url = $1 if ($url =~ /(.+?)\&nbsp/);
next if $title =~ /nbsp;$/;
printf " %-80s ==> %-70s\n", $title, $url;
}# while inner
}#while outer
print "------------------------------------------------------------------------------------------\n";
}#foreach
exit 0;

sub do_GET { # subroutine that does the actual GET on the webpage and returns the source
# Parameters: the URL,
# and then, optionally, any header lines: (key,value, key,value)
$browser = LWP::UserAgent->new() unless $browser;
$browser->agent("Mozilla/5.0");
my $resp = $browser->get(@_);
return ($resp->content, $resp->status_line, $resp->is_success, $resp)
if wantarray;
return unless $resp->is_success;
return $resp->content;
}





Self-criticism

10 10 2006
    I need to be more serious in blogging.




Latest ebooks, free…

10 10 2006

Get the latest ebooks by torrent from ebookshare.net. A big Thanks to, whoever made this site. I uploaded some of my own ebook collection in my this box.net folder “http://www.box.net/public/punb6h9utk“.





I found hasin hayder’s blog today…

8 10 2006

I discovered some Bangladeshi blog today. Amongst those is hasin hayder‘s blog. He is one of the pioneers in Bangladeshi programmer’s community. Has a very interesting bolg, which he started from October 2005. So there are lot to know about him.

Self criticism: Yes, I know, I should read more Bangladeshi blogs. I keep reading Michael Arrington’s and others.





Spread it

8 10 2006

Please read it and spread it. link

Hello all,

This mail is involves approximately one hundred thousand people,
living in a remote place of Jessore named Vobodoho Upazilla. Many of
you may already know about this issue. For those who do not know about
this, about one hundred thousand people in three villages of Vobodoho
Upazilla in Jessore have been water clogged for more than a year. All
their lands are under water. Therefore, they cannot cultivate anything.
Their houses and roads areunder water, too. As a result, they cannot
lead normal life. Water clogging is not a new issue in Bangladesh. This
situation it did not arise from flood. It’s a man made disaster. It has
occured due to the formation of sluice gate there. Therefore, it does
not have any natural solution.

This water is not going anywhere unless the authority does something
about the sluice gates. It was decided on November 2005 that the
situation would be dealt on an emergency basis. But, needless to day,
no help reached to the villagers. If anyone wants to know more
information about this issue, here is the web site link:

http://bhobodoho.blogspot.com/

This blog is being maintained by the Drishtipat Virginia(USA). Our objective is twofold

1. To raise awareness

2. To donate those people

Those people are badly in need of food, medicine and other stuffs.
But, raising awareness is more important than donation. We can give
donation which will temporarily solve the problem. But, people have to
be aware of this. Otherwise, the NUMB authority of Bangladesh is never
going to pay any heed to the demand of those people.

Students of BRAC University have currently done a video on youthtube
about this issue. It gives a vivid picture of the sufferings of those
people.

http://www.youtube.com/watch?v =w6jbUi4VTDw

Muhammad Jafar Iqbal recently wrote an article in Prothom Alo ocussing those people.

http://www.shuchinta.com/wp-content/uploads/2006/09 /mziSep2706.pdf

Now, in order to raise awareness we are thinking of doing a manob
bondhonat Shahid Minar. A tentative date for the event is 20 Dec. A few
members from Dristipat Virginia will be visting Bd during that time.

We are trying to get some Big names along with us to have greater
attention. A press release will be issued to involve media. We need
people. The more people we have the stronger the event.

Our earnest request to everyone .please spread this news…..only 17 more days to the event…..

Hope to see you all there………

LETS DO IT

Drishtipat Virginia





3 Games that will change gaming standards…

7 10 2006

I JUST LOVE “CRYSIS” by Crytek, the upcoming ground-breaking FPS game on PC. I can’t boast about it in a few lines. I will write more later. 1 line for now, “It will be the first game that uses DirectX 10, which is not released yet”.
crysis-small

Another too good shooter is GOW, Gears of War by Cliffy B.’s team in Epic Games. That one is on Xbox 360. But its the best game yet, visually. May be for its gameplay too. I just wish I had one Xbox 360. Its getting out soon.

Another very good upcoming one is Assassin’s Creed, by UBIsoft Montreal. It will lunch on
PC too, along with PS3 and Xbox 360. Hurray!!

These three game will set the standard for the buzz word “Next Gen Games”.





I am the 21st century brain worker…

7 10 2006

Found something very interesting. The writer of this “legendary” article about a simple web crawler wrote about himself,

Mike Thomas is an Internet application developer working for a consulting firm in Saskatchewan, Canada. Mike lives in Massachusetts and uses two Linux systems to telecommute 2000 miles to his job and to Graduate School at the University of Regina. He can be reached by e-mail at thomas@javanet.com.

I had to ask myself: How many miles I do? Lets check in Google Earth. Its 7,850 Miles or 12,634 KM. So I guess I am one the longest mile workers ;). His article is really very helpful anyway, and legendary too (read the comments there, you will know). I bookmarked this site 4/5 months ago just to add this story in my blog.