Planet Squeak

blogs about Squeak, Pharo, Croquet and family
planet squeak - planet squeak es - planet squeak jp - planet croquet - planet squeak code - planet smalltalk

January 20, 2017

Torsten Bergmann

GT4Gemstone

The Glamorous Toolkit for remote work with Gemstone/S is available on GitHub.

by Torsten (noreply@blogger.com) at January 20, 2017 05:15 PM

January 19, 2017

Torsten Bergmann

Bloc progress

A picture showing again some progress on Bloc for Pharo. If you want to help or test check the github page.

The screen shows the big list of naughty strings that can some systems cause to crash. As it works Pharo and Bloc can be considered string safe ...

by Torsten (noreply@blogger.com) at January 19, 2017 09:26 PM

January 13, 2017

Torsten Bergmann

Calypso browser update: method browser and better UI

A new version of Calypso, a new browser for Pharo. Read more here and here or watch the new video:


by Torsten (noreply@blogger.com) at January 13, 2017 11:01 AM

Snapcraft for Pharo

With snapcraft.io you can package any app for every Linux desktop, server, cloud or device, and deliver updates directly. Guillermo provided a Snapcraft for Pharo today.

by Torsten (noreply@blogger.com) at January 13, 2017 10:58 AM

CampSmalltalk 2017 in Durham, North Carolina

You're invited to Camp Smalltalk - RDU, March 31st – April 2nd 2017 in downtown Durham, North Carolina. Details at http://www.campsmalltalk-rdu.com

by Torsten (noreply@blogger.com) at January 13, 2017 10:50 AM

January 10, 2017

Torsten Bergmann

Pharo on FOSSASIA 2016

A journey in FOSS with Pharo & FOSSASIA by Jigyasa Grover - FOSSASIA 2016

by Torsten (noreply@blogger.com) at January 10, 2017 06:21 PM

January 02, 2017

Torsten Bergmann

Amber 0.18.2 is out

read more here and here.

by Torsten (noreply@blogger.com) at January 02, 2017 03:12 PM

December 30, 2016

Torsten Bergmann

Redline Smalltalk updated

Redline Smalltalk (which is running on JVM) was updated. Read more.

by Torsten (noreply@blogger.com) at December 30, 2016 12:18 AM

December 28, 2016

Torsten Bergmann

Pharo happiness

Use Pharo and cognitive services from Microsoft to find out about the happiness of people on pictures. The article is in japanese - but the code example shows what to do.

by Torsten (noreply@blogger.com) at December 28, 2016 07:06 AM

Calypso - another system browser for Pharo

Calypso is another system browser for Pharo. Read about it here or check the code here.


by Torsten (noreply@blogger.com) at December 28, 2016 06:56 AM

December 21, 2016

The Weekly Squeak

Eliot Miranda – Lubrication and Flow

Eliot gave a terrific presentation about the current state of the community and what we might do to improve it.

Evelyn (Lin) Ostrom

1933-2012

Eight principles for managing a commons

  1. Clearly defined boundaries
  2. Proportional equivalence between benefits and costs
  3. Collective choice arrangements
  4. Monitoring
  5. Graduated sanctions
  6. Fast and fair conflict resolutions
  7. Local autonomy
  8. Polycentric governance

http://www.onthecommons.org/magazine/commons-strategies

http://fast.org.ar/talks/lubrication-and-flow

Editorial: by Ron Teitelbaum follows

Eliot gave the presentation to help get the discussion going (it’s not the start of the conversation either, there are earlier efforts like the Pharo Consortium) this Article is part of that discussion.

My take on the conversation is that there are really two aspects of what Eliot is discussing.

First that some sort of economic organization that helps Smalltalk is needed and that the organization should be used to help both programmers and customers.  It seems to me that a Smalltalk Guild could be set up to do just that.  It would be a place for customers to find certified developers with access to a group of people (other guild members) that can solve difficult problems if they get stuck.  It could also be a place where members who make over a certain amount of money could get proportional benefits.  As a developer. I would probably join such a guild and as a customer, I would love to have a place to go which could help me solve some programming issues.

