Search This Blog

Monday, October 17, 2011

Java Async IO Package

We need Async IO Package for sheer performance and scalability!
Performance and scalability are key attributes of the IO system for IO-intensive applications. IO-intensive applications are typically, although not exclusively, server-side applications. Server-side applications are characterized by the need to handle many network connections to many clients and also by the need to access many files to serve requests from those clients. The existing standard Java facilities for handling network connections and files do not serve the needs of server-side applications adequately. The java.io and java.net packages provide synchronous IO capabilities, which require a one-thread-per-IO-connection style of design, which limits scalability since running thousands of threads on a server imposes significant overhead on the operating system. The New IO package, java.nio, addresses the scalability issue of the one-thread-per-IO-connection design, but the New IO select() mechanism limits performance.

SQL Vs NoSQL


The advantage of a relational database is the ability to relate and index information. Most key-value systems don't provide that.
Does switching to nosql really make sense for the intended use case?
You have kind of missed the point. The point is, you don't have an index. You don't have a centralized list of records, or the ability to relate it together in any easy way. What makes nosql key-value stores so quick is that you store and retrieve what you need in a name-based approach. You need that blurb on someone's profile page? Just go fetch it. No need to maintain a table with everything in it. This being said, NoSQL has a number of novel structure which make many usecases trivially easy, e.g. Redis is a data-structure oriented DB well-suited to rapidly building anything with queues. MongoDB is a freeform document database which stores documents as JSON.
Not everything really needs to be tabular.
There's advantages and disadvantages. Sometimes using a mix of both can also make sense. SQL for most, and something along the lines of CouchDB for random things that have no need to be clogging up an SQL table.
You can liken a key-value system to making an SQL table with two columns, a unique key and a value. This is quite fast. You have no need to do any relations or correlations or collation of data. Just find the value and return it. This is an oversimplification, NoSQL databases do have a lot of nifty functions beyond simple K,V stores.
You'll find a simple K,V store is also fast in SQL databases. I've used it in place of actual key-value systems before NoSQL databases matured a bit.
I do not think scientific data is well suited to a nosql implementation, but if you look at HBase, it may well suit a scientist's needs.
The efficiency comes from the following areas:
1. The database has far fewer functions: there is no concept of a join and lessened or absent transactional integrity requirements. Less function means less work means faster, on the server side at least.
2. Another design principle is that the data store lives in a cloud of servers so your request may have multiple respondents. These systems also claim the multi-server system improves fault tolerance through replication.

Saturday, September 17, 2011

ActiveMQ Java Example

 private static ActiveMQConnectionFactory connectionFactory;
      private static Connection connection;
      private static Session session;
      private static Destination destination;
      private static boolean transacted = false;
 
      public static void main(String[] args) throws Exception {
          BrokerService broker = new BrokerService();
          broker.setUseJmx(true);
          broker.addConnector("tcp://localhost:61616");
          broker.start();
 
          setUp();
          createProducerAndSendAMessage();
          System.out.println("Simulating a huge network delay :)");
          Thread.sleep(4000);
          createConsumerAndReceiveAMessage();
 
          //TODO: Find out how to get rid of the exceptions thrown when stopping the broker
          broker.stop();
      }
 
      private static void setUp() throws JMSException {
          connectionFactory = new ActiveMQConnectionFactory(
                  ActiveMQConnection.DEFAULT_USER,
                  ActiveMQConnection.DEFAULT_PASSWORD,
                  ActiveMQConnection.DEFAULT_BROKER_URL);
          connection = connectionFactory.createConnection();
          connection.start();
          session = connection.createSession(transacted, Session.AUTO_ACKNOWLEDGE);
          destination = session.createQueue("mmy first active mq queue");
      }
 
      private static void createProducerAndSendAMessage() throws JMSException {
          MessageProducer producer = session.createProducer(destination);
          producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
          TextMessage message = session.createTextMessage("Hello World!");
          System.out.println("Sending message: " + message.getText());
          producer.send(message);
      }
 
      private static void createConsumerAndReceiveAMessage() throws JMSException, InterruptedException {
          connection = connectionFactory.createConnection();
          connection.start();
          MessageConsumer consumer = session.createConsumer(destination);
          MyConsumer myConsumer = new MyConsumer();
          connection.setExceptionListener(myConsumer);
          consumer.setMessageListener(myConsumer);
      }
 
      private static class MyConsumer implements MessageListener, ExceptionListener {
 
          synchronized public void onException(JMSException ex) {
              System.out.println("JMS Exception occured.  Shutting down client.");
              System.exit(1);
          }
 
          public void onMessage(Message message) {
              if (message instanceof TextMessage) {
                  TextMessage textMessage = (TextMessage) message;
                  try {
                      System.out.println("Received message: " + textMessage.getText());
                  } catch (JMSException ex) {
                      System.out.println("Error reading message: " + ex);
                  }
              } else  {
                  System.out.println("Received: " + message);
              }
          }
      }

