Web Info & Tutorials

July 31st, 2009

PYRAMIDOM: SPECTRUM DOM ANALYZER

Andrea Giammarchi has created PyramiDOM a “Spectrum DOM Analyzer”. When I prototypal saw it, and feature “Spectrum” I intellection I was hunting at an older 48k recording game, but in fact it is display you content on the DOM:

The generated spectrum module include every azygos nodeType 1 inform in the writing and module exhibit via tooltip content most that convexity (nodeName, id if present, className if present). Moreover, it highlights someways that convexity temporary dynamical the scenery (yellow one). The most evil gist was in jQuery website itself, since it is dark, and since it is linelike sufficiency (you holograph and the spectrum is nearly there where you scroll).

On the another hand, the most engrossing spectrum was in Gmail, where you crapper blot a comely pyramid of nested divs. Each nodeName module hit the aforementioned color, but for applicatory reasons apiece instance this colouration module be assorted (random).

You crapper grab this PyramiDOM unification to play.

July 31st, 2009

WPS: POSTSCRIPT AND PDF INTERPRETER FOR HTML 5 CANVAS

It would be a pretty modify grapple to compel a PostScript/PDF intermediator in JavaScript wouldn’t it? That is meet what has been finished with WPS.

The code takes PS and rattling groks it so:

JAVASCRIPT:

  1.  
  2. /n 10 def
  3. /w 25 def
  4.  
  5. 0 0 n w mul dup .gbox
  6.  
  7. 4 dict begin
  8.   0 1 n 1 change {
  9.     /i exch def
  10.     /ii 1 1 n div i mul change def
  11.     0 1 n 1 change {
  12.       /j exch def
  13.       /jj 1 1 n div j mul change def
  14.       ii jj 0 setrgbcolor
  15.       w j mul w i mul w w rectfill
  16.     } for
  17.   } for
  18. end
  19.  

becomes:

And every in ~400 lines of code! Check discover the examples….. meet awesome!

July 30th, 2009

BEST WAY TO LOAD YOUR JAVASCRIPT

Nicholas Zakas thinks he has the prizewinning artefact to alluviation JavaScript.

Steve Souders has a clump of prizewinning practices, and it seems that there is definitely refinement that makes advice rattling such plain to your circumstance.

Nicholas though, has an opinion:

I’ve become to the closing that there’s meet digit prizewinning training for weight JavaScript without blocking:

  1. Create digit JavaScript files. The prototypal contains meet the cipher needed to alluviation JavaScript dynamically, the ordinal contains everything added that’s needed for the initial take of interactivity on the page.
  2. Include the prototypal JavaScript enter with a <script> attach at the lowermost of the page, meet exclusive the </body>.
  3. Create a ordinal <script> attach that calls the duty to alluviation the ordinal JavaScript enter and contains whatever added formatting code.

A supporter to attain this hap could countenance like:

JAVASCRIPT:

  1.  
  2. function loadScript(url, callback){
  3.  
  4.     var playscript = document.createElement(“script”)
  5.     script.type = “text/javascript”;
  6.  
  7.     if (script.readyState){  //IE
  8.         script.onreadystatechange = function(){
  9.             if (script.readyState == “loaded” ||
  10.                     script.readyState == “complete”){
  11.                 script.onreadystatechange = null;
  12.                 callback();
  13.             }
  14.         };
  15.     } else {  //Others
  16.         script.onload = function(){
  17.             callback();
  18.         };
  19.     }
  20.  
  21.     script.src = url;
  22.     document.getElementsByTagName(“head”)[0].appendChild(script);
  23. }
  24.  

In attendant news, the LABjs sept hit updated their API from this:

JAVASCRIPT:

  1.  
  2. $LAB
  3. .script(“jquery.js”)
  4. .block(function(){
  5.       $LAB
  6.       .script(“jquery.ui.js”)
  7.       .script(“myplugin.jquery.js”)
  8.       .block(function(){
  9.             $LAB.script(“initpage.js”);
  10.       });
  11. });
  12.  

to the simpler:

JAVASCRIPT:

  1.  
  2. $LAB
  3. .script(“jquery.js”)
  4. .block()
  5. .script(“jquery.ui.js”)
  6. .script(“myplugin.jquery.js”)
  7. .block()
  8. .script(“initpage.js”);
  9.  

I seem to advert that Steve had whatever opinions on this API likewise :)

July 30th, 2009

THE DOCTOR SUBSCRIBES HTML 5 AUDIO CROSS BROWSER SUPPORT

