Building Web Hack Interfaces Christian Heilmann UEL Hack Day London, UK, October 2007
Building web interfaces is a fun task.
The technologies involved are easy to learn.
Text + Images + Multimedia =  Content “ What is it about”
HTML =  Structure “ What is what”
CSS + Background images  =  Look and Feel “ How should it be displayed”
Scripting and Extensions  =  Behaviour “ How should it behave and react?”
Playing each of these to their respective strengths = great web products.
There is one thing to consider though.
Browser Operating System  Screen Size  Screen Resolution Browser Size Plugins and configurations Input Device Reading Level Vision Level of Understanding Motor accuracy
Browser Operating System  Screen Size  Screen Resolution Browser Size Plugins and configurations Input Device Reading Level Vision Level of Understanding Motor accuracy UNKNOWN
Keeping this in mind makes you a true developer for the web.
Be paranoid. Expect the failure.
Yahoo! has to do that day-in day-out.
People trust us with their data and use our products to connect with other people.
This is why we hire great developers.
This is also why we use their knowledge to make things easier for all.
Instead of constantly re-inventing we spy good solutions and learn from mistakes.
The outcome of this research is available to you!
http://developer.yahoo.com
Learn about: Design Patterns Performance Security
Tap into the collective wisdom:
 
 
The Yahoo! User Interface Library
CSS Framework JavaScript Library Widget Framework Debugging Utility
CSS Components: CSS Reset CSS Fonts CSS Grids  Making CSS layouts predictable and working across browsers and operating systems =
JavaScript Components: DOM Event Connection Animation  Making JavaScript development less random across browsers and easier to concentrate on the architecture of your scripts. =
Widgets: Panel Dialog Autocomplete DataTable Slider Menu Calendar Colorpicker Tabview  Rich Text Editor Creating HTML/CSS/JS based RIAs with tested and fully skinnable components. =
Debugging YUI Logger is a cross-browser, cross-platform debugging console. YUITest is a unit and component testing framework in JavaScript
Industrial Strength for everyday solutions
Comes with full documentation, examples, cheatsheets and quick start guides. http://developer.yahoo.com/yui/docs
Others already benefit:
http://tech.groups.yahoo.com/group/ydn-javascript/links/YUI_Implementations_001149002597/
http://tech.groups.yahoo.com/group/ydn-javascript/links/YUI_Implementations_001149002597/ Newsvine, Opera, O’Reilly,  Dow Jones Index, Paypal,  Slashdot, Digg, SugarCRM,  VersionTracker,iFilm,  vBulletin, ebay
We also like to tell people about cool YUI stuff.
http://yuiblog.com
Play with our APIs and Feeds.
Answers Local Mail Maps Search Shopping Travel del.icio.us Flickr™ MyBlogLog Pipes Upcoming Webjay Finance HotJobs Traffic Weather
Get SDKs to play with our applications: Messenger Music Search Widgets
What if there is some data you want to access but no API to get it in the right format?
http://pipes.yahoo.com
 
 
… or hack what is out there.
Example: slideshare.net
Slideshare is a place to share presentations.
You can embed the presentations into other web products.
 
There is an API, but there is no way to get all your latest presentations to have a “slide portfolio”.
However, there is an RSS feed with all the data I need!
 
Battle plan: Retrieve feed Display links to slides Get the slide movies  Write some script to show the movies when the links are clicked
<?php $url = 'http://www.slideshare.net/rss/user/cheilmann'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $slides = curl_exec($ch); curl_close($ch); $slides = str_replace('slideshare:embed','slideshareembed',$slides); $slides = str_replace('media:title','mediatitle',$slides); $xml = domxml_xmltree($slides); $json = array(); $slidesharelist = ''; $links = $xml->get_elements_by_tagname('link'); $img = $xml->get_elements_by_tagname('url'); $titles = $xml->get_elements_by_tagname('mediatitle'); $embeds = $xml->get_elements_by_tagname('slideshareembed'); foreach ($embeds as $key=>$el) { $l = $links[$key+1]->children[0]->content; $t = $titles[$key]->children[0]->content; $slidesharelist .= '<li><a href=&quot;'.$l.'&quot;>'.$t.'</a></li>'; $emb = $el->children[0]->content; if(strpos($emb,'<div')===false){$emb = $el->children[1]->content;} preg_match_all('/value=&quot;([^&quot;]+)&quot;/msi',$emb,$obj); $json[]='\''.$obj[1][0].'\''; } ?>
<style type=&quot;text/css&quot;> @import 'slideshareshowstyles.css'; #slideshareshowslideshow{background:url(<?php echo $img[0]->children[0]->content;?>) no-repeat center center;} </style> <div id=&quot;slideshareshow&quot;> <ul id=&quot;slideshareslides&quot;><?php echo $slidesharelist; ?></ul> </div> <script type=&quot;text/javascript&quot; src=&quot;http://yui.yahooapis.com/2.3.1/build/yahoo-dom-event/yahoo-dom-event.js&quot;></script> <script type=&quot;text/javascript&quot; src=&quot;swfobject.js&quot;></script>
< script type=&quot;text/javascript&quot;> YAHOO.example.slideshareshow = function(){ var container = document.getElementById('slideshareshow'); YAHOO.util.Dom.addClass(container,'jsenabled'); var list = document.getElementById('slideshareslides'); var links = list.getElementsByTagName('a'); var displayContainer = document.createElement('div'); displayContainer.id = 'slideshareshowslideshow'; container.appendChild(displayContainer); var current = null; for(var i=0;links[i];i++){  YAHOO.util.Event.on(links[i],'click',show,i); } function show(e,i){ YAHOO.util.Dom.removeClass(current,'current'); current = this; displayContainer.innerHTML = ''; var so = new SWFObject(slides[i], &quot;slideshareshow&quot;, &quot;425&quot;, &quot;355&quot;, &quot;8&quot;, &quot;#ffffff&quot;); so.addParam(&quot;allowScriptAccess&quot;, &quot;always&quot;); so.addParam(&quot;allowFullScreen&quot;, &quot;true&quot;); so.write(displayContainer); YAHOO.util.Dom.addClass(current,'current'); YAHOO.util.Event.stopEvent(e); } var slides=[<?php echo implode($json,','); ?>]; }(); </script>
http://www.wait-till-i.com/index.php?p=500
This is awesome! We are building badges for people to be able to display lists of their recent slideshows on their site, but it did not integrate the player. I love what you have done – well designed and well executed. I want it for my own site now. I will post about it to our blog. And we will point to it when we release our own badges. Thanks! rashmi (SlideShare cofounder)
Anything else?
per aspera ad astra   &quot;through adversity to the stars&quot;  or &quot;a rough road leads to the stars&quot;
per aspera ad astra
http:// developer.yahoo.com /flash/
Get Flashing and Flexing
Christian Heilmann http://wait-till-i.com http://icant.co.uk Thank you! http://creativecommons.org/licenses/by-sa/3.0/

Building Web Hack Interfaces

  • 1.
    Building Web HackInterfaces Christian Heilmann UEL Hack Day London, UK, October 2007
  • 2.
  • 3.
    The technologies involvedare easy to learn.
  • 4.
    Text + Images+ Multimedia = Content “ What is it about”
  • 5.
    HTML = Structure “ What is what”
  • 6.
    CSS + Backgroundimages = Look and Feel “ How should it be displayed”
  • 7.
    Scripting and Extensions = Behaviour “ How should it behave and react?”
  • 8.
    Playing each ofthese to their respective strengths = great web products.
  • 9.
    There is onething to consider though.
  • 10.
    Browser Operating System Screen Size Screen Resolution Browser Size Plugins and configurations Input Device Reading Level Vision Level of Understanding Motor accuracy
  • 11.
    Browser Operating System Screen Size Screen Resolution Browser Size Plugins and configurations Input Device Reading Level Vision Level of Understanding Motor accuracy UNKNOWN
  • 12.
    Keeping this inmind makes you a true developer for the web.
  • 13.
    Be paranoid. Expectthe failure.
  • 14.
    Yahoo! has todo that day-in day-out.
  • 15.
    People trust uswith their data and use our products to connect with other people.
  • 16.
    This is whywe hire great developers.
  • 17.
    This is alsowhy we use their knowledge to make things easier for all.
  • 18.
    Instead of constantlyre-inventing we spy good solutions and learn from mistakes.
  • 19.
    The outcome ofthis research is available to you!
  • 20.
  • 21.
    Learn about: DesignPatterns Performance Security
  • 22.
    Tap into thecollective wisdom:
  • 23.
  • 24.
  • 25.
    The Yahoo! UserInterface Library
  • 26.
    CSS Framework JavaScriptLibrary Widget Framework Debugging Utility
  • 27.
    CSS Components: CSSReset CSS Fonts CSS Grids Making CSS layouts predictable and working across browsers and operating systems =
  • 28.
    JavaScript Components: DOMEvent Connection Animation Making JavaScript development less random across browsers and easier to concentrate on the architecture of your scripts. =
  • 29.
    Widgets: Panel DialogAutocomplete DataTable Slider Menu Calendar Colorpicker Tabview Rich Text Editor Creating HTML/CSS/JS based RIAs with tested and fully skinnable components. =
  • 30.
    Debugging YUI Loggeris a cross-browser, cross-platform debugging console. YUITest is a unit and component testing framework in JavaScript
  • 31.
    Industrial Strength foreveryday solutions
  • 32.
    Comes with fulldocumentation, examples, cheatsheets and quick start guides. http://developer.yahoo.com/yui/docs
  • 33.
  • 34.
  • 35.
    http://tech.groups.yahoo.com/group/ydn-javascript/links/YUI_Implementations_001149002597/ Newsvine, Opera,O’Reilly, Dow Jones Index, Paypal, Slashdot, Digg, SugarCRM, VersionTracker,iFilm, vBulletin, ebay
  • 36.
    We also liketo tell people about cool YUI stuff.
  • 37.
  • 38.
    Play with ourAPIs and Feeds.
  • 39.
    Answers Local MailMaps Search Shopping Travel del.icio.us Flickr™ MyBlogLog Pipes Upcoming Webjay Finance HotJobs Traffic Weather
  • 40.
    Get SDKs toplay with our applications: Messenger Music Search Widgets
  • 41.
    What if thereis some data you want to access but no API to get it in the right format?
  • 42.
  • 43.
  • 44.
  • 45.
    … or hackwhat is out there.
  • 46.
  • 47.
    Slideshare is aplace to share presentations.
  • 48.
    You can embedthe presentations into other web products.
  • 49.
  • 50.
    There is anAPI, but there is no way to get all your latest presentations to have a “slide portfolio”.
  • 51.
    However, there isan RSS feed with all the data I need!
  • 52.
  • 53.
    Battle plan: Retrievefeed Display links to slides Get the slide movies Write some script to show the movies when the links are clicked
  • 54.
    <?php $url ='http://www.slideshare.net/rss/user/cheilmann'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $slides = curl_exec($ch); curl_close($ch); $slides = str_replace('slideshare:embed','slideshareembed',$slides); $slides = str_replace('media:title','mediatitle',$slides); $xml = domxml_xmltree($slides); $json = array(); $slidesharelist = ''; $links = $xml->get_elements_by_tagname('link'); $img = $xml->get_elements_by_tagname('url'); $titles = $xml->get_elements_by_tagname('mediatitle'); $embeds = $xml->get_elements_by_tagname('slideshareembed'); foreach ($embeds as $key=>$el) { $l = $links[$key+1]->children[0]->content; $t = $titles[$key]->children[0]->content; $slidesharelist .= '<li><a href=&quot;'.$l.'&quot;>'.$t.'</a></li>'; $emb = $el->children[0]->content; if(strpos($emb,'<div')===false){$emb = $el->children[1]->content;} preg_match_all('/value=&quot;([^&quot;]+)&quot;/msi',$emb,$obj); $json[]='\''.$obj[1][0].'\''; } ?>
  • 55.
    <style type=&quot;text/css&quot;> @import'slideshareshowstyles.css'; #slideshareshowslideshow{background:url(<?php echo $img[0]->children[0]->content;?>) no-repeat center center;} </style> <div id=&quot;slideshareshow&quot;> <ul id=&quot;slideshareslides&quot;><?php echo $slidesharelist; ?></ul> </div> <script type=&quot;text/javascript&quot; src=&quot;http://yui.yahooapis.com/2.3.1/build/yahoo-dom-event/yahoo-dom-event.js&quot;></script> <script type=&quot;text/javascript&quot; src=&quot;swfobject.js&quot;></script>
  • 56.
    < script type=&quot;text/javascript&quot;>YAHOO.example.slideshareshow = function(){ var container = document.getElementById('slideshareshow'); YAHOO.util.Dom.addClass(container,'jsenabled'); var list = document.getElementById('slideshareslides'); var links = list.getElementsByTagName('a'); var displayContainer = document.createElement('div'); displayContainer.id = 'slideshareshowslideshow'; container.appendChild(displayContainer); var current = null; for(var i=0;links[i];i++){ YAHOO.util.Event.on(links[i],'click',show,i); } function show(e,i){ YAHOO.util.Dom.removeClass(current,'current'); current = this; displayContainer.innerHTML = ''; var so = new SWFObject(slides[i], &quot;slideshareshow&quot;, &quot;425&quot;, &quot;355&quot;, &quot;8&quot;, &quot;#ffffff&quot;); so.addParam(&quot;allowScriptAccess&quot;, &quot;always&quot;); so.addParam(&quot;allowFullScreen&quot;, &quot;true&quot;); so.write(displayContainer); YAHOO.util.Dom.addClass(current,'current'); YAHOO.util.Event.stopEvent(e); } var slides=[<?php echo implode($json,','); ?>]; }(); </script>
  • 57.
  • 58.
    This is awesome!We are building badges for people to be able to display lists of their recent slideshows on their site, but it did not integrate the player. I love what you have done – well designed and well executed. I want it for my own site now. I will post about it to our blog. And we will point to it when we release our own badges. Thanks! rashmi (SlideShare cofounder)
  • 59.
  • 60.
    per aspera adastra &quot;through adversity to the stars&quot; or &quot;a rough road leads to the stars&quot;
  • 61.
  • 62.
  • 63.
  • 64.
    Christian Heilmann http://wait-till-i.comhttp://icant.co.uk Thank you! http://creativecommons.org/licenses/by-sa/3.0/