Christian Heilmann

Author Archive

Brownbag presentations in London – want some info and Q&A for lunch?

Sunday, May 31st, 2009

July and August is a very slow time for me this year as there aren’t any conferences I am speaking at and no hack days planned. September will be packed again, though.

This is why I am right now planning to do some brown bag presentations in the London area. I’ve already been at IPC media, will go next Friday to ebay/gumtree/skype/paypal/shopping.com in Richmond and have had Sky and Thomson Group/TUI show some interest on twitter.

Brown bag presentations are by definition talks during lunch break where people can bring their food along. That way your employees can get some information or discuss their issues with an invited expert without disruption of your normal office hours and times.

I’d be happy to come around and give a talk on all the things I am passionate about. Currently these things are:

  • Opening your own and reaching data on the web easily with YQL
  • Mining your content and enhancing it with geographical information (Yahoo Placemaker)
  • Building specialist search engines (BOSS)
  • Accessibility and that it is not magic
  • Professional Web Development
  • Performance of web products and how to improve it

I am open to other topics, though.

If you are interested in some of that and you are in the Oyster card area, comment here or contact me on Twitter and we can talk date, location, topic and time. I don’t expect any pay, but normally a coffee, some water and a sandwich :). The whole idea of the exercise is to be able to reach developers that normally do not get the chance to go to conferences.

TTMMHTM: Panic half, make a mag, howling wolves, geocoders and lots of videos

Thursday, May 28th, 2009

Things that made me happy this morning:

TTMMHTM: Yarn about CSS on mobiles with free music (or summat)

Tuesday, May 26th, 2009

Things that made me happy this morning:

Newsmap – using Placemaker to add geo location to a news feed

Friday, May 22nd, 2009

I am right now very excited about the new Placemaker beta – a location extraction web service released at Where2.0. Using Placemaker you can find all the geographical locations in a feed or a text or a web url and you get them back as an array of places.

As a demo I took the Yahoo News feed and ran it through Placemaker. The resulting places are plotted on a map and the map moves from location to location when you hover over the news items.

The result is online at http://isithackday.com/hacks/placemaker/map.php

Yahoo News Map by  you.

Getting the data from the data feed and running it through placemaker is very straight forward. I explained the basic principle in this blog post on the Yahoo Developer Network blog. The only thing to think about is to define the input and output types correctly:



If you look at the source of this example you will find that Placemaker injected contentlocation elements in the feed itself:




2514815

38.8913
-77.0337


23424793

21.511
-77.8068


23424977

48.8907
-116.982


55843872

19.9445
-75.1541


You’ll also notice that the elements are namespaced and the names of the locations in CDATA blocks, both things I hate with a passion. Not because they don’t make sense, but because simplexml can be drag to make understand them.

What I wanted to do with this data was twofold: create a JSON array of geo locations to plot on a map and a display of the news content. This is the PHP that does that:


$places = simplexml_load_string($results, 'SimpleXMLElement',
LIBXML_NOCDATA);
// if there are elements found
if($places->channel->item){
// start a JSON array
$output .= '[';
// start the HTML output
$html = '
    '; // set the counter - this will be needed to link news // items and map markers $count = 0; // loop over RSS items foreach($places->channel->item as $p){ // set inner counter (as there are more locations per news item) $innercount = 0; // start the HTML list item and give it an ID with the counter // value $html .= '
  • children('http://wherein.yahooapis.com/v1/cle'); // check that there is a location sub-element in this item if($locs->contentlocation){ // if there is one, add a class to the LI $html .= ' class="haslocation"'; // start an array for displaying of the locations under the // news items $dlocs = array(); // loop over all the places found for this item foreach($locs->contentlocation->place as $pl){ // append a new JS object with the location data // and a unique ID to the locations array $locations[] = '{name.'","title" title="">name":"'. preg_replace('/n+/','',addslashes($p->title)). '",latitude" title="">lat. '",longitude.'","id":"m" title="">lon'. $count.'x'.$innercount.'"}'; // add the location name to the display locations array $dlocs[] = $pl->name; // increase the inner count to ensure that every marker has // a unique ID $innercount++; } } // append the HTML for the news item $html.='>

    '.$p->title.'

    '. $p->description.'

    '; // if locations were found, add them if(sizeof($dlocs)>0){ $html.='

    Locations: '.join(',',$dlocs).'

    '; } // end the list item $html.='
  • '; // increase the counter $count++; } // join the json object data with a comma and close the JSON array $output .= join(',',$locations); $output .= ']'; // if there are no items simply return nothing } else { $output = ''; } // and this ends the HTML $html.= '
'; ?>

The result of this can be seen here http://isithackday.com/hacks/placemaker/map-2.php.

The JavaScript to show the map is pretty straight forward and more or less the demo example of the maps API:


// will be called with the array assembled in PHP
function placeonmap(o){
// if there are locations
if(o.length > 0){
// create a new geopoints array to hold all locations
// this is needed to determine the original zoom
// level of the map
var geopoints = [];
// add map with controls
var map = new YMap(document.getElementById('map'));
map.addZoomLong();
map.addPanControl();
// loop over locations
for(var i=0;i);

That’s pretty much it. I am sure it can be refined, but it is amazing how easy it is to get geo information into any text with Placemaker.

TTMMHTM: Sorry Jinho answers, twittering cat flaps, hot goths and the real AYB

Monday, May 18th, 2009

Things that made me happy this morning: