Bookmark This Page    
   What Is Fwicki?   Login   Sign Up   Search Feeds   Custom Fwickis        
    
AJAX programming information AJAX

Asynchronous JavaScript and XML.
 

AJAX - The Cool Intermediary:

The AJAX engine works within the Web browser (through JavaScript and the DOM) to render the Web application and handle any requests that the customer might have of the Web server. The beauty of it is this: because the AJAX engine is handling the requests, it can hold most information in the engine itself, while allowing the interaction with the application and the customer to happen asynchronously and independently of any interaction with the server.

Asynchronous:

This is the key. In standard Web applications, the interaction between the customer and the server is synchronous. This means that one has to happen after the other. If a customer clicks a link, the request is sent to the server, which then sends the results back. With AJAX, the JavaScript that is loaded when the page loads handles most of the basic tasks such as data validation and manipulation, as well as display rendering the AJAX engine handles without a trip to the server. At the same time that it is making display changes for the customer, it is sending data back and forth to the server. But the data transfer is not dependent upon actions of the customer.

AJAX techniques use a combination of the following:

  • XHTML (or HTML) and CSS, for marking up and styling information.
  • The DOM accessed with a client-side scripting language, especially ECMAScript implementations such as JavaScript and JScript, to dynamically display and interact with the information presented.
  • The XMLHttpRequest object is used to exchange data asynchronously with the web server. In some AJAX frameworks and in certain situations, an IFrame object is used instead of the XMLHttpRequest object to exchange data with the web server, and in other implementations, dynamically added script tags may be used.
  • XML is sometimes used as the format for transferring data between the server and client, although any format will work, including preformatted HTML, plain text, JSON and even EBML. These files may be created dynamically by some form of server-side scripting.

Like DHTML, LAMP and SPA, AJAX is not a technology in itself, but a term that refers to the use of a group of technologies. The "core" and defining element of AJAX is the XMLHttpRequest object, which gives browsers the ability to make dynamic and asynchronous data requests without having to unload and reload a page. Given XMLHttpRequest can eliminate the need for page refreshes, other technologies become more prominently used and highlighted with this development approach.

When XMLHttpRequest is used, extensive use of the DOM, CSS and other JavaScript techniques become more important and are used in conjunction to provide a more-enhanced "single-page" experience. While technically not AJAX themselves, these other technologies are generally lumped in with the term because of their relation to the overall user experience when combined with XMLHttpRequest.

Historically AJAX:

Although the term AJAX was coined in 2005, most of the technologies that enable AJAX started a decade earlier with Microsoft's initiatives in developing Remote Scripting. Netscape Evangelism published an article in 2003 referred as Inner-Browsing presenting the paradigm shift for Web page navigation and implementation techniques. Techniques for the asynchronous loading of content on an existing Web page without requiring a full reload date back as far as the IFRAME element type (introduced in Internet Explorer 3 in 1996) and the LAYER element type (introduced in Netscape 4 in 1997, abandoned during early development of Mozilla). Both element types had a "src" attribute that could take any external URL, and by loading a page containing JavaScript that manipulated the parent page, AJAX-like effects could be attained. This set of client-side technologies was usually grouped together under the generic term of DHTML. Macromedia's Flash could also, from version 4, load XML and CSV files from a remote server without requiring a browser being refreshed.

Microsoft's Remote Scripting (MSRS), introduced in 1998, acted as a more elegant replacement for these techniques, with data being pulled in by a Java applet with which the client side could communicate using JavaScript. This technique worked on both Internet Explorer version 4 and Netscape Navigator version 4 onwards. Microsoft then created the XMLHttpRequest object in Internet Explorer version 5 and first took advantage of these techniques using XMLHttpRequest in Outlook Web Access supplied with the Microsoft Exchange Server 2000 release.

The Web development community, first collaborating via the microsoft.public.scripting.remote newsgroup and later through blog aggregation, subsequently developed a range of techniques for remote scripting to enable consistent results across different browsers. In 2002, a user-community modification to Microsoft Remote Scripting was made to replace the Java applet with XMLHttpRequest.

