Web Info & Tutorials

February 12th, 2008

MODERN ARNIS IN OSHAWA (TORONTO) ONTARIO

I am entertained to foretell that I module be doctrine Modern Arnis classes at at the Legends Community Centre on Harmony Road in Oshawa (Toronto), Ontario. The underway schedule is as follows:

(1) weekday Feb 20th, state shack 3 7:00pm to 9:00pm
(2) weekday Feb 27th, state shack 3, 7:00pm to…

February 12th, 2008

BOOK REVIEW: ADVANCED AJAX BY LAURIAT

Advanced Ajax

Because Ajax moves so much application logic from the server to the client, it forces many developers to master a wider range of web technologies than ever before. To work effectively on Ajax projects, front-end developers have to concern themselves with database performance, business logic and other server-side concerns. Back-end and middleware developers, meanwhile, have to make friends with XHTML, CSS, JavaScript and a wide range of browsers. Sure, it’s possible to develop Ajax apps in a siloed team environment. But it’s not the easiest way, and it rarely provides the strongest results.

Shawn M. Lauriat’s “Advanced Ajax: Architecture and Best Practices” (Prentice Hall, 2008, 360p) bridges the gap between developers with exclusive client- or server-side skills. By exploring tools, technologies and best practices for every layer of the Ajax programming model, this solid new programming manual promises to plug the holes in any developer’s resume. Lauriat’s tops-to-tails approach offers something for almost any developer, but it also guarantees most readers will find some sections remedial. As this two-part review will demonstrate, that’s not necessarily a liability.

more…

February 12th, 2008

DOJO ROUNDUP: A/V, ANIMATION, AND A LOT MORE

A lot of news came together at the Dojo Developer Days event.

Below is my meta-roundup based on Alex’s wrapup, and other news.

Animation

Eugene Lazutkin (SitePen) has been a busy man. His impressive work on dojox.gfx, dojox.gfx3d, and dojox.charting made Dojo 1.0 the best tool around for portably drawing vector graphics in a browser without plugins, and for 1.1 he’s updating dojox.gfx to include animations, based loosely on easy-to-use Dojo Core animation APIs. Shapes, transformations, colors, and other dojox.gfx properties can be animated, chained, and eased on any 2D drawing object in Dojo 1.1, all using the high-performance, single-timer animation system from Dojo Core.

Speaking of animations, Peter Higgins gave us a tour of some of the great components he’s been whipping up now that Robert Penner’s awesome easing function set has landed under CLA in dojox.fx.easing. Of course, you can plug these great easing functions into any Dojo animation, but examples like dojo.moj.oe really give them life.

Adobe AIR and Dojo

Rob Christensen and another of his colleagues from Adobe were kind enough to give us a thorough walk-through of Adobe AIR as well as showing off Dojo 1.1’s comprehensive support for AIR. This work was done by SitePen and Chris Barber with financial support from Adobe. Not only does the Dojo package system work as expected in AIR, new dojox.storage providers for AIR give a simpler interface onto AIR’s database, including for encrypted data. The demo showing a full Dojo-based application inside of AIR for quickly taking notes started to show the potential.

More

  • DojoX A/V: Starts as a way to embed flash and quicktime, but will also have a Jukebox and a Tuner. The bigger news here is that there is the beginnings of a partial port of some of the Dojo base to AS2 (including console pass-throughs, the event system (i.e. connect), and a number of the lang constructs) in order to support some of the A/V stuff well, all compiled using MTASC.
  • CSS Selectors: a new tutorial on how to use dojo.query to get fast selection fun. Also, Dojo 1.1 already has a patch that uses the new WebKit native selectors
  • Crypto: Blowfish now performs about 4 times faster than it used to
  • Charting: curves… mmm
  • DojoX Sketch: We reported about the Comet version
  • Color: In addition to adding conversion methods to HSL, HSV, CMY and CMYK, there is a Generator that allows you to create a palette of colors based on several well-known generation rules
  • Flash storage: Brad Neuberg started hacking and found that Adobe has fixed the serialization problems with Flash’s ExternalInterface, so a clean up is coming for dojox.flash, and Dojo Offline
  • A next-gen JSON-RPC for Dojo which supports pluggable back-ends
February 12th, 2008

LINQ TO JSON

James Newton-King has posted a new bit of code called LINQ to JSON which is a .NET LINQ style API over JSON.

For example, here is how you could get out categories and how often they are used:

JAVASCRIPT:
var categories =
  from c in rss.PropertyValue<jobject>("channel")
              .PropertyValue<jarray>("item")
              .Children<jobject>()
              .PropertyValues<jarray>("category")
              .Children<string>()
  group c by c into g
  orderby g.Count() descending
  select new { Category = g.Key, Count = g.Count() };
 

There is also a project, JSLINQ which is an implementation of LINQ to Objects implemented in JavaScript. It is built using a set of extension methods built on top of the JavaScript Array object. If you are using an Array, you can use JSLINQ.

February 12th, 2008

AJAX INTERCEPTOR: HAVE SOMEONE CLEAN FOR YOU

José Manuel Alarcón Aguín has written AJAXInterceptor, a JavaScript library that you add which takes over form submissions and makes them happen asynchronously with XHR.

You can also control progress indicators and request cancelation via code such as:

HTML:
<div id="progress">
  <img src="progressimgs/bigrotation2.gif" alt="Loading..." align="middle" hspace="10" /> Loading...
  <input type="button" value="Cancel" onclick="AI_CancelRequest();" />
</div>
<script language="javascript" type="text/javascript" src="AJAXInterceptor_r.js"></script>
<script language="javascript" type="text/javascript" defer="defer">
  AI_SetProgressDiv("progress");
</script>
 
February 12th, 2008

THE PARSEINT GOTCHA

Guyon Morée has posted the old chesnut parseInt gotcha, so I thought I should put it up here as a quick tip:

I was working on some stuff in javascript which involved some date/string parsing when one morning it failed. "That's weird, yesterday it worked fine!"
After some debugging with FireBug I found parseInt() was failing on me.

It was the 8th of February and it was failing on "08" as an input string. I opened the FireBug console and entered parseInt("08"), just to be sure I wasn't' getting mad and sure enough, the output was 0. Just as a way of rechecking my sanity I entered parseInt('07') and this did return the correct answer, 7.

So I googled the parseInt function and discovered some funky default behavior, which was flagged as deprecated.
The parseInt takes a second radix parameter. With this you can tell parseInt the base your input is in.

All fine, but there are also some prefixes defined, so you can input '0xff' for hexadecimal values. Unfortunately they also thought it would be smart to assign 0 to octal values. So 08 is being intepreted as an octal value.

Even though I think the behavior is error prone, it's even weirder that it returns 0. I believe it should return something like NaN as it is isn't a valid number in the assumed base.

Mike Owens posted the Prototype based '+' mapping to do the work for you:

JAVASCRIPT:
['2008', '02', '11', '06', '21', '03'].map(function(v) { return + v });
# [2008, 2, 11, 6, 21, 3]