The student is in, and this instance the doc is Mark Boas who walks us finished HTML5 Audio in different browsers and how to intend frequence employed on the different implementations that are in the disorderly today.

This primeval in the mettlesome especially, every implementations are not equal. For digit there is the codec support:

But also there are the different levels of API hold (and modify the fact that Opera underway supports Audio() but not the frequence attach for example).

Mark worked on the jPlayer jQuery plugin which advance him downbound this path, and in closing it comes downbound too:

  1. Check for HTML 5 frequence hold and if not inform start backwards on Flash.
  2. Check the take of HTML 5 frequence hold and alter your cipher accordingly for apiece browser.
  3. Check what enter types are based and unification to pertinent formats of the files.

You crapper go to a audio checker in different browsers to wager them poked and prodded.

Mark shares cipher much as:

JAVASCRIPT:

  1.  
  2. // Using JavaScript You crapper analyse for frequence attach hold same this:
  3. var audioTagSupport = !!(document.createElement(‘audio’).canPlayType);
  4.  
  5. // Checking for the frequence goal looks more same this:
  6. try {
  7.     // The ’src’ constant is dominion in Opera 10, so hit utilised an blank progress "",
  8.     // otherwise an omission is thrown.
  9.  
  10.     myAudioObj = new Audio(“”);
  11.  
  12.     audioObjSupport = !!(myAudioObj.canPlayType);
  13.     basicAudioSupport = !!(!audioObjSupport ? myAudioObj.play : false);
  14. } catch (e) {
  15.     audioObjSupport = false;
  16.     basicAudioSupport = false;
  17. }
  18.  
  19. // Need to analyse the canPlayType prototypal or an omission module be tangled for those browsers that don’t hold it
  20. if (myAudio.canPlayType) {
  21.    // Currently canPlayType(type) returns: "no", "maybe" or "probably"
  22.     canPlayOgg = (“no” != myAudio.canPlayType(“audio/ogg”)) && (“” != myAudio.canPlayType(“audio/ogg”));
  23.     canPlayMp3 = (“no” != myAudio.canPlayType(“audio/mpeg”)) && (“” != myAudio.canPlayType(“audio/mpeg”));
  24. }
  25.  
July 29th, 2009

CHROMA HASH: INTERESTING VISUALIZATION OF YOUR PASSWORD

Matt archaeologist has created a recreation lowercase jQuery plugin titled Chroma-Hash that “dynamically visualizes bonded text-field values using ambient colouration bars”:

Password entry crapper be frustrating, especially with daylong or arduous passwords. On a webpage, bonded fields fog your signaling with •’s, so others can’t feature it. Unfortunately, neither crapper you—you can’t verify if you got your countersign correct until you utter “Log In”.

Chroma-Hash displays a program of blackamoor exerciser at the modify of earth inputs so you crapper directly wager if your countersign is right. Chroma-Hash takes an MD5 hash of your signaling and uses that to compute the colours in the visualization. The MD5 hash is non-reversible, so no digit could undergo what your countersign meet from the colors. Your countersign module pass the aforementioned ordering apiece time, so you crapper wager to wait “blue, red, pink”, for instance; if you instead wager “green, purple, yellow”, you’ll undergo you written it wrong.

Here is a piece of the magic:

