smalltalk

Smalltalk collect on Go slice of int

package main import "fmt" type intSlice []int func (i intSlice) collect(block func(i int) int) intSlice { r := make(intSlice, len(i)) for j, v := range i { r[j] = block(v) } return r } func main() { numbers := intSlice{1, 2, 3} squared := func(i int) int { return i * i } fmt.Printf("%v", numbers.collect(squared)) } Try it. Implementations of select,inject,detect are left as an excercise for the reader.

Soek.goodies.st improved

The site soek.goodies.st gives access to the sources of open-source Smalltalk libraries and frameworks. A big advantage to developers is that they can explore Smalltalk classes without having to successfully load them into one of the Smalltalk dialect platforms. Recently, I have changed much of the Smalltalk generator and HTML/Javascript generated code. Formerly, all Smalltalk source was highlighted using a client-side Javascript library. This resulted in long page loading times because it had to iterate through all DOM elements and replace the HTML content by a post-processing (using regex) result.

Melissa for VA Smalltalk

Melissa is a simple tool that can help in building development and runtime images in a continous integration environment. It is being used extensively to create daily builds for Smalltalk images. This post describes the steps to use Melissa for VA Smalltalk 8+. The intended way to use Melissa is to start with a clean VA image, load the Melissa config app and save it as melissa.im. In order to tell Melissa what to build, you need to start that image passing the command line parameter “-melissa buildscript.

Google API access from Smalltalk using JNIPort

JNIPort for VisualWorks provides a way to use Java and its huge number of available libraries directly from Smalltalk. For example, to access the Google Spreadsheets APIs and Tools, you need to download the Java client libraries and all its dependencies. The paths to there Jars must be known to the JVM and can be set through JNIPort. For easy deployment, I put together a single jar using an Ant build script such that the Runtime settings could be:

JQTouch library support for Seaside

One way to build applications for the iPhone is to create a Web application that tries to look and behave like a native one. Currently, many Javascript libraries are being developed that try to accomplish just that. One of the big reasons for choosing this route is that developing such applications is so much easier compared to the Apple-way (learn Objective-C, build and test on the local emulator and try to get it accepted by AppleStore).

soek.goodies.st - exploring open-source Smalltalk libraries

Soek is a Smalltalk application that provides a different way to navigate through documentation and source code of a Smalltalk library. Instead of the classic multi-list browser view in an image, Soek offers a flat view on all methods and classes and is build using the Seaside Web framework. missing image /2009/11/screen-shot-2009-11-13-at-6-33-24-pm.png I discovered this way of publishing a framework when I worked with Rails and did most of my searches on Railsbrain.

Making a package visible to WebVelocity

If you want an existing package to register as a WebVelocity one and as a result make it visible to the browser page, you can evaluate this script: (Store.Registry packageNamed: 'Your-Package-Name') propertyAt: #application put: true; propertyAt: #namespace put: 'Your-Namespace'; propertyAt: #velocityThemeName put: 'Default'. which I found when looking for the newApplication functionality in the image.

HypertextLogger for server application logs

Logging can be very helpful in analyzing the (faulty) behavior of a server application in response to client requests. HypertextLogger is a simple component that produces HTML in response to logging instructions. Its main purpose it to provide a better readable log file. By choosing you favorite CSS, you can highlight what is important and leave other information unfocused (timestamps). missing image /2009/06/hypertextlogger.png Upon creation of the logger, it produces a new .

Getting started with Glare-DataServices

Glare-DataServices is a framework for building Flex Remoting services in VisualWorks Smalltalk. In this post, I will guide you through the steps for creating a small application that demonstrates the use of the framework. Install the bundle First, you have to connect to the Cincom Public Store Repository. Then open the list of Published Items and load the bundle GlareDataServices. It includes the Glare bundle and Glare-DataServices packages. The required dependencies AT MetaNumerics and Opentalk are automatically loaded if not present.

VAStGoodies.com services API

