Web Info & Tutorials

April 30th, 2009

YQL EXECUTE NOW ALLOWS YOU TO CONVERT SCRAPED DATA WITH SERVER SIDE JAVASCRIPT

I am a bounteous follower of YQL, a abominably cushy and fuss-free artefact to admittance APIs and intermixture accumulation retrieved from them in a simple, SQL call language. Say for warning you poverty photos of Paris,France from Flickr that are licensed with Creative Commons attribution, you crapper do this with a azygos command:

CODE:

  1. select * from flickr.photos.info where photo_id in (select id from flickr.photos.search where woe_id in (select woeid from geo.places where text=‘paris,france’) and license=4)

Try it discover here and you wager what I mean.

The incoming travel of this programme was to unstoppered it discover to the public. You crapper delimitate an “Open Table” as a simple XML plan and alter your possess API into this programme with that.

One abstract that’s been executing on my ness to verify the concern most has been eventually free now: YQL execute. Instead of making the YQL module itself such more Byzantine (and thusly streaming in circles) we today earmark you to embed JavaScript in the Open Table XML that module separate on the YQL computer and earmark you to admittance another scheme services, authenticate and bowing HTML with JavaScript and E4X. As Simon Willison place it:

This is nuts (in a beatific way). Yahoo!’s provocative coupler SQL-style XML/JSONP scheme assist programme today supports JavaScript as a category of stored machine language, message you crapper ingest JavaScript and E4X to screen-scrape scheme pages, then ask the results with YQL.

Using this, you crapper augment the warning functionality of YQL to some you need. For example, you crapper bowing HTML with YQL using XPATH, but there was no artefact to ingest CSS selectors. Using an unstoppered plateau that invokes James Padolsey’s css2xpath JavaScript on the computer side, this is today possible.

CODE:

  1. use ‘http://yqlblog.net/samples/data.html.cssselect.xml’ as data.html.cssselect; superior * from data.html.cssselect where url=“www.yahoo.com” and css=“#news a”

Run this ask in YQL

The accumulation plateau is pretty easy:

XML:

  1. <?xml version=“1.0″ encoding=“UTF-8″ ?>
  2. <table xmlns=“http://query.yahooapis.com/v1/schema/table.xsd”>
  3.   <meta>
  4.     <samplequery>select * from {table} where url="www.yahoo.com" and css="#news a"</samplequery>
  5.   </meta>
  6.   <bindings>
  7.   <select itemPath=“” produces=“XML”>
  8.     <urls>
  9.       <url></url>
  10.  
  11.     </urls>
  12.     <inputs>
  13.       <key id=“url” type=“xs:string” paramType=“variable” required=“true” />
  14.       <key id=“css” type=“xs:string” paramType=“variable” />
  15.     </inputs>
  16.       <execute><![CDATA[
  17.    //include css to xpath modify function
  18.    y.include("http://james.padolsey.com/scripts/javascript/css2xpath.js");
  19.    var ask = null;
  20.    if (css) {
  21.       var xpath = CSS2XPATH(css);
  22.       y.log("xpath "+xpath);
  23.       ask = y.query("select * from html where url=@url and xpath=\""+xpath+"\"",{url:url});
  24.    } added {
  25.       ask = y.query("select * from html where url=@url",{url:url});
  26.    }
  27.    response.object = query.results;
  28.       ]]></execute>
  29.     </select>
  30.   </bindings>
  31. </table>

Check the authorised Yahoo Developer Network journal place on YQL execute for more examples, including marker examples for flickr and netflix.

April 29th, 2009

AJAX FRAMEWORK ANALYSIS RESULTS

Matt Raible has posted on the psychotherapy the he has finished for a client on choosing an Ajax framework. This is the geezerhood older discourse “which Ajax support should I use?” It is agonizing. It is hard. It isn’t pretty. We created a dartboard:

Matts verify compares Dojo, Ext JS, GWT, and YUI using different criteria that you crapper wager here (including his ratings):

What you apace wager is that it is evenhandedly hornlike to opt between the favourite frameworks (and this is a limited subset that was narrowed down, thus no jQuery, Prototype, Mootools, etc).

I am fascinated in sight what another criteria grouping ingest to choose.

April 28th, 2009

HAPPY BIRTHDAY, OPERA

You haw hit already seen Opera’s celebratory bag tender rating their ordinal anniversary:

But did you also attending the funny portrayal their founders’ story?

Happy Birthday, Opera.

April 27th, 2009

MOOTOOLS 1.2.2 AND THE NEW MOOTOOLS MORE PLUGIN LIBRARY

The MooTools aggroup has been laboring over the terminal week. Last weekday they free MooTools 1.2.2:

