Activate your free membership today | Log-in

Tuesday, June 9th, 2009

Finally, a useful blink tag! Detecting your user blinking

Category: Canvas, Showcase

Dave Burke just gave an awesome demo at GDD Beijing. Fire up Firefox 3.5beta (for now) and head over here and watch the human blink detection in action!

Here Dave tells us more about his awesome hack:

Inspired by a demo by Paul Rouget, I’ve created an image processing demo that detects eye blinks in real-time. It uses a combination of <video>, <audio>, <canvas> and worker threads. The <video> frames are “projected” on to a <canvas> to get access to the raw pixels. The Euclidean colour distance is calculated inter-frame and thresholded, resulting in a view that shows movement (shown on a second canvas). A worker thread then performs several algorithms including tracing, sorting, and positioning check of the blobs of pixels. If the worker thread determines an eye blink, it posts back to the main thread which uses the canvas to draw bounding boxes around the eyes. The algorithm is based on a paper I wrote almost 10 years ago describing a communication system I built for a patient with severe spinal injuries. I had originally implemented it in C++ using Microsoft’s “Video For Windows” (a precursor to DirectShow). I bet I would have laughed if someone said that I’d be able to write the same system in JavaScript less than 10 yrs later!

Thanks Dave!

Posted by Dion Almaer at 11:59 am
15 Comments

++++-
4.5 rating from 25 votes

Thursday, June 4th, 2009

CSS Video Effects

Category: Safari, Showcase, Video

Charles Ying has been playing with some new cool features that just made it to WebKit Nightly, specifically CSS effects with HTML5 video.

With some cool CSS such as below, Charles gets the nice effect of reflection live on HTML5 video (which is playing a .mov that you select)

CSS:
  1.  
  2. .reflector
  3. {
  4.         -webkit-box-reflect: below 1 -webkit-gradient(linear, left top, left bottom, color-stop(0.5, transparent), color-stop(1.0, rgba(255, 255, 255, 0.5)));
  5. }
  6.  
  7. .fader
  8. {
  9.         -webkit-transition-property: opacity;
  10.         -webkit-transition-duration: 550ms;
  11.         -webkit-transition-timing-function: ease-in-out;
  12. }
  13.  

You will see that in a few lines of jQuery he builds the movie list and fades in and plays the video on click, all via:

JAVASCRIPT:
  1.  
  2.     jQuery.map(movies, function (movie)
  3.     {
  4.                 var thumb = jQuery('<a href="#" title="' + movie.title + '"><img src="' + movie.thumb + '" class="reflector" /></a>');
  5.  
  6.         thumb.click(function ()
  7.         {
  8.                         var video = jQuery('<video id="cell" autoplay="true" class="fader reflector" />').get(0);
  9.                         video.style.opacity = 0;
  10.                         jQuery("#holder").empty().append(video);
  11.  
  12.                         video.addEventListener("loadstart", function ()
  13.                         {
  14.                                 jQuery(body).addClass("darker");
  15.  
  16.                                 setTimeout(function ()
  17.                                 {
  18.                                         jQuery(menu).css("visibility", "hidden");
  19.                                         video.style.opacity = 1;
  20.                                 }, 550);
  21.                         }, false);
  22.  
  23.                         jQuery(video).attr("src", movie.link);
  24.                        
  25.                         var finished = function ()
  26.                         {
  27.                                 video.style.opacity = 0;
  28.                                 setTimeout(function ()
  29.                                 {
  30.                     video.pause();
  31.                                         jQuery(menu).css("visibility", "visible");
  32.                     jQuery(body).removeClass("darker");
  33.                                 }, 550);
  34.                                 return false;
  35.                         }
  36.                        
  37.                         video.addEventListener("ended", finished, false);
  38.  
  39.                         jQuery(video).click(finished);
  40.  
  41.             return false;
  42.         });
  43.  
  44.         jQuery("#menu").append(thumb);
  45.     });
  46.  

Nicely done!

Posted by Dion Almaer at 12:28 pm
7 Comments

+++--
3.2 rating from 23 votes

Wednesday, June 3rd, 2009

Almost.at beautiful new Cappuccino app

Category: Cappuccino, Showcase

I am sitting in the JavaOne keynote watching the event in real-time through the new application, almost.at. It aggregates tweets, links, photos and videos all in one nice interface.

You will notice that the UI has an iTunes-like feel with the bottom timeline, and it looks great. I am starting to wonder if you have to get a UI review from Sofa before you deploy a Cappuccino application? What are you hiding 280North! ;)

Posted by Dion Almaer at 8:47 am
5 Comments