Second that we need to have better visibility, coordination, and cooperation.  The cost of coordination using technology is falling fast.  Having a site that pairs tasks with developers, shows developers guild certifications, allows for customer and developer ratings and comments, highlights training materials and growth paths, and generally allows communities to form and disband around specific areas funded by companies or the guild itself would fundamentally change how we organize and grow the community.

To illustrate let’s say we form a Smalltalk Guild.  Members pay $10 a year to join + %10 of what they make on jobs they get through the Guild Jobs.  Companies can also join the guild and pay $100 per year and pay %10 in addition to what they pay for a job if they hire a Guild member to do the work.  (These are just made up figures I have no idea if they would actually work and some study would be needed to figure that out).  As a group, the Guild can provide Training for new members, create certification levels and growth plans.  The incentive for the group is that as members grow and make more money everyone benefits, there is an incentive to make sure people are qualified, can do the work, and actually get work instead of doing nothing (like java programming).  Users that contribute over 10k to the guild (earn 90K) can get benefits if they are out of work, or maybe healthcare on a group plan, some form of compensation which of course would be less than they contribute + generate in customer fees and would be decided by the Guild as Eliot says 0.N/X.  This gives the best guild members an incentive to stay with the guild and to feel like the guild is helping them provide some basic needs and it allows the guild to acknowledge the contributions the member is putting in to help the entire group.  The money could also be used to benefit the Guild.  To pay for someone’s training or certification, to increase visibility, to look for donors, find new customers, invest in new training materials, new conferences, courses, or even develop technology like the VM or application frameworks based on the group’s collective choices.


by Ron Teitelbaum at December 21, 2016 06:56 PM

December 20, 2016

Torsten Bergmann

Cuis now in 64 bits

Cuis Smalltalk switched to 64 bit now. Nice!

by Torsten (noreply@blogger.com) at December 20, 2016 03:13 PM

December 15, 2016

Torsten Bergmann

Iceberg Techtalk

Techtalk on Iceberg - the git integration for Pharo:




 
Scroll forward until presentation starts after initial 10 minutes.

by Torsten (noreply@blogger.com) at December 15, 2016 12:49 PM

December 06, 2016

Torsten Bergmann

New version of StateSpecs 2.0

is described here.

by Torsten (noreply@blogger.com) at December 06, 2016 09:14 AM

December 02, 2016

The Weekly Squeak

Smalltalks 2016 Argentina Videos

Gilad Bracha – Utopia And Dystopia: Smalltalk And The Wider World

Many more videos available here:


by Ron Teitelbaum at December 02, 2016 12:15 AM

November 21, 2016

Gilad Bracha

Illiterate Programming

I have long been a fan of literate programming, especially live literate programming. I wrote a brief note about the topic a while ago, but for various reasons did not distribute it. Recently, the early release of Eve (very nice work) has injected some new life in this area.  So I decided to belatedly post my musings on the subject.

Ironically, posting live programming content is difficult on many web publishing venues, such as this blog, or Medium.  So if you actually want the substance of this post, you'll have to follow this link.

by Gilad Bracha (noreply@blogger.com) at November 21, 2016 02:38 AM

November 14, 2016

Torsten Bergmann

Scripting Unreal with Pharo

Kilon is working on bridging with CPP code (using shared memory approach). Still not finished - but he made some progress by remote driving Unreal engine. Read more.

by Torsten (noreply@blogger.com) at November 14, 2016 06:44 PM

Refactoring Example in Smalltalk

A nice example of the refactoring capabilities of Smalltalk (here Pharo). Refactor until you are satisfied with the code and make sure your tests run green.


by Torsten (noreply@blogger.com) at November 14, 2016 06:41 PM

November 08, 2016

Torsten Bergmann

LMDB with Pharo

A Smalltalk driver for the Lightning Memory-Mapped Database (LMDB)

by Torsten (noreply@blogger.com) at November 08, 2016 07:44 AM

November 04, 2016

Torsten Bergmann

Smalltalk Reflections episode 16: Unit testing

In this episode, Craig and Philippe discuss unit testing in Smalltalk, and how it influences the development process. We welcome special guest Jean-Christophe Mincke in our exploration of validation

by Torsten (noreply@blogger.com) at November 04, 2016 11:12 PM

The code behind Google Authenticator

