Planet Smalltalk

June 18, 2013

Bob Nemec - Roassal visualization of Seaside components

At STIC 2013 Alexandre Bergel presented Roassal, a Smalltalk visualization engine. It looked like a nice fit for our project, where we build deeply nested Seaside views from VW window specs. Navigating the component structure can be confusing, so I decided to add a tree view using Roassal.

We have the ability to inspect individual components, and we added our own inspector subclass which gives us a place for a custom menu (in VW you can do that by overriding #inspectorClasses). The most used menu entry is 'Inspect Parent Path', which inspects an array of components built from walking the parent links from the selected component up to the root component.

The parent path is handy, but is does not provide enough context, and navigating to a component outside of the parent path is a pain. It would be better to see a parent tree, with siblings and labels. Each of our components answers #parentComponet and #components. For the parent tree we just added each parent and each parent's components (siblings) into a set. Coding it in Roassal was easy...


visualizeParentPath

| view list |

list := self parentPathWithComponents.
view := Roassal.ROMondrianViewBuilder view: Roassal.ROView new.
view shape rectangle 
if: [:each | each hasUpdates] borderColor:  Color red;
if: [:each | each == self] fillColor:  Color yellow;
withText: [:each | each displayVisualizationLabel].
view interaction 
item: 'inspect' action: #inspect;
item: 'visualize' action: #visualizeParentPath.
view nodes: list.
view edgesFrom: #parentComponent. 
view treeLayout.
view open.


And here is what it looks like (the mouse is hovering over the 'I' input field; the popup is the printString of the component)...


This has proven to be quite handy. A big thanks to everyone that contributed to Roassal.

Simple things should be simple. Complex things should be possible.  Alan Kay. 

Marten Feldtmann - VASmalltalk – Headless Communication Server the Graphical Way ..

This is my first official communication server in VASmalltalk – programmed in the graphical environment of VASmalltalk.

FirstZMQServerwithConnections

Communication is done via 0MQ. The server shown here is a service registration server for a local network. Local services (written in C#, Java, Smalltalk or …) deliver their service information to their local service registration server – and this information is spread over all service registrations servers in the local network.

The good thing is, that – due to 0MQ – VASmalltalk has no load due to network communication, because all stuff is done in an external C thread.

The system is embedded as a standalone software component (physically as a software IC) within my Portobello framework and has the “normal” jQueryMobile administration GUI.


Filed under: .NET, Smalltalk Tagged: 0MQ, Connections, Smalltalk

Torsten Bergmann - Balloon stickers

In need of some Smalltalk marketing - then get some stickers.

Torsten Bergmann - Benchmarking with SMark

JR's Smalltalk 4 You - ST 4U 404: Dan Ingalls at STIC 2013

Dan Ingall's keynote address at STIC 2013 - "A few of my favorite things"

James Robertson - Presentations in Smalltalk

If you want to go "all in", using Smalltalk for your presentation itself, then have a look at Presenty for Pharo

Tags: ,

Pharo News - Benchmarking with SMark in Pharo

A small ad-hoc tutorial for the RMoD team at INRIA Lille.
I explain the very basics of benchmarking using the SMark framework.
Pointers:
- http://smalltalkhub.com/#!/~StefanMarr/SMark
- http://ci.inria.fr/pharo-contribution/job/SMark

Torsten Bergmann - Presenty

Presenty is a user interface framework for Pharo based on MVP (Model view presenter). Read more about it on Denis blog. Code is on SmalltalkHub.

June 17, 2013

Dale Henrichs - New Versions of GemStone, Pharo and Squeak Supported by builderCI

CalculusAs of this morning, builderCI supports Pharo-3.0 and GemStone 3.1.0.3.

The total number of versions that can be automatically tested using Travis-CI and GitHub is now 16 (6 Pharo versions, 3 Squeak versions and 7 GemStone versions).

For information on using builderCI, see the project README.

Photo by http://www.flickr.com/photos/encels/4059671027 / CC BY-NC-SA 2.0


Chris Cunnington - An Altitude application

Another image here. 

Here is a web application using Colin Putney’s Altitude framework. It’s a mockup for a possible squeak.org website. The site uses Bootstrap to make the site with Altitude, as the underlying framework. If you open it with Cog, execute the first line in the Workspace, you’ll see the site at localhost:8624. If your computer is connected to the internet, it’ll pull down related files and present the site. I have to say that Colin intended a more sophisticated use of what he created. Some shortcuts were taken by me to make it have conventional RESTful-looking urls.


Dale Henrichs - FileTree 1.0.2 released

Dale Henrichs - GemTalk Systems Podcast

gemtalklogo

I guess I was so busy preparing for my STIC talk I forgot to announce the availability of a podcast on GemTalk Systems that I did with James Robertson and David Buck. I have to say that James and David run a pretty smooth interview. It was fun and (I hope) informative.


Cincom Smalltalk - ESUG 2013 ─ Call for Presentations Deadline Extension

For the past 21 years, the European Smalltalk User Group (ESUG) has organized the International Smalltalk Conference, a lively forum on cutting-edge software technologies that attract people from both academia and industry. ESUG 2013 will be held on September 9-13, 2013 in Annecy, France.

Pharo News - Log4s - A Logging Framework for Smalltalk

Log4s is a Smalltalk logging framework based on the popular Java log4j framework. This presentation will describe the concepts behind log4s and demonstrate the logging flexibility of the framework.

Log4s is available on SS3: http://ss3.gemstone.com/ss/Log4s.html

JR's Smalltalk 4 You - ST 4U 403: Dart at STIC 2013

Alan Knight talks about the Dart language, and how it can be used with Smalltalk, at STIC 2013

June 16, 2013

Independent Misinterpretations - IM 130: STIC 2013 Wrap Up

James and David talk about the conference on Wednesday evening, just after it all wrapped up

Torsten Bergmann - STIC 13 - VA Smalltalk Roadmap

First video recorded by James from this months "STIC 13" conference, Wigwam resort, Phoenix Arizona (June 9-12). Expect more to come in the next days ...

Torsten Bergmann - Barcodes in Smalltalk

Didnt know Barcodes are so easy to implement in Smalltalk. So I started with EAN13 barcode together with unit tests.

Project lives on: http://smalltalkhub.com/#!/~TorstenBergmann/Barcode

You can also load it using the config browser in Pharo 2.0 now. It is already usable - thanks to the power of Pharo.

Short Guide:

 To instantiate: BarcodeEAN13 value: '2109876543210'
You can get the binarySequence of a barcode:

(BarcodeEAN13 value: '2109876543210') binarySequence


calcuate the checksum (last digit):

 (BarcodeEAN13 value: '2109876543210') computeChecksum


 or visualize the barcode:

  BarcodeEAN13 example asForm asMorph openInWorld


 or to write to a file:

   PNGReadWriter putForm: BarcodeEAN13 example asForm onFileNamed: 'sample.png'


  Now includes EAN8 as well

Chris Cunnington - A Web Framework For Cuis

David Graham ported Andreas Raab’s WebClient web server to Cuis on GitHub, as is shown here. I created a simple web framework a while ago by welding the canvas of Seaside to Goran Krampe’s HttpView2 chassis. The result is called GreenNeon, which I’ve ported to Cuis. You can download the image here.  Zipped it comes in at 5M. Start it wit Cog and you can go to localhost:9221 and it’ll say Hello World!. The Websela homepage uses GreenNeon and Bootstrap. I’m unfamiliar with GitHub and the .pck file format Cuis developers use in lieu of Monticello .mcz files, so I’ve just provided an image.


Pharo News - Voyage: The adventure of persisting object models

Voyage is a small persistence framework, purely object oriented, intended to present a common API to most common development usages. It is just a small layer between your objects and the persistent mechanism. This layer provides some useful vocabulary for your objects.

read more...

June 15, 2013

James Robertson - ESUG 2013 Call For Presentations Extended

From Stef:

We received already many good proposals but we know that you are busy now. So we decided to grant an extension for the call for presentation up 7 of July 2013. We will notify current proposers by the end of the current week -ie: 22.

For more details, just check out the ESUG conference site.

Tags:

Andres Valloud - Internet "speed tests" generally unhelpful

So let's say you are having internet issues that look like traffic drops.  The ISP's technician runs a speed test and shows you that your connection speed is ok.  But you know from your previous runs that the results are unstable.  A reason why is that several popular speed test sites measure speed by receiving files (download speed) and sending files (upload speed).  Some examples include http://www.speedtest.net/, http://www.speakeasy.net/speedtest/, http://speedtest.comcast.net/, http://www.bandwidthplace.com/, and http://whatismyipaddress.com/speed-test.  The issue with this procedure is that they also end up measuring file I/O and, particularly, how your browser does file I/O, and how your operating system caches file I/O.

Yes yes I know your SSD drive is fast, and yes yes your hardware RAID card is awesome.  But why should there be file[system] I/O at all when doing a network test?  Here's the net effect I have observed on OS X with Firefox, on a fast machine with plenty of RAM to cache disk reads.

First, there is the issue of where Firefox puts the files, which is the browser's cache.  If your cache is full, then Firefox will have to make space in the browser's cache as it's writing the file during the speed test.  The cleanup operation will cause random file I/O in the cache's hash bucketed directory structure to find the files, and then more random file I/O to delete the files.  OS X doesn't like caching a lot of disk writes while deleting files, so this means file I/O checkpoints.  If your file system is POSIX, that also means a number of atime updates as well.  Finally, I assume something will have to be done in the database that's holding which URLs correspond to what files.  And what if the cache is full of tiny (less than 4kb) files, as it usually is?  Then all this file I/O will happen every 4kb or less during your speed test measured in megabytes per second.  Oh, and did I mention there has to be file I/O to write the file to the browser's cache too?

Well ok you could at least clear the cache before beginning.  Try deleting 250k files out of a 1gb browser cache on OS X.  With an SSD drive, that can take a significant fraction of a minute (top speed on the order of 2k IOPS, usually less than 1k IOPS).  With a regular hard drive, that will cost you half an hour or more (top speed on the order of 300 IOPS, and a lot of audible seeking --- as if the OS was flushing disk buffers continuously).

But even if you flush the cache so the browser can write without deleting anything, that's not a guarantee of a proper test because OS X also buffers writes until the buffer fills, and then further I/O is effectively blocked until the buffers are flushed to disk.  You can see this effect by using the activity monitor app during the test.  The writes will flatline at zero most of the time, and at some point the buffers will be flushed (at hopefully much higher speeds than the speed test itself is receiving data).  While the flushing happens, most speed tests seem to get stuck and their fancy graphics don't update, etc.

I've yet to find a browser based speed test that simply allocates memory to do these things.  I'm not saying none exists.  Speed tests such as the above are not useful because of the problems described above.

Generally, the issue with the Firefox cache induced file I/O can be improved dramatically by creating an ExFAT disk image and mounting it where Firefox expects the hash bucketed directory structure to be.  Clearing the browser's cache is vastly improved with this approach.  Whereas it can take half an hour or more with a regular drive to delete 250k files and 1gb of cached data, the disk image approach can do the same thing in a few seconds.  Effectively, you get SSD performance out of your mechanical drive simply because you coax software to do a better job of file I/O.  The only hiccup will occur when OS X decides to flush disk buffers, at which point the machine might seem stuck for a couple seconds.

Can we please fix these underlying issues so that we can get proper performance out of SSD drives too?

Update: a Comcast technician suggests http://testmy.net, which doesn't look like it's writing stuff to the browser's cache.  Nice!

June 14, 2013

Chris Cunnington - The Squeak Wiki On Your Desktop

The Squeak wiki can be a reference for you on your desktop. Download this image. Open the image and execute the two commands in the Workspace one at a time. Then go to localhost:8666. You’ll have the Squeak wiki in a browser on your desktop.

You may want to leave a few seconds after the first command, as the image has to suck in ten thousand files. I removed a few things to make the download smaller. It is ~50M and expands to ~350M. There is no Croquet book or Swiki book (i.e. the Swiki wiki). There are no images. Getting it out of the server was 3G.

If you want to take a new Squeak 4.4 and load in the ComSwiki, you can find the source on the Gemstone SqueakSource here. You’ll need to install Comanche. (I recommend the near latest, but not the latest version of Kom.)

The only real change I made to make the ComSwiki work in 4.4 was to copy #readOnlyFileNamed: into UnixFileDirectory. ComSwiki wants StandardFileStream in XmlSwikiStorage. UnixFileDirectory readOnlyFileNamed: ’1.xml’ needs to produce a StandardFileStream and not MultiByteFileStream, which is what FileDirectory readOnlyFileNamed: will provide.

There are no tests for the ComSwiki. If it explodes on your desktop, perhaps you could say where.


German Arduino - PasswordsPro and SpiderOak Hive

As lot of people, I use several different computers and devices, then I need a way to maintain my passwordspro files synchronized with no effort.

The simple way is use SpiderOak Hive (available even in the free SpiderOak accounts).

SpiderOak Hive is a new feature of the super online backup SpiderOak that permit to maintain a folder synchronized between different devices.

The only requirement is have a SpiderOak account with SpiderOak running in your device.

In the video is possible to see the following sequence:
  • In a Computer A, a Test record (of a secure note) is modified to TestZZZ.
  • In the Computer B, after a few instants, the PasswordsPro file get updated (synchronized)
  • In the Computer B, the Test record is deleted.
  • In the Computer A, after a few instants, the PasswordsPro file get updated (The Test record don't exist anymore).

The backup service of SpiderOak has tons of nice features as backup history, sync data between multiple devices, access from anywhere, including the web, store data from any number of computers and different operating systems, share data by ShareRooms, etc but the feature that I like more is the Zero Knowledge privacy.

Taken from SpiderOak site, Zero Knowledge Privacy means that the server has zero knowledge of your data. In non-technical terms it means that your data is 100% private and only readable to you.

And, if this data, are passwordspro encrypted files, then the privacy is at least 200% !

Enjoy!

The Weekly Squeak - Otomatic (Squeak/ Smalltalk): more example of ensemble enabled version (2011)

JR's Smalltalk 4 You - ST 4U 402: VA Smalltalk Roadmap (STIC 2013)

John O'Keefe at STIC 2013, giving the VA Smalltalk Roadmap.

Esteban Lorenzano - Voyage: The adventure of persisting object models

Voyage is a small persistence framework, purely object oriented, intended to present a common API to most common development usages. It is just a small layer between your objects and the persistent mechanism. This layer provides some useful vocabulary for your objects.

Voyage

Voyage can work in two different programming styles (modes):

  1. Singleton mode: You have an unique repository in your image, which works as a singleton keeping all your data there. When you use this style, you can program using a “behavioral complete” approach: your instances respond to a certain vocabulary (see below to more details about vocabulary and usage).
  2. Instance mode: You can have an undetermined number of repositories living in your image. Of course, while some work can be done to keep the object vocabulary working as “standard use”, this mode requires you to make explicit which repository are you going to use.

Vocabulary

This is all the vocabulary you need to work with Voyage:

Singleton modeInstance modeFunction
savesave:stores an object into repository (insert or update)
removeremove:removes an object from repository
removeAllremoveAll:removes all objects of class from repository
selectAllselectAll: retrieves all objects of some kind
selectOne:selectOne:where:retrieves first object that matches the where clause
selectMany:selectMany:where:retrieves all objects that matches the where clause

Voyage-Mongo

Voyage is a common layer for different backends but currently it supports just two: an “in memory” layer (to fast prototype applications and to fist stage developments), and a Mongo database backend.

Mongo is a document oriented database that works well persisting complex object models, even if it is not an object database (like Gemstone, Magma or Omnibase). Because of that, we need an “Object-Document mapper” (the document equivalent to an ORM), and while it does not solve all the impedance mismatch issues, it fits a lot better with an object world, being able to preserve it’s dynamic nature.

1. Installation

To install Voyage you can go to Configurations Browser (in World Menu/Tools) and load “ConfigurationOfVoyageMongo”. Or alternatively you can execute in your workspace:

Gofer it
	url: ‘http://smalltalkhub.com/mc/estebanlm/Voyage/main’;
	package: ‘ConfigurationOfVoyageMongo’;
	load.
(Smalltalk at: #ConfigurationOfVoyageMongo) load.

That will load all you need to persist your object model into a Mongo database.

Create a repository

Start a new repository or connect with an existing one is very simple, you just need to do:

repository := VOMongoRepository 
	host: ‘mongo.db.url’ 
	database: ‘databaseName’.

Alternatively you can specify the port to connect by using protocol VOMongoRepository class>>host:port:database:. You can keep that instance for storage/retrieval, but probably you prefer to use the Singleton mode. To enable your repository to be accessed all around the image, you can execute:

repository enableSingleton.

WARNING: executing this line will remove older repositories from Singleton mode!

NOTE: In this document, we are going to cover Voyage in Singleton mode, but using it in Instance mode should be straightforward (just take a look at VORepository persistence protocol).

2. Storing objects

Basic storage

Let’s say we want to store an Association (yes, the example is dumb, but is the simplest I can think of). To do that, we need to declare Association to be storable as root (first entrance point) of our repository:

Association class>>#isVoyageRoot
	^true

Then, you just need to execute:

anAssociation := #answer->42.
anAssociation save.

This will generate a collection named “point” in your database, with a document with the following structure:

{ 
	"_id" : ObjectId("a05feb630000000000000000"), 
	"#instanceOf" : "Association", 
	"#version" : NumberLong("3515916499"), 
	"key" : ‘answer’, 
	"value" : 42
}

As you can see, there are some “extra information” to allow the object to be recognized:

  1. #instanceOf keeps the type (Class) of the stored instance. This is useful for reconstructing complex hierarchies (I’ll talk a bit more about this later).
  2. #version keeps a marker of the version commited. This property is used for refreshing cached data in the application. If there is not #version field the application will refresh always the object with data from database (and you will lose a lot of performance).

Embedding objects

Now, most objects you use are not so simple as associations, but more complex graphs with other complex object instances inside. Let’s say that we want to keep rectangles. Each rectangle contains two points, so, is a graph like this:

model

To store this, we add:

Rectangle class>>#isVoyageRoot
	^true

And execute:

aRectangle := 42@1 corner: 10@11.
aRectangle save.

This will generate a document like this:

{ 
	"_id" : ObjectId("ef72b5810000000000000000"), 
	"#instanceOf" : "Rectangle", 
	"#version" : NumberLong("2460645040"), 
	"origin" : { 
		"#instanceOf" : "Point", 
		"x" : 42, 
		"y" : 1 
	}, 
	"corner" : { 
		"#instanceOf" : "Point", 
		"x" : 10, 
		"y" : 20 
	}
}

As you can see, for many cases, you do not need to do anything special to store complex graphs (but you can enhance and/or modify the way you persist objects, see “Enhancing storage” section below).

Referencing other roots

Some times, your objects are graphs who contains other root objects (for instance, you could want to keep “users” and “roles” in different collections, and of course, an user has a collection of roles).

To do that, you just need to declare the former embedded objects as roots.

In our rectangle example, let’s suppose we want to keep into a separated collection the points (we call them referenced instead embedded).

After we add #isVoyageRoot to Point, we can save our rectangle, and we will get:

In collection “rectangle”:

{ 
	"_id" : ObjectId("7c5e772b0000000000000000"), 
	"#instanceOf" : "Rectangle", 
	"#version" : 423858205, 
	"origin" : { 
		"#collection" : "point", 
		"#instanceOf" : "Point", 
		"__id" : ObjectId("7804c56c0000000000000000") 
	}, 
	"corner" : { 
		"#collection" : "point", 
		"#instanceOf" : "Point", 
		"__id" : ObjectId("2a731f310000000000000000") 
	} 
}

In collection “point” (two documents):

{ 
	"_id" : ObjectId("7804c56c0000000000000000"), 
	"#version" : NumberLong("4212049275"), 
	"#instanceOf" : "Point", 
	"x" : 42, 
	"y" : 1 
}

{ 
	"_id" : ObjectId("2a731f310000000000000000"), 
	"#version" : 821387165, 
	"#instanceOf" : "Point", 
	"x" : 10, 
	"y" : 20 
}

Enhancing storage

You can change the way your objects are stored by adding magritte descriptions.

For instance, always with our rectangle example (but with points embedded, not referenced), let’s say:

  1. I want to use a different collection name: “rectanglesForTest” instead “rectangle”.
  2. I know that I will store always points in my collection, and therefore the #instanceOf information is redundant.
  3. I know that “origin” and “corner” attributes are going to be always points, so #instanceOf informations is redundant there too.

Rectangle class>>mongoContainer 
	<mongoContainer>
	
	^VOMongoContainer new 
		collectionName: 'rectanglesForTest';
		kind: Rectangle;
		yourself

Rectangle class>>mongoOrigin
	<mongoDescription>

	^VOMongoToOneDescription new
		attributeName: ‘origin’;
		kind: Point;
		yourself

Rectangle class>>mongoCorner
	<mongoDescription>

	^VOMongoToOneDescription new
		attributeName: ‘corner’;
		kind: Point;
		yourself

Then, you can save your rectangle and you will see that the document generated (now in “rectanglesForTest”), it will look more or less like this:

{ 
	"_id" : ObjectId("ef72b5810000000000000000"), 
	"#version" : NumberLong("2460645040"), 
	"origin" : { 
		"x" : 42, 
		"y" : 1 
	}, 
	"corner" : { 
		"x" : 10, 
		"y" : 20 
	}
}

You can do other fancy stuff with this, like:

3. Retrieving objects (querying)

So far, we can write objects to our database. But, how about to retrieve them?

WARNING: This examples will not work if you have “mixed” the persisted documents with the previous examples (with referenced and embedded points, for instance). I recommend you to drop all collections and “start clean” with the embedded approach.

Rectangle selectAll.
Rectangle selectOne: { ‘origin.x’->42 } asDictionary.

Notice that here we are accessing an embedded object property!

Rectangle selectMany: { ‘origin.x’->42 } asDictionary.

Querying with MongoQueries

Since some versions ago, MongoTalk (the base layer of Voyage-Mongo) provides a cool way of doing queries:

Point selectOne: [ :each | each x = 42 and: [ each y > 50] ].

This looks easier than using a dictionary, but still has some minor issues, when querying embedded object. In that case, we still can use a block statement, but we need to access directly to the embedded attribute:

Rectangle selectMany: [ :each | (each at: ‘origin.x’) = 42 ]

This cover almost all the functionality you can currently get by using Voyage with Mongo. In next documents we will cover some of the possible applications of this framework, and the design implementation.

Torsten Bergmann - Units in Smalltalk

I uploaded a "ConfigurationOfUnits" to the MetaRepoForPharo20. With this the "Units" framework is easily loadable from the Pharo 2.0 config browser.

Here are some examples from the Unit framework:

(10km + 10km) gives you 20km

You can also convert easily

  (10km + 24m) as: 1m

gives you  10024 metres.

It is also simple to compare:

  1hour < 10 seconds

which gives you false.

Torsten Bergmann - Otomatic

Alan Knight - Smalltalk for dessert - photo from STIC 2013