++++-
4 rating from 26 votes

Tuesday, May 19th, 2009

Locking onto beat; More visualizations of music

Category: Canvas, Showcase

"darkimmortal" has created another really nice visualization of music that uses Canvas and SoundManager2 to do its work.

Do yourself a favour, and hit play to see the funk

The example uses two canvases, one to do the logic wave work, and then it is copied into the main canvas that you see ctxR.drawImage( ctxL.canvas, 0, 0 );.

Here's some of the fun:

JAVASCRIPT:
  1.  
  2. function render(event){
  3.         var now = new Date().getTime();
  4.         ctxL.clearRect( 0, 0, 200, 100 );
  5.         var cdex = ~~((now/100)%21);
  6.         var colors = [_calone[cdex], _caltwo[cdex], 'rgb('+~~(24+(_vis||[0,0])[1]/19+34*Math.cos(now/8192+(_vis||[0,0])[0]/92))+','+~~(16+20*Math.cos(2+now/7192+(_vis||[0,0])[1]/71))+','+~~(32+24*Math.cos(4+now/5192+(_vis||[0,0])[0]/87))+')'];
  7.         for( var j=0; j<colors .length; j++ ){
  8.                 ctxL.beginPath();
  9.                 ctxL.moveTo( 250,50 );
  10.                 ctxL.fillStyle = colors[j];
  11.                 var ii;
  12.                 for( var i=0; i&lt;128; i+=3 ){
  13.                         ii = Math.abs(i-64);
  14.                         // Wave equation from Dynamic Hypnoglow
  15.                         // Optimised and made epic by Darkimmortal
  16.                         ctxL.lineTo( ii*4-32, 32+(64+ii/2)*(.1+.2*Math.cos(j+(now/352)+i/31))+(i&64)*1/(68-ii)+16*Math.sin( (now+(_vis||[0,0])[0]/1337 )/( (788-j*287)%1337 ) - ii*(.07+j/43+(_vis||[0,0])[1]/1973-(_vis||[0,0])[0]/1837) ) );
  17.                         // End of wave equation.
  18.                 }
  19.                 ctxL.closePath();
  20.                 ctxL.fill();
  21.         }
  22.  
  23.         ctxR.clearRect( 0, 0, 200, 100 );
  24.         ctxR.drawImage( ctxL.canvas, 0, 0 );
  25.         ctxR.globalCompositeOperation = 'lighter';
  26.         if(_bright){
  27.                 _bright2 ++;
  28.         }
  29.         if(_bright2> 3){
  30.                 _bright = false;
  31.                 _bright2=0;
  32.         }
  33.         ctxL.globalCompositeOperation = _bright ? 'lighter' : 'copy';
  34.        
  35.         for( var i=0; i&lt;6; i++ ){
  36.                 ctxL.drawImage(ctxL.canvas, 0, 0, 200>>i, 100>>i, 0, 0, 100>>i, 50>>i)
  37.                 ctxR.drawImage(ctxL.canvas, 0, 0, 100>>i,  50>>i, 0, 0, 200, 100);
  38.         }
  39.         _overlay.style.backgroundPosition = ~~((_vis[_axis]/2.5) % 600 ) +'px '+ (_firefox + (_aim> 2800 ? 10 : (_aim <500 ? -10 : 0))) +'px';
  40.        
  41.         if(_vis[_axis] <_aim){
  42.                 _vis[_axis]+= 20;
  43.         }
  44.         if(_vis[_axis]> _aim){
  45.                 _vis[_axis]-= 20;
  46.         }
  47.        
  48.         _fpsb ++;
  49.         if(_fpsc + 1000 <now){
  50.                 _fpsc = now;
  51.                 _fps = _fpsb;
  52.                 _fpsb = 0;
  53.         }       
  54. }
  55.  

Posted by Dion Almaer at 7:31 am
17 Comments

++---
2.5 rating from 33 votes

Monday, May 18th, 2009

Crap I missed it, doesn’t miss your file upload!

Category: Showcase, UI

The Crap I missed it! crew took on the task of dealing with importing your iTunes XML file, and wanting to give you responsive feedback on the items as they come in. The usual tactic would be to suck in the entire file, and then process it.

Michael Baldwin did more, and here he tells us more:

We wanted to allow users to upload their iTunes library files, so that we could extract artist names (to let users sign up for new album and concert notifications). The problem was that these .xml library files can easily run up to 20MB in size.

Which means 1) long, boring downloads without feedback that it's really working, 2) huge space requirements on our servers to support lots of concurrent uploads, and 3) big memory requirements to process the XML files.

