VA Smalltalk 8.6.1 – first impressions

Instantiations released VA Smalltalk 8.6.1 yesterday. We haven’t ported our project code to the new version yet, but given the fact that this is “just” an update to 8.6, I don’t expect to experience a lot of problems here. The Migration Guide, an often undervalued but very helpful resource, doesn’t really mention a lot that seems relevant to our code (except for the Base64 encoder, but we’ll have to see if it’s just a new class name for us or if there’s more to it).

But be warned: if you think an update that only shows in the third digit of a version number is a minor update, you are wrong, Instantiations has a tradition of coming up with new and interesting features in what seems to be minor releases. This time, there is not much new feature-wise, meaning you can’t build much new stuff for your end users that you couldn’t with 8.6. But for the developer, 8.6.1 feels a lot slicker and this release really is a big step forward.

Code Assist is such a great and nice feature and has learned quite a few nice tricks in 8.6.1. It now runs lint checks online on your code right as you type and provides you with a lot of hints and stuff.

But first things first.

I’ll give you a brief overview of the first things I encountered with 8.6.1 and that I think are probably important for other users.

Installation and Environments

One of the strange things in VA Smalltalk for the last few releases was the fact that the install scripts for Linux needed teh X server. There was no installation script for headless installation. It was easy to get around this if you know VA Smalltalk, but for a less experienced user, this was a no-go. With 8.6.1, the Linux version ships as either rpm or deb packages and an install script that runs on the command line. On our OpenSuSE box, this worked like a charm using ssh.

On the client side, I was shocked at first that the 8.6.1 installer does not ask for an installation path and just installs into the existing 8.6 installation directory.It does, however, make sure that the important directories like newimage etc. are untouched and adds 861-versions of these. There is no separate installation package for client and manager any more.

So I was in doubt if I like that. But it turns out that my existing environments/images are running as before, old image, connected to the old Library. No troubles so far.

The best thing that may or may not be new, but that I just realized now is that if you create a new Environment (image directory), the Environments tool lets you select if you want to create an 8.6.0 or an 8.6.1 environment. Great idea for all those who have to maintain existing software but also make progress in new versions.

The installer also has an option to upgrade an existing library to 8.6.1, which I didn’t test. But it sounds like a fantastic little feature (once you’ve made a backup of your library, as you always do, right?). We chose to use a new Library, and do whatever needs to be done later (we’ll most likely make a copy of the existing 8.6 library and use the Library Importer tool to get the latest VAST code into it. This way we keep all our code history).

Tool improvements

Boy, 8.6.1 is so much better than 8.6. If you are on a version like 7 or even older, I promise you won’t realize your favorite tool any more. Code Assist was such a great step forward in 8.6, but it really lifts off in 8.6.1.

The editor now has such nice things as code folding (you can fold long comments) and it feels much faster and fluid. Autocompletion suggestions come up much quicker and teh whole thing just seems like it got a boost. I only learned a lot about what Code Assist added to the last version (like camel case guessing – you can type “oc” and Code Assist will instantly suggest “OrderedCollection”), so I look forward to what I will learn and love over the next few weeks and months.

I remember being blown away by what Seth showed in August at ESUG. A lot of refactoring and code improvement will be so much more fluid with 8.6.1, but I must say I haven’t played with this stuff yet.

One thing I checked was Refactoring, or better the “Mastering Envy Refactoring Browser extensions”. I’ve sat with Seth and showed him a few things I really thought should be changed or improved there. And what can I say?

Refactoring now just feels right in so many little aspects. Like when you select an instance variable in a Class Browser and click on “Create Accessors…”. The Browser now knows which variable you mean!

This doesn’t sound like a big thing, but it is, because in the past, you had to pick the very same variable ion a little prompter again. Not any more. It is pre-selcted now and you can just press Enter! If you refactor a lot, and I really do refactor a lot, both my own and lots of legacy code, then you will value these little things a lot. It saves you a lot of time and your metabolism profits a lot from 8.6.1.