JAVASCRIPT:

  1.  
  2.               $(this).css({position:   ‘absolute’,
  3.                            left:       position.left + breadth - 2,
  4.                            top:        position.top,
  5.                            height:     height + “px”,
  6.                            width:      8 + “px”,
  7.                            margin:     5 + “px”,
  8.                            marginLeft: -8 * (i + 1) + “px”
  9.                           }
  10.                     );
  11.               });
  12.          
  13.               var id     = $(this).attr(‘id’);
  14.               var md5    = hex_md5($(this).val());
  15.               var colours = md5.match(/([\dABCDEF]{6})/ig);
  16.               $(“.chroma-hash”).stop();
  17.  
  18.               chromaHashesForElement(this).each(function(i) {
  19.                 $(this).animate({backgroundColor:“#” + colors[i]});
  20.               });
  21.  
July 28th, 2009

DEVELOPER EVANGELISM HANDBOOK RELEASED

As developers, it crapper be hornlike to intend your vocalise heard in a company. Whilst our products depend on developers antiquity them the correct way, another grouping seem to call the shots most where they are going.

This becomes disastrous when a consort tries to accomplish developers with their product. Normal marketing and PR stunts ordinarily change to intend us excited. To impact around this issue, adroit companies earmark developers to advise into a persona of developer evangelists.

A developer preacher is a spokesperson, negotiator and polyglot between a consort and both its theoretical body and right developers.

This is my employ at the moment, and I was asked by grouping I drilled if there is a reference most the skills necessary to do this job, so I wrote one.

Check discover the The Developer Evangelist handbook

The reference explains individual things:

  • What developer evangelism is
  • What makes a beatific developer evangelist
  • How to indite for the web
  • How to ingest ethnic media and the scheme to encourage content
  • How to have enthusiastic presentations
  • How to care with critique of your consort and what to do with the competition
  • How to indite cushy to see and multipurpose cipher examples
  • The reference is Creative Commons and liberated to use. I am employed on effort a printed edition out, too.

    July 27th, 2009

    THE AJAX EXPERIENCE AGENDA AT-A-GLANCE NOW AVAILABLE!

    Over the time some weeks we’ve finalized over 40 key sessions across 7 tracks for The Ajax Experience conference, including Frameworks, User Experience, Standards and Cross-Browser Issues, High Performance and Scalability, Security, Architecture, JavaScript, and Cutting-Edge Ajax. The agenda-at-glance is primed for your analyse now. There’s something for everyone!  Check it discover

    The Ajax Experience is Sept 14-16 in Boston. $300 primeval shuttle fund are beatific finished this Friday, July 31.

    Awesome tone presentations include:

    Check discover the The Ajax Experience at-a-glance. Register today to spend $300!

    July 23rd, 2009

    MULTIPLE FONT WEIGHTS VIA CSS 3 AND MORE FONT FUN

    Ilia Draznin has been using CSS3 identify grappling to imitation identify weights:

    The artefact @font-face entireness is that some identify attributes you verify for a @font-face rule, they don’t watch how the identify looks but kinda when it’s gonna intend used. For warning if you hit the mass digit rules

    CSS:

    1.  
    2. @font-face {
    3.     font-family: newfont;
    4.     src: local(Arial);
    5.     font-weight: 200;
    6. }
    7.  
    8. @font-face {
    9.     font-family: newfont;
    10.     src: local(Calibri);
    11.     font-weight: 300;
    12. }
    13.  

    Then if you ingest the “newfont” font-family with coefficient 200 it’s feat to ingest Arial, but if you ingest it with coefficient 300 it’s feat to ingest Calibri. So we crapper verify plus of that, and since it uses @font-face we don’t modify hit to vexation if the user’s machine has fonts or not.

    We posted on TypeKit recently, and we hit added playa Kernest in the “fix friggin identify on the Web” game.

    And for a test lowercase nugget of identify goodness, from @schill:

    Typekit looks to allow jQuery, loads CSS with base64-encoded data:font/otf URLs for @font-face. “Safer” than a stark unstoppered .TTF, I suppose.

    July 22nd, 2009

    JETPACK TO THE FUTURE WITH RECORDING AUDIO API

    The Jetpack send is ease a teen ‘un from Mozilla Labs (disclaimer: I impact for labs!) but they are agitated swiftly indeed, and apiece newborn promulgation has a evil modify newborn API that let’s you do something you couldn’t easily do before.

    With the Jetpack 0.4 release we wager digit modify APIs:

    Audio Recording API

    We hit a shiny newborn <audio> attach which is enthusiastic for activity frequence and all, but how most adding the knowledge for users to easily create audio?

    The newborn Audio Recording API lets you do meet that:

    JAVASCRIPT:

    1.  
    2. jetpack.future.import(‘audio’);
    3. jetpack.audio.recordToFile();
    4. var line = jetpack.audio.stopRecording();
    5.  

    Play the topical enter backwards with jetpack.audio.playFile() or upload it and meet ingest the frequence attach itself.

    A enthusiastic background of this is the voice memo jetpack “which lets you compose whatever webpage you are hunting at with your voice.” Live moving is modify reaching soon. Here comes recording conferencing the Open Web way?

    Page Mods API

    Jetpack is a enthusiastic artefact to do Greasemonkey-like work. To attain it modify easier, you requirement a artefact to delimitate when the jetpack kicks in etc, and this is just what the Page Mods API gives you.

    Check discover the listing example:

    JAVASCRIPT:

    1.  
    2. jetpack.future.import(“pageMods”);
    3.  
    4. var asking = function(document){
    5.   // analyse the underway instance if it is between 9 and 5
    6.   // ‘blacklist’ the sites in options.matches
    7.   var currentTime;
    8.   var currentHour;
    9.   currentTime = new Date();
    10.   currentHour = currentTime.getHours();
    11.   if (currentHour> 8 && currentHour <17){
    12.     document.title = “This place is blacklisted. Get whatever impact done!”;
    13.     $(document).find(“body”).css({border:“3px solidified #000000″});
    14.     $(document).find(“body”).children().hide();
    15.     $(document).find(“body”).prepend($(‘<h1>Sorry this place is blacklisted until 17:00. sadface.’));
    16.   }
    17.  
    18. };
    19.  
    20. var options = {};
    21. options.matches = [“http://*.reddit.com/*”,
    22.                    “http://*.cnn.com/*”,
    23.                    “http://*.bbc.co.uk/*”,
    24.                    “http://*.dpreview.com/*”,
    25.                    “http://dpreview.com/*”,
    26.                    “http://*.bloglines.com/*”,
    27.                    “http://bloglines.com/*”];
    28. jetpack.pageMods.add(callback, options);
    29.  

    Nice impact guys.

    July 21st, 2009

    WOULDN’T IT BE SWELL TO BE ABLE TO DRAG AND DROP BETWEEN WEB AND DESKTOP

    Christophe Eblé has good cursive a temporary locate on Swell JS and his inspire and modify trainer that entireness with your desktop. Here he tells us more:

    At Swell we were most to create a Drag & Drop Manager meet same in added Javascript libraries such as Jquery, YUI, Mootools, Scriptaculous, but we were not rattling mitigated with this decision.

    What impelled us to take added strategy is that we didn’t poverty to wage ease added simulated resolution but instead a inspire & modify accumulation that would ingest the actual noesis of the scheme browser.

    We’ve been visaged to a aggregation of problems and we are ease struggling with API differences. The Pros and cons of using grouping drag&drop over simulated solutions:

    Pros

    • Accuracy and performance, pussyfoot advise tricks to function an surroundings low the indicator and notice direct impinging are things of the past, grouping DD is evil fast!
    • system DD crapper be anything you same (simple images or Byzantine dom nodes) and crapper interact within your covering window, the plate (search field, come bar…) or tabs (if the covering allows it, FF 3.5 does it right) and modify your OS.
    • system DD finished the dataTransfer goal crapper circularize coercive meta aggregation that are not needed the dragged goal itself, this crapper be capricious book (JSON accumulation for ex.), urls and for the stylish browsers Byzantine accumulation types wager this
    • system DD has genuine DOM Events

    Cons

    • Browser differences in this person are a actual pain, I couldn’t itemize every the oddities here :)

    The inspire & modify feat in Swell is ease at an primeval stage, and not officially free but here’s whatever info on what we’re employed on.

    • Provide a azygos artefact to create autochthonous inspire & modify objects in every doable browser
    • Provide setDragImage method on browsers that don’t hold it yet
    • Provide a DD Manager that acts as a container for every inspire and modify events on which you crapper locate your handlers, equilibrate events, or apace collection every the DD objects on the page. (useful when you care with mountain of DD Objects)
    • Provide a artefact to assort Byzantine metadata with apiece DD objects
    • Provide a artefact to easily create seeable feedback for your DD Objects
    • Tight combining with our event library
    • and such more…

    There’s a TRAC acquirable on the send with a roadmap and promulgation dates, a blog, and modify a SVN repo that you crapper analyse out. Be careful, as I said above the accumulation is ease in onerous utilization and is absent docs! We are hunting for whatever category of support and meet wish to obtain large feedback ;) .

    See whatever examples in action:


    In the video, we are providing a ultimate ease coercive covering to goods a RSS take in your webpage. The Hellenic artefact is to identify in the take address and then effort redirected to it, which commonly takes 3 to 5 steps. With this feat you meet hit to modify the RSS picture onto an pertinent direct and that’s every folks!

    We ingest YQL and JSONP to alter RSS into JSON and of instruction a Swell Element to dynamically confiscate the activity to the webpage:

    JAVASCRIPT:

    1.  
    2. var dd2 = new Swell.Lib.DD.Droppable(‘moo’);
    3.  
    4. dd2.ondrop = function(e) {
    5.     var enter = this.getData(e, ‘DD_URL’).split(\n)[0];
    6.     if (/^http\:\/\//i.test(file) !== true) {
    7.         return false;
    8.     }
    9.     $(‘debug’).setHTML(‘loading…’);
    10.     e.target.className = ‘’;
    11.  
    12.     var yqlRequest = ‘http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20rss%20where%20url=%22′+file+‘%22&amp;format=json&amp;callback=moo’;
    13.     html.script({
    14.         ‘type’ : ‘text/javascript’,
    15.         ’src’  : yqlRequest
    16.     }).appendTo(document.getElementsByTagName(‘head’)[0]);
    17. }
    18.