Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Sunday, May 04, 2008

Jaxer - An innovative paradigm

Jaxer is an open-source web application development framework providing an consistent Javascript based programming model between the cloud (server) and client. In this post I will provide an architectural overview of this technology and provide a conceptual mobile strategy that this framework can be used for.

Architectural Overview

The core of Jaxer is written in C/C++ and is powered by the same Mozilla engine that powers Firefox 3. There is a wrapper Javascript framework which can be easily extended by developers if needed.

Jaxer provides a plugin as post-processor to the web server and receives an static HTML as input. The core framework is responsible for parsing the input, executing scripts (server-side) and generating proxies.

The framework allows the developer to mark Javascript functions to be executed in the server using - runat="server" attribute in the script tag. There is also runat="server-proxy" where when the client calls are redirected to be executed in the server, the framework is responsible for injecting the methods.

From the server-side code there is also access to the Jaxer library and hence access to session, file system, database, network sockets, etc.

Thanks to Aptana for the image.

Mobile in Minutes

Here I would like to outline an use-case which will enable web properties to quickly create a mobile flavored output using Jaxer. This is intended to be a proof-of-concept and an example for the possibilities enabled by this framework. Lets say you have an existing simple web application and want to enable mobile flavored version modifying the existing application. This solution levereges the server-side processing of Jaxer to identify elements of interest from the HTML and renders a modified output.

Here the idea is to annotate on the HTML elements of the original output. It could be id="mobile-????". This step is just to identify elements of interest and construct a modified html. Here is a brief code snippet which should provide some direction and simply by injecting this script and marking ids mobile should do the job. This is no way intended to be a full-fledged implementation but to give a direction and server as a proof-of-concept:


var k = document.getElementById("b");
var m = document.createElement("body");
var e = document.getElementsByTagName("a");
m.innerHTML = 'Mobile rendering: ';
for ( var i = 0 ; i < style="font-style: italic;">
{

var l = e[i];
if (l.id == 'mobile') {
m.innerHTML = m.innerHTML + ' ' + l + ' +'';
}
}

k.innerHTML = m.innerHTML;

Infrastructural Support

Jaxer can "peacefully" co-exists with your open source technology stack. Jaxer can work with your existing Apache installation and have IIS support in their roadmap. Presently MySQL database is supported but definitely this is an area for improvement. There is also support Tomcat based deployment model and out-of-box support for running in EC2.

Conclusion

Emerging programming models such as Jaxer provide possibilities for more innovative web application extensions. This form of web extensions is extremely useful in enterprise and consumer environments to try-out in a plugin in on-demand.

Technorati Tags: ,

Sunday, August 19, 2007

Google Reader Helper for Firefox

Google Reader is one of the most popular web services and I personally use it everyday. One of the features that I miss using a RSS reader is the ability to view comments. In this post I would share a simple hack to help with this issue and to more importantly serve as a proof-of-concept for possibilities around web application extensions. It is written on a framework called Chickenfoot for Firefox that I recently stumbled upon.

What is Chickenfoot?

Chickenfoot for Firefox is itself a Firefox extension that puts programming environment in the browser's sidebar that allows you to write scripts to manipulate the web pages. Chickenfoot is a superset of JavaScript and puts the user in control of writing quick extensions to web pages. There is a detailed quick start tutorial of Chickenfoot here and the extension can be installed from here.

Google Reader Hack

While reading a post in Google Reader there will be only one expanded view of the post which lives under the <div> with id='current-entry'. This hack leverages this to identify the post that user is currently reading and loads that page in another tab automatically. If you're interested in quickly checking/leaving a comment for the post, then you can switch to the other tab and do so immediately without having to click and wait for it to load.

Once you have installed Chickenfoot, download the script here and open Google Reader on Firefox and start the script. If you're familiar with JavaScript then it should be self-explanatory.

Conclusion

Chickenfoot programming paradigm could be used to enhance web experience for user's convenience. Also the intersection of Chickenfoot with concepts like Programming Collective Intelligence will fuel greater innovation by allowing user to be more in control of the experience.

Resources

Chickenfoot For Firefox

Chickenfoot Blog

Google Reader Helper Script

Technorati tags: , ,

Thursday, August 09, 2007

Data Services in Spring

In today's web applications the need for returning model data from controllers in XML/JSON format is quite common. Mostly these requirements are met by writing custom code in controllers. In this post I will present technical approach that would enable your applications to return data model in XML/JSON or data format of your choice to the web tier using Spring MVC without modifying your applications.

Basically the idea is to return XML(or JSON, etc) whenever we encounter a request to the controller with parameter returnData=XML. This can be accomplished by writing a HandlerInterceptorAdapter with postHandle method to do the following:

void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView)
{

if ( request.getParamter("returnData") != null && request.getParamter("returnData")="XML" )
{

// add a XML Serializer to the model
// Find the model object names and add the list to model attribute "xmlModules"
// Set the view name to "xmlView"

}

}


In your xmlView (JSP or Velocity Template) for each attribute in xmlModules use the XML Serializer to generate XML and render it. There are few applications for this approach:

1. Enable front-end to readily use AJAX for existing controllers
2. Use this as a strategy to get a debug view of model data during development
3. Based on some additional key use this to get debug view from production for troubleshooting purpose

Resources:

1. XStream for XML Serialization

Tags: java spring ajax

Saturday, February 24, 2007

OpenID Adoption

As we know OpenID is an open, decentralized, free framework for user-centric identity. The goal is to have the user remember one user name and password and login to any site which supports the protocol. It is light-weight and supports SSO.

In the past few days there has been a lot of traction to OpenID adoption with the announcement for its support from the giants AOL, Microsoft and Digg. So if you have an AOL account then your open id is http://openid.aol.com/username and you can login to any website that supports OpenID. With the growing number of startups the adoption rate for OpenID is poised to grow rapidly.

User Resources

To start using OpenID you will need to obtain one. If you already have an AOL account you could use that if you like. Or you can obtain one from http://www.myopenid.com/. For a quick overview of OpenID here is a video.

Developer Resources

From a developer perspective for you to support OpenID either as client or server there are several resources available as noted below:

OpenID Enabled - OpenID community
OpenID Client/Server Libraries - C#, Java, Perl, C++, PHP, Ruby, ColdFusion
BotBouncer - A CAPTCHA service for OpenID

I was looking at OpenID4Java API - Consumer side and is pretty straight forward.

OpenID and CardSpace

Here is a post explaining how these two complementary technologies can work together. Its interesting.

tags: , , ,

Friday, February 24, 2006

Web Services- Using Axis/Spring/Castor

I was working on application architecture for building a document style web service this past week. I finally built the same using Axis, Spring and Castor frameworks. Spring also has their own web services framework(Spring-WS) but they dont quite have a stable release.

Basically the idea is to leverage the best of these two frameworks. As it is obvious Spring is used for hosting managed beans business logic and Axis for hosting the service. I leveraged Axis flexibilty to use custom Serializers and Deserializers and used Castor for OXM (Object-XML Mapping), so far it seems to work. As always, I would welcome any comments/suggestions/critic.

Wednesday, February 15, 2006

Yahoo releases Javascript UI Library

Yahoo has released User Interface libarary consisting of a set of utilities and controls written in JavaScript. It can be used for any web application and they also have documentation consisting of Design Patterns for using the library.

Click here

Disqus for techtalk