Using YQL Sensibly - YUIConf 2010
-
Upload
christian-heilmann -
Category
Documents
-
view
6.411 -
download
5
description
Transcript of Using YQL Sensibly - YUIConf 2010
![Page 1: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/1.jpg)
Caching, collating and filtering data
Using YQL sensibly
![Page 2: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/2.jpg)
What is the web?
![Page 3: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/3.jpg)
Was ist das Web?
Data + Interfaces
![Page 4: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/4.jpg)
Lots of yummy, yummy data.
![Page 5: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/5.jpg)
Everybody benefits from APIs.
![Page 6: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/6.jpg)
Companies get their data into environments they could never reach.
![Page 7: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/7.jpg)
Developers can build products without buying data or writing code.
![Page 8: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/8.jpg)
Let’s play with two examples.
![Page 9: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/9.jpg)
Build a system to calculate the distance between two places on Earth.
![Page 10: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/10.jpg)
Use a map service?
![Page 11: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/11.jpg)
Raw data and info about the places would be better to have.
![Page 12: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/12.jpg)
Simple Plan:1. Find the location of the two places
on Earth
2. Calculate the distance.
![Page 13: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/13.jpg)
Earth Data = Yahoo GeoPlanet
![Page 14: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/14.jpg)
Yahoo GeoPlanet is a data set that has information about the location of places on Earth.
http://developer.yahoo.com/geo/geoplanet/
![Page 15: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/15.jpg)
![Page 16: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/16.jpg)
http://where.yahooapis.com/v1/places.q('warsaw')?appid={appid}&format=json
![Page 17: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/17.jpg)
= Latitude+Longitude
![Page 18: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/18.jpg)
Distance?
![Page 19: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/19.jpg)
http://www.movable-type.co.uk/scripts/latlong-vincenty.html
![Page 20: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/20.jpg)
Putting it all together...
![Page 21: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/21.jpg)
Putting it all together...
![Page 22: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/22.jpg)
![Page 23: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/23.jpg)
![Page 24: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/24.jpg)
![Page 25: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/25.jpg)
A few annoyances1. Multiple script generation (order?
what if one breaks?)
2. Access keys readable in source.
![Page 26: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/26.jpg)
Building a system to translate foreign tweets.
![Page 27: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/27.jpg)
Twitter is multilingual but doesn’t translate.
![Page 28: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/28.jpg)
Google has a translation service though.
![Page 29: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/29.jpg)
A simple plan:1. Investigate Twitter’s search API and
Google’s translation API and if needed, get keys.
2. Get the results from Twitter for a certain search.
3. Loop over the results, see which ones are not in English, and then translate them with the Google Translation API.
![Page 30: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/30.jpg)
Really not that much difference in code.
![Page 31: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/31.jpg)
It also suffers from the same issues.
![Page 32: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/32.jpg)
1. Asynchronous lookups with generated script nodes are a pain to get right - what if one breaks?
2. Depending on how many Tweets are not in English, you have to hammer Google’s translation API which slows down your overall app.
![Page 33: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/33.jpg)
YUI fixes a few of those issues.1. Using JSONP you can have success
and failure events.
2. You can also provide timeouts
IO
JSON
JSON-P
JSON-P
YQL-QueryGET
![Page 34: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/34.jpg)
Still, it would be nice to have one request, right?
![Page 35: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/35.jpg)
Simplifying access.
![Page 36: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/36.jpg)
YQL http://developer.yahoo.com/yql/console/
![Page 37: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/37.jpg)
YQL http://developer.yahoo.com/yql/console/
select {what} from {where} where {conditions}
![Page 38: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/38.jpg)
Foreign Tweets?
![Page 39: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/39.jpg)
select text from twitter.search where q=”ft2010” and iso_language_code=”pl”
![Page 40: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/40.jpg)
select * from google.translate where q in (select text from twitter.search where q=”ft2010” and iso_language_code=”pl”) and target=”en”
![Page 41: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/41.jpg)
Re-using cool data on the web?
![Page 42: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/42.jpg)
http://www.guardian.co.uk/news/datablog/2010/feb/11/winter-olympics-medals-by-country
![Page 43: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/43.jpg)
![Page 44: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/44.jpg)
![Page 45: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/45.jpg)
select * from csv where url="http://spreadsheets.google.com/pub?key=tpWDkIZMZleQaREf493v1Jw&output=csv" and columns="Year,City,Sport,Discipline,Country,Event, Gender,Type" and Year="1924"
![Page 46: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/46.jpg)
http://winterolympicsmedals.com
![Page 47: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/47.jpg)
Instead of going crazy filtering and sorting in JS...
![Page 48: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/48.jpg)
...use the YQL server and then have a very simple JS for displaying.
![Page 49: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/49.jpg)
Using web services with YQL in JS.
![Page 50: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/50.jpg)
YQL is a web service endpoint on its own...
![Page 51: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/51.jpg)
https://query.yahooapis.com/v1/public/yql?q={uri-encoded-query}&format={xml|json}&diagnostics={true|false}&callback={function}&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
![Page 52: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/52.jpg)
![Page 53: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/53.jpg)
Special case: Scraping
http://www.flickr.com/photos/fdtate/4426760544/
![Page 54: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/54.jpg)
http://www.slideshare.net/cheilmann/reasons-to-be-cheerful-fronteers-2010
![Page 55: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/55.jpg)
![Page 56: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/56.jpg)
select * from html where
url="http://www.slideshare.net/cheilmann/reasons-to-be-cheerful-fronteers-2010"
and
xpath="//ol/li/p[contains(.,'http')]"
![Page 58: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/58.jpg)
http://lanyrd.com/people/codepo8/
![Page 59: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/59.jpg)
HTML as JSON is not fun.
![Page 60: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/60.jpg)
JSON-P-X = HTML as a string in a JSON-P container!
![Page 61: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/61.jpg)
https://github.com/codepo8/lanyrdbadge
![Page 62: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/62.jpg)
Using YQL re-use of web content is very easy indeed.
![Page 63: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/63.jpg)
YUI3’s YQL-Query makes it even better!
![Page 64: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/64.jpg)
Be safe, be good...
![Page 65: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/65.jpg)
Don’t rely on data arriving - test for it!
![Page 66: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/66.jpg)
XML to JSON?
![Page 67: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/67.jpg)
XML to JSON?
![Page 68: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/68.jpg)
Using JSON is easy with libraries.
![Page 69: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/69.jpg)
$.getJSON(url+'&callback=?', function(data){});
JSON-P and jQuery:
![Page 70: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/70.jpg)
$.ajax({ url: url, dataType: 'jsonp', jsonp: 'callback', jsonpCallback: 'ohyeah'});function ohyeah(data){}
JSON-P and jQuery:
![Page 71: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/71.jpg)
Which one to use?
![Page 72: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/72.jpg)
getJSON() is dangerous with other people’s data.
![Page 73: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/73.jpg)
http://{...}&format=json&callback=ohyeah
$.ajax():
$.getJSON():http://{...}&format=json&callback=jsonp1282497813335
Random number
![Page 74: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/74.jpg)
Cachebreaking is not a good idea.
![Page 75: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/75.jpg)
Local caching is a good idea.
![Page 76: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/76.jpg)
Cookies suck, though.
![Page 77: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/77.jpg)
Would be good to have a better solution for that.
![Page 78: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/78.jpg)
localStorage = cookies on steroids.
![Page 79: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/79.jpg)
if(('localStorage' in window) && window['localStorage'] !== null){localStorage.setItem( 'cake', 'much better than cookies')}
![Page 80: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/80.jpg)
if(('localStorage' in window) && window['localStorage'] !== null){var what = localStorage.getItem( 'cake')// what -> 'much better than cookies'}
![Page 81: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/81.jpg)
localStorage only stores Strings - use JSON to work around that.
![Page 82: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/82.jpg)
if(('localStorage' in window) && window['localStorage'] !== null){localStorage.setItem( 'cake', JSON.stringify( {yummy:‘yes’,candles:5} ));}
![Page 83: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/83.jpg)
if(('localStorage' in window) && window['localStorage'] !== null){var what = JSON.parse( localStorage.getItem('cake'));// what -> Object{...} // and not [Object object]}
![Page 84: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/84.jpg)
Let’s wrap this up in a function.
![Page 85: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/85.jpg)
yql - the queryid - storage key namecacheage - how long to cachecallback - obvious, isn’t it?
https://github.com/codepo8/yql-localcache
![Page 86: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/86.jpg)
Browsers supporting localStorage fetch the data every hour.
![Page 87: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/87.jpg)
Others still work, but load the data every time.
![Page 88: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/88.jpg)
callback gets an object with two properties:
data - guess what?type - cached|live|freshcache
![Page 89: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/89.jpg)
Libraries offer storage fallbacks for legacy browers via Flash - YUI is of course one of them.
![Page 90: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/90.jpg)
Offering your own API.
![Page 91: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/91.jpg)
To get your own API into YQL all you need to do is write an XML schema and put it on GitHub.
![Page 92: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/92.jpg)
http://github.com/yql/yql-tables
![Page 93: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/93.jpg)
YQL allows you to write “executable tables”...
![Page 94: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/94.jpg)
...which means you can convert data with JavaScript that will be executed server-side.
![Page 95: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/95.jpg)
Our earlier examples as YQL APIs are...
![Page 96: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/96.jpg)
Twitter translate example:
![Page 97: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/97.jpg)
Offering your own API.
![Page 98: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/98.jpg)
Offering your own API.
![Page 99: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/99.jpg)
![Page 100: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/100.jpg)
SELECT * FROM twitter.translate WHERE language="en" and search="warszawa" and amount="20"
![Page 101: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/101.jpg)
![Page 102: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/102.jpg)
![Page 103: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/103.jpg)
Distance example:
![Page 104: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/104.jpg)
![Page 105: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/105.jpg)
![Page 106: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/106.jpg)
SELECT * FROM geo.distance WHERE place1=”london” and place2="warsaw"
![Page 107: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/107.jpg)
![Page 108: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/108.jpg)
http://isithackday.com/hacks/geo/distance/
![Page 109: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/109.jpg)
Using your JS tables.
![Page 110: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/110.jpg)
Write your schema, put it on the web...
![Page 111: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/111.jpg)
use “http://awesomeserver.com/distance.xml” as distance; SELECT * FROM distance WHERE place1=”london” and place2="warsaw"
use USE to use it!
![Page 112: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/112.jpg)
Both problems solved and released as an API - in JS!
![Page 113: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/113.jpg)
In summaryUse YQL instead of wasting time reading API docs for a simple taskFilter data in the service and get the info back in formats you need.Use the fast YQL server instead of doing lots of requests.Write your own JS APIs using execute.Use local storage and don’t break caching.Go and use the web.Go easy on effects.
![Page 114: Using YQL Sensibly - YUIConf 2010](https://reader034.fdocuments.net/reader034/viewer/2022051412/5484c9d9b47959e70c8b4cc4/html5/thumbnails/114.jpg)
Christian Heilmann http://wait-till-i.com http://developer-evangelism.com @codepo8
Cheers