Christian Heilmann

Author Archive

Creating Happy Little Web Sites – my tech talk at the Guardian

Saturday, June 28th, 2008

Here’s a presentation I have given today at the Guardian office in London. In it I am covering the different great ideas I found out about developing web sites. Check the presentation here:

[slideshare id=488632&doc=happylittlewebsites-1214566328957709-8&w=425]

The Guardian have recorded my talk and will release it on the Inside Guardian blog

Scripting Enabled is what keeps me busy

Thursday, June 26th, 2008

I am very happy to announce that I am organizing my first big event. After years of fighting the good fight and getting people to embrace accessibility I was ready to give up on it. Instead I took a new angle on it and used APIs to create alternative interfaces to systems that just will not get more accessible any time soon.

Readers of this blog will have seen the outcome of these, and last weekend at mashed08 I showed another hack and explained the idea of it. I also gauged if there was any interest by the assembled hackers in an event like this and got some good response.

Even better was that I won a prize – some financial support to get an “accessibility hack day” on the road.

So here goes, check out Scripting Enabled

Scripting Enabled is a conference and hack day in London, England in September 2008.

The aim of the conference is to break down the barriers between disabled users and the social web as much as giving ethical hackers real world issues to solve. We talked about improving the accessibility of the web for a long time – let’s not wait, let’s make it happen.

Right now I am still looking for, well, everything. I have some money, I need a location and other speakers. I got a lot of ideas, though.

Check out the site, the calls for participation and if you want to help, please contact me!

Video of my talk at the University of Ankara

Tuesday, June 24th, 2008

Kivanc Erten has shot a video of my talk at the Open Source Event in the University of Economics and Technology in Ankara, Turkey explaining what free open resources Yahoo has for developers:

[slideshare-presentation:http://www.slideshare.net/cheilmann/yahoo-is-open-to-developers]

Part 1: Yahoo is Open

Part 2: Yahoo is Open

Easy SlideShare (my hack entry for mashed08)

Sunday, June 22nd, 2008

I am just sitting at Mashed 08 and just released my hack for the event – an easier interface to SlideShare.

Easy SlideShare

SlideShare is a great place to publish your presentations on the web. Uploaded Powerpoints and PDFs get converted to Flash movies you can embed in your blogs and web sites.

SlideShare also automatically creates a transcript of the presentation in HTML format, which is quite cool, but hidden far down the page and hard to reach in a screen reader. Easy SlideShare retrieves this information and shows it in an easier accessible manner.

As with EasyFlickr and Easy YouTube all you need to do to show a SlideShare presentation in Easy SlideShare is to add the URL at the end of the Easy SlideShare URL:

http://www.slideshare.net/cheilmann/purple-hack-fodder
http://icant.co.uk/easy-slideshare/?slides=http://www.slideshare.net/cheilmann/purple-hack-fodder

You can try it out with my mashed08 presentation

Easy SlideShare is Open Source, licensed with BSD, and you can download it here:

Currency conversion API on a shoestring

Saturday, June 21st, 2008

Someone just came to our table at Mashed08 and asked if Yahoo! offers a currency conversion API. We don’t, but a few lines of PHP allows you to get the information from the Yahoo finance site:


function convert($from,$to){
$url= 'http://finance.yahoo.com/currency/convert?amt=1&from='.$from.'&to='.$to.'&submit=Convert';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$feed = curl_exec($ch);
curl_close($ch);
preg_match_all("/tabledata1">([^<]+)/",$feed,$cells);
return $cells[1][1];
}
echo convert('USD','GBP');

There’s a whole list of currency codes available on oanda.

A few more lines turns this into a JSON API:


header('Content-type:text/javascript');
$from = $_GET['from'];
$to = $_GET['to'];
$callback = $_GET['callback'];
if(preg_match("/[A-Z|a-z]{3}/",$to) && preg_match("/[A-Z|a-z]{3}/",$from)){
$to = strToUpper($to);
$from = strToUpper($from);
$url= 'http://finance.yahoo.com/currency/convert?' .
'amt=1&from='.$from.'&to='.$to.'&submit=Convert';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$feed = curl_exec($ch);
curl_close($ch);
preg_match_all("/tabledata1">([^<]+)/",$feed,$cells);
if(is_numeric($cells[1][1])){
$out = '{"from":"'.$from.'","to":"'.$to.'","factor":"'.$cells[1][1].'"}';
} else {
$out = '{error not convert currencies, are you sure about the names?"}';
}
} else {
$out = '{error Currency format, must be three letters"}';
}
if(isset($callback)){
if(preg_match("/[a-z|A-Z|_|-|$|0-9|.]/",$callback)){
$out = $callback.'('.$out.')';
} else {
$out = '{error callback method name"}';
}
}
echo $out;

You have several parameters:

  • from (mandatory): three letter currency code (upper or lower case)
  • to (mandatory): three letter currency code (upper or lower case)
  • callback (optional): the name of the callback method that should be wrapped around the resulting object

If something goes wrong, the API will return an object with an error property, otherwise you’ll get an object with three properties:

  • from: the original currency
  • to: the target currency
  • factor: the conversion factor

Say you store this as convert.php somewhere, then you could do the following:




This is a terrible dirty hack and if Yahoo finance ever changes their HTML (and they will), this will cease to work.