What we did instead was to write a bare-bones custom web server just for this task in PHP (yes, PHP) which analyzes the file as it streams in (storing nothing on disk, and using negligible memory), gradually puts artist statistics into shared memory, and then responds to new AJAX requests every ten seconds which retrieve and remove the artist statistics from shared memory.

The end result for users: as users upload their library file over the course of several minutes, they get to watch their web page fill up with their list of artists at the same time, sorted and even animated. If the connection breaks, they can even choose to continue with just the artists that made it.

The end result for us: we can deal with gigabytes of uploads while using trivial computing resources -- just a couple KB of incoming buffer space and a couple KB of outgoing buffer space.

You can check it out yourself, where it will look a bit like this (but constantly updating!)

Posted by Dion Almaer at 7:12 am
19 Comments

++++-
4.1 rating from 17 votes

Thursday, April 30th, 2009

Twiggler, a sample app for the LM Framework

Category: Showcase

David Semeria has been working on LM, another Ajax framework, for a number of years and has just announced it.

The first demo app is a highly customizable Twitter client, Twiggler, that runs in the browser.

Unfortunately nothing is public on the framework so we can't see how it actually works. It looks kinda like Squeak or X from an interface perspective, and you can see an interesting designer view.

Posted by Dion Almaer at 6:24 am
5 Comments

++---
2 rating from 24 votes

Friday, April 24th, 2009

Blackberry Storm using Raphael (SVG/VML) and SoundManager

Category: JavaScript, SVG, Showcase, jQuery

Brad Neuberg pointed me to a Blackberry Storm site that uses Raphael, jQuery, and SoundManager to offer an SVG / VML (for IE) experience.

HTML:
  1.  
  2. <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/jquery-ui.min.js"></script>
  3. <script src="/js/soundmanager2-nodebug-jsmin.js"></script>
  4. <script src="/js/raphael-min.js"></script>
  5. <script src="/js/trig-min.js"></script>
  6.  

Posted by Dion Almaer at 6:48 am
2 Comments

+++--
3 rating from 22 votes

Sunday, April 19th, 2009

Sarien: Multiplayer Game Engine goes Open Source

Category: Games, Showcase

Ben loves to talk about old games such as Dark Castle. I personally love remembering old Sinclair ZX Spectrum games but also fondly remember Leisure Suit Larry.

Wouldn't it be nice if you could play classic old games such as these easily online? Martin Kool thought so, and wanted to create an open source adventure game system, and just released Sarien.net "the portal for reliving the classic Sierra On-Line adventure games. With its focus on instant fun and a unique multiplayer experience, Sarien.net hopes to win new gamers' hearts and promote the adventure game genre."

Features

Completely browser based, runs in IE, FF, Opera, Safari, Chrome

  • Works on the iphone and Wii (both needs fixing at the moment I believe)
  • Games are completely playable using mouse or keyboard input. A lot of effort has been put into the user interface to make it work for the era that we’re in
  • Multiplayer! This was not in the original games, but what you can do now is; when you are playing your own game at your own pace, and are in game X room Y, you’ll see other players in that same game X room Y doing their things
  • You can talk to eachother and replay scenes together
  • All game areas are accessible directly through the address bar, and bookmarkable. Giving players the instant kick of replaying a certain scene
  • While playing, you encounter other npc’s. These add up to your own list of avatars that you can choose to be, not influincing the gameplay but it adds up to the fun (especially in multiplayer)
  • There’s even an extra Studio tool to let you view all game resources, similar to existing tools such as AGI Studio

Check out some of the games and then delve into the resource explorer studio and build your own stuff.

Thanks for doing this Martin! What games would you like to see / create? :)

Posted by Dion Almaer at 10:54 am
8 Comments

++++-
4.7 rating from 38 votes

Thursday, April 2nd, 2009

Stocker showcases Dojo

Category: Dojo, Showcase

SitePen has created Stocker "which demonstrates some of the more advanced capabilities of Dojo, including the newly released DataChart, the DataGrid, Data Store, Comet, Persevere, and BorderContainer. SitePen is also offering a one-day workshop where you will learn how to create Stocker yourself, but I’m here to give you a sneak peak of what Stocker is and how it works.

Stocker uses these technologies to emulate a stock monitoring application. We’re using made up data, but that’s actually more interesting. The Persevere server generates new stock items at certain intervals, and then pushes them to the browser with Comet. Then the Data Store updates its items and triggers an onSet notification. The DataGrid and DataChart are both connected to the same store, and are listening to that event. They then update their displays and show the stock items and their latest data."