MooTools 1.2.2 is a mainly a fault mend promulgation but it also includes an nearly all newborn Class.js. The rational behindhand this is that the older Class.js didn’t endeavor nicely with whatever modern usages of this.parent() inform in the newborn MooTools-More. We already had the playscript primed and proven in the MooTools 2.0 division so we exclusive “backported” it to 1.2.2. Other than providing the parent fixes, the newborn Class also features a much more burly acquisition model, especially when handling with objects.

For example, the objects you compel today in a assemblage are merged if an goal with the aforementioned study is institute in the assemblage prototype:

JavaScript:

  1.  
  2. var Animal = new Class({
  3.     options: {
  4.         color: ‘brown’,
  5.         says: ‘hissss’
  6.     }
  7. });
  8.  
  9. Animal.implement(‘options’, {says: ‘meow’});
  10.  
  11. // Animal.prototype.options is today {says: ‘meow’, color: ‘brown’};
  12.  

This is especially multipurpose when predominate choice options in classes, much as Request.

Upgrading to this edition of MooTools exclusive requires that you modify in the newborn version. There aren’t whatever changes that order changes to sites that compel these features.

MooTools More

Also with this promulgation comes a super update to the MooTools plugin library, MooTools More. Previously this assets of the send featured most a dozen add-ons. The newborn promulgation features 48 plugins, adding things same FormValidators, newborn effects, JSONP support, numerous enhancements to autochthonous objects same String and Element as substantially as burly URI and Date classes. They organisation on adding newborn plugins regularly as this assets of the accumulation grows over the incoming individual months.

Clientcide

Relatedly, MooTools presenter ballplayer physicist has free an updated edition of the Clientcide MooTools Plugins to hold these newborn plugins. Many of the plugins that are today officially conception of the MooTools send came from Clientcide’s assemblage of plugins. For anyone using the Clientcide plugins you crapper encounter sympathy scripts on the download page there. He notes that there are digit or digit breaking changes for users who were using whatever of the plugins that touched over to MooTools More.

April 24th, 2009

280SLIDES, CAPPUCCINO, ATLAS, AND ARISTO

Francisco Tolmasky presented on the stylish goodies from 280North at JSConf. In the instance we’ve presented the 280North guys a intense instance for conversation most 280Slides and their another clog using… Keynote. I don’t undergo if he utilised Keynote at JSConf, but Francisco publicised the slides using the 280Slides web-based show viewer, which is also embeddable:

(We same the embedded viewer, but did they hit to attain it enclose ordinary keystrokes? On Firefox OS X, erst we embed this IFrame, APPLE-W makes the motion invoke white. 10 points for a modify feature, -100 points for robbery the application in this context.)

The slides attain for a beatific analyse of Cappuccino but meet allow short mentions of the another engrossing bits, much as the newborn Aristo thought fashioned by SOFA and the awful Atlas.

Fortunately, there is a past recording of a speech by Francisco on March 30 to the CocoaHeads individual group:


Enjoy!

April 24th, 2009

CSS BROWSER HACKS

Paul Goidelic tries not to ingest CSS application hacks anymore and instead “uses IE’s contingent comments to administer classes to the embody tag, but he place up a apothegmatic itemize of browser limited hacks he has used:

CSS:

  1.  
  2. /***** Selector Hacks ******/
  3.  
  4. /* IE 6 and beneath */
  5. * html #uno  { color: red }
  6.  
  7. /* IE 7 and beneath */
  8. *:first-child+html #dos { color: red }
  9.  
  10. /* IE 7 and recent browsers */
  11. html>body #tres { color: red }
  12.  
  13. /* Modern browsers (not IE 7) */
  14. html>/**/body #cuatro { color: red }
  15.  
  16. /* Opera 9.27 and beneath */
  17. html:first-child #cinco { color: red }
  18.  
  19. /* Safari */
  20. html[xmlns*=“”] body:last-child #seis { color: red }
  21.  
  22. /*safari 3+, plate 1+, opera9+, ff 3.5+ */
  23. body:nth-of-type(1) #siete { color: red }
  24.  
  25. /* expedition 3+, plate 1+, opera9+, ff 3.5+ */
  26. body:first-of-type #ocho {  color: red }
  27.  
  28. /* saf3, chrome1+ */
  29. @media concealment and (-webkit-min-device-pixel-ratio:0) {
  30.  #diez  { background: #FFDECE; border: 2px solid #ff0000  }
  31. }
  32.  
  33. /***** Attribute Hacks ******/
  34.  
  35. /* ie6 and beneath */
  36. #once { _color:blue }
  37.  
  38. /* ie7 and beneath */
  39. #doce { *color: blue } /* or #color:blue */
  40.  
  41. /* ‘Modern Browsers’ includes IE8, whether you concord or not.. :) */
  42.  

He has included a test page and you crapper analyse the different browsers via browsershots.

Finally, he course to added apothegmatic list… of JavaScript sniffs.

April 24th, 2009

MOUSE GESTURES WITH GWT

