Friday, October 31, 2008

Printing Flex Data Grids

One of the questions that I was asked at Colorado Software Summit 2008 after one of my three presentations of Applying Flash to Java: Flex and OpenLaszlo was if there is a way to print the contents of a DataGrid. In this blog entry, I demonstrate simple application of the Flex PrintDataGrid control for doing just that.

The PrintDataGrid control component and the closely related PrintAdvancedDataGrid control component are components meant for visualization only. While they each inherit properties and behaviors from their respective parent classes (DataGrid and AdvancedDataGrid), the print-specific classes should not use any functionality that is associated with user interaction. Note also that the print-specific child classes are in the mx.printing package while their parents are in the mx.controls package.

One of the particularly useful aspects of the Flex 3 Language Reference is that it often includes example code for the language items being described. When the Flex item being described is visual, this reference often includes an actual running instantiation of the example code via the Flash Player. Fortunately, this is true of the PrintDataGrid, which includes multiple examples and does include an actual running Flash-based rendering of the examples.

I am basing my example of using the PrintDataGrid on the DataGrid I previously used in the blog entry Communication Between Two Flex Applications. Here, on one file called SimplePrintDataGridExample.mxml, is the entire code listing demonstrating a basic use of PrintDataGrid.

SimplePrintDataGridExample.mxml


<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
viewSourceURL="http://localhost:8080/Css2008FlashExamples/flex/SimpleDataGrid/SimplePrintDataGridExample.mxml">

<mx:Script>
<![CDATA[
import mx.controls.Alert;
import flash.printing.PrintJobOrientation;
import mx.printing.FlexPrintJob;
import mx.printing.FlexPrintJobScaleType;
import mx.printing.PrintDataGrid;

/**
* Prints contents of DataGrid in print-friendly format.
*
* <p>ADDITIONAL REFERENCES:</p>
* http://livedocs.adobe.com/flex/3/langref/mx/printing/FlexPrintJob.html<br />
* http://livedocs.adobe.com/flex/3/html/printing_3.html
*/
public function printDataGridContents():void
{
const printJob:FlexPrintJob = new FlexPrintJob();

if ( printJob.start() )
{
const printDataGrid:PrintDataGrid = new PrintDataGrid();
printDataGrid.width = printJob.pageWidth;
printDataGrid.height = printJob.pageHeight;
printDataGrid.columns = dataGrid.columns;
printDataGrid.dataProvider = presenters.copy();
printDataGrid.visible = false;
Application.application.addChild(printDataGrid);
while (printDataGrid.validNextPage)
{
printDataGrid.nextPage();
printJob.addObject(printDataGrid);
}
printJob.send();
Application.application.removeChild(printDataGrid);
}
}
]]>
</mx:Script>

<mx:XMLList id="presenters">
<presenter>
<lastname>Johnsson</lastname>
<firstname>Dan Bergh</firstname>
<organization>OmegaPoint AB</organization>
<url>http://softwaresummit.org/2008/speakers/johnsson.htm</url>
</presenter>
<presenter>
<lastname>Kaplan-Moss</lastname>
<firstname>Jacob</firstname>
<organization>Whiskey Media</organization>
<url>http://softwaresummit.org/2008/speakers/kaplan-moss.htm</url>
</presenter>
<presenter>
<lastname>Lan</lastname>
<firstname>Ikai</firstname>
<organization>LinkedIn</organization>
<url>http://softwaresummit.org/2008/speakers/lan.htm</url>
</presenter>
<presenter>
<lastname>Marx</lastname>
<firstname>Dustin</firstname>
<organization>Raytheon Company</organization>
<url>http://softwaresummit.org/2008/speakers/marx.htm</url>
</presenter>
<presenter>
<lastname>Morrill</lastname>
<firstname>Dan</firstname>
<organization>Google</organization>
<url>http://softwaresummit.org/2008/speakers/morrill.htm</url>
</presenter>
<presenter>
<lastname>Moskowitz</lastname>
<firstname>David</firstname>
<organization>Productivity Solutions, Inc.</organization>
<url>http://softwaresummit.org/2008/speakers/moskowitz.htm</url>
</presenter>
<presenter>
<lastname>Opstvedt</lastname>
<firstname>Hermod</firstname>
<organization>DnB NOR</organization>
<url>http://softwaresummit.org/2008/speakers/opstvedt.htm</url>
</presenter>
</mx:XMLList>

<mx:Panel id="mainPanel" width="75%"
title="CSS 2008 DataGrid Example">
<mx:DataGrid id="dataGrid"
width="100%" height="100%"
rowCount="5" dataProvider="{presenters}">
<mx:columns>
<mx:DataGridColumn dataField="lastname"
headerText="Last Name"
width="75" />
<mx:DataGridColumn dataField="firstname"
headerText="First Name"
width="75" />
<mx:DataGridColumn dataField="organization"
headerText="Organization"
width="100" />
<mx:DataGridColumn dataField="url"
headerText="CSS URL"
width="200" />
</mx:columns>
</mx:DataGrid>
<mx:Button click="printDataGridContents();" label="Print!" />
</mx:Panel>

</mx:Application>


The original DataGrid (the one intended for interaction and not for printing that is defined in MXML rather than in ActionScript) is essentially the same as the one I used in the Flex-to-Flex Communication blog entry. A button has been added in this example to kick off the ActionScript method printDataGridContents().

The ActionScript method that is invoked when the button is presssed only directly associate the original, interactive DataGrid with the PrintDataGrid to get column names for the PrintDataGrid. For the source data, the PrintDataGrid is associated (via dataProvider property) with the same XML data that backs the original, interactive grid. Because I don't want the PrintDataGrid affecting the original XML, I used the XMLList.copy() function.

This example also demonstrates how the width and height of the PrintDataGrid can be associated with the FlexPrintJob's width and height.

The following two screen snapshots demonstrate how the Flex application whose code is listed above appears when it is first started and when the Print! button is clicked.


Initial Appearance of SimplePrintDataGridExample



Print! Option Selected via Button Click



When a printer is selected, the print-out of this data looks like that shown in the next screen snapshot.


Printed Output



The Google Chrome web browser was used for all of the above screen snapshots. One of the positive features of Google Chrome is its Developer's "View source" capability. The regular "View Source" capability shows the MXML source code without any translation of the original text and is not very appealing. However, one can choose Develooer->View source on that unappealing display of source to see source with color coding and line numbers as shown in the next screen snapshot.


Google Chrome Display of Developer->View source




I had explicitly made source code available for this Flex application (a process I described in a previous blog entry) so it is nice to have that source code displayed with color coding and line numbers.


Printing from Flex/Flash is Not Without Challenges

In my example here, I depended on the user (me!) to choose to print out in "landscape" mode. Had I printed in "portrait" mode, not all grid information would have been printed. Jesse Warden has a blog entry Forcing Landscape Printing in Flex 2 and 3 that talks about some of the challenges associated with trying to print in landscape mode from Flex.

Even though FlexPrintJob is easy to use, printing from Flex (or more specifically from Flash) can still be tricky, especially when there are multiple pages involved. Some efforts to make this easier include FlexReport and Lin Lin: Tips for using PrintingJob in flex 1.5. Of course, printing has been a difficult issue for many fine programming languages.


