Web Info & Tutorials

March 31st, 2010

FROM WHISPER TO SHOUT; A NEW FORM OF VOLUME CONTROL

David Friedman calls is “silly”, but he has created something ultimate and recreation in his new modify of intensity control that moves from speaking to yell as you modify the volume.

whispershout

The cipher (which entireness on Firefox and Opera correct now) uses assorted tracks for apiece level:

HTML:

  1.  
  2. <audio id=“apA” autobuffer=“true” onTimeUpdate=“update();”>
  3.         <source src=“ogg/Volume1.ogg” type=“audio/ogg; codecs=vorbis”>
  4. </source></audio>
  5. <audio id=“apB” autobuffer=“true”>
  6.         <source src=“ogg/Volume2.ogg” type=“audio/ogg; codecs=vorbis”>
  7. </source></audio>
  8. <audio id=“apC” autobuffer=“true”>
  9.         <source src=“ogg/Volume3.ogg” type=“audio/ogg; codecs=vorbis”>
  10. </source></audio>
  11. <audio id=“apD” autobuffer=“true”>
  12.         <source src=“ogg/Volume4.ogg” type=“audio/ogg; codecs=vorbis”>
  13. </source></audio>
  14. <audio id=“apE” autobuffer=“true”>
  15.         <source src=“ogg/Volume5.ogg” type=“audio/ogg; codecs=vorbis”>
  16. </source></audio>
  17.  

And it keeps road of the timing so it crapper seamlessly endeavor with cipher much as:

JAVASCRIPT:

  1.  
  2. this.apA.addEventListener(“timeupdate”, timeUpdate, true);
  3.  
  4. function timeUpdate() {
  5.         //get the continuance of the player
  6.         dur = audio_player.duration;
  7.         instance = audio_player.currentTime;
  8.         cypher = time/dur;
  9.         proportionality = (fraction*100);
  10.         cloak = document.getElementById(“duration_background”);
  11.         new_width = wrapper.offsetWidth*fraction;
  12.         document.getElementById(“duration_bar”).style.width=new_width+“px”;
  13. }
  14.  
March 30th, 2010

JSINQ 1.0: NOW FULLY SUPPORTS .NET 3.0 QUERY OPERATORS

Kai Jäger’s JSINQ has today gotten to the daylong variety after 1.0 release. Kai has good mutual a some thoughts on the promulgation and the project:

I’m bright to foretell that digit assemblage after its initial release, JSINQ is today steady and crowded with newborn features. Just same the preceding version, JSINQ supports the rank ordered of .NET 3.5 ask operators. As of edition 1.0, JSINQ also supports the .NET 4.0 ask cause “zip”. Additionally, JSINQ today contains rank implementations of System.Collections.Generic.List and System.Collections.Generic.Dictionary. The lexicon collection is especially useful, as it supports capricious values as keys (unlike JavaScript objects). JSINQ is full documented, comes with a broad flat of tests and is already existence utilised in production. Without the nonmandatory ask compiler, JSINQ is exclusive 23 KB when minified.

See it state at the JSINQ playground where you crapper endeavor with your possess queries much as:

SQL:

  1.  
  2. FROM client IN $0
  3. WHERE customer.lastname.charAt(0) == ‘S’
  4. SELECT {id: customer.id, name: customer.firstname + ‘ ‘ + customer.lastname}
  5.  
March 29th, 2010

CSS: DESIGNERS ARE DOING AOP? NO WAY!

AOP? that is for whir kids and Enterprise Java sept (or Lisp hackers hit been doing it for eld and years).

Jonny Tran thinks that every instance you ingest CSS, you’re doing Aspect-Oriented Programming”. He brings up the set parts and pieces behindhand AOP:

cssaop

But what deeper AOP recreation same the wormhole effect which has the coolest study :)

Ramnivas Laddad (pre-eminent AOPer) came backwards with:

You nearly intend wormhole with selectors much as “div * p”

Nice :)

March 26th, 2010

CSS RAINDROPS; SEAN MARTELL WHIZZES INTO THE CSS LOGO GAME

Sean is awesome, and his stylish illusion is in the Raindrop trademark that he has “ported” to CSS (inspired by the Opera logo by king Desandro.)

The recreation is in this CSS where you module wager a full aggregation of gradients, and in sight Sean’s wander artefact on the different layers:

CSS:

  1.  
  2. background: -moz-linear-gradient(top, rgba(245,245,245,1), rgba(205,205,205,1));
  3.  
  4. -moz-border-radius: 100%;
  5.  
  6. background: transparent -moz-radial-gradient(50% 50%, conic farthest-corner, rgba(0,0,0,0) 0%, rgba(0,105,149,0.4) 37%, rgba(80,80,80,0.1) 47%, rgba(80,80,80,0) 58%);
  7.  
  8. // etc
  9.  

In Firefox 3.6+ give it a whirl (only entireness with -moz-* correct now, but instead of complaining, opening it? :)

March 26th, 2010

DYNAMIC LIGHTING EFFECTS IN CANVAS

Jonas designer has a amend weekday recreation demonstrate that normal function and phong shading in JavaScript using Canvas. Your pussyfoot indicator becomes the reddened maker that dynamically lights up a 3D object:

3dlighting

Jonas discusses how his cipher works:

The 3D gist is essentially created using 2 textures. One contains the colouration of apiece element and the another the opencast normal. The colouration ikon is rendered using exclusive backhanded illumination (ambient coagulum in that case). The candid reddened is then premeditated in actual instance using phong shading without the distribute part. For a more faithful description, feature the source. ;)

March 26th, 2010

GITHUB MOVES NETWORK GRAPH FEATURE FROM FLASH TO CANVAS

Given the underway position of Canvas and the close promulgation of Apple’s iPad (which module hit no Flash hold at all), I eventually definite to ache the missile and do a rank writing of the Network Graph in JavaScript and Canvas.

This is blackamoor Preston-Werner of GitHub, from his past posted most migrating the meshwork interpret functionality from Flash to Canvas.

githubnetworkgraph

This isn’t the prototypal place to advise over functionality, but blackamoor has a rattling engrossing appearance on ground he did this, what he likes most canvas, and what he wishes it had:

Where Canvas/JavaScript is meliorate than Flash

  • Fewer lines of cipher and small deliverable size: Smaller cipher humble and the compiled SWF enter clocks in at 111k compared to the minified Canvas edition at meet 25k!
  • Flash entireness seriously on UNIX (and friends)
  • Inspectable/debuggable via browser
  • No assembling step
  • Better indicator handling
  • No requirement to pore to obtain keyboard events

Where Canvas/JavaScript is worsened than Flash

  • Have to appendage excerpt and redraw manually (SVG does meliorate here too)
  • No embedded type support
  • No built-in multiline book twine (painful for Bespin! ;)
  • No HTML separate rendering. Yes! drawElement, drawElement, drawElement. Please individual agents!
March 25th, 2010

SETTIMEOUT: HOW TO GET THE SHORTEST DELAY

We hit every been there with our setTimeout(func, 0), but how near to 0 does it get?

The intrepid king noble of Mozilla delves into the retard in setTimeout and comes discover with whatever engrossing results. Here is his story:

On Sunday, somebody with the soubriquet {g} was on irc.mozilla.org asking most the activity of setTimeout.
In particular, he desired to cypher up impact into a clump of pieces in a artefact that allowed the individual to interact with the tender patch the impact was happening, and was doing this by doing a example of the work, and then making a setTimeout call to move the work. (In whatever cases, this could also be finished using workers.) Unfortunately for him, setTimeout in most browsers doesn’t earmark a retard inferior than most 10 milliseconds (it forces some small delays to be longer), so the impact wasn’t closing as alacritous as it could. (Chrome has denaturized this to 2 milliseconds, though, and ostensibly had some problems with it.)

A patch ago, Jeff Walden advisable to me that Web pages could intend the equal of setTimeout, with a actual set delay, using postMessage. This turns discover to be relatively straightforward:

JAVASCRIPT:

  1.     // Only add setZeroTimeout to the pane object, and conceal everything
  2.     // additional in a closure.
  3.     (function() {
  4.         var timeouts = [];
  5.         var messageName = “zero-timeout-message”;
  6.  
  7.         // Like setTimeout, but exclusive takes a duty argument.  There’s
  8.         // no instance discussion (always zero) and no arguments (you hit to
  9.         // ingest a closure).
  10.         function setZeroTimeout(fn) {
  11.             timeouts.push(fn);
  12.             window.postMessage(messageName, “*”);
  13.         }
  14.  
  15.         function handleMessage(event) {
  16.             if (event.source == pane &amp;&amp; event.data == messageName) {
  17.                 event.stopPropagation();
  18.                 if (timeouts.length> 0) {
  19.                     var fn = timeouts.shift();
  20.                     fn();
  21.                 }
  22.             }
  23.         }
  24.  
  25.         window.addEventListener(“message”, handleMessage, true);
  26.  
  27.         // Add the digit abstract we poverty additional to the pane object.
  28.         window.setZeroTimeout = setZeroTimeout;
  29.     })();
  30.  

