Another example of how great the Smalltalk community is

I think a clear example of how great the Smalltalk community is just happened to me once again  during the recent Camp Smalltalk at North Carolina organized by Instantiations.

But “the thing” started way before that. I think Tim Rowledge started with some GPIO lib wrapper in Squeak. Louis LaBrunda was interested on having that on VAST and started a port. Seth Berman and I helped him to make that happen.

Once we had the gpio wrapper running some folks, like Norbert Schlemmer joined, tested more sensors and improved the original library.

GemTalks (Richard Sargent and others) were interested in trying GBS running on VAST on ARM, and so, they compiled and provided us with ARM compiled GemStone rpi libraries. Then, we test it and confirmed we were able to use GBS from within VAST running on a Raspberry Pi, talking to a GemStone running on the cloud.

Now, the first day at the camp, I got via Amazon a DS18B20 Thermometer Device which would allow me to get temperature from the Pi (via GPIO). This sensor uses the 1-Wire protocol, which I had never used before.  Until the day before of my workshop, I was planning to show GBS running on VAST on Pi but just show dummy examples: execute something on a workspace (that is evaluate on GemStone), browse some GemStone classes, etc.

However… that day, I woke up with an idea: “What if I can get the temperature sensor really working, read the temperatures from VAST and transparently persist them into a GemStone running in the cloud?”  WOW. That sounded magical. And I had from morning to night to do it because my workshop was first thing in the morning next day.

So…as soon as I woke up and knowing Norbert was in Germany, I send him an email: “hey, I know you made a DS18B20 sensor to work, and I have one here, could you send me your example/instructions please?”. Few hours later, I had that response.

After that email, I send an email to Richard: “Hey Richard, do you have an example in which I can take a collection in VAST and simply persist some objects (like Temperatures) in GemStone?”. Few hours later, he provided me with that. He code it from scratch for me.

So….at 7 PM or so (after all Camp Smalltalk talks), while drinking beers, I was about to say “sorry guys, I need to leave to my room, focus, and finish the workshop for tomorrow).” Good luck I didn’t do that. Instead, I open my Mac, my Pi, my sensors, and I started to work on my example with all Smalltalkers and beers around.  You can see it yourself:

I started with getting the temperature sensor to work. I followed all of the instructions but for some reason the Pi was not detecting the device. I had my volt meter but I had no idea how to “debug” that. Hopefully, Julian Ford was on the same table as us, and he started doing his magic until he said “those 2 cables are swapped!”. BOOM. One second after, the sensor was working.


At this time it was already like 11:00 PM. Almost everybody had to leave (and yeah, we lot of beer in blood). I still needed to implement the GemStone part. There was when Sebastian Heidbrink ask me “may I stay with you and watch you?”. Of course my friend!!! So we start trying to make the GemStone part until we hit a state in which the image was a bit broken and we were not able to properly connect to GemStone. At the same time we had Richard backing up us via email/chat from Portland… Anyway, at some point, Sebastian had a great hack/workaround/fix which made the connection to work nicely.

So…we now had the GBS working, Richard example for simple persistence, and the temperature working. This was around midnight already. Finally, with Sebastian we coded the last snippet workspace which would collect a few measures from the sensor, reify them as temperature objects and store that on a collection that would be automatically persisted on a GemStone running in the cloud.

So…here it is the final code snippet for that demo:

| session connector measures |
session := GBSM currentSession.
connector := GbsClassVarConnector
stName: #RjsTemperatureSensorReading
gsName: #RjsTemperatureSensorReading
cvarName: #Readings.
connector updateSTOnConnect.
connector connectInSession: session.

session evaluate: 'RjsTemperatureSensorReading clearReadings.'.

measures := OrderedCollection new.
measures add: TestOneWireDS18B20ThermometerDevice fetchTemperature -> DateTime now.
(Delay forSeconds: 2) wait.
measures add: TestOneWireDS18B20ThermometerDevice fetchTemperature -> DateTime now.
(Delay forSeconds: 2) wait.
measures add: TestOneWireDS18B20ThermometerDevice fetchTemperature -> DateTime now.

measures do: [:each |
(RjsTemperatureSensorReading newTemperature: each key asOf: each value) recordSample.

((session evaluate: '
RjsTemperatureSensorReading sampleReport')
copyReplacing: Character cr withObject: Character lf)
session commitTransaction.

RjsTemperatureSensorReading sampleReport inspect.

Mission accomplished!

Now, what’s the moral of the story? Several Smalltalkers helping from different parts of the globe, with different time zones and even from different Smalltalk dialects. Each providing a piece of help.

If I would have gone to my hotel room to “focus” on the workshop, there is no way I could have done it. Instead, staying right there with cool people made it happen.

I already thank all of you. But I still wanted to show how great the Smalltalk community is.


One thought on “Another example of how great the Smalltalk community is

Leave a Reply