ActiveMQ & Open JMS

ActiveMQ is an open source, Apache 2.0 licensed Message Broker and JMS 1.1 implementation and Enterprise Integration Patterns provider which integrates seamlessly into Geronimo, light weight containers and any Java application.
ActiveMQ provides bridging functionality to other JMS providers that implement the JMS 1.0.2 and above specification. 

A JMS bridge can be co-located with an ActiveMQ broker or run remotely. In order to support JMS 1.0.2 there is separation between Queues and Topics.
Features:
• Supports a variety of Cross Language Clients and Protocols from Java, C, C++, C#, Ruby, Perl, Python, PHP
• OpenWire (cross language Wire Protocol to allow native access to ActiveMQ) for high performance clients in Java, C, C++, C#
• Stomp support so that clients can be written easily in C, Ruby, Perl, Python, PHP, ActionScript/Flash, Smalltalk to talk to ActiveMQ as well as any other popular Message Broker
• full support for the Enterprise Integration Patterns both in the JMS client and the Message Broker
• Supports many advanced features such as Message Groups, Virtual Destinations, Wildcards and Composite Destinations
• Fully supports JMS 1.1 and J2EE 1.4 with support for transient, persistent, transactional and XA messaging
Spring Support so that ActiveMQ can be easily embedded into Spring applications and configured using Spring's XML configuration mechanism
• Tested inside popular J2EE servers such as Geronimo, JBoss 4, GlassFish and WebLogic
• Includes JCA 1.5 resource adaptors for inbound & outbound messaging so that ActiveMQ should auto-deploy in any J2EE 1.4 compliant server
Supports pluggable transport protocols such as in-VM, TCP, SSL, NIO, UDP, multicast, JGroups and JXTA transports
• Supports very fast persistence using JDBC along with a high performance journal
• Designed for high performance clustering, client-server, peer based communication
REST API to provide technology agnostic and language neutral web based API to messaging
Ajax to support web streaming support to web browsers using pure DHTML, allowing web browsers to be part of the messaging fabric
• CXF and Axis Support so that ActiveMQ can be easily dropped into either of these web service stacks to provide reliable messaging
• Can be used as an in memory JMS provider, ideal for unit testing JMS Can be used as an in memory JMS provider, ideal for unit testing JMS

OpenJMS is an open source implementation of Sun Microsystems's Java Message Service API 1.1 Specification
Features:
• Point-to-Point and publish-subscribe messaging models
• Guaranteed delivery of messages
• Synchronous and asynchronous message delivery
• Persistence using JDBC
• Local transactions
• Message filtering using SQL92-like selectors
• Authentication
• Administration GUI
• XML-based configuration files
• In-memory and database garbage collection
Automatic client disconnection detection
• Integrates with Servlet containers such as Jakarta Tomcat
• Support for TCP, RMI, HTTP and SSL protocol stacks
• Support for large numbers of destinations and subscribers