Marc Englund wrote to us most his recent experiments with pussyfoot gestures and GWT:

SimpleGesture is a GWT (and IT Mill Toolkit) feat of the pussyfoot intercommunicate acceptance method described by Didier Brun at bytearray.org (as I see it). It allows you to run cushy to see (human readable) gestures, and obtain events when these occur. Additionally, SimpleGesture crapper achievement newborn gestures, so that you don’t hit to indite them by hand.

In this recording demo, he’s using a Wii to exhibit it soured (this potty me at first, but he’s using the Wii as a pussyfoot and isn’t doing anything with the Wii-specific inputs):


You crapper also play with a springy demo.

SimpleGesture relies on a taste of Flash to do its thing:

I hit utilised the bytearray pussyfoot intercommunicate accumulation for a Flash send before, and I fuck how ultimate the method is, and still it entireness rattling well.
The method entireness by distribution a sort depending on which content the pussyfoot moves in (moving correct module display “0″, agitated downbound module display “2″, and so on), and scrutiny the resulting progress of drawing to the qualified gestures. The intercommunicate with the minimal Levenshtein indifference (and beneath a ordered threshold), is thoughtful a match.

April 23rd, 2009

MYPATTERNS: XPATH / REGEX FOR JS OBJECTS

Nic Volanschi spinous us to myPatterns:

myPatterns is a newborn accumulation adding bespoken notations for accumulation structures in JS (and also C). It’s rattling multipurpose for composition foppish programs using generalized ornament matching.

To vindicate myPatterns, let’s inform a accepted JavaScript object:

JavaScript:

  1. {
  2.   name: { firstname: “John”, lastname: “Smith” },
  3.   children: [
  4.     { firstname: “Eric”, gender: “male”, born: 1991 },
  5.     { firstname: “Deborah”, gender: “female”, born: 1996 }
  6.   ]
  7. }

Using myPattern, you crapper indite a effort to analyse if this goal represents a mortal whose prototypal female is a pupil 18 eld old:

JavaScript:

  1. (s = match(x, “{name:{lastname: %l}, children:[{gender: ‘male’, born: %b} | %x]}”))
  2. && new Date().getFullYear() - s.b == 18

The website explains the ornament above:

In the above, the match() evidence both checks whether the goal has a destined modify (e.g. that the children earth is an clothing containing a prototypal surroundings of a presented form), and returns a “substitution” goal s having the mass value: {l: “Smith”, b: 1991, x: [ {firstname: “Deborah” , born: 1996} ]}.

Furthermore, using your possess notations, you could indite the aforementioned information more concisely, and with your possess individualized touch, for example:

JavaScript:

  1. s = match(x, “<%first ~ %last: [boy(18) | %rest]>”)

In the above, the goal is noted in a more apothegmatic way, and the geezerhood of the prototypal son is direct given in the pattern, as if it was stored in the object, attractive plus of astir patterns to compute the geezerhood on the fly.

Neat!

April 22nd, 2009

DYNAMICALLY GENERATED PDFS… WITH JAVASCRIPT?

In the “it-had-to-be-done-at-some-point” category, we provide you saint Hall’s stylish project:

I hit started employed on jsPDF, an all Javascript-based PDF generator. Currently the demonstrate serves up the generated PDF as a Data URI, but it could be utilised on the computer lateral or within application extensions. It currently exclusive supports ultimate text, but I’m employed on images and type embedding at the moment.

If you’re using Safari, Opera, or Firefox 3.5 Beta, the demo is pretty cool; the client-side JavaScript cipher generates a accumulation address which the application displays.

Neat.

April 21st, 2009

O3D: GOOGLE RELEASES 3D API IN A BROWSER PLUGIN


Google has free O3D, a application plugin that gives developers a 3D API. It sits at a slightly higher take than added APIs (such as OpenGL / Canvas 3D identify implementations) so it module be engrossing to wager if developers same the higher take abstraction, especially for antiquity games. These APIs crapper also be implemented on crowning of the modify take APIs, so in theory it could set on crowning of Canvas 3D.

There are plentitude of demos, samples of cipher and shaders (they created a O3D graduation language.

Interestingly, it embeds V8 as the JavaScript engine which makes for a homogenous engine, but alas you can’t ingest your application debugger (e.g. no Firebug).

It has also been carefully positioned “This API is mutual at an primeval initiate as conception of a conversation with the broader developer accord most establishing an unstoppered scheme accepted for 3D graphics.”

It is engrossing to wager added newborn plugin from Google. I ever hoped that Gears would be digit developer plugin to conception them every but then we hit the Earth API, and this (as substantially as the non developer ones same the inoperative Lively).

Anyway, modify to wager flush experiments in transfer 3D to Web developers, and I countenance nervy to sight what grouping do with it! Leisure Suit Larry 3D anyone? :)