I haven’t really spent much time with the new version, but what I’ve seen is really promising. I’ve also read Marten’s first impressions and he also likes 8.6.1.

I’m sure I will come across new wow-moments with this release and look forward to porting our code (which will be a bit involved, since we have quite a few fixes to Glorp and Seaside that may or may not be fixed in this new release and we’ll have to take a close look at these) and work with it.

Camp Smalltalk on Vancouver Island (Canada)

Sometimes, you have the feeling you just live on the wrong side of the globe. If you are a Smalltalker or would like to learn more about this dynamic programing language and get in touch with a bunch of enthusiasts, you better be in North America the first weekend of October:

This particular Camp has grown like Topsy from a simple attempt to get the small number of Smalltalkers on the island together for a weekend of social programming into a gathering of nearly two dozen experts from all across Canada and the US west coast. If you’re a newcomer to Smalltalk this might be a good chance to meet some experienced people that can help you.

The Camp was ignited by Tim Rowledge of Squeak fame (you can learn more about his work on Squeak on the Raspberry Pi in episode 24 of Smalltalk Inspect) and Sebastian Heidbrink, who has been a co-host on our Smalltalk Inspect podcast for years now. I hear there are a number of very interesting people coming and the list of topics and projects is a like first class menu.

To attend, visit their registration page.

I only hope somebody will take a few photos and blog about the camp, because this will sure be a lot of fun!

Beautiful little tutorial on how to build a complete Seaside Application with an RDB Backend

Sven just announced the availability of a new tutorial named “Reddit.st — In 10 Cool Pharo Classes“.

I am fascinated by how short and clear this piece is. It really explains all you need to know to get started building a Seaside Application using Glorp and Postgres as a database. It is nice to read and really covers all there is to it without leaving you out in the cold. 

Skimming through the code I’d say that the code can be used in any Smalltalk dialect, not only Pharo. Just the Captcha class needs a bit of tweaking for other dialects than Pharo.

I must say I not only like Sven’s coding style but also his writing very much. I recommend taking a look on his other articles on medium.com.

How to see who tried logging into your Ubuntu machine

Putting a piece of software onto a publicly reachable machine on the open (bad, dangerous, dirty and unbelievably complex) web presents you with all kinds of neat problems.
One of them is that as soon as you have a public address, a certain kind of people will sure try to knock on your door, push and pull a little here and there in order to see if they can open a door or a window and look what’s inside for them.

The last few days, we’ve seen an interesting increase in visits from China (well, as far as you can tell from IP address lookup. Maybe someone just uses a chinese access point or whatnot), who all try to log in as root on our Linux server.

Here is what you can do to first find out if someone was on your machine (and left traces):

lastlog
This will show you a list of all your users on the machine and when and from which address they logged in. As long as there are no users in the list that you don’t know, and as long as there are no addresses from where they logged in that sound suspicious to you, there is a chance there was no breach into your system – at least you have a first idea if there is a problem here. Of course, you can assume that real professionals will be clever enough to remove their traces anyways. Not to mention those bad guys we hear so much about these days…

Here’s what the output of lastlog looks like:

Username         Port     From             Latest
root             pts/2    IPADDRESS     Thu Aug 28 15:38:05 +0200 2014
daemon                                     **Never logged in**
bin                                        **Never logged in**

/var/log/auth.log (on Ubuntu)
This is the log file in which you see all authentication attempts. By searching through this file, you can see all login attempts that failed by looking for entries like:

Aug 24 07:21:22 yourhostname sshd[20151]: Failed password for root from 116.10.191.206 port 45168 ssh2

Based on what you learn from the logs you can decide to block certain IPs or subnets in your firewall. It’s hard to give good general advice on the topic…

VA Smalltalk on Linux with German Umlauts – how to set up the environment properly

