lautr.com

Hannes Blog for Development and Stuff besides

iphone

7. Juli 2010
von Hannes
Keine Kommentare

zootool wordpress plugin

I Took the Time to program a neat ZooTool WordPress Plugin. For everyone out there who likes wordpress, zootool, badges and doesn’t like to use to much extern Javascript on his Page this might be Something for you. You can find more Details on my dedicated Page .

Or if you’ve no Idea what I’m talking about check out zootool.

yahoo-placefinder

2. Juli 2010
von Hannes
3 Kommentare

Utilizing HTML5 Geolocation API and Yahoo! PlaceFinder Example

Yeah yeah i know, HTML5 is the new web 2.0 or whatever and everyone has to blag about it, but to be honest, most of the improvments are pretty good, I’m not just talking about the semantics and the end of XHTML (Hooray) but i wont cover that here. Here is what I’m gonna do, show you what you can do with the geolocation API and Yahoos Placefinder API.

Geolocation API is by now implementet in most of the browsers besides IE, of course, so its as usual a nice-to-have thing for desktop devices, of course for mobile, its a completly different matter. But if you wanna know more about it, read it up, there are plenty of rescources avaible on the net.

Yahoos Place finder is, in there own words “Yahoo! PlaceFinder is a geocoding Web service that helps developers make their applications location-aware by converting street addresses or place names into geographic coordinates (and vice versa).” And yeah, besides the marketing spin, that is what it does, you provide latitude and latitude and Placefinder tells you where the hell you are.

I made a short example you can check it out here.

The Code is as slim as they come:
PHP:

$search = 'http://where.yahooapis.com/geocode?q='.$_POST['lat'].',+'.$_POST['lon'].'&gflags=R&appid=[yourappidhere]';
$xml = simplexml_load_file($search,'SimpleXMLElement', LIBXML_NOCDATA);
echo $xml->asXML();

HTML/JS

<h1>Utilizing HTML5 Geolocation API and Yahoo! PlaceFinder Example</h1>
<div>You are currently in <strong> </strong> - <strong> </strong>, well to be more precisely in <strong> </strong> and your ZIP is <strong> </strong>'ish</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript">// <![CDATA[
$(document).ready(function() {
navigator.geolocation.getCurrentPosition(
function(position){
$.ajax({
type: 'POST',
url: '/sandbox/utilizing-html5-geolocation-api-and-yahoo-placefinder-example.php',
dataTyoe: 'xml',
data: ({
lat: position.coords.latitude,
lon: position.coords.longitude
}),
success: function(xml){
$('#city').html($(xml).find('city').text());
$('#country').html($(xml).find('country').text());
$('#neighborhood').html($(xml).find('neighborhood').text());
$('#plz').html($(xml).find('uzip').text());
}
});
}
);
});
// ]]></script>

So you see, with literally no Work whatsoever you can get quite some Information, whatever you with them, is of course up to you, but remember if the user provides the Information or not is up to him!

zf

14. Juni 2010
von Hannes
3 Kommentare

XML-RPC “read timeout” after 10 Seconds with Zend_XmlRpc_Client

Recently i had a small Problem with the Service of a Partner we use for a new Project, it worked all together just fine, but just was a little bit slow at times, so i often got a Red Timeout after 10 Seconds.
All you’ve to do here is, of course, increase the timeout by configuring the Zend_Http_Client that is used here, unfortunately you ether have to set it in every method you use like:

$this->_httpClient->setConfig(array('timeout' => '60'));

(if you like me has an own class that extends from Zend_XmlRpc_Client to do your bidding). O

r must supply a full new, configured HTTP Client like:

$httpClient = new Zend_Http_Client;
$httpClient->setConfig(array('timeout' => '60'));
$xmlrpcClient = new Zend_XmlRpc_Client('http://www.foobar.com/service',$httpClient);

(or something along those lines)

wordpress_logo

19. April 2010
von Hannes
1 Kommentar

My first wordpress Plugin “WP Google Search Query Widget”

So, thats it my first (official) WordPress Plugin, “WP Google Search Query Widget”

This Plugin implements an easy configurable Widget which can display your top Google search querys (Keywords) and link it to your internal search like a tag cloud.
You can use its default font sizes or override them by the classes that are applied. It is recommended to have APC installed to cache the Google API requests but its not necessary.
It is written and currently maintained by Johannes Lauter and uses the Google Analytics API PHP Class from Chris Hope.