nextwebgen.com

The Next Generation Web Now

The Importance of Maintainable JavaScript

Filed under: Front Page,JavaScript,Programming,Web 2.0 News — Chris Cornutt at 7:48 pm on Monday, July 17, 2006

There are three levels of Javascript programming that developers should go through:

  • beginning programming with popups and roll-overs everywhere
  • advanced Javascript coding with site-enhancing functionality and loads of bells and whistles
  • writing maintainable Javascript

That last one throw you for a loop a bit? Well, read on…

It’s one thing to develop code that runs well and that does the job, but without structure and formating as a practice in your development, things can get pretty scary pretty quick. Even this new article from Vitamin reinforces the fact.

Forums and mailing lists are full of requests about Ajax, DOM Scripting and how to use this or that library or effect. There is also an extraordinary amount of scripts, libraries and effects being developed and showcased, and the blogs and news sites specialising in scripting hardly have time to look at the demos properly before they are on Digg.com or del.icio.us and making the rounds from these sites.

Times to celebrate for those who have hung on to their skills when the DHTML craze subsided in 2001 and JavaScript became persona non grata on your CV as a main skill.

They talk about not only some of the benefits of having well-maintained scripts (making the user’s life easier), but some techniques to help you keep things neat in your own work. They make suggestions like “Keep your syntax and structure clean and logical”, “Seperate textual content and code” and “Comment your code” (funny how that last one pops up so often, eh?)

All in all, they give you eight different tips on how to “keep it clean” when it comes to creating code, all with descriptions/explainations and code examples where appropriate.

AJAX pagination made simple (with Symfony)

Filed under: Front Page,PHP,Programming,Web 2.0 News — Chris Cornutt at 8:46 am on Monday, July 17, 2006

Users of the PHP framework symfony are no strangers to easy-to-use functionality, and in this new post on the symfony blog, they share yet another - an Ajax pagination method.

Paginated lists in web pages imply specific controls to navigate across pages (link to previous and next page, link to a specific page, etc.). And lists are paginated because they are often too big to load. But when AJAX comes in, this last constraint disappears, and the specific controls can easily be replaced by a more intuitive tool: The browser’s scroll bar.

They include both an image/demo with an example of how the functionality works as well as (of course) the PHP code to make it all happen.

Integration of Spry and PHP/MySQL

Filed under: Framework,Front Page,PHP,Programming,Web 2.0 News — Chris Cornutt at 7:51 am on Thursday, July 13, 2006

Mike Kornienko writes in this new blog entry about his experiences (complete with code) integrating the Spry Ajax framework into a simple PHP/MySQL application he develops:

Adobe have recently released its Spry Ajax framework for public beta-test by developers and I’ve been playing with this baby for a while. And here’s some kind of report of what I have learned.

He gives several examples of the integration in his post, including the PHP to make some basic XML for Spry to use. His base-level Spry example grabs this data and just echoes it back out to the page via an HTML form. Before finishing it off with the full HTML/Javascript code, though, he shows how to sort by a specific column in the data (in this case, the ID column).

Ajax as a Remedy for the Cacheability-Personalization Dilemma

Filed under: Front Page,Programming,Usability,Web 2.0 News — Chris Cornutt at 7:41 am on Thursday, July 13, 2006

In his latest post from his blog today, Michael Mahemoff looks at a dilema that faces many an Ajax-enabled site out there trying to keep things lively and fresh - how can you personalize content *and* make the pages cacheable and bookmarkable?

Making it happen is actually somewhat simple, but there are a few things to consider first. The pages need to stick with clean URLs (it makes search engines happy), the pages need to be different for each user, and personalized URLs should still be consistent (to aid in sharing/usability).

The solution?

Create pages generically (same version for all users), and in this generic version, embed a remoting call which will customize the page for the current user. Serve http://example.com/fightclub to everyone. Then everyone’s browser makes a further call to grab custom content (Multi-Stage Download).

Check out the full post for complete details.

J2EE and AJAX: AJAX with Servlets

Filed under: Front Page,Java,Programming,Web 2.0 News — Chris Cornutt at 4:07 pm on Wednesday, July 12, 2006

