I've moved! You can find my new blog at EricMartindale.com.

Remaeus' shared items

Friday, June 29, 2007

World Clock

This thing is incredibly cool. A world clock that counts in all sorts of things, deaths, births, and even abortions. A statistician's dream. :)

Wednesday, June 13, 2007

Dr. Quantum - Double Slit Experiment

Dr. Quantum explains one of the phenomenon that get me very excited and intrigued by quantum physics.

Monday, June 11, 2007

Social Solution

All of these Social Networking sites have been giving me a real headache since... well, since forever. There's too many of them. I can't keep track of everything. I've always had the idea of creating a service that'll link all of these together, check and update them all. Well, someone beat me to the punch.

Sara show this to me, but it's take me a while to post my results. Well, here I am.

Now, the other question is what am I supposed to do with all of these accounts that work as an OpenID, like Facebook? Do use one of these as my primary OpenID? Or should I go with one of the many OpenID providers? If so, which should I pick?

Ranger Whittaker



Amber, Chenoa, Stephan, Dylan and Zack Harper star in a random improv movie made illegally (without my permission) at my apartment while I was at work. Rofl.

Sorry about the audio quality. They used a non-digital video device (you know, those clunky old things that record to a VCR tape?) - and I had to spend three or four hours editing the video alone.

I CAN'T SEE WHITE PEOPLE IN THE SNOW.

Monday, June 04, 2007

PHP5, Scraping, and XPath

I've been building a scraper using PHP5 and the newly added XPath functionality. The idea here, as an exercise in programming, is to scrape complete records from Google Maps, including name, address, and phone number.

Here's a snippet of what I've been trying to do. This probably isn't the best approach, but I can't quite figure out how to pull a child of a resulting element, PHP is forever returning an error when I try to use firstchild.

//start our result counter
$i = 0;
//try setting higher than 1000
while ($i < 1000)
{
//show status so we don't get lost
echo "Currently extracting data from records ".$i." through ".($i + 10)."...";

$raw = new domdocument;
$clean = new domdocument;

//special to Google
$url = 'http://maps.google.com/maps?f=l&hl=en&q='.$what.'&near='.$where.'&view=text&start='.$i."&radius=".$radius;

@$raw->loadHTMLFile($url);

$HTML = $raw->saveHTML();
@$clean->loadHTML($HTML);

$xpath = new domxpath($clean);
$xNodes = $clean->getElementsByTagName('td');

foreach ($xNodes as $xNode)
{
if ($xNode->getAttribute('valign') == "top")
{
//echo $xNode->nodeValue."\n";
$output .= $xNode->nodeValue."";
}
}

echo "...done\n";

//add to our counter
//10 results per page, so we add 10
$i = $i + 10;

}

//fix bugged double comma, can't figure out where this is happening
$output = preg_replace("/,,/",",",$output);

$somecontent = make_csv(strip_non_ascii($output));
echo $somecontent;


There's a bit of extra and unrelated code here, but that's the basic process I'm using.