Web Info & Tutorials

January 12th, 2007

RUMOUR: SAFARI FOR WINDOWS?

Mary Jo Foley digs deep in her reporting. This time she noticed a wiki entry on the Mozilla side that thinks Apple may have Safari on Windows with likely ties to iTunes & .Mac.

I don’t know if this makes any sense. The reason I fire up Safari is:

  • Very fast on the Mac
  • Nice, native components

Would SafariWin just use Windows components? Would it be significantly faster than the other options on Windows to make it worth while?

As of this writing, the poll on Mary’s site had the following results:

should safari win

Disclaimer: this is huge speculation

January 12th, 2007

ATTRIBUTE NIGHTMARE IN IE

It’s Friday, so maybe you poverty to set backwards for a whatever transactions and achievement finished whatever instance in Tobie Langel’s chronicle as he tries to get IE to endeavor pleasant with attributes.

This tale walks finished the discompose of intellection that you hit a employed version, and then existence frustrated again.

  • IE: element.foo === element.getAttribute(’foo’)
  • iFlags to the delivery ? element.getAttribute(’onclick’, 2);
  • attributes collection: element.attributes[’foo’];
  • Maybe move for Prototypes upcoming: readAttribute()
January 12th, 2007

ANIMATION WITH CONTINUATIONS

Kris Zyp has written an article discussing the demonstration using continuations in JavaScript to facilitate writing animations with straightforward linear code.

The example is a bunch of bouncing gears that animate up and down as they bounce.

Explanation

When you click on the button, this calls the addGear function and starts a new "thread" of execution. This execution then carries out the steps of the animation in a natural linear coding sequence.

The Narrative JavaScript framework creates the ability to have multiple threads. Each time you click the button, you are effectively creating a new thread of execution. Of course the underlying JS VM is single threaded, but cooperative multithreading is possible as threads suspend execution through the continuation system.

JAVASCRIPT:
  1.  
  2. function addGear() {
  3.  
  4.  var self = this;
  5.  
  6.  function makeGear() { // create the DOM img element for the gear
  7.  
  8.   var gear = document.createElement("img");
  9.  
  10.   gear.src="images/Configurator.gif";
  11.  
  12.   gear.style.position="absolute";
  13.  
  14.   self.gearArea.appendChild(gear);
  15.  
  16.   return gear;
  17.  
  18.  }
  19.  
  20.  function bounceGear(gear, positionX, velocityY) { // do a single bounce
  21.  
  22.   var y = 0;
  23.  
  24.   gear.style.left = positionX + "px";
  25.  
  26.   do {
  27.  
  28.    velocityY = velocityY - 0.4; // make a parabolic bounce
  29.  
  30.    y += velocityY;
  31.  
  32.    gear.style.bottom = y + "px";
  33.  
  34.    sleep(20); // pause for 20 milliseconds
  35.  
  36.   } while (y> 0);
  37.  
  38.  }
  39.  
  40.  function waitForClick(gear) {
  41.  
  42.   var notifier = gear.onclick = new EventNotifier();
  43.  
  44.   notifier.wait(); // pause until the click happens
  45.  
  46.   gear.onclick = null;
  47.  
  48.  }
  49.  
  50.  function doBouncingGear() { // this carries out the overall animation
  51.  
  52.    var gear = makeGear(); // create the gear element
  53.  
  54.    var x = Math.random() * 400; // random x position
  55.  
  56.    var bounceVelocity = 15;
  57.  
  58.    do { // do a decaying bounce
  59.  
  60.     bounceGear(gear,x,bounceVelocity); // do one bounce
  61.  
  62.     bounceVelocity = bounceVelocity/1.3; // the bounce/velocity decreases each time
  63.  
  64.    } while (bounceVelocity> 1) // gotta stop sometime
  65.  
  66.    // finished bouncing
  67.  
  68.    waitForClick(gear); // wait for the user to click on it
  69.  
  70.    // next in the sequence is to roll it away
  71.  
  72.    var velocityX = 0;
  73.  
  74.    do { // now we will roll it away
  75.  
  76.     velocityX += 0.2;
  77.  
  78.     x += velocityX;
  79.  
  80.     gear.style.left = x + "px";
  81.  
  82.     sleep(30);
  83.  
  84.    } while (x <400);
  85.  
  86.    // now we will remove it
  87.  
  88.    gear.parentNode.removeChild(gear);
  89.  
  90.  }
  91.  
  92.  doBouncingGear(); // execute the animation
  93.  
  94. }
  95.  

Animation with Continuations

January 12th, 2007

DOMQUERY - A LIGHTWEIGHT CSS SELECTOR / BASIC XPATH IMPLEMENTATION

Jack Slocum is a machine. We had to add the newborn YUI-EXT collection for him as he is reaching up with much beatific material.

His latest, is an article on DomQuery - A lightweight CSS Selector / Basic XPath implementation.

Support for more Byzantine schemas and writing structures in the grid’s XMLDataModel collection has been requested whatever times. Currently, you are restricted to a plan which consists of exclusive surroundings take attach obloquy and attributes. That is where DomQuery started. When weight a installation from an XML Document, there would be quite a whatever apace executing queries so enthusiastic action was imperative. Thanks to the FireBug Profiler, I was healthy to analyse the bottlenecks and effort assorted enforcement plans to wager what was the fastest.

This accumulation is pleasant and speedy. According to Evangelist Resig it is faster than histrion theologist cssQuery. Evangelist wrote most this in salutation to the criterion figures of jQuery that Jack shows:

We’ve been retentive soured on conversation most the pace of the jQuery selectors for the newborn 1.1 promulgation until our promulgation was fireman to existence primed - however, it seems as if that impact has already been expedited. So with that already discover of the bag, lets countenance at the switch speeds of jQuery.

In short: For jQuery 1.1 we worked rattling rattling hornlike to attain its selectors rattling fast. In fact, according to every our tests we were faster than whatever another switch library. Working on the 1.1 release, histrion Edwards’ cssQuery farther out-performed whatever another switch library. It’s rattling comprehensive, and rattling fast.

Today, Jack Slocum declared his newborn DOMQuery switch library. In short: The forbid has been raised. His accumulation is rattling rattling fast. Quite mayhap the fastest acquirable today.

However, in the comparability between his accumulation and ours, whatever mistakes were prefabricated that we’d same to country up. (By both Jack and jQuery) (For reference, here’s the comparision suite that I utilised for my tests.)

January 12th, 2007

CREATING A FLEX APPLICATION USING THE TURBOGEARS FRAMEWORK

Screencasts are a pleasant artefact to wager destined things. Adobe has finished a recreation one, and got their possess saint Ward, and the experienced doc Eckel unitedly to indite whatever code.

The writing conference is the unify of them building a distribution app from scratch using TurboGears on the backend, and Flex on the face end.

It is recreation to wager doc using stark older vi for his python hacking, and saint gets to go into uber-IDE realty with the Flex Builder (built on Eclipse).