web 2.0
Rockets RPC Demo
Introducing Rockets RPC
What is Rockets RPC?
It is a simple library that makes it to create web services. It allows you to share revolution handlers with web-savvy application. Most web application involves calling a server side component and using the output from that call somewhere, instead of reinventing the wheel, RocketsRPC provides an easy way to share handlers and does all the output piping for you.
Add Two Numbers Example
Suppose you have the following handler which you want to share:on addTwoNumbers pNumber1, pNumber2
return (pNumber1 + pNumber2)
end addTwoNumbers
With RocketsRPC you can expose this handler so that a web page or network aware application can call your code directly by accessing a url like:
http://andregarzia.com/cgi-bin/addTwoDemos.cgi?func=addTwoNumbers&pNumber1=2&pNumber2=2
if you try that url, you'll see it outputs the result from calling addTwoNumbers with pNumber1 = 2 and pNumber2 = 2. To see a live demo of this code, go to http://andregarzia.com/addTwoDemos.html , try it for I'll explain it piece by piece below.
The addTwoDemos.cgi

The web page

http://andregarzia.com/addTwoDemos.html
The web page source

You can see there's a minimal javascript to call 'addTwoNumbers' with the form parameters and glue the result into the 'span' tag. You may be thinking, how does javascript can call 'addTwoNumbers' like that, where is all the xmlHttpRequest part?
Well, RocketsRPC will generate javascript libraries for your CGI at runtime. If you call your CGI passing a param "func" with value "jslib", RocketsRPC will return a javascript library with proxy functions with the same name and parameters as the functions you exposed in your code. When you call those proxy functions, they go to the server, call the correct handler and return the result.
If you want to see the javascript library generated for AddTwoNumber.cgi just browse to http://andregarzia.com/cgi-bin/addTwoDemos.cgi?func=jslib

We can simply include the runtime generated library using a script tag with a source value such as we did on the web page source.

So, in the end, it is just a matter of exposing functions with the 'addFunction' call, including the javascript library in the webpage and then calling the functions as they were javascript native functions.
Can it get any easier?
Andre
|
Cool Web Resources for Runtime Revolution developers
19/06/07 19:46 Filed in: Runtime Revolution | Programming
Introduction
Hello friends, today I decided to make a list of resources I think are invaluable for the wannabe Runtime Revolution Web Application developer. I'll put the resources in the following categories: education, libraries and tools. This list is not complete and the items were placed in the list most because I like them and they serve me well.
The idea behind this little article is to become a hub serving useful resources locations.
Education
We all love the learn-by-doing method and we all know that the best way to learn something is with a practical project but there's a limit for what a person can learn just by himself. There's a new bubble in town, it's the web 2.0 and AJAX bubble, everyone is building their services, some will last, most will not. If you have an idea, chances are that you have three to four competitors already implementing their services. Startups are like mushrooms after rain, you blink and there are bunch of them just at your door step. There are many things a developer can do to keep on the bleeding edge and have a competitive advantage over his competitors, one of them is always learn more, keep learning and your mind will keep fresh and you'll have new views to tackle old problems, also it helps to see the big picture. When all your competitors are looking at the landscape thru a straw, it's very good to have the panorama lens.
To new webapp developers, I recommend:
http://www.jmarshall.com/easy/http/ - Learn about the HTTP protocol. This is what drives the web, your application will ride on the HTTP waves. Understand the protocol and how it works with this easy to follow text.
Introduction to Revolution CGIs - CGIs provide dynamic content to web sites, and allow flexible delivery of information. This tutorial explains how to use Runtime Revolution as a CGI engine on your server, and walks you through several CGI examples written in Revolution's easy Transcript language.
w3schools XSLT tutorial - tutorial on XML Stylesheet transformations, best way to generate the HTML for your apps.
w3schools Javascript tutorial - one can't build web applications by using Runtime Revolution alone, the knowledge of javascript is essential, even if only to glue some libraries to server side data servers.
PS: w3schools has a lots of tutorials, all for free on topics such as XHTML, SQL, SOAP.
Libraries
Code reuse is the key to web development, using good libraries (or creating them) is a must. Libraries keep development costs down and productivity high since less time is spent reinventing the wheel. I'll list first some Runtime Revolution libraries to be used on the server side for your CGIs, then I'll list some javascript libraries to be used on the client side to create effects and all the things expected of the next AJAX killer app.
Runtime Revolution CGI libraries:
LibCGI - Monte and Rodney library for building CGIs using stacks.EasyCGI - My own suite of libraries.
PS: both libraries are bundled with RevOnRockets.
Javascript libraries
Scriptaculous - One of the most useful and popular libraries out there. Lots of features from animation effects, to user interface manipulation and AJAX. I use Scriptaculous for my webapps and I am very happy with it.Prototype - Prototype library is bundled with scriptaculous, it's like scriptaculous is the user interface library and prototype is the backend stuff. When not using scriptaculous interface features, you can simply use prototype for your AJAX needs.
MooTools - This is a very compact library, it features all you need to build AJAX apps.
Yahoo! Interface Library - A very complete and mature library for building AJAX apps. It has everything, from calendar controls, drag & drop routines to connection management and data brokers.
Tools
I mostly work on macintosh computers so forgive me for not talking about windows tools, if anyone send me notes on windows tools, I'll be happy to put them here.
wireshark - a TCP sniffer makes it easier to debug your webapp because you can view all the traffic coming and going on the HTTP port. Some nasty bugs can easily be tracked down by using regular expressions and a sniffer. Wireshark has versions for popular unices and windows.
firebug - Firefox is the web developer best friend due to firebug, a wonderful extension that allows you to inspect and fiddle with everything, the DOM, the httprequesters, css, javascript. You can launch debuggers, watch your routines working. Firebug will help you make sure the client side is working.
RevOnRockets - A 100% transcript based suite of tools including Runtime Revolution libraries, a web server for local development and examples! All with source, all free (yes, I am the author, so this is a shameless plug).
Conclusion
This is just a simple list, to get you interested. Leave feedback using the comments links.
web application done with Runtime Revolution
17/06/07 23:31 Filed in: Runtime Revolution
The Online Hindu Lexicon
http://www.himalayanacademy.com/resources/lexicon
This is a web application that uses AJAX techniques to create a very easy to use lexicon for those interested in Hinduism. It features word definitions in english and cross-references allowing the curious user to jump from word to word as he explores the lexicon.
It was created with Runtime Revolution
http://www.himalayanacademy.com/resources/lexicon
This is a web application that uses AJAX techniques to create a very easy to use lexicon for those interested in Hinduism. It features word definitions in english and cross-references allowing the curious user to jump from word to word as he explores the lexicon.
It was created with Runtime Revolution