I wrote a demo page that demonstrates that this is significantly faster than setTimeout(0).

On Linux

On a Firefox nightly 100 iterations of setZeroTimeout verify most 10-20 milliseconds most of the time, but occasionally longer; on a WebKit physique I hit it takes most 4-6 milliseconds, but occasionally a taste longer. (We should belike analyse the action disagreement here.) In comparison, in Firefox and on non-Chromium-based WebKit, the setTimeout edition takes most a ordinal (though perhaps modify individual on Windows).

On Mac: Boris tells me that on Mac, it’s the opposite: Gecko is faster than Safari or Chrome.

March 24th, 2010

MOOTOUCH: JQTOUCH HAS A MOO-Y CONTENDER


Jacky Nguyen was behindhand a newborn website ExpatLiving from Singapore, and as he shapely discover a pleasant analyse for iPhone and ambulatory Webkit folks, he implemented MooTouch. It is ease in an primeval stage, and is asking for input:

MooTouch is a cutting-edge JavaScript support shapely on crowning of MooTools that genuinely brings the experiences of iPhone / iPod Touch autochthonous applications to scheme applications. It is extremely lightweight and highly extensible, fashioned as a assemblage of loosely-coupled MooTools classes to appendage every users’ contact interactions. attorney features include:

MooTouch.App

  • Full Ajax experience, impulsive noesis weight on demand, ZERO tender change or re-direction
  • Location hash handling
  • History management, makes flooded ingest of the browser’s backwards and nervy buttons
  • Pages transformation using Mobile Safari’s autochthonous CSS3 GPU acceleration
  • Automatic hiding of the browser’s positioning bar
  • Global circumstance deputation to increase performance, and such more…

Some key behaviors that attain the set of MooTouch:

  • MooTouch.Clickable: No more disreputable 300ms retard before the “onClick” circumstance is actually fired!
  • MooTouch.Scrollable: CSS position:fixed not doable on the iPhone? It was yesterday! Have flooded curb over which noesis Atlantic you poverty to wage the simulated scrolling feature, with holograph indicators, swiftness & snapping backwards to boundaries features.
  • MooTouch.Swipeable: Bring “onSwipe” circumstance to some DOM surroundings you like, that’s how the picture room was done
  • and more to come…

MooTouch is assorted from most existing kindred libraries thanks to the use-at-will structure of MooTools. You crapper only meet garner the pieces you requirement and consortium them the artefact you like. Also, you crapper ingest some existing programme support same iUI, iWebKit, UiUIKit, etc. for styling and place MooTouch on crowning to curb every users’ interactions with some DOM element.

MooTouch is currently ease in alpha testing. It module be free low the Open Source university License as something I crapper provide backwards to the enthusiastic open-web community! All feedbacks are rattling such welcome.

March 23rd, 2010

A GOOGLE-Y POST: ANGLE, NATIVE CLIENT AND SKIPFISH

It was a laboring period for Google programme for scheme developers, in rattling assorted areas.

ANGLE

This is exciting. On the Chromium journal speechmaker Bridge declared a newborn unstoppered maker send titled ANGLE which is implementing OpenGL ES 2.0 on crowning of Microsoft Direct3D APIs for Windows folk. This is a bounteous care as you can’t adopt beatific OpenGL drivers on Windows… but with ANGLE springy could be better.

Why is this attendant to Chromium? WebGL:

We’re open-sourcing ANGLE baritone the BSD authorise as an primeval work-in-progress, but when complete, it module enable browsers same Google Chrome to separate WebGL noesis on Windows computers without having to rely on OpenGL drivers.

