Tuesday, February 13, 2007

Function GetYahooRes()

This function just construct the search string that will fetch the desired page, and sends this search string to the function ReadPage. And the return value from the func Readpage is forwarded to the function ParseYahooRes().

Function ReadPage

This is not a class function.
It resides outside of the class definition.

function readpage($url,$till,$occ,$morelen)

//readpage("http://search.yahoo.com/search?p=link%3Ahttp%3A%2F%2F".$this->url."+-".$this->GetDomainName(),
//
http://search.yahoo.com/search?p=link%3Ahttp%3A%2F%2Fwww.salesforce.com+-www.salesforce.com
//"

Search Results

",
//1,
//100);

$url contains the link that will fetch the search result.
$till contains a string, in this case /"

Search Results

/"
$occ contains a number, in this case 1
$morelen contains a number, in this case 100.


And I don't like the idea of this function.
It is trying to do several things, and the logic is not clear.

I think I am going to revert to the Fetch_content function.


ParseYahooRes

function ParseYahooRes($str)

--
Return Value: False if $str == Null String.
0(zero) if no search result is found.
GetNumber($s) if success.

* The GetNumber($s) function removes commas from a string and returns as an Integer.

--

function ParseYahooRes($str){
if ($str=="")
return false;

$s=explode("

Search Results

",$str,2);
if (count($s)==1)
$s=explode("

Directory Results

",$str,2);
$s=$s[1];

$s=explode(" of about ",$s,2);
if (count($s)==1)
return 0; // No results
$s=$s[1];
$s=explode(" ",$s,2);
$s=$s[0];
echo '*'.$s.'*';
return $this->GetNumber($s);
}


Saturday, January 27, 2007

Norton Ghost

I strongly recommend all to use Norton Ghost to periodically create a snapshot of your operating system. I am running my windows XP version for more than 2 years without making a single attempt to reinstall ..windows.. offfice... winamp .. powerdvd... visual studio 6.0 .. visual studio .net .. msdn ... apache .. mysql .. and all other softwares that I use.

It saves me a week whenever a crash occurs. I can recover in 8 to 12 minutes, which could have taken 7 - 10 days of hard works.

Again I strongly recommend.

Podcast

I found a very new hobby, and it is fun and constructive both at the same time. Just download and install iTunes from apple's website. And then go to iTunes store and subscribe to different podcasts. They are much fun. And it will help you to improve your english listening skill too.

You can listen to the podcasts just when you wake up. Listen it for 30 minutes. I think it will pay off.

I try to get up at 5.00 am just to listen to the podcasts, right at the beginning of my day.

Redhat 9.0 and RealTek 8139

If your realtek lan card does not work in your red hat 9.0 operating system, don't panic. Just give the following commands. It works for me

$insmod 8139too media=0x01

I used the media=0x01 becuase i was trying to make the lan a half duplex and 10 Mbps. If you want auto mode, please leave out the media=0x01 part.