For kontolino.de, our accounting application for small and medium businesses, the deployment platform is Linux. Our prime development platform is Windows, because some of the nicer and newer features of VA Smalltalk (like the Scintilla editor) are not (yet) available on Linux. Also, the fact that VAST uses MOTIF, makes it a bit of a beast when you want to click on a menu item. And, let’s face it, MOTIF just looks strange and old on today’s Linux distros.

Like it or not, testing and bug fixing sometimes is needed on Linux, so we have to fire up VAST on Linux from time to time, not only for packaging (which could be done on Windows as well, but you need to test the runtime on Linux anyways, so cross packaging is not a good option for practical reasons).

For quite a while now, we’ve had a major problem with VAST on Linux, which I regarded as a given:

You could either use Keyboard shortcuts like Ctrl-X/C/V or Ctrl-S with the default Locale (en_US or C), or you could edit Umlauts in the Browsers, but then neither of the Ctrl-shortcuts would work, sometimes VAST would even crash. This was less than ideal, but for just fixing small bugs, we could handle it.

Frequent readers of my blog know that I am not to vain to publicly write about my fails in professional life. This one falls into this category. Because it turns out this whole problem goes away once you configure your system properly. In our case the system is Ubuntu 13.10 and 14.04 32 bits.

So here are the steps it takes to make the combination of German Umlauts AND Ctrl-Shortcuts work on one image at the same time (tadaa!):

First, you need to install and generate the German Locale in Linux:

  1. edit the file /var/lob/locales/supported.d/de as root or using sudo (you need to edit another one for your country, of course)
  2. Append the line
    de_DE@euro ISO-8859-15
    and save the file
  3. generate the locales: sudo locale-gen

Ubuntu now not only supports UTF-8, but you can also use ISO-8859-15 for your applications

The second step is to start VA Smalltalk with this new Locale. For this, you simply edit the executable abt shell script in your image directory and add the following line to it:

export LANG=de_DE.ISO-8859-15@euro

Next time you start the image, it will support Umlauts .

If you still have trouble entering the Euro-Symbol, you may have to change the Browser or Code font within VA Smalltalk. We’ve chosen misc-fixed.ISO8859-15 for now, and so far we haven’t found any problems.

This may be old hats to you if you develop on Linux, but for us, this has helped a lot for working on our system in Linux. Fixing a bug is now also possible if the method we’re editing contains Strings with Umlauts.

Before that fix, pressing Ctrl-S would delete the contents of the code pane and replace its contents with a Strange character. So fixing bugs on Linux felt like walking through a mine field: you always had to be very careful about which key to press,

Glorp: How to create Foreign Keys with ON DELETE SET NULL

In Glorp, you can create foreign keys between tables. By default, such a foreign key will result in problems when you delete an entry in the table with the key attribute.

So if you need to create a foreign key that does not restrict deletion of a parent row, you want to add a foreign key that defines a constraint of ON DELETE SET NULL. Or maybe you want to forward deletion with ON DELETE CASCADE.

It took me a few minutes to figure out how to define such a key, so I write it down here for all to see and for me to remember.

It turns out all you have to do is to define a suffixExpression for the foreign key in your tableFor… method like this:

fkeyId := aTable createFieldNamed: 'other_id' type: platform int4.
aTable
	addForeignKeyFrom: fkeyId
	to: ((self tableNamed: 'THEOTHER') fieldNamed: 'id')
	suffixExpression: 'ON DELETE SET NULL'

Teo Torriatte

I am sitting here at my home office desk struggling with a delicate implantation of some new Announcements into our web application where we have to take very special care of transaction handling between Seaside Components.

In such situations I like to pick one of my good old vinyl LPs out of the shelf and listen to some good ole stuff. Today I somehow picked Queen’s Day At The Races (1976) and right now I heard something long forgotten: Teo Torriatte. This one (well, the whole album) reminds me of the days when I was working on wires, signals and stuff on my model railway, back in the early 80’s. I could lock myself into my room and work on the model for days, as long as I had some good music on my turntable, like Queen, Pink Floyd, Kansas, Kraftwerk, Heart or Marillion.