Want to see what it would be like to develop using Persevere, DataGrid, DataChart, and friends!

Posted by Dion Almaer at 6:44 am
6 Comments

+++--
3.8 rating from 61 votes

Monday, March 30th, 2009

PaperCube: Killer Way to Explore Academia

Category: Showcase

Just last week a few of us were discussing the riches that await discovery in the various computer science research paper archives and today Peter Bergström wrote in to tell us that he's finished work on his PaperCube research paper search engine (which we mentioned when it was incomplete some time ago).

Bsaed on SproutCore, PaperCube lets you easily explore papers, including linking to references and citations--its very cool, and Peter's prepared a video to walk through the features:

Posted by Ben Galbraith at 10:00 am
3 Comments

++++-
4.2 rating from 14 votes

Wednesday, March 25th, 2009

JuicyDrop: More fun with music visualizations

Category: Canvas, JavaScript, Showcase

Jacob Seidelin is at it again, with another music visualization using canvas and more:

A couple of weeks ago I played around with music visualization using JavaScript/canvas and SoundManager2. Well, I couldn't leave it at that and as I mentioned in the comments, I had an eye on the MilkDrop plugin for Winamp. The result so far is a little Winamp lookalike called JuicyAmp with its own music visualizer JuicyDrop that feeds on Milkdrop preset files.

If you just want to see the pretty colors -> CLICKY. (But please use Chrome or Firefox 3+)

MilkDrop is nice because, although there's a built-in editor in the plugin, the presets are in plain text. They are basically just lists of variables and equations that, with a bit of mangling, can be evaluated as JavaScript. There are also extensive guides that explain how to author presets and how variables are passed around between the different equations. And, even better, the source code for the plugin was released a couple of years ago.

MilkDrop presets consist of a number of different elements (waveforms, shapes, per-pixel effects, etc). Some of them I haven't touched at all, but JuicyDrop supports enough at the moment that a good handful of presets run just fine. That said, there are a whole bunch of problems to work out and the presets included were selected because they looked alright and didn't make it blow up.

I strongly recommend using Chrome for this. Firefox 3 can play too but is probably somewhat slower. There's something screwy going on with Safari, it's like it's refusing to update the display (try holding down a key on your keyboard), I'm not sure what exactly is causing it. Opera is a mixed experience for me and it seems to have a problem with playing the music that I haven't found the reason for yet.

Posted by Dion Almaer at 4:17 am
5 Comments

++++-
4.8 rating from 31 votes

Thursday, March 12th, 2009

Project Dragonfly: Floor planning from AutoDesk

Category: Showcase

Project Dragonfly is the latest experiment from the Autodesk Labs group. It enables to visually floor plan in both 2d and 3d space:

A few of the folks who brought you Project Draw and Autodesk Seek, teamed with some fairly new members of the Autodesk family, have cooked up something new for the home project "do-it-yourselfer" - Project Dragonfly. I grew up in Louisiana and we used to call them Mosquito Hawks, so I was happy to hook this free web-based floor planning application into the Autodesk Labs site. Project Dragonfly’s technology preview offers all-types of users, even those without prior design skills, the ability to visualize a future home improvement project or dream about a long awaited one.

The team told us a little of the implementation:

In terms of implementatoin we use the Flex platform for the client. We are using a very cool 2d library for flex called Degrafa and Away3d for the 3d implementation. The most interesting aspects of this application IMHO are the rules system which provides ability for collision detection (this is not just a bounding box collision but a true geometry collision), orientation (objects reorient as they move closer to walls) and ability to do wall attachments.

On the 3d front of course the quality of user experience and performance were equal concerns. So we heavily customized the away3d framework, especially the renderers and offloaded a ton of work to the server (we use the amazon computing cloud-ec2 for hosting, s3/sdb for storage and cloudfront for CDN) so we can handle the processor intensive tasks away from the client.

Posted by Dion Almaer at 4:21 am
2 Comments

++++-
4.2 rating from 33 votes

Monday, March 9th, 2009

ModelAdmin: new opensource jQuery-based web-application system

Category: Showcase

Sigurd Magnusson recently told us about ModelAdmin, a just-released feature in the open source SilverStripe CMS that uses jQuery to build rich user interfaces to let every day people manage data in a web-app.

This free code will let strong PHP+JS developers build really great web interfaces to be used by non-technical people.

You write object-oriented MVC code in PHP, and a jQuery-based application, along with the database schema, automatically builds around you. (This is similar to ruby on rails, with the exception that the database schema is derived from code, rather than the code inspecting the database schema.)

