Ernest Micklei's Blog

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

Tiny, single-purpose class: ResultToFunctionAdaptor

Every now and then I need a small piece of functionality that perfectly fits into a single, minimal-behavior thus single-purpose class. This time I am developping a Adobe Flex application that uses the RemoteObject facilities. Before invoking a method on a RemoteObject, you have to add two event handlers that will be called with a ResultEvent or a FaultEvent respectively. Typically in the “onResult(event:ResultEvent)” function, one takes the result of the event and calls another function or update a view.

Coding extensions for VisualAge for Smalltalk

The configuration map “Philemon Tools” , available at VAStGoodies.com, now contains an application that enhances the source code browser in VisualAge for Smalltalk. In short, it provides the following features: code completion paste buffer (hold shift while selecting menu item "paste" to select from previous copied source) repeat edit action (like VisualWorks "again") modifier+key combinations (see below) Control+t ifTrue:[ {selected source} ] Control+g ifFalse:[ {selected source} ] Control+Shift+( ( {selected source} ) Control+1 Browse hierachy or implementors Control+2 Browse references or senders Control+3 Show previous occurrence of selected text Control+4 Show next occurrence of selected text Control+5 Show containing Block Control+p Cycle forward through suggestions of completing method|variable|class name Control+Shift+p Cycle backward through suggestions of completing method|variable|class name F2 Format + Save F5 Save F6 Revert F7 Indent selected source F8 Un-indent selected source The code completion part is written by Erik Stel.

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 ?

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.

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.

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.

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.

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: