background preloader

Developing Backbone.js Applications -

Developing Backbone.js Applications -
By Addy Osmani (@addyosmani) Available free for open-source reading below or for purchase via the O'Reilly store. Pull requests and comments always welcome. Prelude Not so long ago, “data-rich web application” was an oxymoron. Today, these applications are everywhere and you need to know how to build them. Traditionally, web applications left the heavy-lifting of data to servers that pushed HTML to the browser in complete page loads. Think of the Ajax shopping cart which doesn’t require a refresh on the page when adding an item to your basket. The rise of arbitrary code on the client-side which can talk to the server however it sees fit has meant an increase in client-side complexity. Thankfully, there are a growing number of JavaScript libraries that can help improve the structure and maintainability of your code, making it easier to build ambitious interfaces without a great deal of effort. Target Audience Acknowledgements Credits Target Version Reading What Is MVC? What is Backbone.js? <! Views

Upgrading to RequireJS 2.0 · jrburke/requirejs Wiki Why There has been a good deal real world usage of requirejs, and there were some features around configuration that have come up that would be nice to add. At the same time, there were some configuration options and internal features that have not held their weight, and it would be good to remove them. Support for the AMD APIs has not changed. If anything, I am hoping that the AMD loader implementers are starting to agree on higher level APIs, like common config.

jQuery Validation Plugin "But doesn't jQuery make it easy to write your own validation plugin?" Sure, but there are still a lot of subtleties to take care of: You need a standard library of validation methods (such as emails, URLs, credit card numbers). You need to place error messages in the DOM and show and hide them when appropriate. You want to react to more than just a submit event, like keyup and blur. Spring security 3 Ajax login – accessing protected resources I have seen some blogs about Spring Security 3 Ajax login, however I could not find any that tackles how to invoke Ajax based login, where a protected resource is being accessed in Ajax by an anonymous user. The problem – The web application enables anonymous access to certain parts and certain parts are protected resources which require the user to login. When an anonymous user accesses protected resources (via Http Get / Post), Spring Security automatically invokes the login page and after a successful authentication, redirects to the required resource/page. However, if the protected resource is being accessed in Ajax, the login page will not appear correctly (will be set on part of the page).

Writing efficient CSS selectors 17 September, 2011 Efficient CSS is not a new topic, nor one that I really need to cover, but it’s something I’m really interested in and have been keeping an eye on more and more since working at Sky. A lot of people forget, or simply don’t realise, that CSS can be both performant and non-performant. This can be easily forgiven however when you realise just how little you can, err, realise, non-performant CSS. These rules only really apply to high performance websites where speed is a feature, and 1000s of DOM elements can appear on any given page.

Hello Backbone.js Tutorial Shameless advertisement: Don't forget to check out Agility.js, a simpler alternative to Backbone.js. Hello Backbone is a simple Backbone.js tutorial comprised of self-explanatory "hello world" examples of increasing complexity. It was designed to provide a smoother transition from zero to the popular Todos example. Backbone.js offers a lean MVC framework for organizing your Javascript application. It leads to more maintainable code by untangling the "spaghetti" of callbacks tied to different parts of the DOM and the backend server that often arises in rich client-side applications.

Part 1: Backbone.js + Require.js This article provides a brief introduction to JavaScript AMD and MVC technologies. It then details a working example of modularizing the Backbone.js 101 tutorial, “Todos” by Jérôme Gravel-Niquet, using Require.js. The article assumes basic familiarity with the aforementioned libraries, concepts, and example. This will be part one of a four part series. If you already know the basics or would like to dispense with the pleasantries then skip ahead to Let’s Get Started. JavaScript - Errors & Exceptions Handling Advertisements There are three types of errors in programming: (a) Syntax Errors and (b) Runtime Errors (c) Logical Errors: Syntax errors, also called parsing errors, occur at compile time for traditional programming languages and at interpret time for JavaScript. For example, the following line causes a syntax error because it is missing a closing parenthesis: When a syntax error occurs in JavaScript, only the code contained within the same thread as the syntax error is affected and code in other threads gets executed assuming nothing in them depends on the code containing the error.

Hibernate Annotations First, set up your classpath (after you have created a new project in your favorite IDE): Alternatively, import your pom.xml in your favorite IDE and let the dependencies be resolved automatically, We recommend you use Hibernate Validator and the Bean Validation specification capabilities as its integration with Java Persistence 2 has been standardized.