Software engineering notes

Posts Tagged ‘yui

Dav Glass’ YQL module for YUI 3 is awesome

leave a comment »

sample app:


<ul>
 <li><img/></li>
</ul>
<script type="text/javascript" src="http://yui.yahooapis.com/3.0.0/build/yui/yui-min.js"></script>
<script type="text/javascript" src="http://github.com/davglass/yui-yql/raw/master/yql-min.js"></script>
<script>
//ref: http://davglass.github.com/yui-yql/
YUI().use('yql', 'node', function(Y) {
 var q1 = new Y.yql('select source from flickr.photos.sizes where photo_id in (select id from flickr.photos.search where text="panda" and safe_search="true")');
 q1.on('query', function(r) {
     var li = Y.get('li');
     for (var i = 0; i < r.results.size.length; i++) {
         if (-1 !== r.results.size[i].source.indexOf('_s')) {
             var clone = li.cloneNode(true);
             clone.query('img').set('src', r.results.size[i].source);
             Y.get('ul').append(clone);
         }
     }

 });

});
</script>

Update 12/13/10 YUI 3 now supports YQL natively: http://developer.yahoo.com/yui/3/yql/

Written by Erik

December 24, 2009 at 2:51 am

Posted in code

Tagged with , ,

notes from YUIConf 2009: “Building YUI 3 Custom Modules”, by Caridy Patino

leave a comment »

what is a module in yui 3?
– modules are not plugins, but there is a plugin module
– module names are passed into a sandbox w/ the ‘use’ method
– prefer YUI().use instead of var Y = new YUI(); Y.use …
– you can have multiple use() calls to defer loading
– community modules vs basic yui core team modules

custom modules
– registration
— by seed YUI().use
— seed will import
— by inclusion
— manually add script include and then YUI.use
— YUI(config)
— most performant
— this takes advantage of onload handling
— reduces number of http requests req’d in ‘by inclusion’
— organization
—- use YUI_config global var to manage registration
—- you can have multiple config options

building custom modules
– YUI.add(‘foo’, fn(Y){mod code}, version, requirement list);
– naming convention: utilities are all lowercase, classes are camelcase w/ uppercase leading char
– plugins extend host modules
– stack: utilities –> classes –> plugins –> mashups

how to use and build plugins
– plugins allow us to extend an existing class at runtime
– the def of a plugin looks much like that for a module class
– instead of extending y.base, we extend y.plugin.base

mashups and legacy code
– using multiple modules, including external dependencies, enhancing dom, defining event listeners
– use case: using a pre-existing yui2-based object in yui3
– check out zakas’ talkon scalable app arch
– cool: organize app as module repo
– conclusions
— define apps at a granular level
— modular apps are easier to test
— share code thru yui3 gallery
— use yui custom modules to integrate pre-existing code

q/a
– differences btwn yui2 and yui3 lazy loading?
— yui3 will load everything as a single item, if module requirements are defined using config option
— yui3 will load items in the order they are specified
– reusing modules across multiple sandbox
— yes, if defined as such in config

github/caridy
twitter/caridy
caridy.name

Written by Erik

October 29, 2009 at 10:21 am

Posted in notes

Tagged with , , ,

notes: Bayjax Meetup (7/27) @ Yahoo! Sunnyvale: Jon Leblanc on YQL + YUI

leave a comment »

 

Jon Leblanc talking about YQL + YUI

Jon Leblanc talking about YQL + YUI

 

 

Meetup: http://www.meetup.com/BayJax/calendar/10852424/

jonleblanc on using yui w/ yql
– “select * from internet” gets a laugh
– the console (developer.yahoo.com/yql/console) is an easy way to get started w/ yql
– there are ~80 tables of y! data
– 253 community tables on github.com/yql
– yql execute
– yql insert|update|delete
– christian heilmann’s “geomaker” tool scrapes a url, extracts locations, and plots them on a map
– github.com/jsleblanc/yql-utilities
— js-yql-display
— yql can return jsonp and jsonpx
— yql plays well w/ yui
– questions
— rate limiting
— 1000/hr/ip w/ oauth
— w/ oauth 100k/day/ip
— caching?
— defaults to 5 min
— build your own table or append a var to url to break the cache

jonleblanc on using yui w/ yql

– the console (developer.yahoo.com/yql/console) is an easy way to get started w/ yql

– there are ~80 tables of y! data

– 253 community tables on github.com/yql

– yql execute

– yql insert|update|delete

– christian heilmann’s “geomaker” tool scrapes a url, extracts locations, and plots them on a map

– github.com/jcleblanc/yql-utilities

— js-yql-display

— yql can return jsonp and jsonpx

— yql plays well w/ yui

– links are on http://speakerrate.com/jcleblanc

– questions

— rate limiting

— 1000/hr/ip w/ oauth

— w/ oauth 100k/day/ip

— caching?

— defaults to 5 min

— build your own table or append a var to url to break the cache

Written by Erik

July 27, 2009 at 7:58 pm

Posted in notes

Tagged with , , , ,