Web Info & Tutorials

January 31st, 2008

SECURE STRING INTERPOLATION IN JAVASCRIPT

Mike Samuel of the Google Caja team (and much more) has a fantastically detailed document on the choices for secure String interpolation in JavaScript.

He spends a lot of time discussing:

There are a large number of examples a long the way:

JAVASCRIPT:
  1.  
  2. var ids = [1, 2, 3, 4];
  3. var column = 'value';
  4. var foo = 'foo';
  5.  
  6. open(Template("SELECT $column FROM Table WHERE id IN $ids AND foo LIKE $foo"))
  7. // === "SELECT `value` FROM Table WHERE id IN (1, 2, 3, 4) AND foo LIKE 'foo'"
  8.  
January 31st, 2008

DOMAPI 4.5: NEW, IMPROVED, AND MORE FREE

DomAPI

DomAPI has been around for ever but the package has been updated:

DomAPI version 4.5 has a new lower price and a simplified licensing plan.

In a nutshell, there are now 2 license types, 'Free' and 'Pro'. Both types can be used on commercial sites, in any capacity, with no restrictions. The benefits of the pro version include:

  • Access to unobfuscated source code
  • Access to hourly beta builds
  • Permission to alter the source code
  • Permission to remove branding and 'splash' items
  • Permission to bundle the library with applications

If you purchased a DomAPI 4.0 license, you automatically are upgraded to 4.5. If you have a 3.x license, or purchased a 3.x to 4.x upgrade, you will need to obtain a new 4.5 license. DomAPI 4.5 Professional licences are currently priced at only $49 USD.

The latest public release of DomAPI contains all the fixes an additions that have been made to DomAPI v4.0 since its original build nearly 2 years ago. These features were previously only available within the hourly beta builds, but now everyone can benefit from them.

Upgrading from 4.0 to 4.5 should be completely painless -- it is meant to be backwards compatible with your existing code.

Some of the major improvements include:

  • Complete support for IE7
  • Complete support for Firefox 2
  • Better memory leak protection in IE6/7
  • Plenty of little fixes and performance enhancements
January 31st, 2008

MOST RELEVANT BROWSERS OF 2009

John has taken a shot at listing the most relevant browsers of 2009:

  • IE 7
  • IE 6
  • Firefox 3
  • Safari 3
  • Opera 9.5

I think that Firefox 3 and Safari 3 may end up tieing, and if you frame it as rendering engines, Webkit will probably beat Gecko as it is also being used by iPhone, AIR, Android, and Nokia (they use Gecko too).

And, what about IE 8?

January 31st, 2008

JSON 2.0: LIBRARIES AND BROWSER SUPPORT

John is at it again, writing a piece on recent news surrounding JSON.

He links to an updated library by Douglas Crockford,

JAVASCRIPT:
  1.  
  2. JSON.stringify({name: "John", location: "Boston"});
  3. // => "{'name':'John','location':'Boston'}"
  4. JSON.parse("{'name':'John','location':'Boston'}");
  5. // => {name: "John", location: "Boston"}
  6.  

It also turns out that Mozilla implemented this functionality in the browser (time for a wrapper):

JAVASCRIPT:
  1.  
  2. var nativeJSON = Components.classes["@mozilla.org/dom/json;1"]
  3.     .createInstance(Components.interfaces.nsIJSON);
  4. nativeJSON.encode({name: "John", location: "Boston"});
  5. // => "{'name':'John','location':'Boston'}"
  6. nativeJSON.decode("{'name':'John','location':'Boston'}");
  7. // => {name: "John", location: "Boston"}
  8.  

And in conclusion:

The final, and most important, step is being worked on right now - a way to access native JSON encoding and decoding from web pages. How it'll be accessible is up to some debate (as having its naming conflict with an existing object would be a really bad thing). Regardless, there should be something within the browser by the time the Firefox 3 betas wrap-up.

January 31st, 2008

BANK OF MONTREAL NOTICE OF ANNUAL MEETING AND PROXY CIRCULAR AVAILABLE ONLINE

Bank of Montreal has commenced the mailing of its Notice of Annual Meeting of Shareholders and Proxy Circular for its upcoming Shareholders' Meeting. via WebWire

January 30th, 2008

BMO AND CIBC TOP BOSSES REAPED FEWER MILLIONS IN LATEST YEAR

- Senior bank executives suffered pay declines last year, proxy circulars released Wednesday indicate.

At Bank of Montreal (TSX:BMO), CEO Bill Downe got no cash bonus for 2007 after a $1.25-million bonus in 2006, though his base salary advanced to $964,245 from $704,613 and his share and stock-option grants were maintained.

CIBC's (TSX:CM) Gerry McCaughey again received a $1-million base salary, with his 2007 bonus yet to be disclosed but unlikely to match the previous year's total compensation of $9.4 million including share and option grants. Read more

January 30th, 2008

THE CO-OPERATORS PLANS TO SELL ITS OFFICE BUILDING PORTFOLIO

“The methodicalness module goodness from a sharper, more strategic pore on our set businesses of providing shelter and playing services to Canadians”

