(옷)장수네 집..

Tuesday, January 30, 2007

test

ddddd

Thursday, January 12, 2006

JAHAH - Cross-Domain JS Library

JAHAH - Cross-Domain JS Library: "With all the recent excitement about cross-domain Javascript, it was perhaps inevitable that libraries would emerge to automate the process. David Janes has produced one such library: JAHAH. The name comes from AHAH, which we posted about earlier.



Amongst its features:

* It is easy for web page authors to include JAHAH documents
* It is easy for content producers to create JAHAH documents
* JAHAH documents can be included “cross-domain”, unlike most AJAX technologies (without bridging)
* JAHAH documents are search engine friendly

The package comes with several Python JAHAH webservices:

* jahah-include — extract the body or a fragment of another document and return it as a JAHAH document
* jahah-feed — convert an RSS/Atom feed into a JAHAH document.

All JAHAH webservices must have a fallback mode into AHAH, making these tools useful in that environment also.

Code usage:



Automatically load by magically marked hyperlinks

... loading…

Load a JAHAH document into a element (by ID)



JAHAH is app"

Logging and Ajax: Beyond alert()'s

Logging and Ajax: Beyond alert()'s: "Eric Spiegelberg has written Log4Ajax , an article with corresponding demo code for logging ajax applications. Eric's article builds upon an earlier, simpler system for logging from Joshua Gitlin's article Errors and Ajax.

It details a logging system in javascript displayed to an in browser console, with the option of sending messages to the server (via ajax) in order to persist them. Eric uses the java based log package log4j on the server side to capture the log messages from the client, but the idea could easily be adapted to whatever sort of server side logging system you want.

He also talks about some possible improvements, like filter levels for client and server and a queue to keep your server from getting hammered by debug messages. An opportunity for some open source development, perhaps (although I didn't see mention of the license terms anywhere).

You can download the code used at the sourceforge project page, and also view a live demo. A simple yet powerful option for your logging when alert() messages won't cut it.

"

J3Unit: javascript testing + jetty and junit

J3Unit: javascript testing + jetty and junit: "
J3Unit is a new OO testing framework for Javascript with optional integration with Jetty and Junit for automation into your test suite. It builds upon the work done with the Script.aculo.us test unit runner and JSUnit.

Of course, you can grab the zip file and just get up and running in static mode. Or take a look at the demo page for how static mode works.

Local browser mode sounds like an alternative to Selenium, or maybe Watir, though the description isn’t quite clear on it:



Local Browser Mode is a JUnit test case DefaultJ3UnitTest that runs both Jetty and Firefox on your local machine. This test case is intended to be included in a larger suite of JUnit tests that the user plans on running directly on his or her machine.

So I’m guessing the idea behind this mode is you can write your test cases in Junit or Javascript, and have a consistent, stand alone run environment with the Jetty+Firefox package. Of course, going with Junit brings with it the possibility of integration with Ant and CruiseControl, as the dojo folks have been doing this for awhile with Jum.

Does anyone know of similiar automation options for Javascript that don’t depend on Ant or Java?

(via Matt, who appears to have trackbacks disabled)
"

Better JavaScript: Objects, Functions, and Constructors

Better JavaScript: Objects, Functions, and Constructors: "My case insensitive namesake, dIon Gillard, has started to put out daily blogs that introduce JavaScript to Java folk that don’t think of it as a real language. dIon agrees with Douglas Crockford’s thought that JavaScript is The World’s Most Misunderstood Programming Language.

So far his blog gets back to basics as he discusses: Introduction Objects Functions Constructors


"

JavaScript Tip: Running code in the dark

JavaScript Tip: Running code in the dark: "At a recent client, we were finding strange behaviour occuring in the JavaScript side of the house.

After taking a look, the problem was namespace collisions.

A couple of the developers were new to JavaScript, and didn’t know about the scoping world.

For example, the classic:


var foo = 'whee';


when placed at the top level of a script, and run in a browser, will actually set a variable on the scope that it is in, which is “window”.

You can simply test this with:


var foo = 'whee';
alert('foo = ' + foo);
alert('window.foo = ' + window.foo);


As such, the project was polluting the window object with everything under the sun, and there were conditions in which clashes occured.

We quickly fixed this with the lovely trick:


(function() {

// do you stuff here!

})();


You can make sure that the namespace is save with another simple example:


(function() {
var foo = 'whee';
alert('inside: ' + foo);
})();

alert('outside: ' + foo); // no var foo!
"

Monday, January 09, 2006

Google RSS Reader: Ajax and Continuations

Google RSS Reader: Ajax and Continuations: "

Niall Kennedy has disected the Google RSS Reader, which gives us a look into how Google does its thing.

Nick Minutello then took this further, looking into the Ajax lens and finding out about how Google uses Ajax and continuations.



So I was mucking around with Niall’s excellent reverse-engineering of the Google Reader, and I figured out that Google have some pretty must have some pretty funky (in a good way) framework to work with client/server interactions from Javascript.

The UI has a feature called the “Lens”, which allows one to scroll through blog posts. Posts are requested 20 at a time (and returned in an the Atom XML format). Once you scroll more than 20, another HTTP request is required. The usual way to do that would be to pass some kind of “start” parameter, but instead the Atom file contains a element which contains a unique ID (think of it as a session ID).


This id can be passed to the Google feed URL endpoint, and it will return the next 20 elements starting from where you left off.

E.g.: request: GET /reader/atom/feed/http%3A%2F%2Fdel.icio.us%2Frss%2Fpopular%2F response: COT3ruq0jYIC request: GET /reader/atom/feed/http%3A%2F%2Fdel.icio.us%2Frs"