Ernest Micklei's Blog

things I create and problems I solve, to remember and share

Importing directly from VAStGoodies.com

A small but handy enhancement of the previous submitted VAStGoodies tooling, is the ability to import configuration maps from VAStGoodies directly into your library. This feature is available in the standard Configuration Maps Browser.

  • missing image of /2009/03/import_vastgoodies.png

It uses the same Envy dialog to select versions from available maps.

  • missing image of /2009/03/import_select_vastgoodies.png

As always as soon as one finishes a feature, a new idea pops up. What if the tool can automatically detect the recent changes available for downloaded material ? and does all those  imports for you ? Who wants to contribute?

Tracking Object instances in VisualAge for Smaltalk

InstanceCounter is a tool that can be used to watch the number of instances present in your image.  It can be started from the Transcript Philemon menu or by evaluating:

InstanceCountMonitor openOnClasses: #( ByteArray Process)
  • missing image of instance_count_monitor.png

The menu item named “Pointers 1st instance” opens the PointerFinder tool. This is a tool to find the path on which an object is referenced.  It is based on an implementation in VisualWorks by Hans-Martin Mosner (c) 1995.  The algorithm is based on an idea by Wim Boot.

Interactive compilation for VisualAge for Smalltalk

One of my favorite features of the Cincom VisualWorks IDE is the interactive compiler error handler. When trying to save Smalltalk source that result in compilation errors, the IDE prompts the developer with a menu of suggestions to correct that error. Although the VA compiler can detect these errors obviously, the code browsers merely put the error message in the source.

The application PhilemonToolCompilations has an interactive error handler that implements this behavior for the VisualAge for Smalltalk IDE. Features include:

Tooling available for VAStGoodies

Early this year,  Adriaan van Os announced VAStGoodies.com that wants to be the open source software repository for the VA Smalltalk community. To promote this great initiative, I proposed to create some tools that allow you to contribute to VAStGoodies.com directly from your Smalltalk image. Initially, it includes an editor to edit project annotations and an uploader that takes a versioned ConfigurationMap to publish it. Future versions will enable you to download new and updated versions of projects directly into your repository.

Ring Benchmark - my first concurrent Erlang

Following the advice of Dave Thomas who said: “any developer should learn a new language every year” on RailsConf 2007 in Berlin, I decided that Erlang was going to be my challenge for 2008. However, the first months of 2008 passed without any Erlang until I listened to Joe Armstrong himself at Qcon in London. His talk was inspiring to me so right afterwards I bought his book and start reading it on my flight home.

SelfDiagnose for Ruby on Rails

SelfDianogse is a library of tasks to diagnose a running system with respect to its dependent external resources. Recently, I did some Rails development and was thinking about how to implement it for the Ruby on Rails framework ? Obvious choice is to make a plugin that on installation adds the SelfDiagnoseController.rb to the application. Because of the scripting nature of Rails framework, putting the configuration in XML (as it is done for Java) is not the Ruby-way. So either use YAML or put the configuration directly into the controller. Let’s investigate the latter.

Sorting XMLListCollection by attribute

Just want to share the result of a small puzzle I had about sorting elements of an XMLListCollection by one of the attributes of such an element. At first, I tried sorting the elements of the XMLList I had, but the API does not provide any methods to do that. Bruce Phillips wrote a snippet that pointed me to right direction. So, here it is:

var doc:XML = <root>
      <item name="C"/>
      <item name="B"/>
      <item name="A"/>
  </root>
var collection:XMLListCollection = doc.item
var sort:Sort = new Sort()
sort.fields = [ new SortField("@name", true) ]
collection.sort = sort
collection.refresh()

As expected, the collection will show:

External configuration for SelfDiagnose

Initialization of the SelfDiagnose component is done by reading the resource selfdiagnose.xml which must be located on the classpath of the Web application. This configuration declares the diagnostic tasks that are executed in the context of the Web application. The upcoming release (1.1) will have a new feature that allows you to override the local configuration and dynamically load the configuration from a provided URL:

http://your-app/selfdiagnose?config=http://some-other-server/selfdiagnose.xml

or even a local file can be passed:

Foreign compile-time dependencies in SelfDiagnose

In the upcoming release 1.1 of the SelfDiagnose task library, a new task has been added called CheckEndecaService. Endeca is commercial software that provides excellent Search services to e.g. e-commerce web applications. This particular task checks the availability of that service and can perform a simple query. To implement this, the following snippet has been used:

HttpENEConnection connection = new HttpENEConnection();
connection.setHostname(host);
connection.setPort(port);
UrlENEQuery eneQuery = new UrlENEQuery("N=0", "UTF-8");
ENEQueryResults eneResults = connection.query(eneQuery);
Navigation navigation = eneResults.getNavigation();
long numERecs = navigation.getTotalNumERecs();
double time = eneResults.getTotalNetworkAndComputeTime();

Without a full understanding, you can see that this snippet is using classes which belong to the Endeca API package. SelfDiagnose is a open-source library and therefore can and will not have any dependencies on commerical software. So how can we still use this code without the compile time dependencies?. Of course, in order to execute this code, the runtime dependencies must be available. It does not make sense to use the CheckEndecaService if your application is not using it.

Amazon Web Services Test Drive Needed

Designing and implementing applications that make use of Amazon Web Services such as S3, SQS and SimpleDB, require extensive testing to ensure a robust integration. In addition to scenarios for the “happy flows”, test scenarios should be created to handle the critical exceptional situations. How does my application respond to failures in communication, checksum errors, service unavailability, never ending transactions and extremely frequent or heavy traffic?

In the spirit of test driven development, I see a need for writing up such scenarios and simulate the unexpected behavior of AWS just to verify the correct handling of each exceptional event. Such a Test Drive service would implement the API of services available at Amazon Web Services. It should provide extra control services to put a Web Service in some “testing mode” such as “simulate disk failure”, “simulate terminated http connection” or “simulate invalid access key"or a combination thereof.