Archive for the ‘AJAX’ Category

Sometimes Google scares me:

What is Google’s Lighthouse? by ZDNet’s Richard MacManus — The Google Analyst Day earlier this week threw up a conspiracy theory of sorts, Is it a security function, or a next-generation search for desktop files? Or… with Google initially providing a powerpoint file of the presentation that had extensive notes about upcoming products named as: GDrive, GDS and Lighthouse. Greg Linden was one [...]

I nearly got played today. Slashdot DID get played today.

Basically, Chris McEvoy took this and substituted “Frames” with AJAX. I believe Chris was trying to make a point with the article, but it’s mostly untrue.

There are several ways to get around the navigation and usability issues that CAN crop up in AJAX applications when you don’t reload the page or assign unique URLs. On his blog, Chris complains about the usability issues with Microsoft’s Windows Live AJAX project, and it’s a valid complaint.

The problem is, joke or not, this is leading people to believe there’s no way to fix those problems, when there are several ways out there.

Ahwell. If people are suckered in, I guess it’s their own fault.

AJAX RSS Aggregator

August 26th, 2005 No Comments

For those of who have any idea what RSS is, this is neat! For those who don’t, well.. I can attempt to explain.

RSS is a protocol for extracting “news” from a particular source using a language called XML (eXtensible Markup Language). XML is very similar to HTML, in the sense that it “describes” the data. It doesn’t, however, have any means of making the text appear different.

Anyways, an RSS aggregator is a program that will hit the RSS “feed” of several websites, and pull it up into a single page to view. Slashdot is, essentially, a news aggregator, and has several RSS feeds you can choose from. You can do all sorts of neat things with RSS feeds, as they’re written in XML, which the newer “HTML” is based upon. You can easily convert it into a block of HTML and have it spit back out as part of a web page. It’s how I got the posts from BEFORE I set up this weblog (from truth.mygamefactory.org) to appear in the blog. It pulled the information using RSS from the Truth website.

What happens when you combine this with AJAX? Well, it may not seem like a lot, but it allows for some really neat things. AJAX, as you may or may not know, allows a webpage to be a “gateway” to server-side instructions, but without reloading the page. That is, it gets around the “stateless” limitation on HTTP, and allows you to click a checkbox, and bam! A whole new page appears. Basically, what this aggregator does, is it keeps all of the actual operations of checking the news sites, database interaction and the like “behind” the page you’re cliking on. This means the view pane just adjusts when you click on a different site or article, retrieving the information directly. What’s REALLY cool about this takes some thinking to wrap my head around: I can read all the web-pages I like that support RSS all from one place. If there’s something new posted to the site, I’ll see it in the RSS feed almost immediately. I can then play around with how it looks and never have to worry about that site’s clunky or difficult to navigate interface again! I still read their content, and they know it, but I can instead enjoy the experience how I want to enjoy it.

Django and You

August 25th, 2005 2 Comments

Today I spent several (read: about 4) hours working with and toying with a neat little web application framework called Django. It’s very much like working with Ruby on Rails, but a little bit more intuitive.

The downside is the documentation is only slightly poorer than Ruby on Rails’ documentation, which is to say, not very good. The tutorial helped quite a bit with the basics, but even that does not work “out of the box“.

I’ll keep working on it, as I’m interested to see if I can whip up an AJAX implementation for it, making data entry web applications easy to put together.

That’s right, in a matter of a few hours, I can build you a character database, fanboy!

My first AJAX

August 24th, 2005 No Comments

Well, I’ve created my first AJAX application (with a few bits of help from formassembly.com), and it works beautifully. I can’t wait until WordPress starts implementing it. That would make for some interesting ways to extend it, that’s for certain.

Hmm…

AJAX Work

August 24th, 2005 No Comments

So I’ve been reading up on the various AJAX kits out there, and so far it looks like CPAINT is probably the most stable and tested one out there. It has both an ASP and a PHP version, meaning I can use it for both sides of the fence in web development.

According to the manual (that you can find faster in the distribution than you can on their website), it’s as simple as:

<?php
require_once(”cpaint v2/cpaint.inc.php”);
$cp = new cpaint():
$cp->register(’calculate_tax’);
$cp->start();
$cp->return_data();
function calculate_tax($sales_amount) {
global $cp;
$cp->set_data($sales_amount * 0.075);
}
?>

