Planet Squeak

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

September 10, 2021

PharoWeekly

[Ann] Simple window tiler

Tyler durden from fight club. It has a really poor documentation and lacks tests, hopefully is going to change soon. It allows one to do drag and drop for organizing Spec Windows.

https://github.com/pharo-contributions/durden

by Stéphane Ducasse at September 10, 2021 10:53 AM

September 09, 2021

Program in Objects

JRMPC 2022 Registration Is Now Open

This is the high school programming competition you’ve all been waiting for. Registration for it is now open. Registration is free! There are big prizes!

For more details, visit https://jrmpc2022.wordpress.com/.

by smalltalkrenaissance at September 09, 2021 11:08 AM

PharoWeekly

[Job] Pharo upgrade

Hi,
We are running a seaside app on GemStone 3.4.1 and develop in Pharo 6.1.
Is there someone out there who would be interested in taking on the job of upgrading both GemStone, Pharo and Seaside to recent versions? This is in our environment, with numerous databases, testing and dev environments.
It would be preferable if the person (or people) understand Monticello, Metacello and Seaside packages that work together. 
This would be on a contract basis until the project is complete. Please contact me directly if you are interested. 
Kind regardsOtto Behrens Otto Behrens <otto@finworks.biz>

by Stéphane Ducasse at September 09, 2021 05:27 AM

September 08, 2021

Historical - Vanessa 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 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 Vanessa (noreply@blogger.com) at September 08, 2021 06:55 PM

September 05, 2021

Craig Latta

Squeak turns: 25. We celebrate!

Squeak turns 25 on Friday, 24 September 2021. Let’s celebrate! We’ll begin with an informal online gathering, at https://8×8.vc/3plus4/cast. It will start at 11am pacific time (18.00 UTC), and last all weekend, so that folks from all timezones may attend. To increase the chance of crossing paths, let’s aim for peaks at each noon and midnight UTC. We’ll also use https://squeak.slack.com as a text backchannel, starting now.

Proceed for Truth!

by Craig Latta at September 05, 2021 04:41 PM

September 02, 2021

PharoWeekly

Passed – 83969 …In tests we believe, and we prove it.

Hi all

Passed – 83969 this is the jenkins result when we check if a commit is integrable into Pharo 10.

This is always a warm feeling and we will continue to add more tests to cover our lovely systems.

In tests we believe, and we prove it.

Stef

by Stéphane Ducasse at September 02, 2021 08:44 AM

August 31, 2021

Vanessa Freudenberg

Frontend-only Multi-Player. Unlimited Bandwidth. Or: What is Croquet.io, really?

A multi-player web app needs a backend, right?

What if I told you, it doesn’t?

Read on for how Croquet gets rid of servers. No, really.

Instantaneous Shared Experiences is how we describe Croquet on our website. And while that excellently describes What Croquet does, as Croquet's Chief Architect, I wanted to share a bit about How we do that.
So I wrote a Twitter thread. Here it is in blog form, slightly extended.

Click the animation above if it does not play automatically

Croquet lets you build completely client-side multi-user web apps.

Read that again.

Client-side.
Multi-user.

No I’m not kidding. I built it, I know it works. 😁 

Croquet apps run completely client-side:
  • can be hosted as a static web site
  • no server-side code needed
  • no networking code needed 
Croquet is literally virtualizing the server: Instead of running code on a server (or in a serverless function) we run it as a virtual machine (VM) on each client. 
Croquet carefully controls the inputs to these identical VMs so they execute in sync. 

The input events for the shared VMs are routed via Croquet’s global fleet of “reflector” servers. A reflector just bounces events from one user to all users. There’s no computation involved. Reflectors are small and fast. We have them around the globe, and will have many more with extremely low latency soon.

Crucially, the reflector guarantees event order and timing so every VM processes the same event at the same time. (That’s what the animation on top shows.)
Croquet reflectors also send out a continuous heartbeat to keep the VMs running, and in sync, without user input. 

Since the “server” is really a VM running on the client, you get unlimited bandwidth from that “server” to the client.

👏Unlimited👏Bandwidth👏