The use of J2EE in development work has been growing at a staggering pace over the last few years. Developers are finding its environment and capaitilities to be just what they need. One thing that it’s missing though, is a good method to interact with the user. Sure, there are the usual web interaction methods, but why use those when you can incorporate Ajax into your application? Not sure how? Check out this new tutorial from DevArticles for the full scoop on using Ajax either client-side or as a servlet at server-side.

AJAX provides asynchronous communication service through JavaScript and XML. Thus a good combination can be formed by using AJAX at client-side and a servlet at server-side, providing a non-obtrusive, responsive and highly interactive web experience.

In this discussion, I will focus on utilizing such a winning combination. The first sections will detail the steps required for setting up an application for utilizing AJAX along with a servlet. In the last section I will develop a registration module that will use AJAX to check the availability of the username.

They start off with the basics - how to set up the XMLHttpRequest object and create an interface to pass the information to it. Next up is handling the state change of the object (when something, anything happens) and the generation of the XML response. Finally, they thie things together into a chunk of code that can send a message and retrieve the results from the request.

A Basic Approach to Server-side Data Validation with AJAX

Filed under: Front Page,JavaScript,Programming,Web 2.0 News — Chris Cornutt at 8:03 am on Wednesday, July 12, 2006

Input validation can be one of the biggest hurdles in a web application (besides being one of the most important). As much as we as developers hate to think about it, there will be users out there that try to stretch the limits of the app, finding the weak spots. Don't let input validation be yours - always check what the user gives you. How, you ask? Well, that's what this new article from DevArticles.com is for.

Would you like to learn how to validate user-supplied data using JavaScript, but without the risks? This article will show you how to handle it in a way that takes advantage of JavaScript's pluses, but adds a level of safety, thanks to AJAX. It is the first of three parts.

This validation mechanism can be developed bearing in mind specific conditions where JavaScript has been disabled by the client, while still maintaining its full validation capabilities on the server. Indeed, this approach can be quite useful for constructing richer Web applications, and that's precisely what I'm going to do in the next few lines: build an AJAX-driven form validation application, which will use PHP for validating data on the server.

They start building their sample application with the interface - a simple form. Since a basic form is a bit of an eyesore, they also use a little bit of CSS to help clean it up a bit. They combine them both to make the sample interface (complete with code/HTML). There's no Javascript or validation in this part of the series, but this does lay down the groundwork for the future editions as they get more and more advanced.

Go forth and API

Filed under: Front Page,Programming,Web 2.0 News,XmlHttpRequest — Chris Cornutt at 9:28 am on Tuesday, July 11, 2006

Backend scripts aren’t the only way to access the wealth of valuable web services out there. Anyone that’s done any playing around with Ajax can see the possibilities of combining the two - accessing the APIs directly from your client-side application. In this brief tutorial from ThinkVitamin.com, they follow this course and give you a simple example to get the ball rolling.

To most, the virtues of Web 2.0 are rather ephemeral; that’s always been one of its main criticisms. However, I like to think that one of the movement’s key aspects is a sense of community, an ability to create sites and applications that bring people together.

Even Web APIs aren’t a new idea. Google’s search API has been available via SOAP since 2002, and there’s definitely older services than that. However, the recent growth in Web API availability has been fuelled by two recent developments. The first, which I’ve already mentioned, was a philosophical change in the way that data is handled. The second was the introduction of AJAX. Again, not a new idea, or even a new technology, but sometimes it’s all about timing.

They mention several of the different APIs out there (including Flickr, Google Maps, and Amazon) as well as some of the mashups that take advantage of the merging of these APIs. To illustrate the point of the simplicity of these interfaces, they include a code example of connecting to the Flickr API to grab photo information. There’s also a bit on proxying your XMLHttpRequests and a brief look at using JSON to communitcate with the APIs that support it.

Safari gets a Javascript debugger

Filed under: Front Page,JavaScript,Programming,Safari,Toolkit,Web 2.0 News — Rob Sanheim at 11:16 am on Wednesday, June 28, 2006

Its about time - Webkit - the development version of Safari, has gotten a real javascript debugger. Its called Drosera, and the Surfin Safari blog has the announcement. Or you can just download the latest nightly of Webkit and go. Its interesting to note that this and the Web Inspector tool for Safari are about 90% plain HTML and Javascript. Hows that for a something that isn’t even a “real programming language”?

Drosera javascript debugger for Safari

« Previous PageNext Page »