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 02, 2014

Torsten Bergmann

Reddit.st — In 10 Cool Pharo Classes

Another nice article published by Sven on how to use Pharo, the Seaside web framework and the Glorp ORM together with Postgres DB to create a Reddit.st version.

Read more here.

by Torsten (noreply@blogger.com) at September 02, 2014 08:18 AM

August 30, 2014

Gilad Bracha

Taking it to Th’emacs

Emacs is my preferred text editor. I don’t use old-fashioned text editors as much as I used to, because I often need more specialized tools.  I use IDEs for various programming languages and other things when producing high quality documents. And yet, I often wish I could subsume these with a tool that had the basic goodness of emacs.

What makes emacs interesting all these decades after its inception is not what keyboard shortcuts it supports or what its basic editing functionality is. Rather, what matters are some of its underlying design principles.
As a consequence, you can control everything emacs does programmatically. This makes emacs extensible in a way that is far deeper and more powerful than a plug-in architecture. A plug-in architecture must anticipate every desired extension to the system. Since it never can, it always disappoints in the end. Along the way it grows ever more complex and bloated in its futile attempt to foresee every possible need. With a language, you can code any extension you need.

If the scripting language is truly dynamic, and allows you to not only extend but also modify the running system, the possibilities are truly unlimited.

The points above are not limited to editors. They are fundamentals of system design.

There was a time when even Microsoft recognized this, making apps that could be programmed via VisualBasic. Sadly, they concocted a security nightmare, because malware can also control your application. Which is why being able to secure your application’s scripting language is critical as well. 

Last June, I spoke at QCon NY, and demonstrated a number of interesting web based systems that had some these properties (as well as a couple that did not, but were interesting for other reasons):
We really need an Emacs for the modern age.  An editor, surely, but one that lets you edit rich text, images, audio and video. In fact, you should be able to embed arbitrary widgets. And of course it needs to be scriptable I just explained. So you might evaluate code that creates a UI element and inserts into the editor.  

Now you can make the editor modify its own GUI. In fact, the editor can be extended into a general purpose GUI builder just like Lively. And every such GUI can modify itself if you wish; sometimes you may wish to modify it so it can no longer modify itself, and then you have a frozen application. Your editor has become an IDE. In fact, it is a live literate programming environment

If the editor’s scripting language interoperates well with the surrounding environment, it can be used to control the computer and everything the computer itself controls. You can check in to the environment and hardly ever leave. You can lead your cyber life in it.: email, social media, live chats, streaming audio and video can all be incorporated. Moreover they can all be controlled and customized by you, the lucky user. 

To a degree, Lively is such an editor. It’s biggest drawbacks are a lack of polish due to lack of engineering resources and that its scripting language is Javascript.

Now, imagine that the editor was polished and robust. Even more importantly the code you created in this environment was modular and secure and written in an elegant and principled language. Imagine you could deploy the same code either on the web, or natively on both desktop and mobile. Imagine that the applications built with the language support online and offline use out of the box, automatically synchronizing data and code between clients and servers. Imagine that they have built-in support for collaboration, either syncing in real time or merging offline as required. 

Of course, it is the vision of such a language and platform that has always motivated the Newspeak project.  I have discussed many of these points before. In particular, I’ve talked about the weaknesses of traditional IDEs (see for example this post and this one), and the need for a platform that supports synchronization over the net (here and again here) for a long time. Yet the message bears repeating. 


by Gilad Bracha (noreply@blogger.com) at August 30, 2014 10:07 PM

August 29, 2014

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) {
        data.setFloat64(0, value * Math.pow(2, 64));
        bits = ((data.getUint32(0) >>> 20) & 0x7FF) - 64;
    }
    var exponent = bits - 1022,
        mantissa = ldexp(value, -exponent);
    return [mantissa, exponent];
}


function ldexp(mantissa, exponent) {
    return exponent <= 1023 ?
        mantissa * Math.pow(2, exponent) :
        mantissa * Math.pow(2, 1023) * Math.pow(2, exponent - 1023);
}
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 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 two steps we can deal with that.

So there you have it. Hope it's useful to someone. And here is the version I put into SqueakJS, if you're curious.

by Bert (noreply@blogger.com) at August 29, 2014 09:06 PM

August 28, 2014

The Weekly Squeak

Pyonkee (Scratch on iPad)

pyonkee

From Masashi-san:

Hi all,

 

I have just released a Scratch clone running on iPad. It is based on Scratch 1.4 from the MIT Media Laboratory.

