Search This Blog

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!