Planet Smalltalk

March 13, 2010

James Robertson - [Smalltalk Tidbits, Industry Rants] Evolving Xtreams by using it

Michael writes about some interesting performance results that came out of experimental usage of the xtreams code.

Technorati Tags:

Howard Stearns - The Authority

People have been having great pun as this has floated around the 'net for a while, along with charges of Photoshopping, authentication via reviews of business directories, and charges of racism. Now within a day or so of the release of Gooogle...

Michael Lucas-Smith - Stumbling blocks: Evolving Xtreams by using it

I began to write up a blog post about how to do things in Xtreams compared to Streams. I was also benchmarking as I went. Things were going smoothly until I got to an example where I would read a file line by line and test if it starts with an angle bracket. In this case, Xtreams was well over 60x slower. Scanning over a large file took a long time.

I began to investigate and I discovered that there were plenty of places to improve performance, but the biggest killer of time was the testing-for and raising-of exceptions. In my particular file, 70,000 exceptions were being raised over the 22mb file. The time to test-for and raise these 70,000 exceptions was more than half the execution time of the example.

I made a branch of Xtreams that didn't use exceptions. Instead, the API methods would return the number of elements they read and you would have to check that result each time. This was not an ideal API and Martin hated it. Still, the example was capable of running only 2x slower than the regular Streams version, while doing it in a much "fancier" fashion (ie: I had more options and more power at my finger tips).

We still want the exceptions, we're not going to live without them, but we came to the conclusion that raising exceptions when you read the end of a substream (as opposed to when you read the end of a stream) was a bad thing. 70,000 substreams do not need to raise an exception internally just to move you to the next substream. If you send a method like #rest or -= 0 to a substream, you shouldn't ever have to raise an exception. It's only if you attempt to read -past- the end that you should see the exception.

Substreams are useless if you don't give them a reasonable end condition. In our current implementation you provide the end condition separate to the substream itself. Here's an example that will give you a substream that will read only 100 elements at a time:

stream slicing: [:substream | substream limiting: 100]

Because we have a separation of the slicing implementation and the ending implementation, the two must communicate between themselves and they do so by raising and listening for exceptions. This is where the expensiveness comes in.

Since you're unlikely use a substream without requiring it to end in some fashion ahead of the main stream and since you can always use a substream to do the ending even if you only ever want one substream, we've decided to merge the slicing and ending code together. This will allow us to implement substream slicing without the need for thousands of internal exception checks and raises.

We've not begun implementing this, but I suspect the implementing will probably remain fairly similar to the end user, sans the #slicing: terminology, in otherwords this would be the same example as above:

stream limiting: 100

Hopefully this new approach will mean we can have comparable speeds to Smalltalk-80 streams while still giving us all the new power of Xtreams.

Pharocasts - Build Squeak VM on Linux

This screencast is based on the following tutorials:


and of course the official install guide from squeakvm.org.

You need gcc and cmake packages installed.

Once done you can print yourself a certificate! (thanks Torsten :)

Download screencast (800x600): .mpeg 17.1 MB, .mov 16.9 MB



Checkout the trunk from Squeakvm Subversion repository(here rev. 2151):
svn co http://squeakvm.org/svn/squeak/trunk/platforms/ -r 2151


or get the official release from squeakvm.org.

Load VMMaker 1.2 :
Gofer new
squeaksource:'MetacelloRepository';
package:'ConfigurationOfVMMaker';
load.

(ConfigurationOfVMMaker project version:'1.2') load.

March 12, 2010

James Robertson - [Smalltalk Tidbits, Industry Rants] Catch the Video from our Events

Didn't get a chance to see us at any of our recent Smalltalk technology events? Well, you can still see what we presented - we have video of everything. You can subscribe to our video feed to have them downloaded directly with your favorite podcatching software, or head on over to the video page for the events.

Smalltalk Technology Series

Technorati Tags: ,

JR's Smalltalk Daily - Smalltalk Daily 03/12/10: UUID

How to generate a UUID (standards based) in Smalltalk

James Robertson - [Smalltalk Tidbits, Industry Rants] Bringing Diff to Smalltalk

Travis explains:

we've separated what to diff with how to diff completely. This means that I can have a method on RBScanner which scans source tokens. But it can go further. Since said scanner knows where comments are, we can produce strings for the comments. In fact we can go further, we can break the comments up into words easily. We can even note when the token is a string literal token and break it up into words as well. And we can insert elements for white space. So that when we difference Smalltalk methods, we get everything broken down to the granularity we'd like.

Travis Griggs - How to get a Human from a Chimpanzee

One of the things I've never liked about the VisualWorks differencing tools, is that I have to choose between source and text differencing. Usually I want source. Source compares the source code tokens. But sometimes, it shows nothing. Why? Because the only change is a word in the method comment. Unfortunately, it only shows me the whole comment is changed, not the actual localized changes. Changes only in whitespace are equally distracting. The current solution embodied by DiffList, and a UI tool called Differator, doesn't really get where I want to.

What I really want one is ONE difference mode, that shows all of this at the same time. Pursuing this goal, lend me on an interesting journey. The results are in the mar10.2 7.8 build that will come out tomorrow.

To begin with, we have to separate two distinct parts. One is comparing texts. The other is what to do with the differences we find. Let's leave the second behind for a minute. If we solve the first problem generally enough, we'll have a myriad of choices open to us for the second.

A good starting place, is to go to the classic Unix diff command line utility. After digging around for a while with this, we'll discover two things: 1) It's not really about text at all 2) the algorithm found at the heart of the diff program is a nicely tuned piece of work.

The basic diff algorithm starts out on the basis, that for any two sequences (whether they're sequences of characters, words, textlines, bytecodes, or even DNA markers), there is a sequence that is a "longest common sequence". There may be multiple resolutions to this, but none of them is longer than the other. You can find lots of interesting stuff about this around the net. A simple example is the sequences h-u-m-a-n and c-h-i-m-p-a-n-z-e-e. The longest common sequence (LCS) between the two is h-m-a-n. Once we have that, we can determine the steps it takes to turn the first sequence into the second. This is sometimes called the shortest edit script. In this case, we end up with the following edit script: Insert c, copy h, delete u, copy m, insert p, copy a and n, insert z and e and e. This gives a directional evolution from one to the other. Want to go the other direction though? Just transpose inserts with deletes and keep matches in place.

With this kind of information, we can envision a number of different ways of highlighting differences between texts, or DNA sequences, etc. We can do them in a unified view. We can do them in side by side views. We can even discern replacements from true insertions or deletions, because it's a paired delete/insert sequence.

The mar10.2 build adds a new differences: API to SequenceableCollection. You can take any two sequences and determine how to evolve one from the other. You can feed it DNA symbols, strings, numbers, whatever you can think of to put in a SequenceableCollection. The result is an array of SubsequenceDifference subclasses, one for each of the different kind of edits.

At the heart of the algorithm is a modified/ported version of a generalized version of the Meyer's Diff algorithm. This too, you can find lots of stuff on the net about. You'll even find a couple of visualizations. What the Myers adaptation of the LCS exploits is that usually, the algorithm is applied in cases where differences are few compared to matches. It also integrates the process of finding the LCS with the process of determining steps, it ends up being a linear space algorithm. To say it's a hairy nasty work of indirection and head scratching, is an understatement. It makes sorting algorithms look like kindergarten reading.

I ported it 3 times. Each implementation I found had a test suite, so I gathered those into one big test suite and added a couple edge cases. The first port was of a C# implementation. This seemed easy, but I ended up with out of bounds errors (the algorithm relies heavily on 0 based array addressing). So I tried a Ruby version. It was ironically harder to port (this is the language that's supposed to be a lot like Smalltalk). And it too had issues. Then I ported a generalized C version (generalized in the sense it was parameter-izable), and it worked! All the tests passed. There's irony for you.

How much faster is it? Given the degenerate case of determining how to get from Object comment to Object comment reverse, the VisualWorks DiffList which is a hybrid LCS searcher and produces only "unmatching range" information, takes 12.5 seconds to run. The differences: method does it in under half a second. Implementing a naive recursive LCS method, has to be killed after grinding for 3 hours.

At least two good things have come out of this. One is that there is now a general purpose method to quickly and efficiently produce complete shortest edit scripts between any two sequences. Application programmers don't have to be tied to the IDE's method of highlighting differences between two strings, they can do whatever they want. Application Programmers can use it in contexts beyond source comparison (e.g. comparing load lists, or determining undo differences, or DNA sequencing, or schedule comparison, etc).

Secondly, we've separated what to diff with how to diff completely. This means that I can have a method on RBScanner which scans source tokens. But it can go further. Since said scanner knows where comments are, we can produce strings for the comments. In fact we can go further, we can break the comments up into words easily. We can even note when the token is a string literal token and break it up into words as well. And we can insert elements for white space. So that when we difference Smalltalk methods, we get everything broken down to the granularity we'd like. Which was what I wanted in the first place.

James Robertson - [Smalltalk Tidbits, Industry Rants] Whither Look and Feel?

Travis shares some ideas he's got on evolving the UI in VisualWorks - complete with a screencast.

Technorati Tags: ,

March 11, 2010

Travis Griggs - Skinny 93

A couple of months ago, I was daunted by the prospect of having to do yet another Look and Feel set of subclasses for the VisualWorks widget set. The technique of subclassing is hopelessly over-leveraged in what is there.

The debate about whether to do native widgets or not, and in what form factor has gone round and round for years now. It will continue to do so. Somewhere in there, I pondered "what would happen if I could draw standard widgets faithfully (or pretty darn close), but still emulate them? Is there a half way point there?"

I found that for OSX and Windows, there actually was to some degree. I discovered that all of the graphic resources that OSX uses are actually in a database and can be pried out and reused. You have to make the right decisions about how to use them, but if you use them correctly, you're doing the same thing OSX is. On Windows the story was even better. uxTheme.dll is the theming engine that Windows uses to evolve it's look and feel, as well as customize widgets for other platforms (such as mobile devices) -- much thanks to Michael Lucas-Smith for pointing me towards this.

So I began experimenting with that, and some other ideas that we've already been hinting at, in a package that I dubbed Skinny. It's so dubbed, because I'm interesting in getting to a point, where changing the skin of a VW app (whether the IDE itself, or something else), is relatively easy.

Here's a screencast that shows me playing with version 93 which is in the Open Repository.

Here's a list of questions/answers one might ask about such an experiment:

Q: Which versions of VisualWorks do I have to have for this?

A: You need a pretty recent 7.8 dev build. There are small things from this project, that we've been rolling into VisualWorks proper.

Q: Do you plan on integrating this in the product someday?

A: I don't know yet. It could be that we end up doing yet another subclass tree and just harvest the uxTheme.dll drawing know how. Or maybe more of a hybrid. I don't know yet.

Q: Does the Windows look and feel work on other platforms?

A: No. It doesn't.

Q: What other skins have you played with?

A: There's an OSX one. It uses Cairo to render the various graphics excavated out the OSX graphics database. Ironically, it actually works better at the moment on either Windows of X11, since Cairo doesn't interleave efficiently with Quartz drawing. It works there, but it's pretty jerky. Great benchmark for really improving Cairo on OSX.

Q: Which widgets have you built for?

A: Push Buttons, Radio Buttons, Check Boxes, Scroll Bars, Tab Controls, Splitters (the splitters don't build thru UIBuilders tho)

Q: What if I'm more interested in not using UIBuilder technology and just simply snapping widgets together?

A: Look at the various class side example methods on Skinny objects.

Q: What known issues are there already?

A: Haven't made any of them keyboard navigable (waiting to integrate some changes to the core to simplify KeyboardProcessor first). The Scrollbars don't get their thumbs sized initially right, they require a click to do so. Lots of others, I'm sure.

Q: What IDE tools seem to work?

A: In the screencast, I show workspace, inspector, and settings tool. There's actually one page in settings tool that has issues still (a store one with a dataset). The browser kind of works. Some of the widgets don't pick up the skinny skin. The FileBrowser tanked last time I tried it. I have used the debugger on it successfully before, but currently have it turned off.

Q: Why are you blogging about it?

A: Always a good idea to give people a peek at what kind of things are going on. I'd also be interested in people trying to use it with their own apps. I'm curious how long it would stay alive and if there's an obvious "implement this next" vector.

James Robertson - [Smalltalk Tidbits, Industry Rants] Cairo and Pango from Smalltalk

Very nice Cairo and Pango work in Cincom Smalltalk from Chris Thorgrimmsen.

Technorati Tags: , ,

Torsten Bergmann - Trax for Squeak

Stephen Pair released Trax, a general object versioning system for Squeak.

Read more here.

Laurent Laffont - How I build squeak vm on (Arch)Linux

I write this post as a memento for me. I will appreciate some feedback on building the VM on other Linux distro.

1. Prepare a working directory

All the work will take place in ~/squeakvm (/home/lol/squeakvm on my machine):


mkdir ~/squeakvm
cd ~/squeakvm


2. Get squeak-vm source

The easiest part. The VM source code tarball can be found on http://www.squeakvm.org/unix/. At the time of writing, the last stable version is 3.11-3.2135. Go and get it:


wget http://www.squeakvm.org/unix/release/Squeak-3.11.3.2135-src.tar.gz
tar -xvzf Squeak-3.11.3.2135-src.tar.gz


3. Load VMMaker tool

For more explanations on why VMMaker is needed and how it works, here is a good overview.

To generate the source code for your own VM, you need a running Pharo image. Here I use a fresh Pharo 1.0-10508 rc2 image from Pharo website.

Open your image, then load VMMaker by evaluating this in a Workspace:

Gofer new
squeaksource: 'MetacelloRepository';
package: 'ConfigurationOfVMMaker';
load.

(Smalltalk at:#ConfigurationOfVMMaker) project lastVersion load.




4. Load FT2Plugin

To display anti-aliased font of Pharo images, you need the FT2Plugin. To load it:

MCHttpRepository
location:'http://www.squeaksource.com/FreeTypePlus'
user: ''
password: ''.

MCHttpRepository
location: 'http://source.impara.de/freetype'
user: ''
password: ''.


5. Configure VMMaker and generate the VM source

Now you can open VMMakerTool:

VMMakerTool openInWorld


In the Path to platforms field put the path to the extracted Squeak VM tarball: ~/squeakvm/Squeak-3.11.3.2135-src.

Then right-click on one of the plugins pane and select make all external for a simple configuration.



Note you can have a description of each plugin by reading the class comment.Classes are part of VMMaker-Plugins category.

In path to generated source select a directory where the VM source will be written. Here ~/squeakvm/src32.

The VMMakerTool window should look like this:



Then click on the Entire button (top-left of window). Wait a moment, pray, and the code should be generated.

Finally, I replace the original VM source with the generated one.

rm -rf ~/squeakvm/Squeak-3.11.3.2135-src/unix/src
cp -a ~/squeakvm/src32 ~/squeakvm/Squeak-3.11.3.2135-src/unix/src


Note: theorically this should not be necessary as the configure script accepts an option to specify the source directory path, but it doesn't seem to work.

6. Build the VM

First create a directory for the build and go in:

mkdir ~/squeakvm/Squeak-3.11.3.2135-src/build
cd ~/squeakvm/Squeak-3.11.3.2135-src/build


Then run the configure script

../unix/cmake/configure 


First problem. I have this error:

CMake Warning (dev) in /home/lol/squeakvm/Squeak-3.11.3.2135-src/build/=/CMakeLists.txt:
Syntax error in cmake code when parsing string

${=_link_directories}

syntax error, unexpected cal_SYMBOL, expecting } (21)


Thanks to this mail there's a patch to correct it.


cd ~/squeakvm/Squeak-3.11.3.2135-src/unix/cmake/
wget http://lolgzs.free.fr/pharo/Plugins.cmake.patch
patch -p0 < Plugins.cmake.patch
Then clean and run the configure script again
cd ~/squeakvm/Squeak-3.11.3.2135-src/build
rm -rf *
../unix/cmake/configure
You should have the Makefile now. Run make:
make
Then another problem as libfreetype (needed by FT2Plugin) is not found. To correct it, create config.cmake for FT2Plugin this way:
mkdir ~/squeakvm/Squeak-3.11.3.2135-src/unix/plugins/FT2Plugin/
echo "PLUGIN_FIND_LIBRARY(FT2 freetype)" > ~/squeakvm/Squeak-3.11.3.2135-src/unix/plugins/FT2Plugin/config.cmake
More informations on this error here. Clean and run make again:
make clean
make
Then install:
sudo make install
7. Conclusion
The process is not so easy. To help I put all the squeakvm directory (with sources, pharo image with vmmaker) on http://lolgzs.free.fr/pharo/squeakvm.tar.gz

UPDATE: Good post for MacOSX

JR's Smalltalk Daily - Smalltalk Daily 03/11/10: Browser Code Features

Today's Smalltalk Daily looks at a couple of small, but useful features of the browser that you might have missed.

Torsten Bergmann - Building Squeak VM on Linux

Laurent wrote on how to build the Squeak VM on Linux. Nice that the VMMaker metacello configuration I created (see here and here) is used.

Adrian Lienhard - Building a Pharo/Squeak VM from first Principles

I've been building and modifying Squeak VMs for a couple of years, but each time I started afresh it took me considerable amount of time to set up a working toolchain. Changes in Pharo, VMMaker, platform C code, make files, in system libraries etc. can introduce subtle problems and the official documentation typically is obsolete. To help me – and others – be faster next time, I wrote the following step-by-step guide to build a Unix VM on OSX 10.6.

0. Preparation

Make sure you have xcode installed (http://developer.apple.com/tools/xcode/).
Install cmake >= 2.6.2 from http://www.cmake.org/

Create a work directory on your desktop (it is important it has no spaces!):

mkdir ~/Desktop/vmbuilding; cd ~/Desktop/vmbuilding

Let’s download a fresh Pharo image for later testing. In case you are behind a proxy, set the variable http_proxy to make wget work.

export http_proxy=http://<proxy server>
wget http://gforge.inria.fr/frs/download.php/25397/Pharo1.0-10508-rc2dev10.01.2.zip
unzip Pharo1.0-10508-rc2dev10.01.2.zip

Next we check out the VM platform-specific C sources and make files

svn co http://squeakvm.org/svn/squeak/trunk/platforms/ -r 2151

Note the use of hardcoded revision numbers to make sure these instructions still work in the future.

1. Compile from existing source

We start by compiling the source that come with Subversion. This allows us to test the basic setup without the sources we will generate ourselves.

cd platforms; mkdir build; cd build
../unix/cmake/configure --without-RomePlugin --without-vm-display-Quartz
make

If you got here without any errors you can try to start the new VM. Since Quartz does not work anymore on Snow Leopard, we use X11 as display driver and hence have to start up X11 first:

open /Applications/Utilities/X11.app
./squeak ~/Desktop/vmbuilding/Pharo1.0-10508-rc2dev10.01.2/Pharo1.0-10508-rc2dev10.01.2.image &

The Pharo image should start up now. Print “SmalltalkImage current vmVersion”, which shows the version of the image from which the VM source was built.
The result should be 'Squeak3.10.2 of ''5 June 2008'' [latest update: #7179]'.

Print and store the result of “1 tinyBenchmarks” then quit the image.

2. Install VMMaker

Start up the same image with your Mac VM:
open ~/Desktop/vmbuilding/Pharo1.0-10508-rc2dev10.01.2/Pharo1.0-10508-rc2dev10.01.2.image

In a workspace in the Pharo image do the following. If you are behind a proxy first let Pharo know. Then load VMMaker through the following Metacello config (thanks Torsten!):

HTTPSocket useProxyServerNamed: '<proxy server>' port: <port>.
Gofer new
      squeaksource: 'MetacelloRepository';
      package: 'ConfigurationOfVMMaker';
      load.
((Smalltalk at: #ConfigurationOfVMMaker) project version: '1.2') load

This takes some time. When it finished loading, we open the VMMaker GUI:

Preferences disable: #raiseDeprecatedWarnings.
VMMakerTool openInWorld

3. Configure VMMaker and generate sources

First let’s backup the original sources

mv ../unix/src ../unix/src_original

In the VMMaker GUI:
Change path to platform code: /Users/<user>/Desktop/vmbuilding/platforms
Change path to generated sources: /Users/<user>/Desktop/vmbuilding/platforms/unix/src
Don’t forget to accept the changed field by cmd-s. Leave the other settings unchanged.

Make all plugins internal (right-click in list of plugins). Then select as not built (you can drag and drop between lists): Aio, FFT, FT2, InternetConfig, MacMenubar, Mpeg3, QuickTime, Security, Sound, TestOSA

Select as external:  B3DAccelerator, FFI, FileCopy, HostWindow, MIDI, UUID, XDisplayControl.

Note, that I haven't cared to make Freetype work and have just excluded it above. In a related blog post, Laurent describes how to patch Freetype to compile on Linux.

Evaluate the following expression to force the use of LF for line breaks (else the awk script triggered by cmake does not properly work).

MultiByteFileStream defaultToLF.

Click the button Entire to generate the VM sources in the directory ./unix/src/. After the VMMaker has completed, save and quit the image.

4. Compile the new sources

We create a new build directory and compile the source we created in step 3.

mkdir ../build_new; cd ../build_new
../unix/cmake/configure --without-vm-display-Quartz
make
./squeak ~/Desktop/vmbuilding/Pharo1.0-10508-rc2dev10.01.2/Pharo1.0-10508-rc2dev10.01.2.image &

If you get here without an error, you made it! Congrats! ;)

5. Benchmarks

A good way to test the healthiness of a new VM is to run the tiny benchmarks.

1 tinyBenchmarks

The result should be similar to the ones you obtained in step 1.

On my MacBook Pro 10.6.2 with 2.4GHz Intel Core 2 Duo, gcc 4.0.1 I got
479400749 bytecodes/sec; 12303286 sends/sec.

Posted by Adrian Lienhard on March 11, 2010

March 10, 2010

Chris Thorgrimsson - Pango + cairo = Nice Labels!

If you aren’t already aware, the folks (Travis Griggs and his co-workers) at Cincom have developed language bindings for Pango. The Pango website describes Pango as…a C library for laying out and rendering text. The description also goes on to say…integrating Pango with cairo provides a complete solution with high quality text handling and graphics rendering.      

Since my machine animation overviews usually need a lot of labels (some active and some passive), I decided that it was time for a new widget…..the PangoMarkupLabelView (The PangoMarkupLabelView’s model is a CairoTransformWrapper on a PangoMarkupLabel). The reason I called it a markup label is because Pango offers a markup capability as part of its library. I really liked this markup interface since it helped me simplify my widget. The view’s widget spec and associated GUIPainter slices help to configure the markup string. In turn the markup string then plays a central role in how Pango lays out and renders the string on to the cairo context. A nice description of the markup language can be found here.      

Like the CairoPNGImageView, I also wanted my labels to take advantage of all the functions that my transform wrapper provide. If you have watched any of the videos about the transform wrapper, then you probably know what I am referring to.      

Here’s a few pictures and a video of the label in action.      

PangoMarkupLabel Image 1

An example of a PangoMarkupLabel

 Yes…the “glassy effect” has been done to death, but I couldn’t resist seeing if I could make an active widget that had a bit of it. I suppose there is a place for it, but it’s unlikely you would ever see it used on my animation overviews.      

PangoMarkupLabel Image 2

An example of using the labels to build a component

 The only point to this video is to show that the labels can also be active. All you’re going to see is a ticking clock……exciting!  

  

Before I end this post, I figured I should give an update about the progress of putting my Cairo Graphics Kit up on the Cincom public store. As it stands, I am waiting to hear back from our legal department. I am requesting that we use a GNU LGPL license to cover the work (same license that cairo and Pango use).      

I would like to think that all this work is free to give away to the world. The reality however is that the company I work for has the final say since they are paying me to do this work. Fortunately, my VP does see the advantage of putting this in the public domain in the hope that others help to contribute to it. Hopefully our lawyers see it the same way.


PangoMarkupLabel Clock Demo

Joachim Tuchel - The Seaside Training Course had its premiere

Last week I finally gave my first Seaside Training course. It was a two day workshop for a group of six very experienced Smalltalk developers. Like all our training courses, it was focussed around a single example project that grew step by step with each new aspect of Seaside being introduced. The feedback I got was very [...]

GNU Smalltalk Blogs - GTK Tutorial

Hi,

Thanks to Nicolas Petton ;)
The GTK Tutorial is now hosted : http://bioskop.fr/gtk_tutorial

Gwen

Joachim Tuchel - Why Supporting ESUG is important

Stef just sent a message to several mailing lists in order to raise funds and/or find helping hands for the European Smalltalk Users Group (ESUG). Since my company (objektfabrik) is also a sponsor of ESUG, and we greatly appreciate the work they do, especially in organizing the annual ESUG Conference, I put a link here and [...]

Self Blogs - Self 4.4 Beta 1 released

Hi guys,

I’ve released Self 4.4 Beta 1.

Download VM installers for MacOS X and Linux and Clean and Demo snapshots from: http://selflanguage.org/download/.  As usual, the sources for the Self VM and objects are available from http://github.com/russellallen/self including as a tarball.

Barring minor fixes, I will reissue this release as Self 4.4 at the start of April. The proper description of Self 4.4 is a revived Self running on modern Mac OS X and Linux x86 and ready as a base for new functionality.

Self 4.4 will be the first Self release since Self 4.3 which was released in June 2006. In future we will attempt a slightly faster turnaround :)

Please post bugs to the Self bugtracker at http://self.lighthouseapp.com and to this mailing list.

Cheers,

Russell

——————–

Since Alpha 2 we have changed (this is a quick dump from commit messages):

  • Changes to SelfDroplet to ensure proper registration of filetype
  • Minor changes to website
  • Fix for bug ticket #3 – Compressed snapshots now work on Linux
  • Fix to UI1 text editing and small improvement to error handling
  • Fix for bug ticket #2 – Self will now compile on Ubuntu
  • Fix for bug ticket #1 – Linux: Display will now reopen after saving world in new snapshot
  • Added -Wno-write-strings flag to GCC compile
  • Initial copy of Self Handbook (incorporates existing manuals in RST for Sphinx)
  • Changes for Snow Leopard
  • Add a nice icon for the Dock in MacOS X
  • Removed some binaries from the git repository, split sortedList out of the list module.
  • Fix colorsFor: in ‘traits ui2Image’ to account for mapped or unmapped
  • Add PNG support and fix JPG/GIF support in webBrowser
  • Changed flag to be “-headless” to start image without ui2
  • Added Chris Double as an AUTHOR
  • Make webBrowser send Host: header
  • Add linux build files to .gitignore
  • Set the module for linux socketConstants
  • Added value:With:With:With:With:With:With:.
  • Get builds working under Arch Linux
  • Add a socketConstants slot for os_file under linux
  • Fix sockets under Linux
  • Clarification of copyright AUTHORS to include Sun and Stanford University
  • Split mirrorProgramming from mirror, so that Klein won’t need to file it in.
  • Added blockTests.self.
  • Clean up and clarification of copyright terms
  • Source tree cleanup
  • Fixes to UI1
  • Starting to refactor the tests to make it easier to use them in Klein.
  • Also refactored the slotFinder to be iterative instead of recursive.
  • Made the javaServer stuff file in OK (sort of, I think). It still needs to be filed in from the terminal, without the Self desktop running.
  • Updated website to Sphinx 0.6.1 and added links to blog
  • Fixed a typo in some comments, added max: and min: methods to the ordered mixin.

Göran Krampe - First FOSS-Stockholm meeting

On the 24th of february the first FOSS-Stockholm meeting was held in Kista. And I dare say it turned out to be a success!

My company MSC sponsored the event together with Nohup so that there was enough sandwiches and drinks to keep the crowd happy. :)

I taped all of the talks and you will find these movies and more here and here are the original movies if you are interested.

/Goran

March 09, 2010

Lukas Renggli - More Filesystems

In my recent post I’ve mentioned that the Filesystem library can work on different kinds of filesystems. In this post I am going to walk you through the supported filesystems one by one.

Before you proceed with this hands-on blog post, please update to a patched and unofficial version of the Filesystem package. In the meantime some bugs and minor issues got fixed that are not integrated into the official release yet.

 Gofer new
renggli: 'fs';
package: 'Filesystem';
load.

Disk Filesystem

The Disk Filesystem is implemented in FSDiskFilesystem and its platform specific subclasses. As we have seen in the last post the singleton filesystem instance for the current platform can be retrieved using:

 disk := FSDiskFilesystem current.

Subclasses of FSFilesystem implement many methods, but we should resist from calling most of them directly. These methods implement the low-level behavior of the respective file-systems and are private to the framework.

As we have learned in the previous post we should only work with references. Filesystem instances know two methods that return an FSReference object. This is true not only for the disk filesystem, but also for all other filesystem types presented later on:

 disk root.                               " a reference to the root directory "
disk working. " a reference to the working directory "

Given a reference we can navigate to another reference in the filesystem with the method #resolve:. Resolving works similar the command cd (change directory) on Unix and Windows and returns a new reference to a file or directory. Print the result of evaluating the following expressions:

 disk working resolve: '/'.               " the same as 'disk root' "
disk working resolve: '.'. " the same as 'disk working' "
disk working resolve: '/home/renggli'. " an absolute path to a directory or file "
disk working resolve: '../bar'. " a relative path from the working directory "

Note that the message #resolve: is also understood by FSFilesystem itself. Do not call this method though, it is private and does not return an FSReference as you might expect.

Memory Filesystem

The memory filesystem is another simple filesystem type. Think of it as a virtual in-memory filesystem, very much like a RAM disk that lives in your Smalltalk image. The use of a memory filesystem can be very convenient for testing your filesystem code, because it does not pollute your hard disk and is garbage collected as soon as you do not reference it any longer. To instantiate a memory filesystem evaluate:

 memory := FSMemoryFilesystem new.

On this filesystem you can do everything you learned before. A memory filesystem is initially empty:

 memory root children size.               " --> 0 "

To create a file we can use the same techniques we learned previously:

 (memory root / 'foo.txt')
writeStreamDo: [ :stream | stream nextPutAll: 'Hey Memory' ].
(memory root / 'foo.txt') exists. " --> true "

We can also copy files from a different filesystem to our memory filesystem:

 cache := disk working / 'package-cache'.
cache copyAllTo: memory root.

The above code copies all the files in the package cache of your Pharo installation to the memory filesystem. Before you try it out make sure that you don’t have your MP3 collection in that directory, otherwise your image might blow up.

In my case I have now 64 files in the memory filesystem:

 memory root children size.               " --> 64 "

As you would expect we can perform other operations on our virtual filesystem, for example delete all the files that start with the letter F:

 memory root children do: [ :reference |
reference basename first = $F
ifTrue: [ reference delete ] ].

As you see, there is nothing special about a memory filesystem. It behaves and understands exactly the same messages as the disk filesystem does.

ZIP Filesystem

The ZIP filesystem represents a ZIP Archive that resides on another filesystem. To create a new archive instantiate the ZIP filesystem with a reference of a ZIP archive:

 zip := FSZipFilesystem atReference: disk working / 'cache.zip'.

Contrary to other filesystems a ZIP filesystem needs to be opened (and closed) explicitly:

 zip open.

Apart from that, the ZIP filesystem behaves exactly the same way as the other filesystems we learned up to now. To copy the contents of the memory filesystem to the ZIP archive we can evaluate the following code:

 memory root copyAllTo: zip root.

To enumerate the contents we use:

 zip root children
do: [ :reference | Transcript show: reference basename; cr ].

To flush the ZIP archive to the underlying filesystem we simply close it:

 zip close.

This is a convenient way to access archives. Again your code does not have to worry about the details of this particular filesystem, but transparently accesses and modifies it using references.

cURL Filesystem

The cURL filesystem is an experimental extension to the Fileystem framework. It uses the cURL plugin written by Danil Osipchuk to work with filesystems that can be accessed through FTP, FTPS, HTTP, HTTPS, SCP, SFTP, and TFTP.

First, we need to load the extension packages:

 Gofer new
renggli: 'fs';
package: 'Curl';
package: 'FS-Curl';
load.

Note that the cURL filesystem also requires the latest version of the CurlPlugin. Make sure that your VM is up-to-date before you proceed:

 Curl curlVersion.                        " --> 'libcurl/7.19.4 OpenSSL/0.9.8l zlib/1.2.3' "

What about downloading the latest cURL plugin for the Mac VM from within Pharo? To do this we can connect to the directory with the latest experimental code of John McIntosh:

 ftp := FSCurlFilesystem url: 'ftp://ftp.smalltalkconsulting.com/experimental'.

With the resulting filesystem you can do all things you already know. If you are not authenticated however, it is unlikely that you are allowed to write (or upload) to the server. Note that currently enumerating the contents of a directory only works for FTP and SFTP servers. Due to limitations of the CurlPlugin it is furthermore not possible to create directories, delete or rename files. Hopefully that will be fixed sometime soon in the plugin code.

 ftp working children.

To download the curl plugin and save it to your hard disk you can use:

 ftp working / 'CurlPlugin.1.1.0.bundle.zip' copyTo: disk working / 'CurlPlugin.1.1.0.bundle.zip'.

Unpacking the zip archive should be a breeze.

Philippe Mougin - F-Script Switching Options

In F-Script, blocks combined with message sending can be used to create new control structures fitting your needs (and mood!). Indeed, things like if/else, while or exception handling control structures are all provided at the library level, with no need for specialized syntax in the language itself. In F-Script Switching Options, Jeff explore creating new kinds of conditional control structures:

There are many ways to think through the flow of a program, and times when certain constructs like switch statements are a nice option, even in a language with no syntactical support for it, per se. Philippe Mougin was discussing just such options in F-Script back in the Oughts. I had a need for switching in F-Script, and came up with a few versions that I found useful. Read more…


GNU Smalltalk Blogs - Towards a permissive copyleft license for dynamic languages

The problem

With the recent increase in free-software releases for dynamic languages, a serious issue is there for people who would prefer to give their software the protection of copyleft. The issue is the difficulty of interpreting the Lesser GPL in the context of these languages.

The difficulties in turn from two different sources. First, it is hard to interpret the language of the Lesser GPL in the context of languages that have no object files but only source code files.

read more

James Robertson - [Smalltalk Tidbits, Industry Rants] Event Video

I'm processing the videos we shot on our technology event roadtrip - I hope to have them posted by the end of the week (if not then, by Monday). Exporting out of iMovie takes time, and then I have to post-process the resulting export so that I'm not asking people to download an enormous file :)

Smalltalk Jobs - Software Developer IV

Title: Software Developer IV
Required skills: Agile software development experience., Smalltalk, Web Services, Relational Databases, Application Servers, Object-Relational Mapping, OOAD, J2EE, Bachelor's Degree in Computer Science or equivalent education
Region: Canada
Location: Toronto, ON
Type: Permanent
Advertised by: Ontario Teachers’ Pension Plan
Advertised by » More details: www.workopolis.com
Notes: This position has been filled or is no longer available, 3/8/2010
MGP.
Last Modified: yesterday

Smalltalk Jobs - Software Developer III & IV

Title: Software Developer III & IV
Required skills: Smalltalk, Web services, Relational Databases, Application Servers, Object-Relational Mapping, OOAD, J2EE, Agile Development, Bachelor's Degree in Computer Science or equivalent education
Region: Canada
Location: North York, ON
Type: Permanent
Advertised by: Ontario Teachers’ Pension Plan
Advertised by » More details: www.workopolis.com
Notes: This position has been filled or is no longer available, 3/8/2010
MGP.
Last Modified: yesterday