This was the third season of the Great Indian Developer Summit and like the previous conferences, this one too saw developers, technologists, evangelists and motivation speakers come from all parts. Yes motivation speaker! Priya Kumar, a dynamic motivational speaker and author of the best selling book "I am another you" was here and spoke on Possibilities and becoming a hero in what you are doing. The talk was refreshing and a welcome break. Being post lunch it was well timed and brought energy back into the dozing audience.
I personally like this conference for the great array of speakers that it calls upon. Being a Java and Web App enthusiast, I attended the GIDS.Web track of the conference. The day started with a keynote by the great Marty Hall from coreservlets. He compared the various approaches to building Rich internet applications with Ajax. He spoke about Javascript libraries like dojo, jQuery available for adding Ajax support to an existing web application vs building Ajax rich applications from scratch using frameworks like JSF. In another session later in the day he juxtaposed the different javascript libraries like jQuery, dojo, prototype, scriptaculous, google closure, and YUI. He rated them against their support for Ajax, UI controls, DOM manipulation, ease of use, javascript features and popularity.
Scott Davis delivered an engaging talk on Deconstructing Web2.0. He impressed upon the audience that Web2.0 is not a thing but a state of mind. It's a dynamic, interactive, collaborative and componentized view of the web. He provided many examples and built a web application using grails there and then to drive the point on dynamic nature of Web2.0, short delivery cycles where applications are always in beta.
There were a couple of sessions on cloud computing by Amazon and Adobe. But they just scraped the surface. We have heard enough about it. Some practical exercises would have been really useful.
The presentations will be up on the devsummit website.
~Ashish.
Tech Talk
Wednesday, April 21, 2010
Thursday, April 23, 2009
GIDS.Java
Day 3 of the Great Indian Developer Summit had its key focus on Java, and Enterprise applications. The conference saw a sea of delegates from the major IT companies all around Bangalore. The usually quaint and quiet premises of IISc was today beaming with techies and nerds noisily discussing their favorite programming language or tool. Age was no bar here. The gray haired were as much (if not more!) geeky as the college pass-outs (or drop-outs!). Organized by Devmarch, the conference had the likes of Microsoft, Yahoo!, IBM, Adobe, Red Hat, Intel for its sponsors.
The attendees had various things to choose from. There were sessions conducted by leading speakers in the industry. There were expos hosted by the sponsors. There were workshops; after all what's programming without some hands-on! And of course there was a lot of opportunity and scope for networking with the speakers and attendees.
Sessions for the day were grouped in five parallel tracks. They dealt with the key technologies like cloud computing, RESTful web services, Ruby on Rails, Groovy, Agile development and Ajax in addition to Java of course.
Craig McClanahan, the creator of Struts started off the morning session with an insightful talk on Cloud Computing. It means different things for different people. For some it is Software as a service, for some it's virtualization, for a few it is utility computing, grid computing, and for others it is application hosting platform. Truth is that it is a combination of all these and more and has created a lot of buzz amongst the enterprises and developers alike. What's driving their interest is the low cost and agile business model that the cloud promises to achieve. The pay as you go economic model, the rapid, self provisioning and API driven development model and the flexibility offered through standard, elastic, on-demand services is attractive to one and all. There are many clouds out there and Craig spoke about what they all share and what they don't. He also highlighted the three layers in cloud computing - Software as a service (SaaS), Platform as a service (PaaS) and Infrastructure as a service (IaaS) from top to bottom. These are the primary areas where the vendors are focusing be it Amazon Web services and EC2 or Google App Engine or Salesforce.com. At closing he introduced the upcoming cloud platform of Sun (or Oracle!) and hinted on the announcement of the Sun storage and compute services at JavaOne (shhhh!).
Jim Webber, author of "Developing Enterprise Applications - Architect's guide" conducted an engaging session on Introducing REST - the Starbucks example. He used the Starbucks coffee shop example to drive home the RESTful paradigm of web services. He started off with the Richardson Maturity Model - a model of technologies stacked up based on the level to which they embrace the web. The stack has the traditional RPC at its peak and then moves down to technologies that use URIs, web services and finally to REST that completely embraces web. REST is all about resources, their states and how they can be accessed with URIs. It's quite hard to believe that what was always there around us (meaning the web) eluded us all with it's power and scalability. While we focused all the energies on building middleware to support the integration, scalability, security and other "abilities", it was all already there in the form of the web. Jim talked about the HTTP implementation of REST, the CRUD operations using the POST, GET, PUT and DELETE verbs, and how HTTP supports metadata in its header. He also stressed on the microformats and media types that are again intrinsic to a RESTful implementation. Jim's humor, the informal style of presentation and animated hand waving was very well taken by the audience. Needless to say that it kept them all engaged and on the edge of their seats!
Last session for the day was one on testing Java with JRuby. It was delivered by another Thoughtworker Ola Bini [Ola Bini blogs]. Now this was a very interesting topic. All the more for me as I had been thinking about this for some time now. Since the dynamic languages are known and used for stitching components, using them for testing is a natural extension. Especially when one has to come up with the test code quickly (which is usually the case), JRuby can be of great help. And its many gems provide added capability for avoiding repetition, and for writing plain text stories and scenarios. Bini kept shuffling between the presentation and demos and did complete justice to the topic.
Kudos to the organizing team. With over 3000 attendees at the conference, the logistics was well handled. The sessions were well timed and but for a couple of changes to the agenda, all the others started and got over on time. The only grouse was the long queues and crowd at the dining area; some arrangement there would have helped. And did I say that the food was awesome! :)
~Ashish
The attendees had various things to choose from. There were sessions conducted by leading speakers in the industry. There were expos hosted by the sponsors. There were workshops; after all what's programming without some hands-on! And of course there was a lot of opportunity and scope for networking with the speakers and attendees.
Sessions for the day were grouped in five parallel tracks. They dealt with the key technologies like cloud computing, RESTful web services, Ruby on Rails, Groovy, Agile development and Ajax in addition to Java of course.
Craig McClanahan, the creator of Struts started off the morning session with an insightful talk on Cloud Computing. It means different things for different people. For some it is Software as a service, for some it's virtualization, for a few it is utility computing, grid computing, and for others it is application hosting platform. Truth is that it is a combination of all these and more and has created a lot of buzz amongst the enterprises and developers alike. What's driving their interest is the low cost and agile business model that the cloud promises to achieve. The pay as you go economic model, the rapid, self provisioning and API driven development model and the flexibility offered through standard, elastic, on-demand services is attractive to one and all. There are many clouds out there and Craig spoke about what they all share and what they don't. He also highlighted the three layers in cloud computing - Software as a service (SaaS), Platform as a service (PaaS) and Infrastructure as a service (IaaS) from top to bottom. These are the primary areas where the vendors are focusing be it Amazon Web services and EC2 or Google App Engine or Salesforce.com. At closing he introduced the upcoming cloud platform of Sun (or Oracle!) and hinted on the announcement of the Sun storage and compute services at JavaOne (shhhh!).
Jim Webber, author of "Developing Enterprise Applications - Architect's guide" conducted an engaging session on Introducing REST - the Starbucks example. He used the Starbucks coffee shop example to drive home the RESTful paradigm of web services. He started off with the Richardson Maturity Model - a model of technologies stacked up based on the level to which they embrace the web. The stack has the traditional RPC at its peak and then moves down to technologies that use URIs, web services and finally to REST that completely embraces web. REST is all about resources, their states and how they can be accessed with URIs. It's quite hard to believe that what was always there around us (meaning the web) eluded us all with it's power and scalability. While we focused all the energies on building middleware to support the integration, scalability, security and other "abilities", it was all already there in the form of the web. Jim talked about the HTTP implementation of REST, the CRUD operations using the POST, GET, PUT and DELETE verbs, and how HTTP supports metadata in its header. He also stressed on the microformats and media types that are again intrinsic to a RESTful implementation. Jim's humor, the informal style of presentation and animated hand waving was very well taken by the audience. Needless to say that it kept them all engaged and on the edge of their seats!
Last session for the day was one on testing Java with JRuby. It was delivered by another Thoughtworker Ola Bini [Ola Bini blogs]. Now this was a very interesting topic. All the more for me as I had been thinking about this for some time now. Since the dynamic languages are known and used for stitching components, using them for testing is a natural extension. Especially when one has to come up with the test code quickly (which is usually the case), JRuby can be of great help. And its many gems provide added capability for avoiding repetition, and for writing plain text stories and scenarios. Bini kept shuffling between the presentation and demos and did complete justice to the topic.
Kudos to the organizing team. With over 3000 attendees at the conference, the logistics was well handled. The sessions were well timed and but for a couple of changes to the agenda, all the others started and got over on time. The only grouse was the long queues and crowd at the dining area; some arrangement there would have helped. And did I say that the food was awesome! :)
~Ashish
Sunday, April 12, 2009
REST explained
Came across this funny yet revealing post of this guy explaining REST to his wife. It's simplistic and comprehensive starter on all that is REST.
REST to my wife
~Ashish
REST to my wife
~Ashish
Tuesday, March 31, 2009
XML generation using SAXTransformer in Java JDK
XML generation is a common found requirement in applications. Typical way to address it in java is to manually append the XML string in a StringBuffer. Firstly this can be quite tedious. Secondly it is susceptible to manual errors while writing the XML. Also, the developer needs to take care of the escape characters etc. Clearly this is not the best way of XML generation in Java.
A better way of achieving this is to use the classes in javax.xml.transform package of JDK. These are traditionally used for XML parsing and transformations. Their use of XML generation is uncommon and unobvious. here's a code snippet that shows how these classes can be used for XML generation:
SAXTransformerFactory saxFactory = (SAXTransformerFactory) TransformerFactory.newInstance();
StringWriter writer = new StringWriter();
try {
TransformerHandler handler = saxFactory.newTransformerHandler();
Result result = new StreamResult(writer);
handler.setResult(result);
handler.startDocument();
AttributesImpl atts = new AttributesImpl();
atts.addAttribute("", "", "name", "CDATA", "");
atts.addAttribute("", "", "version", "CDATA", "6.2");
handler.startElement("http://wbe.ibm.com/6.2/Event/connect", "","connector", atts);
atts.clear();
atts.addAttribute("", "", "name", "CDATA", "connect");
atts.addAttribute("", "", "type", "CDATA", "Event");
handler.startElement("", "", "connector-bundle", atts);
atts.clear();
handler.startElement("", "", "connect", atts);
String paramValue = null;
for (ScenarioParameter param : scenarioParams) {
atts.clear();
atts.addAttribute("", "", "type", "CDATA", param.getType());
handler.startElement("", "", param.getName(), atts);
paramValue = getParamValue(param.getParamId(), params);
handler.characters(paramValue.toCharArray(), 0, paramValue.length());
handler.endElement("", "", param.getName());
}
handler.endElement("", "", "connect");
handler.endElement("", "", "connector-bundle");
atts.clear();
handler.startElement("", "", "system", atts);
String systemName = InetAddress.getLocalHost().getHostName();
handler.characters(systemName.toCharArray(), 0, systemName.length());
handler.endElement("", "", "system");
handler.startElement("", "", "timestamp", atts);
String timestamp = new Date().toString();
handler.characters(timestamp.toCharArray(), 0, timestamp.length());
handler.endElement("", "", "timestamp");
handler.startElement("", "", "loginfo", atts);
String logMsg = "Sending values at runtime";
handler.characters(logMsg.toCharArray(), 0, logMsg.length());
handler.endElement("", "", "loginfo");
handler.endElement("", "", "connector");
handler.endDocument();
System.out.println(writer.toString());
TransformerHandler listens for XML parse events and transforms them to Result. Since we are not using it for parsing, here the handler generates those events like startDocument, startElement and transforms them into Result. The Result thus contains the XML that we wanted to generate. Note that it is the developer's responsibility to take care of the well formedness of the XML. A startElement has to have a matching endElement and a startDocument has to have a matching endDocument.
~Ashish.
A better way of achieving this is to use the classes in javax.xml.transform package of JDK. These are traditionally used for XML parsing and transformations. Their use of XML generation is uncommon and unobvious. here's a code snippet that shows how these classes can be used for XML generation:
SAXTransformerFactory saxFactory = (SAXTransformerFactory) TransformerFactory.newInstance();
StringWriter writer = new StringWriter();
try {
TransformerHandler handler = saxFactory.newTransformerHandler();
Result result = new StreamResult(writer);
handler.setResult(result);
handler.startDocument();
AttributesImpl atts = new AttributesImpl();
atts.addAttribute("", "", "name", "CDATA", "");
atts.addAttribute("", "", "version", "CDATA", "6.2");
handler.startElement("http://wbe.ibm.com/6.2/Event/connect", "","connector", atts);
atts.clear();
atts.addAttribute("", "", "name", "CDATA", "connect");
atts.addAttribute("", "", "type", "CDATA", "Event");
handler.startElement("", "", "connector-bundle", atts);
atts.clear();
handler.startElement("", "", "connect", atts);
String paramValue = null;
for (ScenarioParameter param : scenarioParams) {
atts.clear();
atts.addAttribute("", "", "type", "CDATA", param.getType());
handler.startElement("", "", param.getName(), atts);
paramValue = getParamValue(param.getParamId(), params);
handler.characters(paramValue.toCharArray(), 0, paramValue.length());
handler.endElement("", "", param.getName());
}
handler.endElement("", "", "connect");
handler.endElement("", "", "connector-bundle");
atts.clear();
handler.startElement("", "", "system", atts);
String systemName = InetAddress.getLocalHost().getHostName();
handler.characters(systemName.toCharArray(), 0, systemName.length());
handler.endElement("", "", "system");
handler.startElement("", "", "timestamp", atts);
String timestamp = new Date().toString();
handler.characters(timestamp.toCharArray(), 0, timestamp.length());
handler.endElement("", "", "timestamp");
handler.startElement("", "", "loginfo", atts);
String logMsg = "Sending values at runtime";
handler.characters(logMsg.toCharArray(), 0, logMsg.length());
handler.endElement("", "", "loginfo");
handler.endElement("", "", "connector");
handler.endDocument();
System.out.println(writer.toString());
TransformerHandler listens for XML parse events and transforms them to Result. Since we are not using it for parsing, here the handler generates those events like startDocument, startElement and transforms them into Result. The Result thus contains the XML that we wanted to generate. Note that it is the developer's responsibility to take care of the well formedness of the XML. A startElement has to have a matching endElement and a startDocument has to have a matching endDocument.
~Ashish.
Monday, March 30, 2009
Dynamic EJB lookup using Java Reflection
Applications often need to lookup resources based on their JNDI names. The lookup code can be made short and dynamic using Java reflection.
In my application there was a need to lookup an EJB. The JNDI name was dependent on the value of a constant (called cepengine). This is how I implemented the lookup.
I wrote a constants file (constants.properties) with these entries:
cepengine=wbe
eventdefinition.bean.jndi=ejb/com/ibm/eventmanagement/eventdefinition/EventDefinitionServiceHome
eventdefinition.wbe.bean.jndi=ejb/com/ibm/eventmanagement/eventdefinition/wbe/WBEEventDefinitionServiceHome
eventdefinition.bean.home.wbe=com.ibm.eventmanagement.eventdefinition.wbe.WBEEventDefinitionServiceHome
eventdefinition.bean.home=com.ibm.eventmanagement.eventdefinition.EventDefinitionServiceHome
I then wrapped this up with a java class (PropertyLoader.java) with methods to return the various values in the properties file. For instance here is the method that returns the JNDI name:
public String getEventDefinitionServiceJNDI() {
String cepEngine = getCEPEngine();
String constStr = null;
if (cepEngine != null && !cepEngine.equalsIgnoreCase("")) {
constStr = "eventdefinition." + getCEPEngine() + ".bean.jndi";
} else {
constStr = "eventdefinition.bean.jndi";
}
return bundle.getString(constStr);
}
Similarly there is a method that returns the name of the home interface class.
Next I implemented the lookup code using the ServiceLocator pattern in a class aptly named ServiceLocator.java. Here's the code snippet that looks up the home interface object and creates the bean object:
private Object locateEJBHome(String jndi, Class homeClass)
throws ClassCastException, NamingException {
Object ejbHome = ejbHomeObjects.get(homeClass);
if (ejbHome == null) {
ejbHome = PortableRemoteObject.narrow(getInitialContext().lookup(jndi), homeClass);
ejbHomeObjects.put(homeClass, ejbHome);
}
return ejbHome;
}
public EventDefinitionService getEventDefinitionService() {
EventDefinitionService facade = null;
Object facadeHome = null;
PropertyLoader propLoader = new PropertyLoader();
String eventDefHomeName = propLoader.getEventDefinitionServiceHome();
try {
facadeHome = locateEJBHome(propLoader.getEventDefinitionServiceJNDI(), Class.forName(eventDefHomeName));
if (facadeHome != null) {
facadeHome = Class.forName(eventDefHomeName).cast(facadeHome);
Method createMethod = facadeHome.getClass().getMethod("create",new Class[] {});
facade = (EventDefinitionService) createMethod.invoke(facadeHome, new Object[] {});
m_log.info("Received the Event Definition service bean handle");
}
} catch (NamingException ne) {
m_log.severe("NamingException getting event definition EJB facade home."+ ne);
} catch (Exception e) {
m_log.severe("Exception getting event definition service object."+ e);
}
return facade;
}
Let's look at the getEventDefinitionService() method. The method first gets the bean JNDI name and home interface class name using the PropertyLoader. It then uses the generic locateEJBHome() method to look up and return the home object. We then typecast the returned object to actual home class. Using java reflection we get the method object for the method called "create". This is the method that creates the bean object. Note that in my requirement there was a hierarchial relationship between the bean implementations. WBEEventDefinitionService is a subclass of EventDefinitionService. Therefore when I invoke the create method object, I know that the returned object is an instance of either EventDefinitionService or its subclass. However if this is not the case, the same notion of reflection can be extended here as well.
Thus you can see that this code makes is extremely short and easy to do look up the EJB what might have otherwise required separate lookup code for each EJB.
~Ashish
In my application there was a need to lookup an EJB. The JNDI name was dependent on the value of a constant (called cepengine). This is how I implemented the lookup.
I wrote a constants file (constants.properties) with these entries:
cepengine=wbe
eventdefinition.bean.jndi=ejb/com/ibm/eventmanagement/eventdefinition/EventDefinitionServiceHome
eventdefinition.wbe.bean.jndi=ejb/com/ibm/eventmanagement/eventdefinition/wbe/WBEEventDefinitionServiceHome
eventdefinition.bean.home.wbe=com.ibm.eventmanagement.eventdefinition.wbe.WBEEventDefinitionServiceHome
eventdefinition.bean.home=com.ibm.eventmanagement.eventdefinition.EventDefinitionServiceHome
I then wrapped this up with a java class (PropertyLoader.java) with methods to return the various values in the properties file. For instance here is the method that returns the JNDI name:
public String getEventDefinitionServiceJNDI() {
String cepEngine = getCEPEngine();
String constStr = null;
if (cepEngine != null && !cepEngine.equalsIgnoreCase("")) {
constStr = "eventdefinition." + getCEPEngine() + ".bean.jndi";
} else {
constStr = "eventdefinition.bean.jndi";
}
return bundle.getString(constStr);
}
Similarly there is a method that returns the name of the home interface class.
Next I implemented the lookup code using the ServiceLocator pattern in a class aptly named ServiceLocator.java. Here's the code snippet that looks up the home interface object and creates the bean object:
private Object locateEJBHome(String jndi, Class homeClass)
throws ClassCastException, NamingException {
Object ejbHome = ejbHomeObjects.get(homeClass);
if (ejbHome == null) {
ejbHome = PortableRemoteObject.narrow(getInitialContext().lookup(jndi), homeClass);
ejbHomeObjects.put(homeClass, ejbHome);
}
return ejbHome;
}
public EventDefinitionService getEventDefinitionService() {
EventDefinitionService facade = null;
Object facadeHome = null;
PropertyLoader propLoader = new PropertyLoader();
String eventDefHomeName = propLoader.getEventDefinitionServiceHome();
try {
facadeHome = locateEJBHome(propLoader.getEventDefinitionServiceJNDI(), Class.forName(eventDefHomeName));
if (facadeHome != null) {
facadeHome = Class.forName(eventDefHomeName).cast(facadeHome);
Method createMethod = facadeHome.getClass().getMethod("create",new Class[] {});
facade = (EventDefinitionService) createMethod.invoke(facadeHome, new Object[] {});
m_log.info("Received the Event Definition service bean handle");
}
} catch (NamingException ne) {
m_log.severe("NamingException getting event definition EJB facade home."+ ne);
} catch (Exception e) {
m_log.severe("Exception getting event definition service object."+ e);
}
return facade;
}
Let's look at the getEventDefinitionService() method. The method first gets the bean JNDI name and home interface class name using the PropertyLoader. It then uses the generic locateEJBHome() method to look up and return the home object. We then typecast the returned object to actual home class. Using java reflection we get the method object for the method called "create". This is the method that creates the bean object. Note that in my requirement there was a hierarchial relationship between the bean implementations. WBEEventDefinitionService is a subclass of EventDefinitionService. Therefore when I invoke the create method object, I know that the returned object is an instance of either EventDefinitionService or its subclass. However if this is not the case, the same notion of reflection can be extended here as well.
Thus you can see that this code makes is extremely short and easy to do look up the EJB what might have otherwise required separate lookup code for each EJB.
~Ashish
Saturday, November 22, 2008
Women in Web2.0
Here's a listing of women entrepreneurs who made it big in Web 2.0 startups
Most Influential Women in Web 2.0
Ashish
Most Influential Women in Web 2.0
Ashish
Saturday, March 22, 2008
Which language should I learn next?
I had always looked at programming languages as means of achieving the ends. Probably that's why I was stuck with Java for the last four years. That was until the Ruby bug bit me and I was awed by its features. Really learning a new language can be both fun and a learning experience. This blog on Dobbs tell us which languages to focus on.
Learn as many languages as you can
Slashdot has some interesting comments on it:
What programming languages should you learn next?
-Ashish.
Learn as many languages as you can
Slashdot has some interesting comments on it:
What programming languages should you learn next?
-Ashish.
Subscribe to:
Posts (Atom)