Remote Scripting Frameworks such as ARSCIF surfaced in 2003 not long before Microsoft introduced Callbacks in ASP.NET. In addition, the World Wide Web Consortium has several Recommendations that also allow for dynamic communication between a server and user agent, though few of them are well supported. These would include:

  • The object element defined in HTML 4 for embedding arbitrary content types into documents, (replaces inline frames under XHTML 1.1)
  • The Document Object Model (DOM) Level 3 Load and Save Specification
 
 

AJAX
Created By, Programming
[Valid RSS]
Report Invalid Feed or Terms of Service Violations

XML / RSS Feed: AJAX
Copyright: Copyright ©2008 Fwicki.Com. All rights reserved.
Description: It is reported that the first use of the term in public was by Jesse James Garrett in February 2005. Garrett thought of the term when he realized the need for a shorthand term to represent the suite of technologies he was proposing to a client. Whatever the origins of the acronym, it is clear that AJAX is one of the hottest and most talked about technologies among leading programmers.
Tags: AJAX
You must login to tag this feed.  Login


Web 2.0 Marketing Tips, Using Myspace, Youtube, Squido www.MakeMoneyOnYouTube.net...
Sat, 27 Sep 2008 01:41:57 GMT     Digg! Bookmark This Page


http://www.MakeMoneyOnYouTube.net Use the power of (Web2.0) to market your business and explode sales trough the roof..Web2.0 is growing day by day, we make it grow, we create it we explode it... web 2.0 marketing tips, marketing tips, tips marketing web 2.0 expo 2007 web 2.0 designs web 2.0 blog web 2.0 explorer web 2.0 personal edition web 2.0 applications web 2.0 ajax web 2.0 templates web 2.0 definition leadership leadership quotes leadership qualities leadership styles leader marketing tips internet marketing tips email marketing tips free marketing tips business marketing tips online marketing tips affiliate marketing tips tips on marketing network marketing tips tips for marketing small business marketing tips real estate marketing tips website marketing tips mortgage marketing tips web marketing tips sales and marketing tips direct marketing tips direct mail marketing tips restaurant marketing tips marketing tips com music marketing tips holiday marketing tips insurance marketing tips search engine marketing tips best marketing tips guerilla marketing tips marketing tips for real estate viral marketing tips marketing tips for small business marketing interview tips marketing tips for realtors book marketing tips retail marketing tips mail marketing tips postcard marketing tips loan officer marketing tips marketing tips for small businesses sales marketing tips free internet marketing tips massage marketing tips marketing tips and tricks marketing promotion tips marketing promotion tips articles chiropractic marketing tips e mail marketing tips successful marketing tips search marketing tips museum marketing tips guerrilla marketing tips realtor marketing tips e marketing tips tips for email marketing salon marketing tips 10 marketing tips product marketing tips affiliate marketing program tips mortgage broker marketing tips marketing tips for real estate agents web site marketing tips art marketing tips top ten marketing tips internet affiliate marketing tips lawyer marketing tips free online marketing tips real estate agent marketing tips marketing plan tips marketing tips and ideas ebay marketing tips tips to marketing cheap marketing tips marketing career tips construction marketing tips marketing tips newsletter tips for viral marketing top 10 marketing tips yahoo search marketing tips site marketing tips blog marketing tips mlm marketing tips marketing and advertising tips top marketing tips apartment marketing tips marketing writing tips training marketing tips creative marketing tips marketing research tips software marketing tips marketing tips for mortgage brokers hypnosis marketing tips free mortgage marketing tips top tips for email marketing 101 marketing tips effective marketing tips marketing tips for loan officers sales & marketing tips easy marketing tips marketing tips for financial planners international marketing tips law firm marketing tips catalog marketing tips sports marketing tips tips on email marketing tips on network marketing marketing strategies tips photography marketing tips women rainmakers best marketing tips interview tips for marketing telemarketing tips store marketing tips broker marketing tips agent marketing tips firm marketing tips marketing tips from tips for marketing jobs marketing tips and strategies tips on internet marketing (get altitude) Category: Howto & Style MLM web2.0 free leads gold mine Eben Pegan pagan getaltituted altitude Marketing Tips youtube myspace Free Goldmine

Reflections from a TiddlyWiki Tiddler and Thoughts on a Guide for Web App Development with TiddlyWiki...
Tue, 23 Sep 2008 23:18:11 GMT     Digg! Bookmark This Page

