Tuesday, May 15, 2007

Smallworld 2007 Americas Users Conference dates

The Smallworld 2007 Americas Users Conference dates have been set for September 9-12. You can read the announcement here.

Monday, May 14, 2007

Magik OLE Excel Reporting Performance Enhancements

I recently received a question about how to speed up Magik reporting to Excel using the OLE functionality. I you have ever used OLE from Magik to access other APIs you will know that it is a powerful but not overly fast way of connecting to 3rd party applications.

The questioner had indicated that they were writing data from Magik to Excel one cell at a time and then formatting each cell individually, too. While this is a logical way of doing a report it was taking a very long time to create a typical customer report.

My suggestions to improve data transfer and formatting performance were:

  • If your report is basically a row report, then you can copy one row at a time onto the Windows text clipboard in Magik. Then you can use an OLE call on Excel to paste the copied text into a range of cells. Be sure that the copied text has a delimiter that Excel can parse on. That way you can pass a large amount of data from Magik to Excel with a single OLE call.

_constant delim_char << tab_char
_local a_frame << smallworld_product.applications.an_element().top_frame

# using a text output stream will let you cleanly create
# a delimited string later on.
_local temp_stream << internal_text_output_stream.new()

_for a_record _over records.fast_elements()
# using OLE, set your cell range...

data_list {a_record.attr1,a_record.attr2,a_record.attr3}

a_frame.clipboard_text << temp_stream.string

# using OLE, do a "Paste" into the current cell
  • As for formatting: is there similar formatting for a row or column of cells? If there is, then keep track of how many rows or columns you have as you are copying/pasting the data into Excel. Then, once you have finished getting the data into Excel, format a range of columns or a range of rows or a range of cells that require common formatting. Again, that way you do the formatting with a minimum number of OLE calls
  • Have you looked at the Smallworld Explorer “Export to Excel” functionality? I think that core code (4.0 SWAF) might make use of an Excel template.
    • see collection_export_engine.export_to_excel

Monday, May 7, 2007

[slightly off topic] Google Maps of Boulder Bike Paths

This is not Smallworld-related but is of interest to me. Every since I moved to Boulder (Colorado, USA) in March, I have been amazed by the number of bicycle paths in the city. Apparently the city will even plow the snow off the paths after a snow storm.

As a new resident of this fair city, I have often wondered how I can get to my destination using the available bike path network. The city provides some great paper and pdf network maps and even plans to create a bike-route-finding website (aka on-the-fly directions for cyclists) later this year. But I think there is still a need for integrating the network maps with a web search engine like Google Maps. Well, Google has recently implemented Google My Maps and I have started using that freely-available tool to start building an overlay on Google Map search results. You can read about it and see the current state of the project at the Cycling in Boulder blog.

If you are interested in contributing to the data in Boulder, please let me know. And if you are interested in doing something for a bike path network in your town that would be great, too! I have two ultimate goals:
  • get people onto their bikes
  • have a large enough interest in something like this that Google takes note and introduces searchable/traceable bike path networks into their Google Maps data.

Tuesday, May 1, 2007

Magik Dialog Designer

Under the heading of “cool and useful Magik stuff”…

I recently had the opportunity to meet with a friend of mine who showed me his latest creation -- Dialog Designer

It is a tool that allows you to graphically layout your new Magik GUI with many of the commonly-used widgets, menubar, statusbar, and docks. Once you have layed out the GUI graphically and applied appropriate properties to the components, the Dialog Designer will stub out all the required Magik files, classes, methods, shared constants and XML config/gui files and place them in a new module directory structure.

While it will not write the Magik behaviour behind the widgets – you still need to write Magik code that does something when the button is clicked – it goes a very long way to building your :build_gui() method for you. And the nice thing is that tricky tasks like resizing rowcols or other widgets is now done automatically for you.

As a long-time Magik developer, I have never been too excited about GUI design because it can be a bit complicated (and time consuming) in Magik. Using the Dialog Designer will make the GUI design considerably easier and definitely save you a number of hours per GUI in development time.

The company that my friend works for has said that they will release the Dialog Designer to the SourceForge MagikComponents community. Until they have done that, I will keep the name of the developer and his company to myself. Stay tuned for a press release from them (hopefully soon) announcing the availability of this very cool and useful tool for Magik developers.