In fact, you can directly “reach into” the replicated VM to pull out any data for rendering. It’s just a pointer 🤷🏻‍♀️ 

Croquet also snapshots these VMs, encrypts the snapshots, and uploads them to a server until the next time they are needed.
The encryption key never leaves the client. Our servers cannot peek into the snapshots. They can’t peek into events either, since those are fully end-to-end encrypted, too. 

And yes this really works. In a web browser. In your browser, in fact. Try this:
That’s WideWideWorld, an editable voxel world with hundreds of AIs running around, and a water simulation. Scan the QR code in the lower left with your phone (or share the session URL). Both clients will be in sync. 

Of course, to build something like WideWideWorld on top of Croquet you’ll need to know how to build a game in the first place. This prototype is by our own Brian Upton (whom you might recognize from Rainbow Six & Ghost Recon). He joined us because no other tech would allow him to build this. 

Croquet is especially good for:
  • multi-user AR / VR / WebXR
  • multi-player games
  • collaborative design and construction
  • synchronized media
  • shared simulations
  • quick prototyping of shared experiences
These are hard to build, and some of the really hard parts are always the networking and server design, implementation, deployment, and scaling. 

Croquet eliminates this headache.

By the way, we are not literally running a Docker image in the browser. Although that would be a fun exercise – theoretically, Croquet can run anything that is deterministic and serializable.

No, it’s just JavaScript. The ECMAScript standard provides the semantic guarantees we need to achieve bit-identical execution across all platforms. Even WASM can be used with some care.

Plus our API is much simpler than traditional client/server code. Your shared server “VM” can be a single class, and you interact with it simply using publish/subscribe!
class Counter extends Croquet.Model {                 init() {                     this.n = 0;                     this.subscribe("counter", "set", this.set);                     this.tick();                 }                 set(value) {                     this.n = value;                     this.publish("counter", "changed");                 }                 tick() {                     this.n++;                     this.publish("counter", "changed");                     this.future(1000).tick();                 }             }
The value of n will be synchronized between all VMs
even as it is incrementing automatically.

