Friday, December 29, 2006

Where is that error coming from?

If a graphical user interface (GUI) has been properly coded, any user error condition will be reported to the user as a dialog similar to...



This is great for the end user because it does not look as cryptic as...



...
but it is a bit of a nightmare to debug if you want to find out where in the code this condition was raised. The cryptic dialog would have been nice because then you could "Show traceback" and continue your investigation from there.

Well, you can also force a traceback with the "nicer" error message if you have access to a MagikSF prompt (typically through emacs). You need to put a !traceback!() call in basic_window.show_alert() to get a look at the callstack to find out where the problem was. Unfortunately, this method is not shipped with CST 4.0, so you will need to do some Magik to force a traceback.

(By the way, the topic of shipped/unshipped code and the Open Source "movement" in the Smallworld community will be covered soon in another article).


1. save the original basic_window.show_alert() method's procedure

MagikSF> orig_proc <<
basic_window.method(:show_alert|()|).value
$


2. temporarily redefine the method to show a traceback

MagikSF> _method basic_window.show_alert(_gather args)
!traceback!(!terminal!)
_endmethod
$


3. Redo the GUI action that cause the user error dialog in the first place. Because of how we redefined the :show_alert() method above, we will not see the error dialog, but we will see the traceback at the command line. Use that traceback to investigate the problem further.

4. revert the basic_window.show_alert() method to its original procedure

MagikSF> basic_window.method(:show_alert|()|).
value << orig_proc
$


As always, if you have any questions or comments about a post, please feel free to e-mail me or reply with a comment to this post.

Now, back to digging out from another blizzard :)

Wednesday, December 27, 2006

startup()

Just finished digging out of the blizzard from last week and now we are waiting for the next one starting tomorrow and going into Friday. It's a good time to settle down at my computer and publish my first post.

I had the idea to create a Smallworld watch blog because I really like the Smallworld product. Since I left GE this fall the one thing I have missed is some of the intellectually stimulating conversations with the likes of Graham, Ralf and Joe. I keep thinking that there should be many applications that have not yet been developed that Smallworld (and Magik) would be a good fit for, but unless we hear about what others are using the software for, it will be difficult to grow new ideas. I hope that I can use this blog to spread information about the latest and greatest from Smallworld, interview users and GE personnel, and try to find the really "cool" applications that use Smallworld but do not get much exposure.

To get things started... Charlie Savage's blog has a well-written section A Bit of GIS History - the Smallworld Technical Papers. It includes a reference to a series of Technical White papers that described the direction of the Smallworld product. Well worth reading if you are interested in what problems Smallworld was originally designed to solve.