Sunday, August 7, 2011

Rapid development

In today's cloud environment, where multi-tier architecture is a must, one has to optimize code between both internal & interactive layers.
Most successful software products are those which invest on software infrastructure development such that 90% of development & enhancement tasks are automated and there is not much maintanance cost in the long run.
Here I would like to come up with a strategy which caters to both mobile & desktop devices:
1. Middle-layer that is lean & configurable. All business logic goes here.
2. Use a relational database to initially build the schema. Once the database grows and can't scale, should have the ability to move database tables into file or some other high performance i/o. The infrastructure design should be such that it should facilitate for migration from database to file storage without affecting the middle-layer.
3. Provide database transactions that will be processed reliably. Should confirm to ACID (atomicity, consistency, isolation, durability) properties.
4. Supporting high-performance api to convert binary data into xml, json or any other data format depending on end-user's device (mobile, desktop)
5. A basic CRUD (Create, Read, Update and Delete) framework that an architect should provide for building an enterprise application. Ensure all basic validations are taken care of at the middle-layer. Should support creation of UI code automatically for all targeted devices.
6. Naming conventions should be strictly followed for better readability & maintainability of the code.
7. Middle layer should be fault tolerant and also be able to handle transactions normally in such a way that even if front-end passes the data without validating it (if javascript is not supported) it should still work normally.
7. JUnit for Java, Jasmine for javascript should be used.
8. Use the most compressed data format where ever possible. With javascript now coming up with typed arrays ensure you don't hog your network with redundant data (https://developer.mozilla.org/en/javascript_typed_arrays). Don't use propreitary data formats.

Friday, September 17, 2010

Issue in debugging Tomcat 6 Remote Java application on Eclipse 3.4.2

This is a very simple task. But people get stuck with a timeout issue while the debugger tries to connect to the java vm. Hence have posted this...

