Are you magellin’

Ever since I purchased my Garmin StreetPilot I have been built an obsession for all that is GPS. I even contemplated buying a Satellite phone , one can pick one up in eBay for a reasonable amount as well as pre-paid cards. Why? Just for those times when you are hiking in the middle of nowhere upstate New York and your cell phone goes blind. Just what happened last time we went upstate , no emergency it was just a little disconcerting to not be able to get in contact with a human being in case we were mauled by some bear. Anyhow, I did not buy the satellite phone, I’ll do that after we buy the Hummer H2 which goes very well with Satellite phones and GPS systems, which I agreed to only buy after we buy a place in the Poconos which we have not really started saving for yet. Of course in between all that is my next guitar which I will definitely get for my birthday next year. In the meanwhile I purchased another GPS unit from Garmin , the Etrex Vista C, great for hiking. One can download topographical maps as well as maps which include hiking trails, city maps. It also does cool things as tracking your path so that you can backtrack etc and lots more.

I guess one of the reasons why GPS stuff is fascinating to me is because I spent approx 4 years working among other things on a VisualWorks GIS application for a utility company. I would like to somehow add doing something with GPS and VisualWorks to my pet project list but that list keeps getting longer. Bruce Badger wrote a driver to his Magellan GPS unit a while back. Actually demoed it at NYC Smalltalk. Garmin also has an SDK which can be wrapped. JUN has API for doing topo stuff so it maps well to GIS. Smalltalk MT if recall correctly has a GIS framework available. I used and extended AppliedReasoning’s GeoSynchrony ( I may be hazy on the name) but they are no more last I heard and that and their graphics package sank with the ship.

Minimal image stripper

For those of you not on the VWNC list here is an interesting post from Terry Raymond. He now has 2.2 mb base image which I believe he is using to support Smalltalk scripting type of functionality. The image only supports file-ins and chunck format at that but he stated the he could probably add support for parcels. Apparently, said support may add another 1 mb. I assume that if on Windows we should still be able to use compression and Reshacker to deliver a relatively small exe which matters to some for example those downloading apps from the web or perhaps folks deploying on PocketPC devices etc. If this can be made to support parcels maybe its the start of an SRE (Smalltalk Runtime Environment).

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Hi

There is now a stripper for 7.3.1 in
http://www.cincomsmalltalk.com/CincomSmalltalkWiki/DOWNLOAD/CODE/stripper731.zip

Watch the word wrap.

Read the include readme and follow the instructions to create a
small(2.2mb)
7.3.1 image.

The stripped image does not support parcels.

Terry

===========================================================
Terry Raymond Smalltalk Professional Debug Package
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI 02878
(401) 624-4517 traymond@craftedsmalltalk.com
<http://www.craftedsmalltalk.com>
===========================================================

A little black magic, making generic VW constructors

I have been playing with a little Smalltalk black magic to solve a philosophical problem. I believe that my acts should be consistent with my beliefs, not always possible not always what I want at the moment but …

So what is the problem?

I happen to be one of those Smalltalkers that creating setters and getters for every instance variable as a default policy just rubs me the wrong way. Now, please I don’t want to start the 20th billionth debate on this, but to me there is state that is just meant to be private really private and putting an accessor in front of one is like building a bathroom without a door. Not cool.

So then don’t create accessors for everything , you may say?

but how many times do we see instance creation methods i.e. constructors where we do this type of stuff:

MyClass>>>newFor: this and: that
inst := self new.
inst this: this; that: that.


^inst

In this case we need the instance side setters #this: and #that:

Alternatively we could do something like:

MyClass>>>newFor: this and: that
inst := self new.
inst newFor: this and: that.

^inst

Here, I don’t have to create the accessors and therefore leave my instVars private but I still have to create an instance side method to field the incoming args used in the construction of the instance. Annoying, but worse it still does provide a mechanism to mutate instance variables that are meant to be private albeit one can’t just mutate one.

Recently one night I was bored and just decided to come up with something no matter if it was ugly or bad, brainstorm something into creation.

I decided on the following requirements:

  • a generic constructor i.e. a message where I could pass an array of instance variable names / value pairs.
  • only allow for every respective class to be the sole constructor of its instances in this manner

The result would then look something like this:

MyClass>>>newFor: this and: that

” e.g.:

self construct: {‘this’->this. ‘that’->that.}

Now, what the heck is that {stuff …}.

That is, if I recall correctly, something that was borrowed from Squeak by Cincom’s Vassili Bykov and its called Brace Constructors. Don’t have time to get into it right now but it basically one can delimit objects with periods i.e. $. So for example one can do the following:

{1. 5+2. true. self calculateSomething}

Anyhow , back at the ranch.

I’m sure that this looks very strange to most Smalltalkers and I’ll admit that I’m not totally sold yet although it really is convenient. So far so good . I may end up liking it.

Note that the following will not work:

MyClass construct: {‘this’->this. ‘that’->that.}

An exception is raised stating that only “MyClass” can send #construct:.

In the next installment of this article I will cover how that is done and the pros and cons.


Pelrine’s presentation

Another great meeting. Got insights into some of the work that Joseph was involved in i.e. the enhancement of the Sunit framework. As we all know automated unit testing i.e. the Sunit framework which was then the model for Junits and others came out of the Smalltalk world. Personally, I learned a few things. For one, I had never taken the time to learn what TestResources do. In the past I used the TestCase subclass class to build resources that could then be made available for the TestCase instances. TestResources are more flexible and can be shared across different test cases. As has proven to be the case so far the informal discussions that arise at the bar are as interesting as the presentations. It also helps to have a local Smalltalk legend in our midsts to get those historical insights on the Xerox Parc days and the various Smalltalk personalities.