One of the developers of the work, Ingo Schommer, has a 25 minute video tutorial on this

You can also checkout the slideshare and code.

The SilverStripe CMS was featured on Ajaxian 24 months ago for starting a new era in terms of CMS usability, using scriptaculous and prototype. The system is being migrated to jQuery, to give more power to developers. ModelAdmin one of the first items across the line.

Recent facts

To see the otherwise heavily scriptaculous+prototype SilverStripe interface, watch this.

Posted by Dion Almaer at 5:58 am
2 Comments

+++--
3.1 rating from 28 votes

Friday, February 27th, 2009

Multi-file upload in the Flickr and Gmail house

Category: Showcase

I saw two posts at the same time on the topic of multiple-file uploading from a Web app which is a topic that we have covered many times before.

This time we have our good friend Scott Schiller posting on the Flickr uploader. He details the user experience from file selection, to progress, to completion, and then delves into the technical details including the Flash 10 changes:

Due to a change in the security model beginning with Flash 10, file selection must now begin via the user clicking directly on the Flash movie. With previous versions, you could call [Flash movie].selectFiles() from JavaScript and the selection dialog would be shown without requiring user action.

To keep the user experience consistent on Flickr where an HTML link could trigger the selection dialog, we made the Flash movie transparent and overlaid it on top of the HTML link. Thus, the Flash movie captures the click and the selection dialog works as expected. One might call this a legitimate, local form of clickjacking.

If repositioning the Flash movie is undesirable in your use case, another option is to render the link, text or button UI within the Flash movie itself and show the movie as a normal inline element.

Then, Gmail finally launched multifile uploading and people will rejoice.

It, as most of these things do, uses Flash:

This is the pragmatic choice, even though Gears has nice support. Time for browsers to step up!

Posted by Dion Almaer at 12:53 am
12 Comments

+++--
3.5 rating from 10 votes

Sunday, February 22nd, 2009

Cross-Browser Inline-Block

Category: Articles, Examples, Showcase

Ryan Doherty has one of those really nice articles that walk you through how to do something that should be easy in CSS but isn't, until you know how: Cross Browser Inline Block.

By the end of it all you will have this:

HTML:
  1.  
  2.     li {
  3.         width: 200px;
  4.         min-height: 250px;
  5.         border: 1px solid #000;
  6.         display: -moz-inline-stack;
  7.         display: inline-block;
  8.         vertical-align: top;
  9.         margin: 5px;
  10.         zoom: 1;
  11.         *display: inline;
  12.         _height: 250px;
  13.     }
  14. </style>
  15.  
  16.         <div>
  17.             <h4>This is awesome</h4>
  18.             <img src="http://farm4.static.flickr.com/3623/3279671785_d1f2e665b6_s.jpg"
  19.             alt="lobster" width="75" height="75"/>
  20.         </div>
  21. </li>
  22.  

which gets you the following reliably in many browsers:

Along the way you will learn about more IE star hacks, fun with hasLayout, use XUL stacks to help Firefox 2 along, and more. Very nice job Ryan.

Posted by Dion Almaer at 5:04 am
11 Comments

++++-
4.2 rating from 42 votes

Wednesday, February 18th, 2009

Queued: a Netflix Queue Manager Using Dojo and AIR

Category: Dojo, Showcase

SitePen, via Adobe sponsorship, has created an open source queue manager for Netflix called Queued.

The entire Dojo toolkit contains much more functionality than any single application needs, so the task of building applications often comes down to figuring out what style of coding you’ll use rather than learning how to use different components and figuring out how to glue them together. For Queued, we ended up with:

  • a single HTML file for the main window
  • dAIR for Dojo/AIR integration (window handling, etc)
  • dijit for layout (BorderContainer and friends)—but only for layout; we wanted to show that you can build compelling experiences without having to include (or learn!) the entire toolkit
  • unobtrusive behavior implementation using dojo.behavior, which made it very easy for our design & CSS guys to be productive without conflicting with the JS guys (and vice versa)
  • dojox.dtl for most widget templating
  • drag and drop for queue re-ordering
  • various animations for polish
  • Dojo’s build system (we distill everything into a single dojo.js and qd.js for the production app)

Since Queued is as much a demonstration of Dojo as it is of AIR, we took special care to keep the code hackery to a minimum—in addition to simply working correctly, we needed the code to be 1) easy to follow and 2) instructive for developers interested in learning how a good Dojo app can be put together. Everything’s nice and organized.

Posted by Dion Almaer at 12:31 am
Comment here

++++-
4.1 rating from 28 votes

Next Page »