river shelter consort The Co-operators says it plans to delude its duty antiquity portfolio after a strategic analyse definite concept is not a set business. via CANOE

January 30th, 2008

RHINO ON RAILS: JAVASCRIPT MVC ON THE SERVER

Cross posted from my personal blog

Last week we posted about Jaxer which offers an approach of turtles all the way down where JavaScript is used on the client and the server.

Then, I got to interview Steve Yegge. Last year, Steve posted about Rhino on Rails, his port of Ruby on Rails to the JavaScript language on the Rhino runtime.

Ever since he presented on the ‘Google Rails Clone’ at FooCamp and he posted about the internal Google Rhino on Rails project, people have been curious to learn more.

  • What does it mean to port Rails to JavaScript?
  • What can’t you do since JavaScript doesn’t have the same meta programming facilities?
  • Rails = a group of Active*, so did you re-implement everything?
  • What do you gain out of having JavaScript all the way down?
  • Does it actually make sense to have jjs? Server side JavaScript generating client side JavaScript? Argh!
  • What is the state of Rhino?
  • Will Rhino support JavaScript 2?

And of course, the big questions:

When do I get to see it!

I happen to be in Seattle at the Google offices, so I was able to ask all of these questions and more. Steve was a fantastic host, and I really enjoyed chatting with him.

This is the kind of video I want to explore at Google. We have many great developers working on cool technology. I want to get them on camera, participating with the community when I can. Sometimes we can talk about products and APIs, but sometimes we will talk about fun ideas and projects that we are working on such as Rhino on Rails.

Anyway, give it a watch and let me know what you think:


This also lead me to the fun idea of Java and JavaScript flip-flopping:

January 30th, 2008

DREAMWEAVER USERS REJOICE! SUPPORT FOR JS LIBS NOW AVAILABLE.

Adobe Dreamweaver isn’t know for it’s JavaScript support let alone coding help for the popular JavaScript libraries and frameworks. Up to now, developers and designers who’ve used DW for their client-side work have been left out of the fun of other IDEs such as Eclipse and Komodo . That’s all changed now that to a couple new extensions for Dreamweaver have been built. Chris Charlton, Community Manager for RMI, has created extensions for Dreamweaver versions 6-9 (MX-CS3) that offer support for jQuery 1.2 and Prototype 1.6 development.

The jQuery API extension seems to be the farthest along offering code completion, code hints, code coloring, and a bunch of snippets that early beta users liked. The Prototype API extension only has basic code completion but is due for an update in the next few weeks to offer extended code hints. The code hints appear when editing a JS document and XTND.us has a short video of an extension in use. The demo video and downloads are freely available at http://xtnd.us. We use these tools every day and help train people… it’s time the tools get better.

He’s also planning on incorporating support for other libs and I’m sure would love some support in making this happen. So all you MooTools and YUI developers, get on the horse and help Chris out.

January 30th, 2008

JQUERY VALIDATION PLUGIN V1.2 UPDATED

Jörn Zaefferer went absolutely feature crazy when he decided to update his jQuery Validation plugin. Update is putting it mildly with "overhaul" coming immediately to mind.

Here are some of the cool new features added in:

  • AJAX-captcha validation example (based on http://psyrens.com/captcha/)
  • Support for "remote" ajax-validation. In other words: Remote validation is now possible and very easy to use.
  • Added highlight and unhighlight options, by default toggles errorClass on element, allows custom highlighting
  • Added valid() plugin method for easy programmatic checking of forms and fields without the need to use the validator API
  • Added rules() plguin method to read and write rules for an element (currently read only)
  • Replaced regex for email method, thanks to the contribution by Scott Gonzalez, see http://projects.scottsplayground.com/email_address_validation/
  • Restructured event architecture to rely solely on delegation, both improving performance, and ease-of-use for the developer (requires jquery.delegate.js)
  • Added feature to merge min + max into and range and minlength + maxlength into rangelength
  • Added support for dynamic rule parameters, allowing to specify a function as a parameter eg. for minlength, called when validating the element
  • Allow to specify null or an empty string as a message to display nothing
  • Rules overhaul: Now supports combination of rules-option, metadata, classes (new) and attributes (new), see rules() for details
  • Added remember-the-milk-demo (thanks RTM team for the permission!)
  • Added marketo-demo (thanks Glen Lipka!)

One of the best features of this release is the remote validation via Ajax. This is extremely easy to implement with the code being as simple as this:

LANGUAGE:
    <input id="email" class="required email" remote="emails.php" maxlength="40" name="email" />

If you enter an email address, the validation plugin sends a request to the server with a parameter “email” and the value you entered. The server-side code can do it's magic and send back the appropriate response based on the user input.

Adding client-side validation to a form can significantly improve the usability of that form, making it much easier for users to fill them out successfully. But pure client-side validation has severe limits where necessary information is available only on the server. Ajax helps to bridge the gap, but synchronizing validation on form submit isn’t exactly an easy task. The validation plugin makes it as simple as pure client-side validation. All you need to do is to specify a rule “remote” for a field and provide a parameter that points to a server-side resource that handles the validation.

To see the plugin in action, Jörn has created some demos using styling from Marketo.com and Remember the Milk. You can see some screenshots below.