create a bat file with below content in your tomcat/bin folder. use this to start your tomcat server.
rem (if it doesn't connect, try 8000)
set JPDA_ADDRESS=8787
set JPDA_TRANSPORT=dt_socket
catalina.bat jpda start

In eclipse go to debug configuration & select remote java application. use localhost if server is local, & set the appropriate port (8787 or 8000 whicever works)

Tuesday, September 7, 2010

jquery vs dojo vs extjs

When building web 2.0 applications there is always this confusion about which is the best library to use.
After a lot of research on jquery, dojo and extjs, here is my thoughts:
1. I recommend ExtJs if you don't want to spend time & energy in fixing bugs & extending components. Also ExtJs gives components for mobile. Else jQuery. jQuery is free, open source software, dual-licensed under the MIT License and the GNU General Public License, Version 2.[4] jQuery's syntax is designed to make it easier to navigate a document, select DOM elements, create animations, handle events, and develop Ajax applications. Used by over 31% of the 10,000 most visited websites, jQuery is the most popular JavaScript library in use today.
2. Ext includes interoperability with jQuery and Prototype
3. Dojo can be used in javascript-based Adobe AIR applications. It has been modified to meet AIR's security requirements.

Javascript code is difficult to maintain compared to Adobe Flex. Hence I don't prefer to modify most of the components. I prefer to make the most of any javascript library that is open source and has the right component for my application.

Thursday, December 17, 2009

Overview of Java Messaging


Messaging is a method of communication between software components or applications. A messaging system is a peer-to-peer facility: A messaging client can send messages to, and receive messages from, any other client. Each client connects to a messaging agent that provides facilities for creating, sending, receiving, and reading messages.


A JMS application is composed of the following parts:
A JMS provider is a messaging system that implements the JMS interfaces and provides administrative and control features.
JMS clients are the programs or components, written in the JavaTM programming language, that produce and consume messages.
Messages are the objects that communicate information between JMS clients.
Administered objects are preconfigured JMS objects created by an administrator for the use of clients. The two kinds of administered objects are destinations and connection factories.
Native clients are programs that use a messaging product's native client API instead of the JMS API. An application first created before the JMS API became available and subsequently modified is likely to include both JMS and native clients.
JMS API can be used in some of the following ways:
Consume messages asynchronously with a message-driven bean
Produce messages from an application client
Produce messages from a session bean
Access an entity bean from a message-driven bean
Produce and consume messages on more than one system
An enterprise application provider is likely to choose a messaging API over a tightly coupled API, such as remote procedure call (RPC), under the following circumstances.
The provider wants the components not to depend on information about other components' interfaces, so that components can be easily replaced.
The provider wants the application to run whether or not all components are up and running simultaneously.
The application business model allows a component to send information to another and to continue to operate without receiving an immediate response.
For example, components of an enterprise application for an automobile manufacturer can use the JMS API in situations like these:
The inventory component can send a message to the factory component when the inventory level for a product goes below a certain level so that the factory can make more cars.
The factory component can send a message to the parts components so that the factory can assemble the parts it needs.
Performs a JNDI lookup of the ConnectionFactory and Destination
Look up connection factory and destination. If either does not exist, exit. If you look up a TopicConnectionFactory or a QueueConnectionFactory
Creates a Connection and a Session:
Connection connection =   connectionFactory.createConnection(); Session session = connection.createSession(false,   Session.AUTO_ACKNOWLEDGE);
Creates a MessageProducer and a TextMessage:
MessageProducer producer = session.createProducer(dest); TextMessage message = session.createTextMessage();
Sends one or more messages to the destination:
for (int i = 0; i < NUM_MSGS; i++) {   message.setText("This is message " + (i + 1));   System.out.println("Sending message: " +     message.getText());   producer.send(message); }
Sends an empty control message to indicate the end of the message stream:
producer.send(session.createMessage());
Finally close the connection using connection.close() in the finally clause.


A sequence of how queue and topic would be used:
Queue name is jms/ControlQueue
Queue name is jms/Queue
Topic name is jms/Topic
Connection factory name is jms/DurableConnectionFactory
  SENDER: Created client-acknowledge session
  SENDER: Sending message: Here is a client-acknowledge message
  RECEIVER: Created client-acknowledge session
  RECEIVER: Processing message: Here is a client-acknowledge 
message
  RECEIVER: Now I'll acknowledge the message
PUBLISHER: Created auto-acknowledge session
SUBSCRIBER: Created auto-acknowledge session
PUBLISHER: Receiving synchronize messages from jms/
ControlQueue; count = 1
SUBSCRIBER: Sending synchronize message to jms/ControlQueue
PUBLISHER: Received synchronize message;  expect 0 more
PUBLISHER: Publishing message: Here is an auto-acknowledge 
message 1
PUBLISHER: Publishing message: Here is an auto-acknowledge 
message 2
SUBSCRIBER: Processing message: Here is an auto-acknowledge 
message 1
PUBLISHER: Publishing message: Here is an auto-acknowledge 
message 3
SUBSCRIBER: Processing message: Here is an auto-acknowledge 
message 2
SUBSCRIBER: Processing message: Here is an auto-acknowledge 
message 3 

Tuesday, April 28, 2009

Lazy-loaded tree example

mx:application mx="http://www.adobe.com/2006/mxml" layout="absolute" creationcomplete="creationCompleteHandler()"

import mx.utils.ObjectProxy;
import mx.events.TreeEvent;
import mx.collections.ArrayCollection;
private var myEvent:TreeEvent;

[Bindable]
private var acSiteTreeList:ArrayCollection;

private function creationCompleteHandler():void {
var obj:Object;
acSiteTreeList = new ArrayCollection ();
for(var i:int = 0; i < 3; i++) {
obj= new Object();
obj["type"] = "something";
obj["children"] = new ArrayCollection();
//fetch is a property in the dataprovider to check if I have fetched the child nodes previously
obj["fetch"] = false;
obj["label"] = "name " + i.toString();
acSiteTreeList.addItem(obj);
}
}

private function setView(event:TreeEvent):void {
if(event.item.type == "something" && event.item.fetch == false) {
myEvent = event; //(myEvent is of type TreeEvent)
//update the dataprovider
var obj:ObjectProxy;
var item:Object;
var children:ArrayCollection;
for(var i:int = 0; i < acSiteTreeList.length; i++) {
obj= new ObjectProxy();
obj["type"] = "something";
//obj["children"] = new ArrayCollection(bloggersArray);
//fetch is a property in the dataprovider to check if I have fetched the child nodes previously
obj["fetch"] = false;
obj["label"] = "node " + i.toString();
item = myEvent.item;
children = item.children;
item.fetch = true;
children.addItem(obj);
acSiteTreeList.itemUpdated(item);
}
}
}

mx:canvas width="100%" height="100%"
mx:tree id="treeSiteList" dataprovider="{acSiteTreeList}" x="204" y="10" height="582" width="394" itemopen="setView(event)"
mx:Canvas
mx:Application

Monday, April 20, 2009

Wowza Media Server - Really hot!

The Wowza Media Server is a upcoming, commercial alternative to Adobe's Flash Media Server with some unique features such as FastForward and Rewind.

The Wowza Media Server (WMS) is a Java 5 (aka 1.5) server application that can be extended using Java on the server side and Flash on the client side using the Flash Media Server client side ActionScript API. The software supports Live streaming (using ON2 Live), Video on Demand with Fast Forward, rewind and prepend operations, multiuser Video Chats (video, audio and text) as well as Video Recording.

This addition brings more competition to the Flash Video space where Adobe's Flash Media Server and Red5 currently represent the outer limits.

Wowza Pro10: FREE
Perfect for development and personal use, the Wowza Pro10 edition supports a maximum of 10 concurrent connections and does not have MPEG-TS ingest capabilities. Otherwise, the Pro10 edition contains the full features and functionality of the Wowza Pro Unlimited with MPEG-TS edition.

Wowza Pro Unlimited with MPEG-TS: Single License $995
The Wowza Pro Unlimited with MPEG-TS edition has no per-server connection capacity limit and is the best option for commercial deployments. While the Wowza Pro Unlimited with MPEG-TS edition does not limit the number of connections, connection capacity will depend on your choice of hardware, internet connection bandwidth and specific application.

Saturday, April 4, 2009

Adobe Flex for .NET developers

One of the announcements from Adobe’s recent annual developer conference that should be of particular interest to .NET developers is the release of a free plug-in for Microsoft Visual Studio, which provides support for building rich Internet applications (RIAs) using Adobe's Flex framework. The release of the Ensemble Tofino plug-in will be important to the many enterprise development teams that have standardized on Visual Studio as their primary integrated development environment (IDE), but who want to take advantage of the ubiquitous Flash Player for deploying a RIA.
With increasing end-user expectations in relation to the quality, expressiveness and performance of web-based applications, developers need to focus more attention on the “richness” of the user experience. Whilst AJAX-style techniques can be used to enrich the user interface, plug-in based technologies like Flash Player is extending the capabilities of the browser, to offer media playback, enhanced graphics and faster code-execution performance.
The only thing that you need to do to enable Flex development within your Visual Studio environment is to install the Ensemble Tofino plug-in, available free from http://www.ensemble.com/. At the time of writing, the plug-in is in an early stage of release, and currently includes the ability to create, compile and debug applications.

AI & UI - Thinking beyond...

Can we build code that can think on its own?
For example, can we build a component that can learn from the inputs that it gets?
I was trying to build a component that can handle additional events based on user inputs. This component can adapt to user's requirement by changing from a 2d to a 3d component on its own.
UI has come a long way and today's user's expect the UI to hold the data within it and expect the UI to "analyze" this data and display appropriate responses through data visualizations to tell the users what action to take!
Talking about 2d to 3d and vise-versa, I believe the marriage between flare and papervision could create the best of the 2d and 3d worlds!
Building a new component that takes ideas from flare and papervision and has Artificial Intelligence embedded makes it mouth watering!

Original = Light weight = High Performance

The fact of the matter is we as developers look for great open source frameworks and libraries that can make our lives easier.
The vision should always be on scalability and performance but for some reason all these free libraries are making us lose focus on the plain fact that we can build ultimate stuff that can be much better than all these that exist for free.
The problem is using these libraries limit our ability think beyond what exists!
The idea is that by creating a component on our own using simple logic creates unbelievably great stuff! All the actionscript code for 2d, 3d and data visualization are great but there is much more than we see.
All I suggest is enjoy creating stuff than just re-using the "elephants"!!!

LivePipe UI

LivePipe UI is a suite of high quality widgets and controls for web 2.0 applications built using the Prototype JavaScript Framework. Each control is well tested, highly extensible, fully documented and degrades gracefully for non JavaScript enabled browsers where possible. MIT licensed and actively maintained.

Openings Jobs in Flex, Java, Perl & C Programming

We have some openings for the following positions:

1. Strong in Java/J2EE skills with 1 to 5 yrs experience.
2. Strong C skills with 4-5 yrs experience.
3. JavaScript, AJAX and Adobe Flex with 1-4 yrs experience
4. Strong in Perl or any other scripting language. Should have worked on automated testing. Around 2-4 yrs experience in testing.
5. Designer for creating content (especially icons) for our web application, product and company website. Should be good in Photoshop, Fireworks or any other Image editor and should be very creative.

Location: Bangalore

mail your resumes to: aditya7773@gmail.com

Prototype JavaScript

Prototype is a JavaScript Framework that aims to ease development of dynamic web applications.

http://www.prototypejs.org/

Featuring a unique, easy-to-use toolkit for class-driven development and the nicest Ajax library around, Prototype is quickly becoming the codebase of choice for web application developers everywhere.

prototype.js is a JavaScript library initially written by Sam Stephenson. This amazingly well thought and well written piece of standards-compliant code takes a lot of the burden associated with creating rich, highly interactive web pages that characterize the Web 2.0 off your back.

Developers familiar with the Ruby programming language will notice an intentional similarity between Ruby's built-in classes and many of the extensions implemented by this library. That's not surprising since prototype.js is a spinoff and is directly influenced by the requirements of the Ruby on Rails framework.

As far as browser support goes, prototype.js tries to support Internet Explorer (Windows) 6.0+, Mozilla Firefox 1.5+, Apple Safari 1.0+, and Opera 9+. Supporting these browsers also cause some other browsers that share their rendering engines to be supported as well, like Camino, Konqueror, IceWeasel, Netscape 6+, SeaMonkey, etc.

Flex Data Visualization & Charting

There are some cool open source projects that are creating ripples in flex. I find the best of all to be Flare. Flare is very flexible and light-weight. It provides foundation classes to create ultimate data-visualization components with useful animations, transitions and effects.
There is another such project called BirdEye. This is pretty cool but still not as great as Flare. However the vision of this project is to create an end-to-end solution for data-visualization. Not the fun stuff that developers would like to reuse.

Flare:
Flare is an ActionScript library for creating visualizations that run in the Adobe Flash Player. From basic charts and graphs to complex interactive graphics, the toolkit supports data management, visual encoding, animation, and interaction techniques. Even better, flare features a modular design that lets developers create customized visualization techniques without having to reinvent the wheel.

BirdEye:
BirdEye is a community project to advance the design and development of a comprehensive open source information visualization and visual analytics library for Adobe Flex. The actionscript-based library enables users to create multi-dimensional data visualization interfaces for the analysis and presentation of information.

Have fun with all the cool data-visualization stuff!

Wednesday, September 17, 2008

Spring & HIbernate

Here I would like to recommend the best combination which is Spring with Hibernate for an Enterprise application which confirms to OOPS philosophy.

Before we go in-depth about the topic, some facts about using an ORM:

Advantages:
Speeds-up Development - eliminates the need for repetitive SQL code.
Reduces Development Time.
Reduces Development Costs.
Overcomes vendor specific SQL differences - the ORM knows how to write vendor specific SQL so you don't have to.

Disadvantages:
Loss in developer productivity whilst they learn to program with ORM.
Developers loose understanding of what the code is actually doing - the developer is more in control using SQL.
ORM has a tendency to be slow.
ORM fail to compete against SQL queries for complex queries.

For Hibernate, Spring framework provides first-class support with lots of IoC convenience features, addressing many typical Hibernate integration issues. All of these support packages for O/R (Object Relational) mappers comply with Spring's generic transaction and DAO exception hierarchies. There are usually two integration styles: either using Spring's DAO 'templates' or coding DAOs against plain Hibernate/JDO/TopLink/etc APIs.

Spring framework is based on Java Bean configuration management with Inversion of control principle (IoC). Spring uses its IoC container as the principal building block for a comprehensive solution that reflects all architectural features. Its unique data access system with a simple JDBC framework improves its productivity with less error. Its AOP program written in standard Java provides better transaction management services and also enables it for different applications.

Following are the modules of the Spring Core Container:
Beans, Core, Context, Expression Language

Dependencies are satisfied through the following:

1. Constructor Injection
2. Setter Injection
3. Interface Injection

Configure the spring bean configuration file
Create bean entries for the following:
jsp view resolver, datasource, sessionfactory & other domain specific dao & controller beans.

Hibernate Mapping for the DAO object will be in the .hbm.xml file

Use a seperate DAO class to interact with the database.
Use a MultiActionController class to handle the web requests.
Add hibernate annotations to Bean classes, if you want to add any database related constraints.
Example:

@Id
@GeneratedValue
@Column(name="USER_ID")
public Long getId() {
   return id;
}

Ensure all DAO classes implement an interface so that save & retrieve methods can be implemented on them.
Use Hibernate Template to access the database in the DAO object.
this.hibernateTemplate = new HibernateTemplate(sessionFactory);
hibernateTemplate.saveOrUpdate(user);
return hibernateTemplate.find("from User");

Hibernate Template is thread safe and reusable. You need not manually open and close Session, Hibernate Template will do that for you.

The specific say User Controller class will extend MultiActionController class. The UserDAOImpl instance is injected using setter injection.

In the jsp page we use Spring Form tags to display the form fields and jstl tags to display the list of users. In the add method we call the saveUser() method and redirect the control to the "list.htm" url. This will invoke the list() method. In the list method you add two things to the modelMap, the user list to display the list of users and an instance of the user object to bind the form fields in the userForm.jsp page.

In the jsp page we use Spring Form tags to display the form fields and jstl tags to display the list of users.




Thursday, June 28, 2007

Coolest thing in Flex???

Does anyone know whats the coolest Flex app running the show?

These are some of my short reviews on some of the cool Flex apps:

Design Color Themes - http://kuler.adobe.com/
Fantastic! For people who don't have much experience in choosing colors this is the place!!

Scrap blog - http://www.scrapblog.com/builder/
It gives a lot of presentation tools to make the blog look great... I liked the template feature. Nice a way to present your blog!! This one is for the artists out there!

The Amgen Tour of California - http://www.amgentourofcalifornia.com/docroot/tourtracker2/index.html
- Doesn't load fast enough. Colors used aren't very great though. UI is just ordinary. Need to appreciate the effort for getting such a flex app developed in a month's time.