The remainders of the model railway are now packed in a few boxes in the basement, waiting to be kissed awake again. Nowadays, it is Smalltalk code I am working on and forgetting the world around me. The little boy is just 30 years older now ;-)

 

 

OS X Mavericks and Safari / Firefox drive me crazy

As I wrote in my last post, the latest version of Safari and Firefox on OS X Mavericks go nuts about finger gestures. This really drives me crazy, so much that I’d like to take my iMac and throw it out of the window from time to time.

I’ve seen there is a workaround by enabling scrollbars to be visible all the time, but it doesn’t work for me.

Every time I accidentally wipe to the left or right on my Mouse, Safari moves the current page a few pixels and the complete tab freezes. Even entering a new URL into the address field doesn’t work any more.

What’s interesting is that Firefox has almost the same issue: I wipe downwards on the mouse, FF will show the vertical scrollbar but it won’t scroll.

After a while, neither Safari nor Firefox will respond to wiping into any direction. At the same time, other Applications like Thunderbird, the Finder, Terminals etc. all work like they should. ARRRRGGGGGHHH!

Today, I decided to hate my Mac. Like I did last Friday. And I am afraid I will continue to do so until there is some update that heals this stupid bug.

The latest Mavericks update and/or Safari are broken…

is it only my or do others also see the effect that since the last OS X Mavericks update, using the single finger gesture in Safari to move back and forth in the Browser history freezes Safari? That’s especially funny when you’re in the middle of editing a long blog post :(

I also can’t scroll vertically in Safari any more with one finger on the MagicMouse. The gesture is working in other programs, however.

Today’s Apple is not what it used to be. I don’t care if they present the latest home automation gadget or a new iWatchagotchi ath the WWDC keynote today. I’d rather have them do their homework on their bread and butter software. If Cook wants to create something innovative, he could try and set up a software quality assurance strategy that actually works.

 

Javascript Associative Arrays are fun! Aren’t they?

…sometimes. Sometimes they also just make your body shake in fever and give you a hard time figuring what is going on with this world around us.

I guess everybody who learns javascript has to go through these things and therefor this is common sense. On the other hand, being a Smalltalk developer for around two decades, I have learned that people regard Smalltalk as a strange language. Which is not something it holds exclusive rights on, obviously.

So here comes my little anecddote. For our Kontolino.de application, I needed to nail together an ajax request that sends a Seaside callback id together with soem String back to the server. Not that I haven’t done this before. Actually I have done that quite a few times already, using both Smalltalk/Seaside and Javascript.

To make a long story short, I needed to create an Associative Array that looks like this: {“5″:”search text”} – easy, right?

No.

First of all, the “5” is the content of a String variable that was rendered on the server side. And the fact that it is a numeric String seems to make things complicated for Javascript.

Because if you do something like this:

var key="5";
var value=someInputTag.val();
var myArray = new Array();
myArray[key]=value;

you will end up with a very strange looking an array: it will have 5 entries, the first four of which are undefined. In the end, it is not an Associative Array at all. It will contain a fifth entry which is the String you just put there. For javascript, a String containing only digits is the same as a number, because, obviously, I must have meant 5 when I said “5”, right?

Since the code looks so easy and straightforward, I was under the assumption that the fact that my Ajax call didn’t work and my server side Breakpoint was never hit has to do with some strange thing going on with Ajax or my server side Seaside code. So I once again started a lengthy journey to neverwhere, which led nowhere, of course. Only took a few hours and some increasing state of desperation ;-)

A few DuckDuckGo searches later, I found a few places where people suggest using this:

var key="5";
var value=someInputTag.val();
var myArray = new Object();
myArray[key]=value;

And what can I say? The website now works like I always wanted it to. (Please make sure you look at the two snippets very carefully to find the difference ;-) ).

Now I am sure I have to be careful to say anything offending about this, because the moment I hit “Post” here on my blog server, somebody will walk around the corner and tell me this is for a (good?) reason. I hate when I have to, but this is one of the things I just have to accept without asking too many questions.