The app is now called “Pyonkee” – freely available on App Store.

https://itunes.apple.com/us/app/pyonkee/id905012686

 

Pyonkee was originally started as a fork of John M McIntosh’s Scratch Viewer.

https://github.com/johnmci/Scratch.app.for.iOS.

 

While Scratch Viewer just works as a viewer of the existing Scratch projects, Pyonkee supports creation/edit of projects.

 

Other features:

- User interfaces are optimized for iPad

- Native font support

- Embedded camera support

- IME support

- Auto-saving project

- Sending projects via e-mail

- Project import/export through iTunes (currently disabled)

 

Moreover, source code is open on github. Feel free to fork it.

https://github.com/SoftUmeYa/Pyonkee

 

Enjoy!

[:masashi | ^umezawa]


by Ron Teitelbaum at August 28, 2014 05:00 PM

Torsten Bergmann

KelticKnots with Pharo

See here.

by Torsten (noreply@blogger.com) at August 28, 2014 12:08 PM

August 25, 2014

Torsten Bergmann

Teapot - another way for Pharo to serve the web

There are various options to write web applications in Pharo. You can use Seaside or Aida web framework or play with the new Tide framework connecting Amber with Pharo.

If you want to quickly write something you can use the plain Zn framework as this nice tutorial from Sven describes.

And now there is something inbetween that allow you to quickly write an application that serves static or dynamic content from Pharo. It is called Teapot and with a few lines of code you can provide JSON to the outside world or other REST based functionality. It also includes support for the Pharo port of Mustache (the templating engine).

The basic concept of Teapot is to define one or many URL Route(s) - either direct or as pattern (for instance with a Regexpression) and return an appropriate response from the Smalltalk side. Simple, lightweight and easy to use.

by Torsten (noreply@blogger.com) at August 25, 2014 11:00 AM

Woden - 3D graphics engine for Pharo

Woden is a multi-media graphics engine written in Pharo. This graphic engine is being designed for video-game development and data visualization.


Read more here.

by Torsten (noreply@blogger.com) at August 25, 2014 09:50 AM

TaskIt Version 1

The first version of TaskIT - a Task management library for the Pharo Language - is released. Read the announcement.

Also read the chapter for the upcoming Pharo for the Enterprise book.

by Torsten (noreply@blogger.com) at August 25, 2014 09:32 AM

August 21, 2014

Torsten Bergmann

Roassal contest result

Winners of the Roassal context are announced here. Click on the link and enjoy the videos.

by Torsten (noreply@blogger.com) at August 21, 2014 09:52 AM

Pharo consortium annual report

Pharo consortium annual report is available
http://consortium.pharo.org/web/announcements/2014-06-20-consortium-report

by Torsten (noreply@blogger.com) at August 21, 2014 06:15 AM

August 20, 2014

Torsten Bergmann

2048 Competition

Details on the 2048 Competition that was run by Cincom for ESUG2014:

 

by Torsten (noreply@blogger.com) at August 20, 2014 06:58 AM

SqueakJS and Smalltalk 78

Bert is progressing with his SqueakJS project. A current version can be found here:

http://bertfreudenberg.github.io/SqueakJS/

He can also run Smalltalk 78 on the Lively Kernel. The nice thing is all the VM code is fully accessible - you can also check the virtual machine while it is running.

If you want to try it yourself just open this page in your webbrowser: http://lively-web.org/users/bert/Smalltalk-78.html