Current covering implementations of WebGL responsibility to be healthy to supply graphics commands to screen OpenGL to intercommunicate content. This responsibility isn’t a difficulty on computers streaming OS X or Linux, where OpenGL is the direct 3D API and thence enjoys solidified support. On Windows, however, most graphics-intensive apps ingest Microsoft Direct3D APIs instead of OpenGL, so OpenGL drivers are not ever available. Unfortunately, this status effectuation that modify if they hit coercive graphics hardware, whatever Windows machines can’t intercommunicate WebGL noesis because they don’t hit the needed OpenGL drivers installed. ANGLE module earmark Windows users to separate WebGL noesis without having to encounter and establish newborn drivers for their system.

Because ANGLE aims to compel most of the OpenGL ES 2.0 API, the send haw also be multipurpose for developers who are employed on applications for ambulatory and embedded devices. ANGLE should attain it simpler to image these applications on Windows, and also gives developers newborn options for deploying creation versions of their cipher to the desktop.

Check discover the source.

Native Client is ARM’d

NaCl allows you to gcc whatever cipher and hit it separate in a browser. Wooah :) The bounteous programme from that tent is new hold for ARM which effectuation NaCl for mobile….. and Chrome OS:

When we prototypal free Native Client a assemblage ago, we based every favourite operative systems (Windows, Mac OS X, and Linux) but exclusive on machines with x86 processors. Today, we’re bright to feature that you crapper physique and separate Native Client binaries for every of the most favourite processor architectures: x86-32, x86-64, and ARM. Even better, our initial benchmarks inform that Native Client executables action at 97% of the pace of an unrestricted workable on both ARM and x86-64 processors. These results inform that a covering streaming on virtually some recent machine or radiophone sound could separate a fast, performance-sensitive Native Client application.

However, we discern that meet streaming on today’s most favourite architectures isn’t enough; if a newborn processor structure emerges, it should be healthy to separate every Native Client modules already free without requiring developers to recompile their code. That’s ground we’re also nonindustrial profession that module enable developers to dispense a takeout state of Native Client programs using LLVM bitcode. Using this technology, a covering streaming on some identify of processor could alter the takeout state into a autochthonous star without admittance to the maker cipher of the program.

Skipfish

For the section afraid …. how most streaming Skipfish “a full automated, astir scheme covering section intelligence tool.”:

  • High speed: clean C code, highly optimized protocol handling, bottom mainframe print – easily achieving 2000 requests per ordinal with susceptible targets.
  • Ease of use: heuristics to hold a difference of quirky scheme frameworks and mixed-technology sites, with semiautomatic acquisition capabilities, on-the-fly wordlist creation, and modify autocompletion.
  • Cutting-edge section logic: broad quality, baritone simulated positive, figuring section checks, confident of soiling a arrange of impalpable flaws, including blindfold shot vectors.

Some modify programme every around…. every Web… and every unstoppered source.

March 22nd, 2010

SHOULD CSS VENDOR PREFIXES BE NUKED? OR JUST TWEAKED?

PPK has gone soured on CSS vendor prefixes. A aggregation of grouping hit finished this. He points to the demand of DRY that frustrates us all:

CSS:

  1.  
  2. div.borderbox {
  3.         box-sizing: border-box;  /* digit */
  4.         -moz-box-sizing: border-box;    /* digit */
  5.         -webkit-box-sizing: border-box; /* threesome */
  6. }
  7.  
  8. div.coolEffect {
  9.   -webkit-transition-property: opacity; /* digit */
  10.   -webkit-transition-duration: 2s;
  11.   -o-transition-property: opacity;            /* digit */
  12.   -o-transition-duration: 2s;
  13.   -moz-transition-property: opacity;      /* threesome */
  14.   -moz-transition-duration: 2s;
  15.   -ms-transition-property: opacity;          /* quaternary */
  16.   -ms-transition-duration: 2s;
  17. }
  18.  

However, there is a furniture point, and a commenter to his place makes it:

Some properties do change. WebKit’s position structure is foul and -moz digit is such more humane.

To me, the set difficulty is the unadaptable “vendor prefix until standardized”. Instead, I would such favour the application to essay to do the correct thing. If you wager box-sizing: border-box; only, ingest that…. and -vendor-* takes precedent. This also allows the mass pattern: Say Mozilla invents a modify newborn feature as use-css: awesome; the WebKit guys crapper feature “actually, that is great, I module double that” and hold it as is (and also transpose -webkit-use-css if they fancy.

The -x-* thoughts don’t attain as such significance to me as the difficulty is when browsers dissent from apiece another :)

But, what do you poverty to see?