A new article from Sven concerning Pharo. Code is on SmalltalkHub.

by Torsten (noreply@blogger.com) at November 04, 2016 09:16 PM

Smalltalk App streaming with Snowglobe

Read more on how to stream apps using Snowglobe. A Snowglobe demo is available here.

by Torsten (noreply@blogger.com) at November 04, 2016 09:12 PM

Tether

Tether - Remote messaging between Smalltalks with WebSockets. Read more.

by Torsten (noreply@blogger.com) at November 04, 2016 09:09 PM

Happy 20th Birthday Squeak!

It was twenty years ago that Dan Ingalls and the rest of Alan Kay's team announced Squeak to the world.

by Torsten (noreply@blogger.com) at November 04, 2016 09:09 PM

SqPronterface - 3D printing with Squeak Smalltalk

SqPronterface - a Port of MacPronterface to Squeak (Smalltalk) to control a 3D Printers. Description is here.

by Torsten (noreply@blogger.com) at November 04, 2016 09:06 PM

November 03, 2016

Craig Latta

Black Page Digital is accepting new clients

Greetings… I’m accepting new clients for my consultancy, Black Page Digital. I have extensive experience with several dynamic languages, virtual machine development, web services, bridging between languages and to static systems, GUI development, and live debugging. Please get in touch; I’d love to speak with you about your development efforts. Thanks!


by Craig Latta at November 03, 2016 08:20 PM

Bert Freudenberg

Deconstructing Floats: frexp() and ldexp() in JavaScript

While working on my SqueakJS VM, it became necessary to deconstruct floating point numbers into their mantissa and exponent parts, and assembling them again. Peeking into the C sources of the regular VM, I saw they use the frexp() and ldexp() functions found in the standard C math library.

Unfortunately, JavaScript does not provide these two functions. But surely there must have been someone who needed these before me, right? Sure enough, a Google search came up with a few implementations. However, an hour later I was convinced none of them actually are fully equivalent to the C functions. They were imprecise, that is, deconstructing a float using frexp() and reconstructing it with ldexp() did not result in the original value. But that is the basic use case: for all float values, if

[mantissa, exponent] = frexp(value)
then
value = ldexp(mantissa, exponent)
even if the value is subnormal. None of the implementations (even the complex ones) really worked.

I had to implement it myself, and here is my implementation (also as JSFiddle):
function frexp(value) {
    if (value === 0) return [value, 0];
    var data = new DataView(new ArrayBuffer(8));
    data.setFloat64(0, value);
    var bits = (data.getUint32(0) >>> 20) & 0x7FF;
    if (bits === 0) { // denormal
        data.setFloat64(0, value * Math.pow(2, 64));  // exp + 64
        bits = ((data.getUint32(0) >>> 20) & 0x7FF) - 64;
    }
    var exponent = bits - 1022;
    var mantissa = ldexp(value, -exponent);
    return [mantissa, exponent];
}


function ldexp(mantissa, exponent) {
  
  var steps = Math.min(3, Math.ceil(Math.abs(exponent) / 1023));
    var result = mantissa;
    for (var i = 0; i < steps; i++)
        result *= Math.pow(2, Math.floor((exponent + i) / steps));
    return result;
}
My frexp() uses a DataView to extract the exponent bits of the IEEE-754 float representation. If those bits are 0 then it is a subnormal. In that case I normalize it by multiplying with 264, getting the bits again, and subtracting 64. After applying the bias, the exponent is ready, and used to get the mantissa by canceling out the exponent from the original value.

My ldexp() is pretty straight-forward, except it needs to be able to multiply by very large and very small numbers. The smallest positive float is 0.5-1073, and to get its mantissa we need to to multiply with 21073. That is larger then the largest float 21023. By multiplying in steps we can deal with that. Three steps are needed for e.g. ldexp(5e-324, 1023+1074) which otherwise would result in Infinity.

So there you have it. Hope it's useful to someone.

Correction: The code I originally posted here for ldexp() still had a bug, it did not test for too small exponents. I fixed it above, and updated the JSFiddle, too. Also, Nicolas Cellier noticed other rounding and underflow problems, his suggestions for ldexp() are now used above.