I’ve recently begun working on a project with Osmosoft, which I’ll announce Real Soon Now, and have got my hands dirty with TiddlyWiki to the point where I’m now able to make at least some useful functionality. You effectively get an MVC framework for free with TiddlyWiki, so as a power developer, I can see how it could let you build a certain type of app quite rapidly. Even without too much knowledge, you could use it for prototyping quite easily, just by knowing the key extension points. I figured it would be worth capturing my reflections to date.

There’s a lot of documentation around on TiddlyWiki, and also some good support resources in the form of Groups and IRC. What I’d like to see in addition to that is a guide for people writing “verticals” - web apps building on TiddlyWiki, rather than incremental enhancements. And also it would be good to see a cookbook or pattern collection covering the main types of plugins.

The other issue I’ve had, while I’m brain-dumping, is that plugin exceptions are caught at some point, with an error message shown, and not propagated, so they don’t turn up in Firebug. I need to look into this more as I think there are ways to get better diagnostics. I would also like to get a better understanding of the startup and shutdown lifecycle. As explained in my last post, there are some techniques you can use to hook in at certain stages, though no direct support.

I’ll have an initial stab here at the kind of thing I’d like to see in a developer guide, and refine it massively at a time when I’m less of a green Tiddler, maybe on a wiki. I’m really not qualified to say too much at this stage, but I want to capture it while it’s fresh on my mind. Note there’s already a lot of good material along these lines on the TiddlyWiki wiki.

Development Process

The simplest way to work is directly inside the TiddlyWiki. Locate shadow tiddlers under the “more” tab and edit them. And create new tiddlers, tag them as “systemConfig”, and stick your plugin code inside them. Each time you change it, hit reload. That’s a nice, simple, way to start off.

For serious development, there are better options. (Which I’m about to start learning.)

Extending TiddlyWiki into a Custom Web App