We have many simple tutorials to get you started: 
(also: hiring a #DevRel engineer to write more) 

We are working on higher-level frameworks, too:
VDOM is already available, and WorldCore soon! See croquet.io/docs

By the way, if you heard of Croquet about 15 years ago – yes, that was us too, in particular our founder David Smith working with Alan Kay.  

That system was written in Squeak Smalltalk and had a fancy 3D UI.
Our new JS system has no UI, so it's good for many kinds of apps.

JavaScript has become incredibly rich, but it has no simple way of communicating with the person on the phone next to you.

Croquet provides this missing infrastructure for the web.

Try it! No servers needed.

(if you 💜 servers come work with us though)
End-Of-Thread 🧵

Compiled from a Twitter Thread I posted the day after Croquet's public launch.

by Vanessa (noreply@blogger.com) at August 31, 2021 03:41 PM

August 25, 2021

PharoWeekly

Pharo activity log…

I’m always super impressed by the activity…

https://lists.pharo.org/empathy/thread/IVLK577LBE6DLUDDCOTKR2AASU7BJR5S

Stef (fat cutter)

by Stéphane Ducasse at August 25, 2021 03:36 PM

Two job offers for Pharo in US

https://join.lifeley.com/developer.html

https://www.alliancereservations.com/developer-test.html

by Stéphane Ducasse at August 25, 2021 12:22 PM

August 24, 2021

Historical - Ramon Leon

Looking for a Developer

If you're interested see listing at: https://www.alliancereservations.com/developer-test.html

by Ramon Leon at August 24, 2021 01:08 PM

August 16, 2021

PharoWeekly

[Ann] 25th of August: Talk about class variable in Pharo

Marcus Denker will present how first class representation of variables simplifies the compiler.

https://www.uksmalltalk.org

by Stéphane Ducasse at August 16, 2021 08:14 PM

August 15, 2021

PharoWeekly

[Ann] Metaclass chapter of Pharo 9 by exam

by Stéphane Ducasse at August 15, 2021 09:49 AM

August 13, 2021

PharoWeekly

[Ann] ABBench: Lightweight Microbenchmarking Library

Hello,
I’ve just released a utility I’ve been using for the past few years to help optimize Pharo code. It’s a library that makes it easy to check whether an optimization has improved performance by wrapping the optimization and the old code in an if block and executing the optimized and unoptimized paths repeatedly under the same runtime conditions to determine which is faster. 

Basic usage is to wrap changes to the code in if blocks like so:
ABBench a: [ …existing code…] b: […optimized code…]
And then run the A/B test by printing:
ABBench bench: […some main method…]

I have found it to make performance testing simple and quick enough that I actually do it. Perhaps someone else will find it useful.
Install with:

Metacello new
  githubUser: 'emdonahue' project: 'ABBench' commitish: 'master' path: ''; 
  baseline: 'ABBench';
  load.

More details can be found here: 

https://github.com/emdonahue/ABBench

Cheers,Evan

by Stéphane Ducasse at August 13, 2021 07:53 PM

Gilad Bracha

How is a Programmer Like a Pathologist?

Blogging platforms like Blogger are totally inadequate, because they don't support embedding interactive code in posts. So this is just an indirection for the real post at: https://blog.bracha.org/exemplarDemo/exemplar2021.html?snapshot=BankAccountExemplarDemo.vfuel#

by Gilad Bracha (noreply@blogger.com) at August 13, 2021 03:59 AM

August 10, 2021

PharoWeekly

Morphic chapter of Pharo9 by example

by Stéphane Ducasse at August 10, 2021 04:40 PM

August 09, 2021

PharoWeekly

[ANN] Bootstrap 5 for Seaside in Pharo

Hi,

after some of you are using https://github.com/astares/Seaside-Bootstrap4
I wanted to let you know that I just published the new / updated project to
support for Bootstrap 5 web development (https://getbootstrap.com) in Seaside
using Pharo.

Project location is on GitHub:

https://github.com/astares/Seaside-Bootstrap5

It might not be fully complete by 100% with all new possibilities of BS5 – but
it is usable and tests are green in Pharo 8 and Pharo 9. Examples are included,
just follow the instructions on the Github page.

Feel free to send contributions via PR’s.

Have fun!
T.

by Stéphane Ducasse at August 09, 2021 01:53 PM

August 08, 2021

PharoWeekly

PharoX summer cleaning (or cutting the fat).

After years of good and loyal services, Glamour and the tools got a needed retirement. After a long effort of about 2/3 years we are happy to be able to massively clean Pharo.

We wanted to do it earlier but we needed a good replacement and now this is done! All the new tools are written in Spec2 and we are rewriting and deprecating all the tools not expressed in Spec2.0.

Let us avoid to be naive and think bit (drawing early conclusions on a wrong basis is always not really smart). We removed 420 classes (around 73,800 lines of code). Ok so what.

First, removing is not the panacea. Because LESS code for LESS functionality is EASY. Just remove the package and you do less. It is important to remove things when they duplicate functionality, when they are unused or/and unmaintained. It was the case of Glamour.

Second some people takes that lowering the number of classes is good. NO! NO! Sorry boys you should look at the Pharo mooc (2 videos of the third week of the Mooc http://mooc.pharo.org). And sorry Smalltalk friends, I’m pretty sure that you understand why having two classes True and False is better than having only Booleans. So please think a bit and relax when you think that class number should be small. It should NOT!

Now removing an old framework and its users and offering to the users an enhanced behavior and a better reusability (yes with Spec2.0 we can reuse/extend the default tools – you can extend the inspector and plug the Presenter you want and that you can reuse from somewhere else, so sweet isn’t) is what we wanted to achieve and we did it and we will continue.

We are doing the same is other parts of the system and this is cool.

So PharoX is shinning.

Happy Stef working on Pharo9 by Example.

by Stéphane Ducasse at August 08, 2021 07:47 AM

August 07, 2021

PharoWeekly

[Ann] Stream chapter of Pharo 9 by Example

by Stéphane Ducasse at August 07, 2021 02:26 PM

August 06, 2021

PharoWeekly

[Ann] Chapter Collection of Pharo 9 by example

by Stéphane Ducasse at August 06, 2021 01:09 PM

August 05, 2021

PharoWeekly

[Ann] Chapter Basic Classes of Pharo 9 by Example

by Stéphane Ducasse at August 05, 2021 01:07 PM

August 04, 2021

PharoWeekly

[Ann] Chapter Sunit of Pharo 9 by Example

by Stéphane Ducasse at August 04, 2021 05:44 AM

August 03, 2021

PharoWeekly

New internal organization

Hello community

Just a little mail from holidays to let you know that from September on we will try a new organisation.

Pharo 9 (with Covid and amount of work) was stressful for us.
Seriously we deliver more than expected so we did several meta meetings (and we will continue) 
to understand how we can work with less stress. 
In particular we want to be able to give better feedback to the community while being able to deliver
the large items we have on our plate.

In a nutshell every month we will have

a full team working day around 

a full internal bug/issue internal sprint: we want to be able to concentrate on issues that require concentration

and we want to make sure that we can provide feedback and integrate PRs that need brain.

our monthly open sprint (we hope that Covid 4th wave will not break our fun once again).

The Pharo consortium team

by Stéphane Ducasse at August 03, 2021 05:14 PM

August 02, 2021

PharoWeekly

[Ann] Chapter 7 of Pharo 9 by example

by Stéphane Ducasse at August 02, 2021 04:15 PM

August 01, 2021

PharoWeekly

[Ann] New version of Pharo with Style

Dear Pharoers

I wrote a new chapter about streams to Pharo with Style.

S.

by Stéphane Ducasse at August 01, 2021 01:00 PM

July 31, 2021

PharoWeekly

[Ann] Chapter 6 of Pharo 9 by Example

by Stéphane Ducasse at July 31, 2021 03:17 PM

July 29, 2021

PharoWeekly

Chapter 5 of Pharo 9 by Example

by Stéphane Ducasse at July 29, 2021 03:16 PM

July 28, 2021

PharoWeekly

About Zinc servers on DO

The answers to the following question are from real pro pharo developers.

Anyone here run a web app using plain ZnServer (or subclasses) on a cheap VPS (i.e., $10/month DO droplet or equivalent). What are your experiences?, suggestions.

I am planning a web app with just plain ZnServer, SQLite3, ATS or equivalent.

Thanks, Vince

Answer 1

Hi Vince,

That is certainly possible and works well. I would recommend an instance with 1GB RAM, that leaves you some headroom.

Deploying web applications is of course a broad subject, much of the required knowledge is not Pharo specific, but needed anyway.

The last chapter in the Pharo Enterprise book (https://books.pharo.org/enterprise-pharo/) is a good starting point (Deployment). But there are other and different approaches.

A plain HTTP demo instance running on a DO instance can be found here: http://zn.stfx.eu/welcome

For production use you should front with NGINX or something similar to add HTTPS.

May people on this mailing list deploy Pharo server applications, we have tens of them in day to day production doing real work.

Good luck on your journey, you know where to ask questions.

Regards,

Sven

Answer 2

Yeap, not much more to add than what Sven said. What’s important to
mention is that they are really stable.
I’ve been running Pharo servers in DO droplets of all sizes, without
issues (some running for months), I only had to upscale one droplet to
more memory, and it was because of a leak I introduced with PGSQL
connections, otherwise, they’re pretty lightweight for today’s
standards and a normal workload.

I have deployments with nginx and Pharo images as upstreams, and I
have one with Docker swarm and Traefik doing the load balancing among
different Pharo workers and acting as the HTTPS endpoint. I’m removing
this option though and moving back to nginx only.

What I never tried was to host a docker container running Pharo, in
some Docker hosting. It might be the best option as a quick start, but
after doing the math, it’s always more expensive than a Droplet.

Best regards,

Esteban A. Maringolo

Answer 2

Yes, very stable. I’ve had a DigitalOcean droplet running for 6 years
that was holding various false starts. To my surprise, one (never
“shipped”) website was still running (Pharo-3.?, mongodb, Bootstrap
css). I’d been poking the site every once in a while, and found that
the Bootstrap UI steadily degraded, because I’d pointed the site’s
.css at some non-fixed version from some CDN server (so that .css must
have changed over the years). The uptime on the machine was over 1000
days, and there have been many emails over the years about network,
hardware, etc. changes. After years of unattended reboots, some relic
was still up.

Anyhow, that instance is now deleted, probably soon to be joined by a
more recent setup where I started with the DO 1-click docker droplet.
This setup was useful to learn about docker, and I might go back to it
in the future. Given Estaban’s comments in this thread, I decided to
do a bare nginx + Pharo image deployment (which is similar to the now
deleted 6 year instance described above, which had Apache2 instead of
nginx). I will have the mongo server on a separate machine, but have
not decided whether to use the DO offering of a managed mongo server.
It’s still a work in progress, and other’s experiences are of
interest.

Thanks for reading.
Yanni Chiu

by Stéphane Ducasse at July 28, 2021 03:08 PM

July 27, 2021

PharoWeekly

[ANN] Chapter 4 of Pharo 9 by Example

by Stéphane Ducasse at July 27, 2021 12:40 PM

July 21, 2021

Program in Objects

The Reinvention of Instantiations

Instantiations is a major Smalltalk vendor with a long and illustrious history. This year, it reinvented itself with a huge rebranding exercise:

I like it very much. I love the aesthetics. This will greatly enhance Instantiations’ image (pun intended) within the programming community.

In addition to the rebranding, Instantiations has been very actively developing its product (VAST) with all kinds of innovations and improvements. I am particularly impressed by the efforts of Instantiations’ lead software engineer, Mariano Martínez Peck.

Keep an eye on this company. I believe it has a bright future.

by smalltalkrenaissance at July 21, 2021 02:26 PM

July 19, 2021

Program in Objects

Top Programming Languages for 2021

TIOBE Index for July 2021

  1. C
  2. Java
  3. Python
  4. C++
  5. C#
  6. Visual Basic
  7. JavaScript
  8. PHP
  9. Assembly language
  10. SQL
  11. Classical Visual Basic
  12. R
  13. Go
  14. Fortran
  15. Groovy
  16. Swift
  17. Ruby
  18. Perl
  19. MATLAB
  20. Delphi/Object Pascal

PYPL for July 2021

  1. Python
  2. Java
  3. JavaScript
  4. C#
  5. C/C++
  6. PHP
  7. R
  8. TypeScript
  9. Objective-C
  10. Swift
  11. Kotlin
  12. Matlab
  13. VBA
  14. Go
  15. Rust
  16. Ruby
  17. Visual Basic
  18. Ada
  19. Scala
  20. Dart

IEEE Spectrum: Top Programming Languages 2020

  1. Python
  2. Java
  3. C
  4. C++
  5. JavaScript
  6. R
  7. Arduino
  8. Go
  9. Swift
  10. Matlab
  11. Ruby
  12. Dart
  13. SQL
  14. PHP
  15. Assembly
  16. Scala
  17. HTML
  18. Kotlin
  19. Julia
  20. Rust

GitHut 2.0 for 2nd Quarter 2021

  1. JavaScript
  2. Python
  3. Java
  4. Go
  5. Ruby
  6. TypeScript
  7. C++
  8. PHP
  9. C#
  10. C
  11. Scala
  12. Shell
  13. Dart
  14. Rust
  15. Kotlin
  16. Swift
  17. PowerShell
  18. Groovy
  19. Elixir
  20. DM

The Most Popular Programming Languages — 2020 Q2 (from Statistics and data)

  1. Python
  2. JavaScript
  3. Java
  4. C#
  5. PHP
  6. C++
  7. C
  8. R
  9. Swift
  10. Objective-C
  11. Kotlin

Closing Remarks

These different indices use different bases for their rankings, so it’s rather like comparing apples and oranges. But we can still draw some interesting insights.

Once high-flying languages like Clojure, Crystal, F#, Haskell, and Nim are notably absent in the top 20 lists. TypeScript figures prominently in two lists but is absent in all the others.

It is my hope that Smalltalk will someday appear in the top 20 lists.

by smalltalkrenaissance at July 19, 2021 01:27 AM