by Bert (noreply@blogger.com) at November 03, 2016 06:16 PM

October 31, 2016

The Weekly Squeak

Squeak Turns 20!

Please Donate to Squeak!

Craig Latta writes:

Hi all–

Happy 20th birthday to us! It was twenty years ago that Dan Ingalls and the rest of Alan Kay’s team announced Squeak to the world. You really changed things with this run at the fence. :)  Thanks again!

 

 


Back to the Future

The Story of Squeak, A Practical Smalltalk Written in Itself

by

Dan Ingalls Ted Kaehler John Maloney Scott Wallace Alan Kay

 

 


by Ron Teitelbaum at October 31, 2016 07:16 PM

Craig Latta

App streaming with Snowglobe

Now that we’ve seen how to run Smalltalk in a web browser, clone web Smalltalk as a desktop app, and send remote messages between Smalltalks, let’s look at an application of these technologies.

app streaming

App streaming is a way of delivering the user experience of an app without actually running the app on the user’s machine. The name is an allusion to music and video streaming; you get to experience the asset immediately, without waiting for it to download completely. Streaming an app also has the benefit of avoiding installation, something which can be problematic to do (and to undo). This is nice when you just want to demo an app, before deciding to install it.

Another advantage of app streaming is that the app can run on a much faster machine than the user’s, or even on a network of machines. Social networks are a crude example of app streaming; there are massive backends working behind your web browser, crunching away on all that graph data. Typically, though, app streaming involves an explicit visual component, with the user’s display and input devices standing in for the normal ones. The goal is to make using a new app as simple as playing an online video.

distributing Smalltalk user interface components

Everything in Smalltalk happens by objects sending messages to each other. With a remote messaging framework like Tether, we can put some of the objects in a user interface on a remote machine. Snowglobe is an adaptation of Squeak‘s Morphic user interface framework which runs Squeak on a server, but uses SqueakJS in a client web browser as the display. This is an easy way to recast a Smalltalk application as a web app, while retaining the processing speed and host platform access of the original.

Morphic is built around a display loop, where drawable components (morphs) are “stepped” at some frequency, like a flipbook animation. Normally, drawing is done on a single morph that corresponds to the display of the machine where Squeak is running. Snowglobe adds a second display morph which is Tether-aware. When drawing to this tethered display morph, the app server translates every display operation into a compact remote message.

To maximize speed, Morphic already tries to do its drawing with as few operations as possible (e.g., avoiding unnecessary redrawing). This is especially important when display operations become remote, since network transmission is orders of magnitude slower than local drawing. Since the tethered display morph also lives in a Smalltalk object memory, we can optimize drawing operations involving graphics that are known to both sides of the connection. For example, when changing the mouse cursor to a resize icon when hovering over the corner of a window, there’s no need to send the icon over the wire, since the displaying system already has it. Instead, we can send a much smaller message requesting that the icon be shown.

For full interaction, we also need to handle user input events going back the other way. Snowglobe co-opts Morphic’s user input handling as well. With user input and display forwarded appropriately together, we achieve the seamless illusion that our app is running locally, either as a single morph amongst other local morphs, or using the entire screen.

going beyond screen-sharing

Protocols like VNC do the remote display and user input handling we’ve discussed, although they are typically more complicated to start than clicking a link in a web browser. But since both systems in a Snowglobe session are Smalltalk, we can go beyond simple screen sharing. We can use Tether to send any remote messages we want, so either side can modify the app-streaming behavior in response to user actions. For example, the user might decide to go full-screen in the web browser displaying the app, prompting SqueakJS to notify the remote app, which could change the way the app displays itself.

try it for yourself

I’ve set up an AWS server running the Squeak IDE, reachable from SqueakJS in your web browser. Be gentle… there’s only one instance running (actually two, one in Europe and one in North America, chosen for you automatically by Amazon). Please check it out and let me know what you think!

 


by Craig Latta at October 31, 2016 08:00 AM

October 30, 2016

Craig Latta

Tether: remote messaging between Smalltalks with WebSockets

In my previous post, I introduced a new topology for distributed computation with Smalltalk: an object memory in SqueakJS in a web browser, paired by remote-messaging connection with another object memory in Cog in a native app, and connected with other SqueakJS/Cog pairs on other physical machines. The remote-messaging protocol that the memories speak is called Tether. I’ll go into a few details here.