My Plight with Tight, part 2

Previous Article in Series

Today I decided to look into using a minimal desktop manager and only start my VisualWorks application. I therefore changed my $HOME/.vnc/xstartup to look like:

!/bin/sh

# Uncomment the following two lines for normal desktop:
#unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
setroot -solid grey
/home/visualworks/scripts/startVWVirgin7_3_1.sh &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &

twm &

Unfortunately, I found that the window title bars and the desktop manager’s menus were not being setup.

After some struggle I discovered that for some reason starting the vnc desktop i.e.

$ > vncserver :3

after logging in as the user wishing to establish the vnc desktop would cause the problem. Instead if one logs in as root and then does an “su” to log into the user’s account in question, then running the above command will set things correctly. Mind you, one gets a warning about not being able to “lock root’s xauthority” file but it will eventually come back with a successfully established vnc desktop.

For some reason the xterm does not start however one can spawn a new one via the desktop manager’s menu.

Perhaps a more Linux / VNC savvy reader can explain the whys. Typically, if using for example a gnome desktop there are no issues at all with the user’s desktop owner actually issuing the desktop instantiation command. BTW, I also made sure that the twm startup files (usr/X11R6/lib/X11/twm/system.twmrc by default or just .twmrc if under the user’s home directory) specified window borders (ClientBorderWidth “10” ) and even included one under my home directory but again to no avail.

At least the above workaround gets me back on track to what is most important i.e. development using VisualWorks Smalltalk. Hope this helps any other Smalltalker contemplating getting on the same boat with TightVNC or VNC for that matter.

My plight with tight

Next Article in Series

Lately I have been struggling with configuring TightVNC both at work and at home. TightVNC is a spin on VNC (Virtual Network Computing). Think of remote desktops , terminal services etc. The scope included making things work with VisualWorks and making things work in both Linux and Windows. After some pain I found out that there are three ways of using TightVNC:

  1. Like terminal services
  2. Like a remote desktop ( remote control)
  3. Like this private X space you can setup for yourself

Like Terminal Services

If one setups VNC as a xinetd service then the result is that VNC will behave like Windows terminal services. By this I mean that every time one attempts to connect the user is prompted with the Linux desktop’s login screen. These sessions are not “shareable” i.e. their is only one active user which is the user that logged in. Info on how to setup VNC as a “xinetd” service can be found here. On Windows I did not find a way of using TightVNC in a terminal services type of way. Instead, when one connects to a Windows box using TightVNC one is actually on the current Windows desktop i.e. under “remote control” or remote desktop mode.

Like a Remote Desktop

The default when hooking up to a Linux TightVNC server is not to hook up to what is called “display 0” i.e. the current X console running on the box in question. Therefore this means that one cannot right off use TightVNC to support “customer service” scenarios. In our case that works out fine, our users are on Windows PCs and the servers are either on Windows or Linux. So for us TightVNC’s primary purpose will be to connect to TightVNC servers running under Linux. However, if one has to connect to the user’s console i.e. if running Linux then that is apparently possible.

Like this private X space you can setup for yourself

This is to me that most useful mode. Effectively, one setup a private X console/desktop where one can spawn applications. When one exits the TightVNC viewer said private desktop does not go away. Therefore when one reconnects one still has access to the spawned applications. Since said apps are running in an X desktop one then can deploy headful apps with all the necessary GUI based tools which can include partial to full development environments. I know of three companies deploying their Smalltalk apps in such fashion. I also deploy the NYC Smalltalk wiki under VNC. It works great. The capability to debug production issues is greatly enhanced using this strategy.

Security

Neither TightVNC nor VNC are inherently secured. However, one can use SSH tunneling to secure VNC. More information can be found on www.realvnc.com faq. I also saw a readme file on how to use Stunnel to do the same. Also one can use a minimal desktop such as TWM and only spawn the desired applications. TWM just provides the necessary window and user input support i.e. there are no admin tools available such as those found in a Gnome desktop for example. Additionally, the desktop exposed can be under a specific user with very specific rights etc. The TightVNC session does use password authentication and of course one can add authentication at the app level as well.

Other Issues

I thought I had issues with running VisualWorks 7.3.1 from a Linux based TightVNC server. Happy to report that is not the case. Well, I did have a problem with certain images going into a free fall upon startup i.e. they would not get past the splash screen and would just start gobbing up all memory. To be honest I don’t have all my facts worked out. My current theory, is that base virgin images extracted via the Gnome Archive manager somehow become corrupted in such a way that starting them in a VNC session throws them into a loop. Once I replaced the faulty image with the base virgin image that is provided with the VisualWorks installation things just worked fine. BTW, for those who live in Windows most of the time , be aware that there are a couple of extra steps to do in Linux to make an image usable. Read the install.pdf.

Conclusion

I am now quite happy. Connecting to the office in New Jersey from my home in Forest Hills, NYC works quite well. A tad slower but even browsing and working with the development tools feels like almost there. Now, I don’t know how it would work out if I had to connect to the Netherlands but for now VNC is doing everything that I expected it to do and more and it works very well with VisualWorks. I don’t know if TightVNC is really any better than RealVNC but don’t really care either way, at least for now.