Monthly Archives: March 2014

JNIPort for Pharo 3.0

Hi everybody,

JNIPort for Pharo 3.0 alpha is now available at SmalltalkHub.

JNIPort is a Smalltalk library which allows Java code to be invoked from
Smalltalk. It acts as a bridge between the world of Smalltalk objects and a
Java Virtual Machine (JVM) where Java code is executing.

When I first ported JNIPort to Squeak and Pharo 1.x, I used Alien as the FFI
library. As NativeBoost has superseded Alien, the interface to the Java
Native Interface library had to be rewritten. There are still some
undocumented and obscure parts in NativeBoost, so this has taken some time.

If you want to try it, load it via the ConfigurationOfJNIPort. I hope this
works. If it does not, load the packages individually in the order in which
they appear in the ConfigurationOfJNIPort.!/~JNIPort/JNIPort
The next step is to read the documentation at
Otherwise, you won’t know what to do next. ūüėČ
Download the extra files from the download page at Wikispaces, you will need
two jar files from there.

Start a Java VM attached to Pharo by adapting and executing the following
code snippet:

| jvmSettings |
“You can set the path to the Java VM library by editing the path as
JNIPortJNIInterface libraryFile:
“JNIPortJNIInterface libraryFile:
‘C:\Programme\Java\jre7\bin\client\jvm.dll’ .”

jvmSettings := JVMSettings new.
jvmSettings usesGhosts: true.
jvmSettings supportsCallbacks: true.
jvmSettings jniPortSettings useJNIHelperLibrary: false.
jvmSettings ghostClassSettings retainMethodSource: true.

“On Mac OS X and Linux, class path entries are separated by colons.”
“On Windows, you have to use semicolons instead. Edit the following line as
jvmSettings runtimeSettings classpath:
” jvmSettings runtimeSettings classpath:

“Uncomment the following if you want the Java VM to emit verbose messages.
How to access these messages depends on your platform.
On Mac OS X, they are visible in the Console application.”
“jvmSettings runtimeSettings addOption: ‘-verbose:jni’; addOption:
‘-verbose:gc’; addOption: ‘-verbose:class’.”
Cursor execute showWhile: [JVM newWithSettings: jvmSettings].

Then the fun starts:

| zfClass zipfile entries |
zfClass := JVM current findClass: #’’.
zipfile := zfClass new_String: ‘JNIPort.jar’.
zipfile size. “–> answers an Integer”
entries := zipfile entries.
entries asAnEnumeration do: [:each | Transcript cr; print: each].

And now to the ugly little secret reason why I call it an alpha version:

While everything seems to work, it is *much* slower than it used to be in
Pharo 1.2 with Alien. And when I compare it with VisualWorks, I wonder if
the Pharo version secretly does some additional work for SETI:
– Starting the JVM:
VisualWorks 0.7 seconds
Pharo 7 to 8 seconds
– A benchmark using some methods of and
VisualWorks 114 milliseconds
Pharo 12 to 13 seconds

I have not yet found the reason. The TimeProfiler is not very helpful, as
its 1 millisecond resolution is too coarse. It would be nice if it had
microsecond resolution. From the TimeProfiler results, it seems that calling
a JNI method with NativeBoost is extremely slow, but I don’t trust those
profiles too much.

So, give it a try, and if you find something useful concerning the bad
performance, please send me a message.

Best regards,
Joachim Geidel


Commits: March 17-21








Phratch official web site

Jannik laval announced the new web site for Phratch. Here is the announce.
I am pleased to announce Phratch website:
Thanks to the support of ESUG, it is possible to make visible this wonderful project.
For now, what is available on the site:
– a presentation of Phratch (you can refer to it now)
– installation files, there is a portable version for Windows, Linux, MacOS.
– tutorials
– block documentation: generated from a Phratch image !
– Some elements for Jetstorm (a lot of new articles will come soon)
– a category with news
Now about the versions, I am developing the version 3.0
Why this number ? Why a third version in one year of work ?
It is clear that a lot of work is already done. Each version represents strong changes in the architecture.
– version 1.0 is the port of Scratch + BYOB + Panther in Pharo. It is working but not extendable.
Рversion 2.0 makes Phratch really extendable. We can develop our own block for everything in Pharo. I also make Phratch more modular with the use of Pragmas for some menus, declaration of blocks… It is available only in Pharo 3.0. There are some languages available, I hope more people can translate in other languages (
– version 3.0 is the version in development. What is new here: Before this version Phratch was really slow. I am cleaning the code, and now it begins to be fast, really fast ! We also begun to write tests.
Thanks to Damien Cassou, Phratch can now be installed on Ubuntu using apt-get.
If you are an Ubuntu user on 12.10, 13.10 or 14.04, you can very easily install Phratch. You have to add the Pharo PPA (ppa:pharo/stable) and install Phratch by issuing these commands:
$ sudo add-apt-repository ppa:pharo/stable
$ sudo apt-get update
$ sudo apt-get install phratch
Then just run
$ phratc
I am really happy to have the support of ESUG and Pharo.
Thanks to the community to make Pharo as usable as it it, it makes our dreams possible.

Timezone in ZTimestamp project

Sven (the author of many cool Pharo packages: JSON, STON, CSV, HTTP, HTTPS) released a new version of ZTimestamp. Here is his announce:

I just added a first version of timezone support to the ZTimestamp project – a small, lightweight, non-intrusive, self-dependent alternative to DateAndTime and friends. With this addition, it is now possible to work with UTC/GMT timestamps internally yet present correctly localised timestamps in any timezone, based on the standard Olsen database. ZTimestampFormat was extended with optional timezone support.

About ZTimestamp

ZTimestamp can be loaded most easily from the Pharo 2 or 3 Configuration Browser.


CI job

From the class comment of ZTimezone


I am ZTimezone, representing the timezone information in the standard Olsen database.


You reference timezones by their ID. The list of supported identifiers is accessible using

ZTimezone timezoneIdentifiers.

To access a timezone do

ZTimezone id: ‘Europe/Brussels’.

The necessary information will be loaded, parsed and cached from a binary file of the zoneinfo database (see also man tzfile). This should work automagically on Mac OS X and Unix, on Windows you have to download the necessary files and specify their location

ZTimezone zoneInfoLocation: FileLocator C / ‘foo’ / ‘bar’ / ‘zoneinfo’.

Once you get a handle on a timezone, the main operation is to query the sub timezone that is applicable at a certain point in time

(ZTimezone id: ‘Europe/Brussels’) subzoneForTimestamp: ZTimestamp now.

The ZSubTimezone instance returned contains information like the UTC offset. Since you’ll probably only be interested in that aspect there is a convenience method

(ZTimezone id: ‘Europe/Brussels’) offsetForTimestamp: DateAndTime now.

The flow is that for every GMT timestamp, you get the concrete offset to use for a specific timezone. Note that this is not a constant, it depends on the time periode the timestamp falls in.

The are 2 more convenience methods to quickly convert between GTM and local wall time

(ZTimezone id: #’Europe/Brussels’) gmtToLocal: ZTimestamp now.
(ZTimezone id: #’Europe/Brussels’) localToGmt: DateAndTime now.

Also note the zoneTab and the timezones are cached in the image. When the TZ database changes, it might be necessary to either call #cleanUp or #reloadAll. When moving images between machines, either all info should be loaded and cached, or it might be necessary to use #zoneInfoLocation: again.


A chronological array of transition points in unix time specifies which sub zone is active from that point on to the next.



Merchant – a credit card processing library

Sebastian Sastre announced Merchant Рa credit card processing library. The code is available

 It is used in airflowing for his client, in flowing’s invoice system for the consulting services.

All over https and¬†never¬†saving credit cards info (only the gateway‚Äôs token of the authorised cards, the sensible data only touches RAM and gets a nice nil on the instVar after the gateway’s result)
We could authorise and capture on debit cards too but the gateway we’re using has debit only for brazilian cards and doesn’t provide the international debit feature (which seems to be kind of a big deal for vendors and banks).
Contact Sebastian Sastre if you want to extend its API to your gateway.
Tagged ,

Renoir: Programmatic CSS builder

Gabriel Omar Cotelli announced today a new library for Pharo.
I’m announcing the first official release of RenoirSt, a DSL enabling programmatic cascading style sheet generation for Pharo.
For the impatient, you can load it in your 3.0 image evaluating:
Gofer it
¬† ¬† configurationOf: ‘RenoirSt’;
or download a ready to use image from the Contribution CI Server ( a ConfigurationBrowser option comming soon).
Visit the project page and GitHub repository for more information on the supported and planned features, and check-out the online tutorial.
I hope you find it useful. Feel free to ask any questions, suggest ideas and improvements, or report bugs (the issue tracker is in GitHub).

BabyMock Two

Attila Magyar announced today a new version of his excellent mock library. Here is the anounce.

I’m pleased to announce the 2.0 version of BabyMock. BabyMock is a visual
mock object library that supports test-driven development.

This version has a new syntax which is incompatible with the old version.
Therefore it has a new repository!/~zeroflag/BabyMock2
(BabyMock 1 is still available at its old location, but in the future I’d to
focus on the development of BabyMock2, so don’t expect too many changes
regarding the old version).

Changes in 2.0

– A new, extensible DSL (no more should/can)
– Improved error messages, history of messages, detailed information about
argument mismatches
– An improved, Spec based GUI
– Clicking on a mock opens an inspector on the expectations
– Clicking on a message opens an inspector on the message
– Object methods can be mocked by defaults
– Blocks can be executed after receiving a message by the mock. The block
has access to the arguments of the incoming message.
– Any argument matcher
– Cleanups and simplifications in the code

I hope you don’t mind the changes regarding the syntax. Personally I think
it has lot more pros than cons.

More information!/~zeroflag/BabyMock2

Tagged ,

CodeCity New Generation

Dear all

Richard Wettel the original author of CodeCity (this was his PhD) announced today a new version of CodeCity in Pharo.
Here is his announce:
After the short preview at the last Moose Dojo, I am happy to let you know that the first version of the brand new CodeCity is out.
CodeCity is a 3D visualization engineased on a city metaphor, which enables us to depict software systems as cities. If you want to know more about this approach, have a look here:
I have now implemented the basic functionality of CodeCity in Pharo and integrated it with Moose. Here is a code city of ArgoUML in the new CodeCity:
To install CodeCity, you need to run this code in a Moose image (setting Moose as a prerequisite is on my TODO list):
Gofer new smalltalkhubUser: ‘RichardWettel’ project: ‘CodeCity’; configuration; load. (Smalltalk at: #ConfigurationOfCodeCity) loadDevelopment
You can also get the latest successful build from:
The new CodeCity does not provide a configuration UI, but it relies on scripting.
While CodeCity was initially aimed at software systems only, there is nothing that stops us to use it at visualizing any kind of data! One example was the visualization of the data taken from a database (population, city, countries, continents) presented at the Moose Dojo. I’m sure Doru will be pleased to show you more of that.
In conclusion, I hope you’ll enjoy playing/working with CodeCity as much as I have been enjoying re-implementing it in the last few months. Playing with CodeCity integrated in the Moose workflows is pure fun. But don’ take my word for it, just give it a try!

Commits: March Week One
















Querying Wikipedia from Pharo

Hern√°n Morales Durand announced a new fun library with which we can query wikipedia.

Some examples follow:

1) Retrieve in JSON movies from the beautiful Julianne Moore:

| jsonResults |
jsonResults := DBPediaSearch new
        timeout: 5000;
        query: 'SELECT DISTINCT ?filmName WHERE {
  ?film foaf:name ?filmName .
  ?film dbpedia-owl:starring ?actress .
  ?actress foaf:name ?name.
  FILTER(contains(?name, "Julianne"))
  FILTER(contains(?name, "Moore"))

To actually get only the titles using NeoJSON:

((((NeoJSONReader fromString: jsonResults) at: #results) at: #bindings)
    collect: [ : entry | entry at: #filmName ]) collect: [ : movie | movie
at: #value ]

2) Retrieve in XML which genre plays those crazy Dream Theater guys  :

DBPediaSearch new
        timeout: 5000;
        query: 'SELECT DISTINCT ?genreLabel
    ?resource dbpprop:genre ?genre.
    ?resource rdfs:label "Dream Theater"@en.
    ?genre rdfs:label ?genreLabel
    FILTER (lang(?genreLabel)="en")
 LIMIT 100';

More examples are available in DBPediaSearch class side. You can install it
from the Configuration Browser.
If you want to contribute, just ask me and you will be added as contributor.
Best regards,