The way to extend TiddlyWiki is not to take a TiddlyWiki and start hacking the source. You can do anything you want to do via the following techniques:

  • Edit Shadow Tiddlers Shadow tiddlers are special tiddlers used to configure the TiddlyWiki. When you open a shadow tiddler and edit it, it saves as a regular tiddler. The original shadow tiddler remains, mainly as a safeguard, but becomes irrelevant. (I mention this because you might think there’s a cascading effect, where the regular tiddler is run before or after the shadow. In fact, the regular tiddler simply replaces its shadow from the perspective of configuration.
  • Make Plugins A plugin is a tiddler tagged “systemConfig” and containing some code. The code will be executed when the wiki loads, since TiddlyWiki’s built-in startup sequence looks for tiddlers marked SystemConfig and executes their content.
  • Include Plugins Include plugins from elsewhere if they are useful. You import a plugin via the PluginManager tool, accessible from Backstage. Or by cutting-and-pasting into a new “systemConfig” tiddler.
  • Change Options Options such as Auto-Save also affect your application’s behaviour. You can set them programatically using config.options at startup. Alternatively, if you have retained the options control in the sidebar, set options there and save the page.

In addition, you may find you need more than one TiddlyWiki file to build up your web app. You might end up with a separate file for each key functional area. (I haven’t seen this done, but a guide could explain how to pull in plugins and tiddlers from a common place. Possibly building on TiddlyWeb.)

Which Shadow Tiddlers to Customise?

Here’s a list of shadow tiddlers you might want to customise for your app:

  • SiteTitle - the contents of this tiddler are used in the header. This is an example of an uber-simple shadow tiddler. When you begin to build a vertical, you will want a header that reflects the name of your app. Similarly, you can set SiteSubtitle and SiteURL tiddlers.
  • StyleSheet - the “StyleSheet” tiddlers lets you add some CSS rules to enhance or redefine the existing CSS based look and feel. This is a slightly more complex form of appearance customisation than the previous point. You probably don’t want your app to look like a carbon copy of the original TiddlyWiki, so use these tiddlers to theme it. There are some other style-related tiddlers, like StyleSheetColors and StyleSheetLayout, but it’s not recommended that you change them, because if you ever upgrade the TiddlyWiki core, any new styling will be ignored. So if there are things you want to change in those tiddlers, just create the CSS rule inside StyleSheet and it will take precedence. There is also a ColorPallette tiddler referenced by StyleSheetColors, which you *can* modify safely, and it lets you change the color scheme. In general, you won’t need to override StyleSheetColors directly - ColorPallette should be sufficient.
  • PageTemplate - the HTML for the entire page. An even more complex way to customise your app, by changing the raw page structure. Note the way this tiddler “pulls in” content other tiddlers. You can therefore change the appearance not just by changing PageTemplate, but by changing those included tiddlers. We’ve already met a couple of them - SiteTitle and SiteSubtitle - which simply contain a word or few in most cases. Others you’ll noticed here are MainMenu and Sidebar to reflect further options which are always present in your app.
  • DefaultTiddlers - a list of the initial tiddlers that show up when the page is loaded. In a web app, this would typically be a blurb, maybe embedding a video or image, and links to other tiddlers. The kind of thing you’d see in any web app, really. In this sense, TiddlyWiki provides you with a basic, customisable, layout scheme.
  • etc.

What Kind of Plugins to Create?

Here are some examples of plugin styles:

  • Macro - Your plugin defines a macro. Users include the macro as <<macroname>> inside a tiddler, and your macro is invoked, and it typically spits out some content. You can easily make your macro apply inside all tiddlers by including it in ViewTemplate.
  • Hijacking (aka Monkey Patching) - changing the behaviour of some code that’s already in the application - either core TiddlyWiki code or another plugin you’ve imported. (Could expand this with specific things that are changed)
  • Startup behaviour - Some code executed on startup.

Architectural Principles

  • Reuse - where a plugin already exists, don’t reinvent the wheel. Reuse it. Likewise for core TiddlyWiki components. If possible, hijack (aka monkey patch) to extend it rather than directly hacking it. (Open-Close Principle).
  • Modularity - Plugins build on each other. Don’t write a single “big bang” plugin for your entire app. Break things down into logical units.
  • Flexibility - keep the app open to further customisation from users. For example:
    • Content inside special tiddlers - Instead of hard-coding values, consider pulling them in from special Tiddlers, just like the way SiteTitle and SiteSubtitle shadow tiddlers are used. This way, a power user could easily change the value by modifying the tiddler. If it’s content to be included somewhere, you would usually want to run wikify(tiddler.text) against the tiddler content, so the user can include TiddlyWiki markup. A useful concept here is “slices” - this mechanism lets you include content from just part of a tiddler, not the whole thing. See how StyleSheetColors uses ColorPallette for an example.
    • Javascript inside special tiddlers - Most apps have critical algorithms which power users - if sufficiently authorised - might like to update (”strategy pattern” type modules). Isolate such code into special tiddlers, so someone can change those critical parts of your code without having to dive into the whole thing. If your core code has the right functions available, the tiddler content might be a kind of internal domain-specific language.
    • Favour macros over plugins which just charge in and change stuff. For example, if you were writing a comments plugin. The brute force approach would be to bolt on a comments area to every tiddler. But you could achieve the same thing by creating a comments macro, and then updating ViewTemplate to run the macro (ie adding < > to ViewTemplate). Power users could then have more flexibility in several ways: (a) they could remove comments or alter where they appear; (b) they could use a plugin like TaggedTemplateTweak to ensure comments only appear for certain tiddlers; (c) they could customise the way comments are handled using parameters to the comments tag (assuming your macro accepted parameters).

Key Classes and Functions

Here’s a guide to the most important classes ( (More complete guide on TiddlyWiki internals).):

  • Tiddler - the data model for a single tiddler - its title (tiddler.title), content (tiddler.text), last modifier, etc.
  • TiddlyWiki (~aka “store”) - a collection of tiddlers. Typically, there is just one TiddlyWiki on the page containing all Tiddlers, called “store”. Due to certain hard-codedness, it’s not worth creating a separate TiddlyWiki - just use “store” to create, retrieve, update, and delete Tiddlers (the “CRUD” functions).
  • Story (~aka “story”) - a view showing zero or more tiddlers. The main display area you see on the standard TiddlyWiki page is a Story called “story”. So use “story” to add and remove tiddlers being viewed.
  • (possibly others)
  • window - for completeness sake, I’ll note that there are certain “global” (i.e. window) functions worth knowing about.

Let’s look at how those classes give our web app a model and view.

First, the model. How is CRUD handled?

Tiddlers are the atomic model unit in TiddlyWiki. You can inspect the contents using tiddler attributes:

  • tiddler.title, tiddler.text, tiddler.fields, tiddler