Conclusion

The FlexPrintJob object and associated components intended specifically for printing make it possible with relatively few lines of code to print out Flex data. I have found that it does require some trial-and-error to get the printing where I want it. There are also issues of how the user attempts to print (using the web browers's Print icon or option rather than the Flex application provided print capability), but these can be at least partially handled via training and/or use of JavaScript to disable those browser print features. Also, another nice option is to mix Flex with DHTML and have the print support be implemented with a static HTML page created specifically for printing.

Tuesday, October 28, 2008

Praise for the Colorado Software Summit

In a previous blog entry, I discussed some of the reasons I love attending the Colorado Software Summit. While I personally really like this conference, it is interesting but not surprising to see the numerous "big names" in the industry who have called this their favorite conference. Below are some snippets from others that describe some of their individual reasons for liking this conference so much. While the 2008 edition is in the books, I look forward to the 2009 edition in late October 2009.


The following quotations are in reverse chronological order. The hyperlinks on the dates point to the original source of the quotation. Several of these have much more descriptive detail than shown here and so are worth clicking on to read those details.


"Last week, I attended the Colorado Software Summit. This conference took place at the Keystone Ski Resort; located at over 9000 feet in altitude (over 2.8km). It was my first time attending the conference and also my first time as a (public) speaker. I have to say that I was very impressed with the conference. First of all, the format of the conference is very different than more 'traditional' software conferences: every speaker is required to present 2 different topics, 3 times each. The net effect is that it is easy to catch a topic since it is repeated 3 times. It also makes every session much more convivial since the number of participants is smaller, thus making it easy to ask questions and interact with the speakers. At the end of the week, it really felt like we were part of a family."
- Yan Pujante (LinkedIn), 28 October 2008

"I spent last week at 9300ft above the sea level at Keystone (CO) attending the Colorado Software Summit. This is one of the best conferences I have attended in a long time, with just about 300 attendees and serious sessions with very little fluff and absolutely no product/vendor pitch of any kind. This is one conference that I can recommend to any one who value their money and time spent on conferences."
- Subbu Allamaraju (Yahoo!, BEA), 26 October 2008

"... my favorite conference begins in Keystone, Colorado. The reason I like it so much is because it's an annual gathering (this will be my 4th year) with friends and it's somewhat like a vacation, except you get to learn a lot."
- Matt Raible (LinkedIn), 9 October 2008

"The Conference That's Worth Attending: I speak at loads of conferences, but there's one I have been attending for nearly a decade which I'd like to recommend you consider. Every year I go the content is spot on, and I know I have to find new insights for the audience in my annual keynote because they are all probably more qualified to be speaking than I am. [... goes on to list many positive characteristics/benefits of the conference...]"
- Simon Phipps (Sun Microsystems), 5 October 2008

"If you are not familiar with the conference, you should take a look. One look at the full schedule and you will see that (like every year), they’ve got some world-class developers talking about some hot topics ... Some other things that make this conference different and better than the rest:"
- Dave Landers (Oracle, BEA), 3 October 2008, emphasis added

"If you've been following this blog for any length of time, you'll know how highly I value the Software Summit. If you can only make it to one software conference this year, this is the one you should go to. You'll learn things that will save you an enormous amount of time and you'll meet some of the best people in the industry."
- Mike Bowler (Gargoyle Software), 3 October 2008

"Repeatedly, this has been one of my favorite events to attend. I think I have only missed the conference twice and every time, except one, ... Over the years I have made a lot of friends and met a lot of very smart people during the week of the event. If you have followed my blog for a while you may have seen a few of the photos I have posted of the beautiful mountain village of Keystone, where the event takes place. That is another side benefit of attending! The conference also does a good job of keeping up with industry trends."
- Kelvin Lawrence (IBM), 30 March 2007 (see also 3 October 2008: "This really is one of the weeks of the year that I really look forward to.")

"For several years I have been a regular presenter at the Colorado Software Summit, an exceptional conference with a reputation for technical excellence and speakers of the highest caliber."
- Simon Roberts (Dancing Cloud Services, Sun Microsystems), Undated


For a large set of additional recommendations to make Colorado Software Summit a must-stop for software developers, see the feedback to Bill Dudney's 2 November 2003 blog entry.

Logging Method Entry/Exit with Spring/AspectJ

The purpose of this blog entry is to show an extremely simple of example of "logging" entry into and exit from methods using the Spring Framework and AspectJ. The example is so simple that I won't actually use log4j or java.util.logging for the actual logging, although they could be easily added.

The first code listing shows the XML file for the Spring context. The majority of this file is devoted to setting up the Spring/AspectJ/AOP configuration. The terms included in the comments of this file that identify aspect-oriented programming (AOP) concepts are defined in Introduction to Aspect-Oriented Programming.


spring-aop-logging-context.xml


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">

<!-- Normal Spring-exposed bean. -->
<bean id="exampleBean"
class="dustin.spring.aopexamples.ExampleBeanClass">
<constructor-arg value="A Logging Example" />
<constructor-arg value="1.0" />
</bean>

<!-- The Aspect itself. -->
<bean id="exampleLoggingAspect"
class="dustin.spring.aopexamples.LoggingAspect" />

<aop:config>

<!-- The Pointcut(s). -->
<aop:pointcut id="loggingPointcut"
expression="within(dustin.spring.aopexamples.ExampleBeanClass)" />

<!-- The Advice(s). -->
<aop:aspect id="loggingAspect" ref="exampleLoggingAspect">
<aop:before pointcut-ref="loggingPointcut" method="logEntry" />
<aop:after pointcut-ref="loggingPointcut" method="logExit" />
<aop:after-returning pointcut-ref="loggingPointcut"
method="logExitAfterReturn" />
</aop:aspect>

</aop:config>

</beans>



With the Spring configuration (including AOP support for logging) defined, the main class that instantiates the Spring context based on this XML file is shown next. This class doesn't do much other than instantiating the Spring container and using System.out to output the information returned from an example bean class. However, this is enough to demonstrate how the method entry and exit from each method in that example bean class is logged above and beyond what is obvious in the code.


Main.java


package dustin.spring.aopexamples;

import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
* Demonstrate Spring/AspectJ-based logging.
*
* @author Dustin
*/
public class Main
{
/**
* Print out the contents of the provided ExampleBeanClass.
*
* @param example Object whose contents should be printed out.
*/
public static void printContentsOfExample(final ExampleBeanClass example)
{
System.out.println(
"\n\n=============================================================");
System.out.println(" Dustin's Software Cogitations and Speculations");
System.out.println(
"=============================================================");
System.out.println( "Name: " + example.getExampleName() );
System.out.println( "Version: " + example.getExampleVersion() );
System.out.println( "Name (Version): " + example.provideNameAndVersion() );
System.out.println(
"=============================================================\n\n");
}

/**
* Demonstrate logging via Spring AspectJ support.
*
* @param args the command line arguments
*/
public static void main(String[] args)
{
final ConfigurableApplicationContext context =
new ClassPathXmlApplicationContext(
"dustin\\spring\\aopexamples\\spring-aop-logging-context.xml");
final ExampleBeanClass example =
(ExampleBeanClass) context.getBean("exampleBean");
printContentsOfExample(example);
context.close();
}
}



The next class I'll define here is the Aspect class that contains the code that I am going to want to run on top of (above and beyond) the code that is executed normally. Here is that class.


LoggingAspect.java


package dustin.spring.aopexamples;

import org.aspectj.lang.JoinPoint;

/**
* Aspect class for the Spring/AspectJ Logging example shown in the blog
* Dustin's Software Development Cogitations and Speculations.
*
* @author Dustin
*/
public class LoggingAspect
{
/**
* Log method entry.
*
* @param joinPoint
*/
public void logEntry(final JoinPoint joinPoint)
{
log("Entering method " + joinPoint.getSignature().getName() + "...");
}

/**
* Log method exit.
*
* @param joinPoint
*/
public void logExit(final JoinPoint joinPoint)
{
log("Exiting method " + joinPoint.getSignature().getName() + ".");
}

/**
* Log method exit after returning.
*
* @param joinPoint
*/
public void logExitAfterReturn(final JoinPoint joinPoint)
{
log( "Exiting method (after return) "
+ joinPoint.getSignature().getName() + ".");
}

/**
* "Log" the provided String.
*
* @param messageToLog String to be logged.
*/
public static void log(final String messageToLog)
{
System.err.println(messageToLog);
}
}



We now have Spring context (including logging AOP support) configuration created along with a main class that instantiates that context and a class that will serve as our logging aspect. Last, but certainly not least, we need the actual class whose methods' entry and exit will be intercepted and have the additional code specified in the Aspect applied to them. Here is that example class. Note that it is a POJO with no specific reference to Spring or to AOP or to AspectJ.


ExampleBeanClass.java


package dustin.spring.aopexamples;

/**
* An example bean class meant to be used with Spring and AspectJ to demonstrate
* AOP-based logging. This is used for a blog entry in Dustin's Software
* Development Cogitations and Speculations.
*
* @author Dustin
*/
public class ExampleBeanClass
{
/**
* The name of the example.
*/
private String exampleName;

/**
* The version of the example.
*/
private String exampleVersion;

/**
* No-arguments constructor.
*/
public ExampleBeanClass() {}

/**
* Constructor accepting arguments to set my state.
*
* @param newExampleName Name of this example.
* @param newExampleVersion Version of this example.
*/
public ExampleBeanClass(
final String newExampleName, final String newExampleVersion)
{
this.exampleName = newExampleName;
this.exampleVersion = newExampleVersion;
}

/**
* Provide my example name.
*
* @return My example name.
*/
public String getExampleName()
{
return exampleName;
}

/**
* Set/change my example name.
*
* @param exampleName New name for this example.
*/
public void setExampleName(String exampleName)
{
this.exampleName = exampleName;
}

/**
* Provide my example version.
*
* @return My example version.
*/
public String getExampleVersion()
{
return exampleVersion;
}

/**
* Set/change the example's version.
*
* @param exampleVersion New value for my version.
*/
public void setExampleVersion(String exampleVersion)
{
this.exampleVersion = exampleVersion;
}

/**
* Provide my example name with version in parentheses.
*
* @return My name and version if format "Name (Version)."
*/
public String provideNameAndVersion()
{
return this.exampleName + " (" + this.exampleVersion + ")";
}
}



The class above, ExampleBeanClass, has no methods for writing output to the standard output stream. The Main class that calls this via Spring does have some standard output calls to output the contents of this class, but we will see additional logged messages when we run the application because the AOP portion of this will add method entry, method exit, and method exit after return log statements for each method invoked on the ExampleBeanClass. It is the Spring XML at the beginning of this blog entry that ties all of these together.

Here is what the output (focus on middle section) looks like when run with the appropriate libraries (CGLIB, Spring Framework, AspectJ, etc.) on the classpath (all available with Spring with Dependencies download).



The order of output of the "normally expected" output statements as compared to the order of the output of the "logging" statements made via Spring's AOP support is interesting to observe. As one might expect, "before" comes before "after" which comes before "after returning", but all are part of the methods' entry and exit and so all come before a third class can print the output of the returned Strings.

As this blog entry has demonstrated, it is very easy to apply aspect-oriented programming techniques to Java applications with Spring and Spring's AOP support.

Monday, October 27, 2008

Communication Between Two Flex Applications

More than one attendee at the Colorado Software Symposium 2008 who attended my presentation Apply Flash to Java: Flex and OpenLaszlo asked how to allow two different Flash applications (.swf) files in the same web browser communicate with one another. Because of the obvious interest in this, I threw together a brief and simple example that will be included on the CD that is distributed to conference attendees. I thought this might interest others as well, so I am writing this blog entry to include the example and provide a basic outline of how it works. In an attempt to kill two birds with one stone, I also used this example to illustrate embedding SWF applications within HTML using SWFObject.

The main ActionScript class of interest for the Flex-to-Flex communication used in this blog entry is the LocalConnection class. Two instances of the LocalConnection class are required; one for each of the SWF applications that will be communicating. The most important methods used in LocalConnection in this blog entry's examples are the send() and connect() methods.

The ASDoc documentation for LocalConnection provides highly descriptive detail concerning use of the LocalConnection class. Other good introductory information on use of LocalConnection is available in Connecting to Other Flash Player and AIR Instances.

For this example, let's assume that one SWF application is calling another SWF object with the calling SWF application being the "sender" and the SWF application that is being called being the "receiver." The "receiver" SWF application will need to use LocalConnection's connect(<connectionName>) method while the "sender" SWF application will use the LocalConnection's send(<connectionName>, <methodName>,<zeroToManyMethodArguments>) method. As you'd expect, the <connectionName> passed to the LocalConnection object of the "sender" must match that passed to the "receiver" LocalConnection.connect(<connectionName>) call. Also, the <methodName> specified in the "sender" use of LocalConnection.send() must match a method that exists in the "receiver" object. Finally, zero or multiple arguments may be passed via the "sender" LocalConnection call to send() that will be accepted by the prescribed method on the "receiver" object.

I have three source files in this example. The first source file (ExampleSwfObjectPage.html) is the HTML page that uses SWFObject to host both the "sender" Flash application and the "receiver" Flash application. The second source file (DriverDataGrid.mxml) is in MXML and represents the Flex application that will be the "sending" SWF. The third source file (TargetDisplay.mxml) is also MXML and represents the Flex application that will be the "receiving" SWF.


ExampleSwfObjectPage.html

This HTML page uses SWFObject to embed both the "sender" and "receiver" Flash applications (.swf files) in the page. When rendered, they will be obviously differentiable by their different color of backgrounds. The code for this HTML page is adapted from the SWFObject documentation on embedding SWF content with static publishing. Here is the HTML code.


<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<!-- Template adapted from http://code.google.com/p/swfobject/wiki/documentation. -->
<head>
<title>CSS 2008 Flex-to-Flex Example: Driver</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("sourceSWF", "9.0.0", "expressInstall.swf");
swfobject.registerObject("targetSWF", "9.0.0", "expressInstall.swf");
</script>
</head>
<body>
<center><h1>CSS 2008 Flash-to-Flash Example: Driver Page</h1></center>

<div>
<object id="sourceSWF"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
width="100%" height="250">
<param name="driver" value="DriverDataGrid.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="DriverDataGrid.swf"
width="100%" height="250">
<!--<![endif]-->
<p>Unable to find or render the DriverDataGrid.swf Flash Application</p>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>

<div>
<object id="targetSWF"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
width="100%" height="100">
<param name="target" value="TargetDisplay.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="TargetDisplay.swf"
width="100%" height="100">
<!--<![endif]-->
<p>Unable to find or render the TargetDisplay.swf Flash Application</p>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>

</body>
</html>



DriverDataGrid.mxml

This MXML file will be the "source" or "sending" SWF in the example The callOtherFlashApp() method makes use of the LocalConnection instance to call the send method to invoke a method name "displaySelectedPresenter" on a connection named "cssConnection" and pass that method a single String argument that of the full name and organization of the speaker as constructed from the selected item in the DataGrid.


<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
applicationComplete="setUpSenderConnection();">
<mx:Script>
import mx.controls.Alert;
private const connection:LocalConnection = new LocalConnection();

/**
* Set up connection.
*/
public function setUpSenderConnection():void
{
connection.addEventListener(StatusEvent.STATUS, onConnectionSendStatus);
}

/**
* Call another, external Flash application.
*/
public function callOtherFlashApp():void
{
const selectedPresenterName:String =
dataGrid.selectedItem.firstname + " " + dataGrid.selectedItem.lastname
+ " of " + dataGrid.selectedItem.organization;
connection.send("cssConnection", "displaySelectedPresenter", selectedPresenterName);
}

/**
* Handle status associated with communicating with other Flash application.
*
* @param event Status event associated with sending to another SWF.
*/
private function onConnectionSendStatus(event:StatusEvent):void
{
switch (event.level)
{
case "status":
trace("Use of LocalConnection.send() succeeded");
break;
case "error":
Alert.show(
"The LocalConnection.send() call failed: "
+ event.code + "\n"
+ event.toString() );
break;
}
}
</mx:Script>
<mx:XMLList id="presenters">
<presenter>
<lastname>Johnsson</lastname>
<firstname>Dan Bergh</firstname>
<organization>OmegaPoint AB</organization>
<url>http://softwaresummit.org/2008/speakers/johnsson.htm</url>
</presenter>
<presenter>
<lastname>Kaplan-Moss</lastname>
<firstname>Jacob</firstname>
<organization>Whiskey Media</organization>
<url>http://softwaresummit.org/2008/speakers/kaplan-moss.htm</url>
</presenter>
<presenter>
<lastname>Lan</lastname>
<firstname>Ikai</firstname>
<organization>LinkedIn</organization>
<url>http://softwaresummit.org/2008/speakers/lan.htm</url>
</presenter>
<presenter>
<lastname>Marx*lt;/lastname>
<firstname>Dustin</firstname>
<organization>Raytheon Company</organization>
<url>http://softwaresummit.org/2008/speakers/marx.htm</url>
</presenter>
<presenter>
<lastname>Morrill</lastname>
<firstname>Dan</firstname>
<organization>Google</organization>
<url>http://softwaresummit.org/2008/speakers/morrill.htm</url>
</presenter>
<presenter>
<lastname>Moskowitz</lastname>
<firstname>David</firstname>
<organization>Productivity Solutions, Inc.</organization>
<url>http://softwaresummit.org/2008/speakers/moskowitz.htm</url>
</presenter>
<presenter>
<lastname>Opstvedt</lastname>
<firstname>Hermod</firstname>
<organization>DnB NOR</organization>
<url>http://softwaresummit.org/2008/speakers/opstvedt.htm</url>
</presenter>
</mx:XMLList>

<mx:Panel id="mainPanel" width="75%"
title="CSS 2008 DataGrid Example">
<mx:DataGrid id="dataGrid"
width="100%" height="100%"
rowCount="5" dataProvider="{presenters}"
itemClick="callOtherFlashApp();">
<mx:columns>
<mx:DataGridColumn dataField="lastname"
headerText="Last Name"
width="75" />
<mx:DataGridColumn dataField="firstname"
headerText="First Name"
width="75" />
<mx:DataGridColumn dataField="organization"
headerText="Organization"
width="100" />
<mx:DataGridColumn dataField="url"
headerText="CSS URL"
width="200" />
</mx:columns>
</mx:DataGrid>
</mx:Panel>
</mx:Application>



TargetDisplay.mxml

The second Flash application will be the "receiver" and will display the presenter name and organization passed to it. This is represented in the code for TargetDispaly.mxml that is shown next.

The setUpReceiverConnection() method demonstrates how easy it is to tie the receiver to the LocalConnection. The provided connection name matches exactly the String provided as the connection name provided in the sender's invocation of LocalConnection.send(). As importantly, there is a method in this SWF application called displaySelectedPresenter and this name matches that provided in the sender's send() method. This method also accepts the single String with presenter name and organization and processes that passed-in String.


<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundColor="#CCFFCC"
applicationComplete="setUpReceiverConnection();">
<mx:Script>
import mx.controls.Alert;
private const connection:LocalConnection = new LocalConnection();

/**
* Set up connection.
*/
public function setUpReceiverConnection():void
{
connection.client = this;
connection.connect("cssConnection");
}

/**
* Display the provided presenter's name.
*
* Name of presenter to display.
*/
public function displaySelectedPresenter(selectedPresenterString:String):void
{
try
{
targetText.text = selectedPresenterString;
}
catch (error:ArgumentError)
{
Alert.show("Error trying to connect to LocalConnection.");
}
}
</mx:Script>

<mx:HBox>
<mx:Label fontSize="20" text="Selected Presenter: " />
<mx:Label fontSize="20" id="targetText" />
</mx:HBox>
</mx:Application>


With the code in place, we can move onto what the single page with two SWF applications looks like. The following screen snapshots show the single page with two SWF applications running on the Google Chrome web browser. The different colors of backgrounds indicate the two different SWF applications.

The first screen snapshot shows the application after it has been loaded, but no presenter has been selected.



The second screen snapshot demonstrates the application after a row representing a speaker in the DataGrid has been selected (clicked on). The SWF with the DataGrid then communicates behind the scenes to the SWF with Flex Labels and that receiving SWF application renders the selected presenter's name and organization.



This simple example just scratches the surface of SWF-to-SWF communication and the possibilities of the LocalConnection class. There are many more security considerations and uses of send() and connect() depending on your usage of the LocalConnection.


Important Notes

The blog entry SWF-to-SWF Communication Issue blog entry talks about an issue associated with use of LocalConnection for SWF-to-SWF communication that unintentionally crosses different web browsers. This same blog entry also references this example of communication between SWF files using LocalConnection. In his blog entry, Ryan Gorer recommends building a unique String in JavaScript for the connection and supplying that to the sender's send and the receiver's connect methods.

According to the ASDoc documentation, the LocalConnection.send() method is limited to sending 40 KB or less of parameter data. When this is exceeded, an error message like that shown in the following screen snapshot is encountered:



The good news is that this is a relatively high upper limit on the arguments size.

Another blog entry on Flash-to-Flash communication is available in the blog entry How To Communicate Between Multiple Flash Applications with LocalConnection.

Friday, October 24, 2008

Final Day at Colorado Software Summit 2008

Today (Friday, October 24, 2008) was the final day of Colorado Software Summit 2008. As usual, the last day is really half a day with two morning presentations before lunch. My last presentation was in the first slot and I spoke on Java Management Extensions (JMX) Circa 2008 for the third and final time at this conference. After that, I had the privilege of attending Simon Roberts's presentation What OO Doesn't Address. In this blog entry, I'll discuss some highlights from Simon's presentation and then conclude with some thoughts on the overall week-long conference.


Simon Roberts - What OO Doesn't Address

For the last session of this conference, I did not think I could look at another line of code this week and I had heard good things about Simon's presentation (an advantage of having every presentation offered three times each is that you can change your plans to attend something with such positive buzz). Because of this, I attended Simon's presentation. Simon addressed why we, the software development community, largely migrated to using object oriented principles and languages. He talked about the many things such an approach addresses as well as some of the areas in which it only partially addresses or does not address at all the problems we face in software development. This was a nice presentation to end with because it validated many of my own conclusions from years of object-oriented software development experience and added some new ideas for me to think about. His presentation also helped me to recognize more completely where object-oriented approaches help and cannot help deal with development problems.

While there were several aspects of Simon's talk I could focus on, the two things that I will point out here was his reference to R. A. Heinlein's Stranger in a Strange Land (1961) and his coverage of the "Duck Poop Test." Simon referenced Strangers in a Strange Land because it brings up the concept of groks, beings that become so familiar with the surroundings that they actually become part of what they are observing. He stated that developers approach this type of relationship with their code.

I especially liked Simon's reference to the "Duck Poop Test." I was already familiar with the concept of the Duck Test (it is sounds like a duck, walks like a duck, quacks like a duck, it probably is a duck). This is commonly used to describe Ruby's (and other dynamic languages') treatment of dynamically typed variables. Simon used it to illustrate that an object is what we want it to be (such as a duck) if it implements all the behaviors and characteristics necessary for that object (duck). The "Duck Poop Test" involves situations when the object doesn't behave as we expected (designed). How do we handle it when we see this duck poop on the ground? Do we try to work around it or do we fail fast? Simon used the duck poop test is fairly graphical detail and made some motions and quacking sounds for a duck gone insane. It was highly entertaining and, more importantly, got the point across. We need to be very careful about we handle the duck poop (failed assertions and exceptions that occur that break what we designed our object for).


Colorado Software Summit 2008 Overall

This was my fourth time attending after previously attending in 2002, 2003, and 2004. This year's edition was every bit as enlightening, entertaining, stimulating, and tiring as in previous years. By Friday, I have so many things going around in my head and have so many new things I want to try out, that I am eager to go and get started. However, at the same time, absorbing so much in such a short period of time is exhausting.

I learned a few things about the Colorado Software Summit by being a presenter. In the past, as an attendee, I knew of the high quality of the speakers at this conference. However, as a presenter this year, I observed much more closely this year the high-quality (in terms of professionalism, skillsets, experience, and behavior) of the conference attendees. In just about every one of my presentations, I talked to one or more developers who have been using the technologies I was discussing and had applied these technologies in ways that had never occurred to me. I may even blog in the future about some of the ideas that attendees pointed out.

Another lesson I learned more completely as a presenter is the amount of error that presenters put into their conference presentations. I spent significant hours on my two presentations and then the two 90-minute presentations offered three times each mean that the speaker ends up talking for 9 hours in the 4 1/2 day period. There are little things to deal with as a speaker such as remembering what you have said in this session versus a previous session and constantly tweaking slides and examples through the week based on attendee feedback.

It was a great honor to be able to speak at Colorado Software Symposium 2008. While it has been exhausting and extremely time-consuming, it has been equally rewarding. I have learned so much about Flex, OpenLaszlo, and JMX in preparing for the talks and in talking to other users of these technologies. I have enjoyed hearing about people who were looking for an answer to a particular problem and have now found that answer in Flex, OpenLaszlo, or JMX. I have also learned so much about the wide variety of technologies covered here and want to go apply some of those technologies to problems I need to resolve.

The dates for Colorado Software Summit 2009 are October 25-30, 2009. It will be here before we know it.

Thursday, October 23, 2008

Fourth Day at Colorado Software Summit 2008

Today (Thursday, 23 October 2008) was the fourth day of presentations at Colorado Software Summit 2008. As usual, I find myself feeling like there is very little room left to cram any more information into my brain and process it coherently. As with all my summaries of Colorado Software Summit presentations, it is important to note that any errors are probably a result of my misunderstanding or misinterpretation of what was stated.


Simon Phipps - The Adoption-Led Market: The Third Wave of Open Source

Thursday mornings at Colorado Software Summit traditionally begin with a keynote presentation from Simon Phipps and this year was no different. It is no surprise that, as Chief Open Source Officer at Sun Microsystems, Simon's annual keynote addresses emphasize open source. The title of this year's keynote address was The Adoption-Led Market: The Third Wave of Open Source.

In his address, Simon used Third Wave of Open Source to describe commercial and government embrace of open source. Simon referred to the first wave of open source as the wave when "fanatics" or "specialists" (depending on your perspective) were the only ones involved. The second wave of open source occurred when forward-thinking software developers started understanding the advantages of open source and now the third wave involves commercial and governmental organizations embracing open source.

Simon described the current procurement methods used by many organizations and stated that he believes that within ten years the majority of organizations will be using adoption rather than procurement to try out products and then adopt the product once it has been proven. Standards and open source together make this possible because an organization can try out the standard-based open source product with the freedom to switch to an alternate implementation of the same standard. Organizations also have the freedom to choose whether to purchase subscriptions for support and other benefits Simon outlined that often go with subscriptions. I have noticed that we already seeing this model with open source products from SpringSource (Spring Framework), Adobe (Flex), Laszlo Systems (OpenLaszlo), Sun (NetBeans and GlassFish), etc.

Simon made many more good points and outlined five lessons of 2008 related to open source freedom. He also referenced Alvin Toffler (The Third Wave) and pointed out the usefulness of ScribeFire 3.1.3. Among many other things Simon covered, he discussed freedom through substitutability rather than interoperability, the standardization processes, cloud computing, and much more. There were a lot of questions and comments, which usually reflects a lot of interest in the topic.


My Last Presentation of "Applying Flash to Java: Flex and OpenLaszlo"

In my third and final time presenting Applying Flash to Java: Flex and OpenLaszlo, I was happy to be able to make a segue from Simon Phipps' keynote about the evolution to an adoption-led market fueled by the compelling combination of open source and standards to Flex and Open Laszlo. These fine RIA frameworks are available for no charge and are open source, but support and other features can be purchased for organizations that desire that support. In other words, organizations have the freedom to use Flex or OpenLaszlo either on their own or by paying for levels of support.


Eric Schreiner - Real World Groovy: How to Add Scripting Functionality to Your (Existing) Application

After another excellent lunch and a brief walk around the Keystone Resort Lake, I attended Eric Schreiner's Real World Groovy - How to Add Scripting Functionality to Your (Existing) Application. While I have had a cursory awareness of Groovy and what it is, the presentation gave me a clearer perspective on Groovy. Eric pointed out that a differentiating aspect of Groovy is that Groovy compiles to Java .class files.

I also thought it was interesting that Groovy will autogenerate get/set methods for data members if they are not provided. Groovy's API is documented at http://groovy.codehaus.org/api/index.html, but what may be even more interesting is that Groovy extends the Java SDK and these extensions are documented at http://groovy.codehaus.org/groovy-jdk/. An example that Eric showed is the File.getText() method. Eric pointed out that Java SE's File class does not have a getText() method but Groovy adds one to it.


Matthew Wakeling - Performance Engineering from Scratch

Matthew Wakeling's excellent presentation Performance Engineering from Scratch was next on my schedule. I had changed my mind from going to another session to go to this one instead after a colleague told me how good it was. This is another advantage of the conference offering three presentations of each topic -- it allows word of mouth to help guide decisions about which presentations to attend.

Matthew's presentation had high ambitions of covering performance theory (including Big O notation), sorting algorithms, lookup algorithms, concurrency issues, database performance issues, and "funky stuff." It was useful to be reminded of some of the Computer Science 101 principles I have not thought about for a while and to learn some new things as well. I especially liked Matthew's coverage of the algorithm implementations used with various Java Collections and the strength of each.

Matthew's presentation included a reference to Tim Bray's On the Goodness of Binary Search and to the Java implementation java.util.Arrays.binarySearch(...). He also talked about the usefulness of TreeMap, TreeSet, HashMap, HashSet, LinkedHashMap, LinkedHashSet, java.util.BitSet, and several useful Java concurrent collections.

Matthew discussed behavior of String.equals and Object.hashCode versus String.compareTo and observed that String.compareTo terminates its checking of equality in characters as soon as it sees a mismatch. Using StringBuffer (or StringBuilder) instead of String for concatenation came up as an "obvious" performance issue. There was also some discussion of the potential performance advantages of moving significant functionality into the database versus the potential lower cost of scaling hardware running Java middleware and allowing that middleware to do more processing.

Matthew discussed the performance implications of reflection and emphasized the cost of catching exceptions related to reflection. Matthew showed several diagrams comparing performance of different collections and algorithms on those collections. He said he will be putting these tests on the conference CD and I am looking forward to trying them out when the CD arrives. The animations on these slides that showed the algorithm sorts and binary searches. These animations likely cost Matthew significant effort, but they were really good at helping me to see very clearly and easily how the various algorithms work. It was clearest presentation of search and sort algorithms that I have ever seen.


Matt Raible - What's Coming in Spring 3.0

As Matt Raible explained in his blog entry The Colorado Software Summit and Spring 3.0's SVN, Spring source code is contained in two repositories. There is also an explanation of what is delaying the release of Spring 3's early release versions. Matt covered the basics of the Spring Framework, the history of the Spring Framework, and outlined the anticipated improvements coming in Spring 3.0 in his What's Coming in Spring 3.0 presentation.

Matt mentioned several useful software development resources in his presentation including the Spring Kick-Start project he and Thomas Risberg host on Google Code for helping learn to use Spring quickly, JavaRebel for reloading class files dynamically, the DZone reference card on Spring Framework Annotations, and a reference explaining the Unified Expression Language (unifies JSP and JSF expression languages).

Matt has summarized this presentation on his blog and that summary includes a copy of the actual presentation.


Overall Comments for the Day

Thursday at the Colorado Software Summit is always the day I really start to feel myself being saturated with new knowledge. I have many things on my to-do list now to look into further or try out and am looking forward to it. I still have one presentation to give. I will be presenting JMX Circa 2008 for the third and final time at this conference first thing tomorrow morning. It will be interesting to see how many people attend, especially considering that it is being held in one of the very long conference rooms (Red Cloud Peak).

With only two sessions left in this year's conference, I have noticed that many of the conference attendees seem to be using Flex, Google Web Toolkit, or one of the Ajax/DHTML frameworks for their RIAs. I only heard one person state that she was using JavaFX. It has been very rewarding to talk to other people who are using Flex, OpenLaszlo, and JMX (my topics at the conference) and to hear some of the creative things they are doing with these technologies.

I did not win the iPod or any of the other items in the Thursday larger-than-other-days daily raffle, but it was still a great day to be at the Colorado Software Summit, to be in beautiful Keystone, Colorado, and to be learning new things.

Wednesday, October 22, 2008

Third Day at Colorado Software Summit 2008

Today (Wednesday, 22 October 2008) was the third day of presentations at the Colorado Software Summit 2008. It had started snowing last night and there was snow on the roads this morning. It seemed to snow most of the day, though it had melted during the warm afternoon. However, the snow started sticking again as the weather cooled off. Today was the day of the conference in which I was scheduled to present each of my two presentations. For the rest of the week, I only had (Monday/Tuesday) or have (Thursday/Friday) one session each day.


Hermod Opstvedt - Pimp My Webapp (with Google Web Toolkit)

Google Web Toolkit is another one of those things which I have had a passing familiarity with having seen it presented at a Denver Java Users Group meeting and reading about it. Even though I doubted (and still doubt) that I'd choose to use GWT over Flex or OpenLaszlo, I was very interested in this presentation because I do think GWT has some attractive features and because so many people at the conference who attended Matt Raible's Appceleration presentation and Kelvin Lawrence's UI BOF seem to be using it. Hermod Opstvedt's presentation was far more in-depth than previous presentations that I have seen on GWT and I learned quite a few new things.

As Hermod was speaking about the advantages of GWT, I was reminded of how similar many of these advantages are to those of using Flex or OpenLaszlo. For example, GWT, Flex, and OpenLaszlo abstract browser-specific details from the developer and both GWT and Flex/ActionScript are arguably more friendly to Java developers than JavaScript. Hermod also covered using GWT with Hibernate and several other products.


Filip Hanik - Zero Latency HTTP — Using Comet with Apache Tomcat

I attended Filip Hanik's presentation on Bayeux the day before this and then attended the presentation Zero Latency HTTP — Using Comet with Apache Tomcat today. Filip is a Tomcat committer and I appreciated his brief historical background regarding Tomcat and HTTP (which Filip pointed out has been stagnant for several years since HTTP 1.1). I really appreciated Filip's coverage of Comet and feel like I have a significantly better understanding of where Comet implementations are at. It is discouraging that Comet implementations are still far from standard and differ for each server. I spoke with Filip after his presentation and determined that Bayeux might be the best best currently to play with Comet concepts.


Overall Comments for the Day

Because I presented twice today, I did not get to attend as many other sessions as I would have liked. However, I appreciated the greater exposure to Comet and Google Web Toolkit. I have been very impressed so far with the quality of the attendees of this conference. As a first-time speaker at Colorado Software Summit, I see a different side of the attendees than I have in the past. I have always known that the attendees of this conference are bright, inquisitive, experienced, and knowledgeable, but I have noticed this time that they ask particular insightful questions in the presentations and that they are very kind about telling me things they like about my presentations. I sat by an attendee at lunch today who is attending the conference for his ninth time. While this is impressive, there are two individuals who have attended all 17 editions of the conference and many who have attended ten or more times.

It has already been a great week and we still aren't done. I'm afraid, however, that I still have not won the daily raffle for an iPod Nano.

Second Day at Colorado Software Summit 2008

Yesterday (21 October 2008) was the second day of presentations at Colorado Software Summit and I learned quite a few new things as well as solidifying my understanding of many more topics. As I stated in my blog entry about the first day of presentations, comments here are my own interpretations of what I thought I heard in these sessions I briefly review here. If something is stated incorrectly, it is likely due to my misunderstanding.


Subbu Allamaraju - RESTful Web Applications - Facts vs. Fiction

In Subbu Allamaraju's presentation RESTful Web Applications - Facts vs. Fiction, he outlined problems with commonly used web frameworks that lead to most web applications not being very REST-friendly. For example, Subbu pointed out how JSF and REST approach the web from opposite extremes and stated that JSF can be patched, but not fixed. Subbu similarly addressed two other web frameworks covered at Colorado Software Summit (Google Web Toolkit and SOFEA/Appcelerator).

Dave Landers, a speaker at several editions of Colorado Software Summit, states that this was his favorite session of the day in his blog entry.

UPDATE (28 October 2008): Subbu has posted the slides for this presentation. His bullet that, from a REST perspective, JSF is not fixable has caused some contention, but there certainly seems to be some valid points in his argument.


Denise Hatzidakis - Put Your Feet Up and Take a RESTful Approach

I always like Denise Hatzidakis's presentations. For one thing, they are rapid delivery, a style I happen to like both as a listener and as a presenter. Denise's presentation Put Your Feet Up and Take a RESTful Approach was exactly what I was looking for in a REST presentation at this conference. I have dabbled in REST some and managed to use it to a minimal degree, but Denise's presentation did a nice job of filling in some holes in my knowledge. Specifically, Denise did a nice job of articulating when to use REST versus WS-* web services. Denise provided a thorough overview of REST from including its history, where it fits, its advantages, REST with HTTP, and REST SOA. With so many people taking one side or another in the REST versus WS-* debate, it was refreshing to see a presentation on where each best fits.


Filip Hanik - What the Bayeux? Understanding, Using, and Developing with the Bayeux Protocol

After presenting my presentation Java Management Extensions (JMX) Circa 2008, I attended Filip Hanik's presentation What the Bayeux? Understanding, Using, and Developing with the Bayeux Protocol. As Filip suggested, it would probably have been helpful to attend his presentation on Comet first, but I did have some minimal exposure to Comet conceptually and was able to understand what Bayeux is attempting to do. I appreciated Filip's honesty in discussing the good and the bad of Bayuex Protocol. I think the Comet concept seems promising, but I would like to see more standardized approaches that are easy to use implemented for it. Bayeux has the potential to be concrete implementation that helps to do this. Comet seems to have a small but very enthusiastic following as evidenced at Comet Daily.


Matt Raible - Building Rich Internet Applications with Appcelerator

For the last session slot of the day, I attended Matt Raible's Building Rich Internet Applications with Appcelerator. Matt asked who was developing Rich Internet Applications and what tools/frameworks they were using for these. In this particular session's audience, it seemed to be pretty even between Google Web Toolkit and Flex.

Matt referenced the article Life Above the Service Tier as he explained the history of SOFEA (for Service-Oriented Front-End Architecture) and the history of the closely related SOUI. Matt recognized the many common features of SOFEA and SOUI in the blog entry SOFEA: Also Known as SOUI.

I had not heard of Appcelerator until I saw it in the agenda for this conference. I spent about 10 minutes reading about it at that time, but then decided to wait to let Matt boil down the essentials at the conference. This actually (but not too surprisingly) paid off handsomely as I learned what I believe I needed to know regarding Appcelerator. Matt highlighted many positives of Appcelerator, but I don't think I see enough advantages to move from Flex and OpenLaszlo to Appcelerator. I appreciate that Appcelerator seems to adopt the best features of the various web framework rather than trying to reinvent them. For example, Matt showed how it uses several Flex components for highly fluid visual effects. A useful site that Matt pointed out for us to look at is Appcelerator in Five Minutes. This provides a mechanism for easily seeing how Appcelerator works. It reminds me of Laszlo in Ten Minutes.

Matt summarizes his own session in his blog and includes his slide presentation in that blog entry.


Kelvin Lawrence - BOF - Current Choices when Building a Modern Lightweight User Experience (UX)

This Birds of a Feather session organized and moderated by Kelvin Lawrence was enlightening as we shared experiences with Flex, jQuery, and other approaches to Rich Internet Applications. Several people who are trying to decide on an RIA framework attended and asked great questions that forced me to remember what interested me about Flex and OpenLaszlo in the first place.


Overall Comments for the Day

The main topics that I wanted to learn more about at the Colorado Software Summit this year were REST, OSGi, and Comet/Bayeux. Even with two of my own presentations in the first two days, I was able to see the OSGi presentation, three REST presentations, and the Bayeux presentation. In addition to these, it was nice to learn more about Appcelerator and iPhone development. I am sorry to report that I did not win tonight's raffle for the iPod Nano.

First Day at Colorado Software Summit 2008

Today (Wednesday, 22 October 2008) is actually the third day of presentations at Colorado Software Summit (Monday was the first day), but I have been too busy tweaking slides and examples for my own presentations and listening and learning at other presentations to take the time to write even a short summary blog on the Colorado Software Summit. Also, I have learned about or been made aware of many new things I want to further investigate.

By the way, the observations I mention below are my own understanding of what I thought I heard. Because I tend to focus on things I am not very familiar with, it is certainly possible that I misheard or misinterpreted something.


John Soyring - Change ... that Matters

The annual tradition of opening the presentation portion of the conference with a keynote presentation by John Soyring continued this year. John's presentations are always at a higher level than I typically like to attend, but they are fitting for kick-offs of the conference. They help to tie in why all the more detailed subjects of the conference matter and what trends and future possibilities may impact us and how we can be better prepared for those.

In this year's opening keynote presentation ("Change ... That Matters"), John summarized the 2008 IBM Global CEO Study ("The Enterprise of the Future"). Among the many observations he made related to this study, he mentioned Extensible Business Reporting Language (XBRL). A couple conference participants later said that this is relatively onerous to use. John also talked about the importance of governance, the strong movement toward Web 2.0 (particularly RESTful approaches and mashups), and the progress on the World Community Grid.

John Soyring also addressed the need for nearly every organization to be able to adapt, respond to, and take advantage of change. He also outlined some differentiating characteristics between "financial outperformers" and average performers. Soyring's presentation may be available online in the future because some of his previous presentations are available online: 2007 Opening Keynote and Web 2.0: The Next Generation (2006).


Yan Pujante - Building LinkedIn's Next Generation Architecture with OSGi

One of the subjects I was most interested in learning something about at CSS 2008 was OSGi. I have read quite a few introductory things on it, but really wanted someone to deliver the details to me in any easy way and Yan Pujante's presentation LinkedIn's Next Generation Architecture with OSGi did just that.

Before this presentation, I could have muddled my way through a one or two sentence description of what OSGi is and how one would use it in a Java environment. While I'm obviously no expert on OGSi with only a single 90-minute presentation to back me up, this presentation has given me the ability, I believe, to describe relatively coherently what OSGi is and how it can be used in a few sentences. I also picked up a few interesting details: (1) OSGi module are JAR files with specific manifest file name/value settings, (2) Java classes in the unnamed package (no explicit package statement) cannot support OSGi because its bundling depends on package structure, (3) OGSi versioning is specified with numerals separated with periods and not with strings, (4) no or little OSGi version slack is preferable in most cases.

Matt Raible, another presenter at Colorado Software Summit 2008, summarizes Yan's presentation here.

UPDATE (28 October 2008): Yan has posted his slides for this presentation.


Subbu Allamaraju - Pragmatic REST

Subbu Allamaraju opened his Pragmatic REST presentation with a slide with much of the same content as in his REST Fluff blog entry. Subbu went on to talk about other practical aspects of using REST and emphasized the proper use of HATEOAS (Hypermedia As The Engine Of Application State).

UPDATE (28 October 2008): Subbu has posted the slides for this presentation.


Tom Harrington - Getting Started with iPhone Development

I attended Tom Harrington's presentation Getting Started with iPhone Development. This conference has four well-timed presentations on iPhone development considering the really recent relaxation of the non-disclosure agreement.

Tom provided the type of details I was looking for and I have to admit I lost some interest in iPhone development when he explained the many requirements involved. These include the requirement to use a Mac for development (not a problem for many of the conference participants, but it is for some) and having to use the Objective-C language. These and other restrictions Tom mentioned are briefly discussed also here. This is another example of a presentation that was highly useful even if it was only to let me quickly (within 90 minutes) realize how much or how little time I want to invest in the near future in learning more about the topic.


Overall Comments for the Day

I ended the day giving my first presentation of the conference. I presented in one of the large rooms (Red Cloud in the Keystone Conference Center). I felt like the presentation went well and the great questions from the participants made me feel even better about it. Although I prefer presenting in smaller rooms in the conference center, I thought it went well overall.

A disappointment of the day for me was not winning the iPod Nano in the daily raffle.

Saturday, October 18, 2008

Command-line JMX Management with jManage

Although JConsole and VisualVM offer freely available and highly useful JMX clients, there are some features of jManage that make it worth using in conjunction with these other JMX clients.

Two of jManage's features that are particularly useful are the interfaces it exposes for managing and monitoring JMX-enabled applications. jManage provides a web interface that can be useful in situations where the managing and monitoring client needs to access server-side JMX support behind a firewall. This same advantage can be achieved with an HTML Adapter or with with the JMX Web Services Connector, but the Adapter is not a standard JSR 160 connector and the JSR-160-compliant Web Services Connector is not yet finalized.

The following screen snapshot shows what the jManage web interface looks like.



For this blog entry, I want to focus on the second interface mechanism that jManage provides for managing and monitoring JMX-enabled applications. The command-line interface (CLI) that jManage provides can be used to run scripts or to run jManage interactively. In this blog entry, I'll focus on running jManage's command-line interface (CLI) interactively.

For the brief examples I demonstrate in this blog entry, I will be using the server-side code from my previous blog entry on JMX Querying to run jManage against.

If you have not set up jManage before, there are only a few steps to follow to get it up and running. I summarize the steps here, but you should reference the JManage Installation wiki page for complete details. The steps you must follow to start using jManage include:

1. Set JAVA_HOME appropriately. Mine is currently set to C:\Program Files\Java\jdk1.6.0_07 for these examples.

2. Unzip/unjar the contents of the downloaded jManage file (such as jmanage-2.0-RC1.zip in my case) into an installation directory (C:\jmanage-2.0-RC1 in my case).

3. Go to the "bin" directory of your jManage directory with the newly unjarred/unzipped contents of the jManage download and run the appropriate (for your operating system) "keygen" command. When prompted for the password (password for "admin"), I just used the default "123456" (no quotes) for this example.

4. From the same "bin" subdirectory in your jManage installation, run the appropriate (for your operating system) "startup" command. You will need to provide the password you specified in step #3.

5. In a web browser, navigate to http://localhost:9090/ if running the web browser from the same machine as jManage or else replace localhost with the name of the machine on which jManage is running.

6. At this point, you'll have a typical web form login page. Enter "admin" for the "Username" and the password you created in step #3 for "Password." Once you have authenticated you can browse this web application. For now, though, I will do just enough to use the command-line interface. The step necessary for this is to create the jManage application and associate it with my application exposing a JSR-160 compliant connector.

7. The following screen snapshot shows the fields that need to be set up for a JSR-160 JMX connection. I got to this screen by choosing to create a new jManage application and then selecting JSR-160 as the type of the application.



8. When step #7 has been accomplished, jManage's web page will list the associated applications as shown in the next screen snapshot.



Rather than using the web browser to manage our applications, we can use the jManage command-line interface to manage and monitor our JMX-friendly application. While we could write and run a script file with the jManage command-line tool, I'll focus on using the command-line tool interactively.

It is simple to start the interactive jManage command-line tool. Assuming the default password setting for admin, it is simply a matter of running the command "jmanage -username admin -password 123456". Because no script file was specified, the command-line tool will run interactively as evidenced in the next screen snapshot by the jmanage> prompt.



The above screen snapshot not only demonstrates running of the jManage command-line tool, but also demonstrates how the "help" command displays usage information and the "apps" command displays applications jManage is managing. In this case, there are three applications: jManage itself, an Oracle database connection, and the JMX Querying Example.

From the usage information printed out for the "help" request, we see that we can run several different and interesting management commands. In the next screen snapshot, I demonstrate using the "mbeans" command to see the MBeans associated with the "JMX Querying Example" application. This screen snapshot also demonstrates a very important point. You cannot specify single values with spaces by surrounding them with quotes. Instead, you must use the tilde character (~) in place of any spaces. So, the request for the MBeans for the JMX Querying Example was actually expressed as "mbeans JMX~Querying~Example". This displays the MBeans associated with this application that we would see when using similar queries with JConsole.



If I wish to find metadata about one of the MBeans returned from the "mbeans" command, I can use the "info" command as demonstrated in the next screen snapshot. As the snapshot indicates, I use the command "info JMX~Querying~Example/dustin:type=complex,name=One". The returned output is metadata information about that particular MBean, including the ObjectName, the underlying class, a description, the attributes, and the available operations.



I can use the "execute" command of the jManage CLI to execute an operation. This is demonstrated in the next screen snapshot where I use the command "execute JMX~Querying~Example/dustin:type=complex,name=One/retrieveStatusString" and get that result: "Successful".



The "help" usage information supplies other commands that can be run from the jManage CLI as well. Also, additional information can be retrieved for each command by running that command without arguments. The command's usage will then be displayed.

I mostly use JConsole and VisualVM for my JMX client needs. However, jManage provides significant advantages such as firewall friendliness via its web browser interface and script-friendliness via its command-line interface. In this blog entry, I've attempted to demonstrate how easy it is to apply jManage to manage JMX-enabled applications supporting a JSR-160 compliant connector. I did not demonstrate the use of a script with jManage and I also did not demonstrate many of jManage's other features, including its JFreeChart-based and customizable dashboards.