Really interesting are also the details (for instance on GarbageCollection and on how to run one high level language on another high language.

Here are the videos from ESUG 2014 on that:




by Torsten (noreply@blogger.com) at August 20, 2014 06:46 AM

QCMagritte

QCMagritte is a framework on top of Seaside to develop applications. Here are the videos from ESUG 2014:



by Torsten (noreply@blogger.com) at August 20, 2014 06:43 AM

Fencing with Smalltalk

Anick Fron is talking about Fencing Software at ESUG 2014 (first written in Java, then rewritten in Smalltalk).

The webpage is http://fencingfox.com




by Torsten (noreply@blogger.com) at August 20, 2014 06:37 AM

August 19, 2014

Torsten Bergmann

Scratch activities in Japan

... on the japanese news.

by Torsten (noreply@blogger.com) at August 19, 2014 06:41 AM

ESUG 2014 Videos

The first videos from ESUG 2014 appear on the net. Greetings to Cambridge.

by Torsten (noreply@blogger.com) at August 19, 2014 06:40 AM

August 14, 2014

Torsten Bergmann

Concurrent Programming in Pharo

Read more here.

by Torsten (noreply@blogger.com) at August 14, 2014 06:54 AM

Voronoi scripted using Pharo

This video is about RTVoronyjBuilder for Roassal. More infos here.


by Torsten (noreply@blogger.com) at August 14, 2014 06:47 AM

July 25, 2014

Torsten Bergmann

Private Pharocloud Smalltalk source code repository

How to run a private Smalltalk source code repository on Pharocloud is explained here.

by Torsten (noreply@blogger.com) at July 25, 2014 07:27 PM

July 23, 2014

Torsten Bergmann

Package Dependencies Analysis in Pharo with new features

Package Dependencies Analysis in Pharo has new features. Read more

by Torsten (noreply@blogger.com) at July 23, 2014 07:09 PM

Smart Breakpoints alpha Release

The first release of SmartBreakpoints for Pharo.

by Torsten (noreply@blogger.com) at July 23, 2014 08:09 AM

ScienceSmalltalk v0.12

There is a new release of SciSmalltalk v 0.12 (written in Pharo Smalltalk) available. Also check out the project page on GitHub.

Beside many others you can use it for mathematical epidemiology modeling, look here for a quick start example on how to obtain the numerical solution of a simple one-dimensional Ordinary Differential Equation (ODE) and visualizing results using Graph-ET.

by Torsten (noreply@blogger.com) at July 23, 2014 08:06 AM

Essence# Invoking .NET with out/ref parameters

A detailed story on invoking .NET methods that have “out” or “ref” parameters from Essence#, a Smalltalk for .NET platform.

by Torsten (noreply@blogger.com) at July 23, 2014 06:23 AM

Improved refactorings

More improvements on the refactoring side of life.

by Torsten (noreply@blogger.com) at July 23, 2014 06:21 AM

July 18, 2014

Torsten Bergmann

Fun with Pharo (when writing books)

Beside the Pharo by Example, Deep into Pharo and the Pharo Enterprise book (available on CI, GitHub and as PDF) there is now also the idea of a book about "funny" things like implementing games in Pharo.

Therefore a new clone of the Pharo by Example book was created with the name "Fun with Pharo". The book is built on CI, the books source is hosted on GitHub and currently it includes already infos on how to build a digital Tamagotchi with Smalltalk or how the PhlappyBird game works.

The PDF for "Fun with Pharo" is already available.

If you want to contribute you should have a look and learn about Pillar and I would recommend to use either Online PillarHub or the new one-click image for PillarHub that you can run locally to write an own chapter.


by Torsten (noreply@blogger.com) at July 18, 2014 07:18 AM

July 16, 2014

Torsten Bergmann

Ephestos

A small demonstration of Ephestos , a communication bridge between Pharo and Blender.
Code is on SmalltalkHub - but actually it is only a simple methodn on the Pharo side:

sendMessage: aString
   |stream|
   stream := SocketStream openConnectionToHostNamed: '127.0.0.1'  port: 4000 .
   stream sendCommand: aString.
   stream close.



by Torsten (noreply@blogger.com) at July 16, 2014 01:46 PM

Pharo Consortium 2014 Annual Report

The Pharo 2014 Annual Report of the Pharo consortium (http://consortium.pharo.org) is available here:

https://pharoweekly.files.wordpress.com/2014/07/2014-06-report.pdf

by Torsten (noreply@blogger.com) at July 16, 2014 12:18 PM

July 15, 2014

Torsten Bergmann

PillarHub

A one click image for PillarHub is available now on CI. You can now run it locally very easy.

Just download (for instance using PharoLauncher), run and check http://localhost:8080

If you still do not know what PillarHub is all about then read this.

by Torsten (noreply@blogger.com) at July 15, 2014 03:00 PM

PhlappyBird

A Morphic based Flappy Bird clone written in Pharo.

Code is on SmalltalkHub: http://smalltalkhub.com/#!/~zeroflag/PhlappyBird


by Torsten (noreply@blogger.com) at July 15, 2014 09:17 AM

July 14, 2014

Torsten Bergmann

Toronto Smalltalk User Group

The Toronto Smalltalk User Group patio night is Monday, July 14 at Pauper's Pub, on the street level patio. See http://www.smalltalk.ca

by Torsten (noreply@blogger.com) at July 14, 2014 09:20 AM