To make the VAStGoodies client work right from the VA image, I needed a service API in addition to the Seaside application that is running on VAStGoodies.com. Requirements for that service include “get all available configuration map names” and “get a download url for a particular version of a configuration map”. Instead of implementing a full-blown end-to-end SOAP based Webservice, I decided to implement a much leaner RPC-style design that simply returns Smalltalk expressions.

Getting Monticello package changes into VisualWorks

The Cloudfork project is available for the three larger Smalltalk implementations: Squeak/Pharo, VA Smalltalk and VisualWorks. For maintaining the ports based on the Squeak implementation, we use the Package-Exporters package. For porting to VA Smalltalk, we are using the VAPackageExporter as explained by Adriaan van Os. One important feature is the ability to maintain the port based on the changes to a project rather than repeating the all-in-one export. For maintaining the VisualWorks port of Cloudfork, I extended the Package-Exporters project with a VWPatchExporter that can be used to export changes in the VisualWorks XML format.

Changing the browser font in VisualWorks

Today I spent some time figuring out if and how I could change to default text font of the Smalltalk browsers in VisualWorks (76nc). For years I have been using my favorite coding font Dina (Win only) in any other tool such as Eclipse. Having this font also in VisualWorks would be very pleasing. So I browsed through the source code of Look policies, Font policies and Font descriptions to find any clues.

Executable operation specifcations in Glare-DataServices

Glare< is a Flex Remoting and Messaging server written in VisualWorks Smalltalk by Philipp Bunge. I am extending his work with Glare-DataServices which basically provides a HttpServlet that dispatches operation invocations send from a AMF client (Flex,AIR) to Smalltalk objects. To work with Glare-DataServices, you need Smalltalk classes that implement operations and ActionScript classes that have corresponding methods in which these operations are invoked remotely. Because both classes (client and server-side) must have the same signature, it is clear that code generation can be very helpful.

Method Categorization and Browse Unsent for VA Smalltalk

Method categorization is an important part of documenting the interface of classes, which is quite unique to Smalltalk to my knowledge. Therefore most developers spent time reorganization their methods in commonly known categories such as initialize-release, accessing and instance creation. PhilemonToolMethodCategories is a goodie that contains some extensions to the standard browsers that deal with categorization. In particular, it offers a different “Move to category…” menu item that pops up a menu with existing categories and another submenu with suggested category names.

Class Search Browser for VA Smalltalk

The Classes Interface Browser is a small search tool to quickly find a Smalltalk class or one of its methods. The two inputs fields on top provide filters for class names and method names of that class. From a selected class or method, you can open a Class Browser by double-clicking. Using the list popup menus, you can navigate (superclass, subclasses…) in the class hierarchy, add a breakpoint and navigate (redefined, overridden) in the method implementation hierarchy.

VAStGoodies.com Statistics

VAStGoodies.com is the open source software repository for the VA Smalltalk community which was launched early this year by Adriaan van Os. As of today, the vastgoodies site has been extended with a page showing the activity statistics. Main purpose of this page is to let the community see that contributions are indeed downloaded and to give credits to those that maintain them. Similar information has been available on Squeaksource for some time now and I was surprised to experience the effects on me with this kind of monitoring.

Navigating Inspector for VA Smalltalk

This goodie is also known as the “Diving” inspector as it allows you to navigate through an object structure by following each variable on a double-click. The inspection depth is shown in the inspector just above the “self”. You climb up the structure by clicking on that list item. missing image of /2009/03/navigating_inspector.png Once loaded into your image, it takes over the standard inspector but uses any dedicated inspector as its model (e.

FileBrowser for VA Smalltalk

FileBrowser is a new addition to the configuration map “Philemon Tools” , available at VAStGoodies.com, for VA Smalltalk. This little but powerful tool has the following features: navigate through your local filesystem showing the contents of files (including images) file selection based on pattern matching support for custom templates for editing (see templateGroups:) configurable contents font navigation history spawn external programs associated with the selected file (e.g. starts Notepad on Windows for .

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.