I saw this on the ESUG mailing list:
I am pleased to announce that registration for the 20th ESUG Conference in Ghent, Belgium is now open!
To register, please proceed to the website or go directly to the accomodations page.
Important: do not forget to book your accomodation directly at one of the hotels in Ghent before June30th!
Technorati Tags: esug
Craig Latta would like to hear from you about Spoon.
Technorati Tags: spoon
In the next version of this virtual image I added both implementations of VASmalltalk: not only the Linux version is running against a local emsrv – but also a Windows installation, running under Wine under Ubuntu.
I will upload this newer version in the next days.
One thing about Smalltalk - it will definitely make you think.
Cincom is looking for an engineer to work in the ChannelStream project; details are here. The location is the Cincom site at Maidenhead just west of London, UK. Others in the ChannelStream team are on the continent so remote pair-programming and periodic travel may be involved. ChannelStream has a Seaside-powered web interface. It manages complex problems of corporate document distribution.
FYI, this weekend I’ll be preparing some documentation for Spoon, and would be happy to converse in-depth about it here and elsewhere online.
Travis talks sorting n VisualWorks:
The core default sort algorithm in VisualWorks is hybridization of quicksort and a insertion sort. The implications for this, is that this somewhat expensive toolListDisplayString method may be called repeatedly for some objects. That means redundant CPU cycles. A common solution to this kind of problem is memoization. Memoization basically is a fancy word which means "cache the results of your computation function, so you only evaluate the function once for each unique input and just look up the cached result for subsequent calls."
Technorati Tags: sorting
There's another logging framework available for Smalltalk, but this one isn't standalone - it's an interface to Fluentd:
Nagare is designed to be simple and scalable. Contrary to other logging frameworks which provide rich set of log output methods (file, socket, DB, etc.), Nagare just connects to fluentd (http://fluentd.org). And Fluentd does the various log processing jobs.
Technorati Tags: nagare
| classes |
classes := Object withAllSubclasses reject: #isMeta.
classes sorted: #toolListDisplayString ascending
| classes |
classes := Object withAllSubclasses reject: [:each | each isMeta].
classes sorted: [:each | each toolListDisplayString] ascending
| classes |
memory := IdentityDictionary new.
classes := Core.Object withAllSubclasses reject: [:each | each isMeta].
classes sorted: [:each | memory at: each ifAbsentPut: [each toolListDisplayString]] ascending
| classes |
memory := IdentityDictionary new.
classes := Core.Object withAllSubclasses reject: [:each | each isMeta].
classes memoizedSortBy: [:each | each toolListDisplayString]
| classes |
classes := Object withAllSubclasses reject: #isMeta.
classes sorted: #toolListDisplayString memoizing ascending
Masashi UMEZAWA has developed a new logging library called Nagare.
Nagare is designed to be simple and scalable.
Contrary to other logging frameworks which provide rich set of log
output methods (file, socket, DB, etc.), Nagare just connects to fluentd. And Fluentd does the various log processing jobs.
Features:
- Simple log interfaces with reliable backend
- Semi-structured logging (Not only String, you can store
structured records in log)
- Flexible - you can easily customise log-tags, log policy, etc.
- Portable (runs on Squeak, Pharo, VisualWorks)
More at http://code.google.com/p/nagare-logger/.
The latest versionof the software found around the world in the One Laptop Per Child computer — Etoys — is now available from the Squeakland website. In Etoys 5 you’ll find new features such as single-stepping a script, attached watchers, a graph paper tool, and ScratchConnect, a way to connect Etoys and Scratch.
Need to load a bunch of stuff into a new Pharo image before you get to work? Mariano has some tools for that.
Technorati Tags: pharo
Blog post by Mariano about StartupLoader:
Hi. Some time ago, I wrote a post about how I build images for my projects. I am downloading new images all the time and because of that I used to have 2 problems: 1) I needed to load several external packages to thestandard Pharo image; 2) I needed to set my own settings and preferences. Today, Pharo 2.0 (which is in development and unstable state) includes most of the packages I always needed to install: shout, code completion, nice browser (Nautilus or OB), refactoring integration, spotlight, etc. So nowadays I only had problem 1).
In this post, I will show you how I solve that problem using StartupLoader, a nice utility present in Pharo (since Pharo 1.4). IMPORTANT: Everything I mention in this blog is taking into account the “new version” I did of StartupLoader. Before writing this post I have improved it and therefore you need at least a Pharo 2.0 version 20071.
read more...
Hi. Some time ago, I wrote a post about how I build images for my projects. I am downloading new images all the time and because of that I used to have 2 problems: 1) I needed to load several external packages to the standard Pharo image; 2) I needed to set my own settings and preferences. Today, Pharo 2.0 (which is in development and unstable state) includes most of the packages I always needed to install: shout, code completion, nice browser (Nautilus or OB), refactoring integration, spotlight, etc. So nowadays I only had problem 1).
In this post, I will show you how I solve that problem using StartupLoader, a nice utility present in Pharo (since Pharo 1.4). IMPORTANT: Everything I mention in this blog is taking into account the “new version” I did of StartupLoader. Before writing this post I have improved it and therefore you need at least a Pharo 2.0 version 20071.
How can we execute something at startup with Pharo? There have traditionally been two known ways (and now in Pharo there is a new third option and it is the reason of this post):
1) Send a .st file as parameter to the VM, that is, you execute the VM like this:
/Users/mariano/Pharo/VM/Pharo.app/Contents/MacOS/Pharo /Users/mariano/Pharo/images/Pharo-1.4.image startup.st
You execute the VM, pass the Pharo image as parameter and then the file. This will be executed during the startup. What’s the problem with this? If I want to always execute the startup in different images I always need to open the image this way, from command line. I just want to open an image with a double-click. Moreover, this file is hand-coded and not versioned in Monticello (what I would like). Besides, there are more limitations as I mention later in this blog.
2) Register your own class in Smalltalk startup list and implement #startUp message to do whatever you want to do. The problem is that my class is not present in the distributed images of Pharo. Therefore I need to manually first load my own code. Same problem: too much work.
Remember my problem: I am downloading new images all the time. Having to manually set up my preferences is boring and time-consuming.
The new StartupLoader class searches for and executes .st files from certain locations. To find these it searches for a ‘.config’ folder in the folder where the image file sits. Then it looks in the next folder up, then up again and so on until reaching the root folder. When a ‘.config’ folder is found, StartupLoader looks within this for a ‘pharo’ folder. This contains the startup scripts common to all versions of Pharo, and also optionally a folder per Pharo version holding startup scripts suitable for that version only. So a typical directory layout might be…
.../some/folders/pharo/Content/Resources/pharo.image. .../some/folders/pharo/Content/Resources/startup.st .../some/folders/.config/pharo/author.st .../some/folders/.config/pharo/useSharedCache.st .../some/folders/.config/pharo/1.4/mystartupFor14only.st .../some/folders/.config/pharo/2.0/mystartupFor20only.st
IMPORTANT: I said that StartupLoader will search for a folder ‘.config’ starting from the image directory until the root of the filesystem. What happens if no folder is found? It creates ‘.config’ in the image folder. However, I recommend you create the ‘.config’ following the standard, that is, in the $HOME.
To know the real values for you…
Print the result of “FileDirectory preferencesGeneralFolder” which holds the startup scripts common to all versions of Pharo.
Print the result of “FileDirectory preferencesVersionFolder” which holds the startup scripts specific to the version of the current image.
The order of the search is from the most general to the most specific:
As you can see the order is from the most general to the most specific. Moreover, it does not stop when it finds files in any of them. So all are searched and executed. More specific scripts can even override stuff set in more general ones. It works more or less the same way as variables in UNIX with .bashrc /etc/envirorment, etc…
So you know where the system will search startup files. Now you can directly put your code there and it will be automatically executed during startup. Great!!! So that’s all? we just write scripts there? Of course not!
Directly putting code in the files is easy, however, it is not the best choice. For example, what happens if there are certain scripts you want to execute only once on a certain image but some other code that you want to execute each time the image starts? To solve that, among other things, we have the reification of StartupAction. Let’s see how we use them:
| items | items := OrderedCollection new. items add: (StartupAction name: 'Basic settings' code: [ Author fullName: 'MarianoMartinezPeck'. Debugger alwaysOpenFullDebugger: true. ]). StartupLoader default addAtStartupInPreferenceVersionFolder: items named: 'basicSettings.st'.
What we do first is to create an instance of StartupAction using the message #name:code:. We pass as argument a name and the Smalltalk code we want to run inside a block closure. In this example, I just set my username and I put a setting to always open the debugger (no pre-debugger window). So far nothing weird.
The magic comes with the last line, the message #addAtStartupInPreferenceVersionFolder: items named: aFileName receives a list of startup actions and a filename and stores the actions in a file with the passes argument. So in this case we have only one action called ‘Basic Settings’ and it will be placed in a file called ‘basicSettings.st’. But where? in which of the 3 folders described previously is it placed? well…it depends on the message. In this case, we used the #addAtStartupInPreferenceVersionFolder:named: (notice the “InPreferenceVersionFolder”). So it put the files in 2). In addition, you can use the messages #addAtStartupInGeneralPreferenceFolder:named: which stores files in 1) and #addAtStartupInImageDirectory: which stores in 3). Notice that with the first two messages we can specify the file name but with the last one we can’t. Remember the last one is always called ‘startup.st’. If you are lazy and don’t want to think the name yourself, you can just use #addAtStartupInPreferenceVersionFolder: which creates a file called ‘startupPharoNN.st’ or #addAtStartupInGeneralPreferenceFolder: that creates a file named ‘startupPharo.st’.
We saw that when executing the message #addAtStartupInPreferenceVersionFolder: items named:aFilename or any of its variant, a file is created with the code we want to evaluate. Then, when the system starts it will find our file and execute our code. But, how is the resulting file? Exactly as the code we provided? No! Look how our example file ‘/Users/mariano/.config/pharo/2.0/basicSettings.st’ is generated:
StartupLoader default executeAtomicItems: {
StartupAction name: 'Basic settings' code: [Author fullName: 'MarianoMartinezPeck'.
Debugger alwaysOpenFullDebugger: true].
}.
So as you can see, the file is generated by sending a collection of actions to “StartupLoader default executeAtomicItems:”. In this example the collection has only one action, but it would have more if our example has more. So now the StartupLoader will execute all the actions found in the file. Do we execute all actions? No! Actions can be built with a property of “runOnce”. So if an action has already been executed in the current image before the last save, it is not executed again. Executed actions are stored in the singleton instance #default of StartupLoader. Therefore, you have to save the image. If an action generates an error the action is NOT registered as executed. In addition, errors are also stored in the singleton of StartupLoader so you can query them after starting the image by inspecting the result of “StartupLoader default errors”.
As an advanced example, I want to show you the script I am using for my images. For that, I have this Smalltalk code:
setPersonalStartUpPrefernces
"self setPersonalStartUpPrefernces"
| items |
items := OrderedCollection new.
items add: (StartupAction name: 'General Preferences for all Pharo versions' code: [
FileStream stdout lf; nextPutAll: 'Setting general preferences for all Pharo versions'; lf.
Author fullName: 'MarianoMartinezPeck'.
FileStream stdout lf; nextPutAll: 'Finished'; lf.
]).
StartupLoader default addAtStartupInGeneralPreferenceFolder: items named: 'generalSettings.st'.
items add: (StartupAction name: 'Settings' code: [
FileStream stdout lf; nextPutAll: 'Setting general preferences'; lf.
UITheme currentSettings fastDragging: true.
CodeHolder showAnnotationPane: true.
MCCodeTool showAnnotationPane: true.
Deprecation raiseWarning: true.
Debugger alwaysOpenFullDebugger: true.
Parser warningAllowed: false.
FileStream stdout lf; nextPutAll: 'Finished'; lf.
]).
StartupLoader default addAtStartupInPreferenceVersionFolder: items named: 'settings.st'.
items removeAll.
items add: (StartupAction name: 'Nautilus' code: [
FileStream stdout lf; nextPutAll: 'Executing Nautilus related stuff'; lf.
Nautilus pluginClasses add: { NautilusBreadcrumbsPlugin. #top }.
Nautilus pluginClasses add: { AnnotationPanePlugin. #middle }.
FileStream stdout lf; nextPutAll: 'Finished'; lf.
] runOnce: true).
StartupLoader default addAtStartupInPreferenceVersionFolder: items named: 'nautilus.st'.
items removeAll.
items add: (StartupAction name: 'Monticello related stuff' code: [
| sharedPackageCacheDirectory |
FileStream stdout lf; nextPutAll: 'Executing Monticello related stuff'; lf.
sharedPackageCacheDirectory := (FileDirectory on: '/Users/mariano/Pharo/localRepo/')
assureExistence;
yourself.
MCCacheRepository default directory: sharedPackageCacheDirectory.
MCDirectoryRepository defaultDirectoryName: '/Users/mariano/Pharo/localRepo/'.
(MCRepositoryGroup default repositories
select: [:each | (each isKindOf: MCHttpRepository)
and: [((each locationWithTrailingSlash includesSubString: 'www.squeaksource.com')
or: [each locationWithTrailingSlash includesSubString: 'http://ss3.gemstone.com/ss/'])]
]) do: [:each |
each
user: 'MMP';
password: ((FileDirectory default oldFileNamed: '/Users/mariano/Pharo/repositoriesPassword.txt') contents).
].
FileStream stdout lf; nextPutAll: 'Finished'; lf.
]).
StartupLoader default addAtStartupInPreferenceVersionFolder: items named: 'monticello.st'.
Basically, I have 4 files to customize stuff: 1) general settings; 2) settings for Pharo 2.0; 3) nautilus and 4) monticello related stuff. 1) is for all Pharo versions. So far I am just setting my username. 2) 3) and 4) are for Pharo 2.0 (just because I know they work in Pharo 2.0 and I am not sure if they work in other versions). For nautilus, I don’t want to add the plugins each time (because it would add the plugin several times) so I create a StartupAction using the message #name: nameOfItem code: code runOnce: aBoolean passing a true to aBoolean.
So you may have noticed that: a) #addAtStartupInPreferenceVersionFolder: and friends expect a list of actions; b) you can have multiples files. So, how do you split your code? From what I can see in the framework, there is no restriction. You can have as many actions per files and as many files as you wish. An action has a block of closure that can contain as much code as you want.
I found that one way of splitting your code is when some actions need to be executed only once and some other each time. Another reason may be some code which may be expected to fail for some reason. If it fails, the code after the line that generated the error won’t be executed. Hence, you may want to split that code to a separate action.
The way I found to work with this stuff is to have my own class GeneralImageBuilder (put whatever name you want). In such class I have the mentioned method #setPersonalStartUpPrefernces (from the advanced example). So I use Monticello to save and load that project. Then, whenever I want to create the script files and add them to their correct directory, I just evaluate that method.
In order to support the “runOnce:”, actions are stored in the singleton instance of StartupLoader. After an action is executed (if executed correctly), the action is stored and marked as “executed”. It may happen that later on you modify the scripts by hand, or you change the rules and re-store them or some kind of black magic. So…if you change some of these, I recommend to do 2 things:
I think that the tool is very nice. It is just 3 classes and a very few methods. I have been improving it recently but still, there could be more improvements. Wanna help? I wanted to summarize this post and write a better class comment, but I am running out of free time. In addition, it would be nice to have some tests
I want to thank to Benjamin Van Ryseghem for doing the first version of the tool and to Ben Coman for fixing the preference folder in Windows and for discussing with me about the performed improvements.
Hope you like it!
For my last project I needed some kind of cache. I had one web service providing the main functionality and that was using another service for session and user information. Having each web request triggering multiple requests internally to resolve user and session data was not an option.
In pharo there is a class called LRUCache. It is like a dictionary where the only implemented method is #at: . The LRUCache is created by providing a size of the dictionary and a factory block. When an element is requested by using at: the factory block will be invoked if the element is not present.
LRUCache does not give you control over the storage of the elements. Either it is there or it will be created and exists then. For my user and session data the situation was slightly more complicated. I don't want to store user information when the user is not confirmed (it can change within the next seconds if the user confirms). And sessions should be removed from the dictionary if they are expired. The removal of expired sessions is not necessary as they would be sorted out automatically. It is an optimization because the cache will be less efficent if expired session block upper position in the LRU order until the reach the tail of the list and get discarded.
To serve my purpose I created a LRUDictionary class. It works like the LRUCache class (yes, I preserved the nice statistics the LRUCache provides about its usage) but adds more of the dictionary protocol to it. I added
at:ifAbsent: at:ifAbsentPut: at:ifPresent: at:put: removeAt: removeKey: removeKey:ifAbsent
The code can be found on squeaksource
Feel free to improve, comment or criticize
With the departure of Alan Knight, the Smalltalk team here at Cincom will need a new manager. Working at Cincom can be quite rewarding, and our Smalltalk tools are among the most important products at the company.
This time around we are looking outside Cincom, and if you have experience with managing a distributed technical team and interacting with a diverse customer base, then you might be a good candidate for the postion.
Yes, balancing the needs of the customers with our geeky need to “get it right”, might seem like herding cats at times, but you will have the opportunity to work with one of the best teams in the industry, and work at a great company. In addition, you would be in a position to help us maintain our leadership in the Smalltalk community, and set the course for the future of Cincom’s Smalltalks.
Torsten spots some Android progress for Smalltalk:
Hilaire Fernandes made DrGeo for Android available. DrGeo is built using Pharo Smalltalk.
Squeak Oversight Board minutes – 5/07/12
Attending: Colin Putney, Chris Cunnington, Bert Freudenberg, Randal Schwartz
- some ideas were explored for a Squeak event concerning kinds of presentations and intended audience; in addition we discussed who might be a good keynote speaker
- ideas for where we should get a new server were explored, but we’re waiting back to hear from some people, so nothing definitive was decided today
- there is a plan (regardless of the readiness of the new server) to take a week in June and update the squeak.org website to the latest version of Aida
- instead of waiting until next year, some steps will be taken to update the voting procedure. The people who voted this year will automatically be included in a new voting list. The new system will likely be based on the Sugar Labs model with a public list of voters. [1]
- Chris Muller is the new SFC liaison contact at the SOB
[1] http://wiki.sugarlabs.org/go/Sugar_Labs/Members