passive frame-based messaging with WebSockets

We begin with a major constraint imposed by running in a web browser: we’re sandboxed, unable to listen for network connections. We must initiate a remote-messaging conversation by connecting to a listening server on a traditional operating system. Over the last few years, the W3C WebSockets standard has received widespread support in every major web browser. We can rely on the ability to create JavaScript WebSocket objects with the SqueakJS JavaScript bridge, and we can easily implement the WebSocket API in Smalltalk on non-web platforms using normal TCP sockets.

WebSockets use callback functions to deliver messages, or frames of bytes, between conversants. The Tether protocol imposes a structure on those bytes, which are processed on each side of the connection by instances of class Tether. The first four bytes are a 32-bit tag which indicates the Smalltalk class which should interpret the rest of the frame. In the case of a remote message, this is class Tether. Successive bytes indicate the message selector to perform, the receiver of the message, and the message parameters.

The message receiver is expressed as a 32-bit key into a table of exposed objects, maintained by the Tether instance handling the connection. The Tether instances themselves expose their identities to each other at the beginning of the conversation. Objects that aren’t specified by reference to an exposed-object table (such as message selectors) are expressed through serialization.

live serialization

The fact that both sides of the conversation are objects in live Smalltalk systems affords many optimizations that aren’t possible when serializing objects to a static file. For this reason, I call this live serialization. For example, when transferring a compiled method between systems, if the method’s literals are objects which already exist in the receiving system, we may write references to them rather than serializing them.

We can also take special measures when the receiving system is missing the classes whose instances we want to transfer. Instead of assuming in advance that the receiving system lacks the classes whose instances we’re transferring, and including them in our payload, as a static serialization file would, we can transfer such classes only on demand. This yields much higher accuracy in object transfer, and far fewer bytes sent over the wire. Since live serialization is part of a complete remote messaging protocol, any messages at all can be sent from either side to complete an object transfer.

With a receiver, selector, and parameters specified, the receiving system can perform the message sent from the sending system. Each object in the system is responsible for serializing itself over a Tether. If the answer to the remote message is a literal object, like a symbol or integer, it will write the bytes of its value on the Tether instance handling the message. If the answer isn’t a literal object, by default it will write a reference to itself. Developers can choose to pass objects by value or by reference as they see fit.

scheduling

Tether performs every remote message in a distinct process, so that no system blocks waiting for an answer to be sent back over the network. Each remote message-send is assigned a unique identifier, and each answer is sent with the ID of its message-send as metadata, so that it can be delivered to the correct waiting process.

This scheme extends the traditional imperative messaging semantics of Smalltalk to any number of machines, and each message-send may involve receiver and parameter objects which are all on different machines. Every message-send may invoke any number of further remote messages before answering.

transparent proxies

An object which represents an object on a remote system is called a proxy. Ideally, it forwards every message sent to it to the remote object, and so provides the illusion of transparent remote messaging. Remote messaging in Smalltalk is often done by using a proxy class which inherits and implements as few messages as possible, and overriding the handler message sent by the virtual machine when a message is not understood. This provides enough coverage to do many useful things, but some messages handled specially by the virtual machine are not forwarded. Some use cases, like remote debugging, require forwarding even those special messages.

To achieve total forwarding coverage, we must modify the virtual machine. There are some situations where this is undesirable (e.g., a lack of tools or expertise, or a requirement to use a past virtual machine unmodified). Tether uses the “does not understand” tactic above in these situations, but provides a modified virtual machine for the rest. In this virtual machine, message forwarding is triggered during method lookup for instances of a specific proxy class (which can be located anywhere in the class hierarchy). Method caching and methods implemented directly as virtual machine instructions are also appropriately adapted. There are a few messages which proxies must understand locally, to participate in live serialization. These messages are also handled specially by the virtual machine.

see for yourself

Tether is an integral part of the Context project from Black Page Digital. A demo of remote messaging between SqueakJS and Cog is available. In tomorrow’s post, I’ll discuss an everyday application of remote messaging.

 


by Craig Latta at October 30, 2016 08:31 AM