Assuming the input on the web form was “1″, this would return an XML response of:

<ajaxresponse>1.075</ajaxresponse>

What does this mean to you, the average reader? Not much, I suppose, unless you’re a PHP programmer and know even a little bit about XML. This XML is returned to the JavaScript running in the web browser, meaning you can click that “calculate” button, and it will NOT load a new page, but will instead execute the PHP function on the backend, and use the results to change something on the form - in this case, the “Tax” amount.

Why not reload the page and have it transmit the information that way? Well, the main two reasons for using AJAX is control and ease of use of the final product. If the buttons all change things instantly (or nearly so) on a web page, wouldn’t you rather that, than wait on the page to reload each time you clicked it?

This could be really useful for shopping cart applications, database interfaces, workflow managers, and can be even used to create javascript-based operating system! There’s even a potential for real-time chat and content management interfaces with a website, so that you can chat with your colleague(s) about what needs to be changed, AS you change it with the content manager’s AJAX interface.

More advanced PHP programmers might ask, “How do I calculate or pass multiple values to the JavaScript?” The answer is provided a little later in the CPAINT documentation. Instead of creating an array, you would create objects that represent XML data nodes, then add the data to the nodes. This will result in an XML return with multiple values, allowing the DOM walker to pick up all the necessary information. Here’s the example from their documentation:

<?php
require_once(”cpaint v2/cpaint.inc.php”);
$cp = new cpaint():
$cp->register(’multi_calc’);
$cp->start();
$cp->return_data();
function multi_calc($num1, $num2) {
global $cp;
$add_result = $num1 + $num2;
$subtr_result = $num1 - $num2;
$multi_result = $num1 * $num2;
$div_result = $num1 / $num2;
$add_result_node =& $cp->add_node(”add”);
$subtr_result_node =& $cp->add_node(”subtr”);
$multi_result_node =& $cp->add_node(”multi”);
$div_result_node =& $cp->add_node(”div”);
$add_result_node->set_data($add_result);
$subtr_result_node->set_data($subtr_result);
$multi_result_node->set_data($multi_result);
$div_result_node->set_data($div_result):
}
?>

This might return:

<ajaxResult>
<add>6</add>
<subtr>-2</subtr>
<multi>8</multi>
<div>0.5</div>
</ajaxResult>

First, I’ll apologize for the ugliness of that code - WordPress insists it creates proper XHTML, yet decides to close the paragraph WITHIN the code block, breaking the page in most browsers.

Second, I cannot express how simple that code is, and how much work it REALLY does. It creates several objects, and generates an XML response based on those objects. You can have a completely static-looking webform that will validate the information in a language you know (PHP), and pass along any errors in an XML context, so that the JavaScript can display those errors on the page. That means, no annoying pop-up dialog saying “Please enter a valid email address” or somesuch.

A really cool thing is that, in theory, CPAINT can handle binary data. That is, you could create a backend script that generates an image, on the fly, and returns it via XML. Even better - you could, in theory, create an entirely web-based SVG application that allows the user to create vector graphics, effectively on the fly, all the while storing every stroke, object and parameter into a database behind the backend. A useful application of this might be an “avatar” creator that allows the user to change aspects of the image without reloading the page. A user would click on “add mustache” and the image is reloaded, without reloading the page, mustache added.

That’s all for now, I’ll probably write more a little later.

The Form Assembly

August 23rd, 2005 No Comments

:mrgreen:

I’m a geek, and I like new toys. The Form Assembly is a suite of toys designed to simplify web form creation and to make the actual submission of form data as seamless as possible.

It does this by using AJAX, or Asynchronous JavaScript and XML.

AJAX lets a programmer or web developer turn a web page (and just a SINGLE web page) into a fully-functional application. A good example of AJAX and how it works is GMail. If you’re on a modern and supported browser, you’ll notice that interactivity throughout most of GMail doesn’t load a new page, but instead does things like create a reply box with just a click. That’s AJAX at work.

AJAX can also be used as a data-entry tool. That is, you can have the “next” button on a form just display another piece of the form on the same page, while the backend behind the site is happily saving the information from the first form to a database.