Data.gov – best place to get federal raw data
Posted in Random acts of writing on July 2, 2009So I was reading the latest issue of Wired magazine and came upon an article they wrote about data.gov. A new government web site that provides raw data from multiple government agencies. The data is provided in many formats including, SHP, KML, XML and CSV.
If you have not visited the site, I recommend you visit. But first get the Wired Magazine and read.
Add Twitter feeds to your web site using Simple XML
Posted in The Codes on July 1, 2009Add Twitter feeds to your web site using Simple XML: see example
//Simply add this section of the code somewhere on top of the page -->//
<?php
function twitter_status($twitter_id, $hyperlinks = true) {
$c = curl_init();
curl_setopt($c, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/$twitter_id.xml");
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($c, CURLOPT_TIMEOUT, 5);
$response = curl_exec($c);
$responseInfo = curl_getinfo($c);
curl_close($c);
if (intval($responseInfo['http_code']) == 200) {
if (class_exists('SimpleXMLElement')) {
$xml = new SimpleXMLElement($response);
return $xml;
} else {
return $response;
}
} else {
return false;
}
}
?>
// --> Add this section of the code where you want to display the TWITTER feed. You just need to make some adjustments and modification to suite your needs. //
<?php
if ( $twitter_xml = twitter_status('TWITTER_ID') ) {
foreach ($twitter_xml->status as $key => $status) {
?>
- <?php echo $status->text; ?><br/><br/>
<?php
++$i1;
if ($i1 == 5) break;
}
?>
<li><a href="http://twitter.com/statuses/user_timeline/TWITTER_ID.rss">more...</a></li>
<?php
} else {
echo 'Sorry, Twitter seems to be unavailable at the moment...again...';
}
?>
Cloud Computing – Sun Microsystems
Posted in The Codes on July 1, 2009Cloud Computing white paper from Sun Microsystems
Cloud computing promises to increase the velocity with which applications are deployed, increase innovation,
and lower costs, all while increasing business agility. Sun takes an inclusive view of cloud computing that
allows it to support every facet, including the server, storage, network, and virtualization technology that drives
cloud computing environments to the software that runs in virtual appliances that can be used to assemble
applications in minimal time. This white paper discusses how cloud computing transforms the way we design,
build, and deliver applications, and the architectural considerations that enterprises must make when adopting
and using cloud computing technology. [Sun Microsystems, Inc.]
Parsing XML and RSS Feeds with PHP
Posted in Random acts of writing on May 2, 2009<?php
$doc = new DOMDocument();
$doc->load('http://feeds.latimes.com/latimes/features/health?format=xml');
$arrFeeds = array();
foreach ($doc->getElementsByTagName('item') as $node)
{
$title = $node->getElementsByTagName('title')->item(0)->nodeValue;
$description = $node->getElementsByTagName('description')->item(0)->nodeValue;
$link = $node->getElementsByTagName('link')->item(0)->nodeValue;
$pubDate = $node->getElementsByTagName('pubDate')->item(0)->nodeValue;
echo "<b><a href=" . $link . " target=_blank>" . $title . "</a></b><br /> ";
echo $description . "<br />";
echo $pubDate . "<br />";
}
?>


