Download - Browser MVC with YQL and YUI
![Page 1: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/1.jpg)
Browser MVC with YQL and YUI
Jonathan LeBlanc
Technology Evangelist
Yahoo! Developer Network
Twitter: @jcleblanc
![Page 2: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/2.jpg)
2
Geo Maker
Available At: http://icant.co.uk/geomaker/index.php
![Page 3: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/3.jpg)
3
Yahoo! Social Updates
Available At:
www.nakedtechnologist.com/
php_widget_oauth/
yql_php_widget.html
![Page 4: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/4.jpg)
4
Christian Heilmann’s Website
Available At: http://icant.co.uk/
![Page 5: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/5.jpg)
5
Fetching Dynamic Data with YQL Browser MVC Model Component
![Page 6: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/6.jpg)
6
![Page 7: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/7.jpg)
7
YQL Query Structure SELECT * FROM Internet
![Page 8: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/8.jpg)
8
YQL Test Console
Available At: http://developer.yahoo.com/yql/console
![Page 9: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/9.jpg)
9
SELECT myColumn, myTitle FROM myTable WHERE myColumn = 'value' AND myTitle = 'title‘
LIMIT 3 OFFSET 10
Running Queries - SELECT Query Structure
![Page 10: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/10.jpg)
10
Modify Data on the InternetCreate Tweets, Add Blog Entries, Update Databases
Current Tables Using I/U/DTwitter Status, bit.ly URL Shortner, Yahoo! Profile Status / Update Stream, Amazon SimpleDB
Running Queries - INSERT / UPDATE / DELETE
![Page 11: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/11.jpg)
11
INSERT INTO bitly.shorten (login, apiKey, longUrl)
VALUES (’ME', 'API_KEY', 'http://yahoo.com')
Running Queries - INSERT Query Structure
![Page 12: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/12.jpg)
12
UPDATE social.profile.status
SET status="Using YQL UPDATE"
WHERE guid=“NJFIDHVPVVISDXZKT7UKED2WHU”
Running Queries - UPDATE Query Structure
![Page 13: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/13.jpg)
13
DELETE FROM twittertable
WHERE tweetid="12345" AND username="twitter_username" AND password="twitter_password
Running Queries - DELETE Query Structure
![Page 14: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/14.jpg)
14
SELECT * FROM flickr.photos.search
WHERE (lat, lon)
IN (SELECT centroid.latitude, centroid.longitude FROM geo.places WHERE text="SFO")
Running Queries – Sub-selects with the IN clause
![Page 15: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/15.jpg)
15
Running Queries – Available Tables
YQL Command: SHOW Tables
Number of Standard Tables: 105
Number of Community Tables: 600
Total Number of Tables: 705
Contribute Tables to:
http://www.github.com/yql/yql-tables/
![Page 16: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/16.jpg)
16
Running Queries – Table Syntax
YQL Command: DESC tablename
![Page 17: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/17.jpg)
17
Running Queries – URL Format
http://query.yahooapis.com/v1/yql?[params]
http://query.yahooapis.com/v1/public/yql?[params]
Params• q=[QUERY]• format=[XML / JSON] • diagnostics=[true / false]• debug=[true / false]• env=[.env file link]• callback=[function name]
![Page 18: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/18.jpg)
18
http://query.yahooapis.com/v1/yql?[params]
http://query.yahooapis.com/v1/public/yql?[params]
Params• q=[QUERY]• format=[XML / JSON / JSONP / JSONP-X]• diagnostics=[true / false]• debug=[true / false]• env=[.env file link]• callback=[function name]
Running Queries – URL Format
![Page 19: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/19.jpg)
19
YQL Open Data Tables Wrap Your Own API or Data Source
![Page 20: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/20.jpg)
20
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta></meta>
<bindings></bindings>
</table>
Open Data Tables – XML File Syntax
![Page 21: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/21.jpg)
21
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta></meta>
<bindings></bindings>
</table>
Open Data Tables – XML File Syntax
![Page 22: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/22.jpg)
22
<?xml version="1.0" encoding="UTF-8"?><table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta> <author>Jonathan LeBlanc</author> <description>My Table</description> <documentationURL>www.site.com</documentationURL>
<sampleQuery>SELECT * FROM {table} </sampleQuery> </meta> <bindings></bindings></table>
Open Data Tables – XML File Syntax
![Page 23: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/23.jpg)
23
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta></meta>
<bindings></bindings>
</table>
Open Data Tables – XML File Syntax
![Page 24: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/24.jpg)
24
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta></meta>
<bindings>
<select itemPath="" produces="XML" >
<urls>
<url env="all”>http://www.site.com/{user}</url>
</urls>
<inputs>
<key id="user" type="xs:string" paramType="path"
required="true" /> </inputs>
</select>
</bindings>
</table>
Open Data Tables – XML File Syntax
![Page 25: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/25.jpg)
25
The USE clause
USE 'http://github.com/yql/yql-tables/raw/master/google/google.buzz.updates.xml'
AS buzz.updates;
SELECT * FROM buzz.updates
WHERE user='nakedtechnologist'
Open Data Tables – Invoking a Table Definition
![Page 26: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/26.jpg)
Google Buzz Table
Available At: http://github.com/yql/yql-tables
![Page 27: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/27.jpg)
27
YQL Execute Extending Open Data Tables
![Page 28: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/28.jpg)
28
Augment data- city / state to APIs that just return zip code
Create APIs from web pages- celebrity birthdays scraped from IMDB
Data Transformations- convert the results from xml to Google's kml format
Move business logic of your application to the cloud
YQL Execute – Use Benefits
![Page 29: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/29.jpg)
29
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta></meta>
<bindings>
<select itemPath="" produces="XML" >
<urls></urls>
<inputs></inputs>
</select>
</bindings>
</table>
YQL Execute – XML File Syntax
![Page 30: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/30.jpg)
30
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta></meta>
<bindings>
<select itemPath="" produces="XML" >
<urls></urls>
<inputs></inputs>
<execute></execute>
</select>
</bindings>
</table>
YQL Execute – XML File Syntax
![Page 31: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/31.jpg)
Global Disaster Alert and Coordination System Table
Available At: http://github.com/yql/yql-tables
![Page 32: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/32.jpg)
32
YUI Data Handling & Manipulation Browser MVC Controller Component
![Page 33: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/33.jpg)
33
DATA PROCESSING
GET
Connection Manager
HANDLING & MANIPULATION
DOM
Event
Uploader
YUI Visualization: Controller
![Page 34: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/34.jpg)
34
<script type="text/javascript">//public YQL query URLvar yqlPublicQueryURL = "http://query.yahooapis.com/v1/public/yql?";
//YQL Queryvar sQuery = 'SELECT * FROM maps.map WHERE zip="94085"';
//prepare the URL params for YQL queryvar sURL = yqlPublicQueryURL + "q=" + encodeURI(sQuery) + "&format=json&callback=getYQLDataCallback";
//make GET request to YQL with provided queryvar transactionObj = YAHOO.util.Get.script(sURL, { onSuccess : onYQLReqSuccess, onFailure : onYQLReqFailure, scope : this});
return transactionObj;
</script>
YUI Visualization: Controller (GET Utility)
![Page 35: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/35.jpg)
35
<script type="text/javascript">//YQL Queryvar sQuery = 'select lastUpdated, link, loc_iconURL, loc_longForm, profile_nickname, profile_profileUrl, publishedTime from social.updates where guid=me | sort(field="lastUpdated") | reverse()';
//prepare the URL & post data for the Yahoo! connection manager POSTvar sURL = "private_data_fetch.php";var postData = "q=" + sQuery;
//define connection manager event callbacksvar callback = { success:parseYQLResults, failure:onYQLReqFailure};
//make POST request to YQL with provided queryvar transactionObj = YAHOO.util.Connect.asyncRequest('POST', sURL, callback, postData);
</script>
YUI Visualization: Controller (Connection Manager)
![Page 36: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/36.jpg)
36
YUI Visualization Browser MVC View Component
![Page 37: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/37.jpg)
37
VISUALIZATION UTILITIES
YUI Visualization: View
AnimationButtonCalendarColor PickerCarouselChartsData TableImageLoader
Layout ManagerMenuProgressBarSliderStylesheetSWF UtilityTabViewTreeView
![Page 38: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/38.jpg)
38
They Go Both Ways
Drag and Drop
ImageCropper
Rich Text Editor
YUI Visualization: Pseudo
![Page 39: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/39.jpg)
39
Build applications faster
(and that run faster)
Conclusion
![Page 40: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/40.jpg)
This Presentation http://www.slideshare.net/jcleblanc
YQL Documentationhttp://developer.yahoo.com/yql
YUI Documentationhttp://developer.yahoo.com/yui
YQL Consolehttp://developer.yahoo.com/yql/console
YQL Github Account (Contribute Tables)http://github.com/yql/yql-tables
![Page 41: Browser MVC with YQL and YUI](https://reader033.vdocuments.site/reader033/viewer/2022051412/54bd61e74a79598f278b45b4/html5/thumbnails/41.jpg)
41
Thank You Questions?