Planet Smalltalk

March 27, 2015

Benoit St-Jean - Division et bits

Un excellent article sur les méandres et les subtilités de la division et des opérations de « bit shift« .


Classé dans:Pharo, Smalltalk, Squeak Tagged: arithmétique, bit, division, Pharo, shift, Smalltalk

Pharo Weekly - Quality Assistant

Dear Pharo users,

As you already know I am working on providing better code quality support in Pharo. You can use Code Critics in Pharo to detect bad practices and potential bugs. But launching the Critics Browser and running it on your code every now and then requires additional effort which demotivates many people in doing it.

I want to present you a compact tool called Quality Assistant
https://github.com/Uko/QualityAssistant#quality-assistant-𝑏𝑒𝑡𝑎-

It runs SmallLint rules on the code that you save and provides you with a critic feedback directly in the place where you code: the Nautilus Browser.

Quality Assistant is available for Pharo 4 from the Configuration browser. Please read about how to set it up here: https://github.com/Uko/QualityAssistant#set-up

I plan to introduce more features in the future and your feedback is much appreciated.

Cheers!
Uko

Nicolas Cellier - Is bitShift: equivalent to division in Smalltalk? And in Slang?

Let's try it in Squeak/Pharo:

(1 to: 8) allSatisfy: [:shift |
    (-255 to: 255) allSatisfy: [:e | (e//(1<<shift) ) = (e >> shift)]]

-> true

Isn't it surprising? It is well known that arithmetic shift for negative numbers is NOT equivalent to integer division (quotient of Euclidean division). See Non-equivalence_of_arithmetic_right_shift_and_division

Let's see. Above article assumes that:
  • negative are represented in 2-complement. We can assume that in Smalltalk for every bit operation (in fact large integers are represented as sign-magnitude, and we emulate two-complement but that's a detail) ;
  • bitShift: is well defined for negative and is propagating the sign bit. Oh yes it is, integers are not bounded and we assume an infinite sequence of 1 left of negatives, so what else would be propagated ;
  • the quotient is rounded toward zero.
Ah the last point is explaining the difference with common knowledge: // is not rounding toward zero, it's rounding toward negative infinity.

If we use quo: instead, then the answer is false and matches wikipedia's answer.

What about Slang? Slang is a subset of Smalltalk which can be translated to C code and which is used for generating the Squeak/Pharo Virtual Machine.

We must have a look at initializeCTranslationDictionary method in CCodeGenerator from the VMMaker package. It maps // to C operation / and \\ to C operation %. Ouch, but / is rounding toward zero as quo: does, and % behaves like rem:.

So what is true in Smalltalk is NOT in Slang. Too bad that we did not use quo: and rem: in Slang, we did not even map them!

This kind of mismatch gave us a famous bug once upon a time. Since right shift was for historical reason translated as a logical shift ((unsigned) a >> b), we thought we could just use // for arithmetic shifts, and the worse thing is that when simulating the Slang code, all was working as expected... Alas not in the VM once compiled.

Today, for the purpose of eliminating false positive warning in dead branches, I was about to generalize constant folding like bindVariableUsesIn:andConstantFoldIf:in: of TSendNode... This method is evaluating the constant in Smalltalk and is generating the value in C. This will work as long as no one mix a negative constant expression with //, \\ or >>. Otherwise, the same expression might well lead to two different results in the generated code, depending on the inlining level! For example, self minSmallInteger + 1 // 2 might well lead to a tricky variant of this bug.

The right thing would be to write slang exclusively with quo: and rem: and to change the generation of >> since we can allways force the logical one by sending a asUnsigned >> b. We can catch all the senders at runtime with a halt, but it's tedious... And there is more than a branch of VMMaker.

If we really insist on using a//b, it translates as:
(a/b)-(int)(a & (((unsigned)a)>>(sizeof(int)*8-1))
 But adopting the C philosophy, we ain't gonna pay for what we don't buy ;)


March 26, 2015

Ricardo Moran - Gifts from Sweden!

Hola, amigos! Espero que anden bien.

Quiero agradecer a Tobii (la compañía líder en captura de movimientos oculares) por obsequiarme un kit de desarrollo Tobii EyeX. Planeo agregar este dispositivo a Physical Etoys. Creo que va a traer un nuevo mundo de posibilidades a nuestra plataforma. Estén al tanto para más noticias. Que se diviertan!

Hi, friends! I hope you are doing good.

I am thanking Tobii (the world’s leader eye tracking company) for giving me a Tobii EyeX Dev Kit. I am planning to add this device to Physical Etoys. I believe that it would bring a new world of possibilities for our platform. Stay tuned for more news and have fun!

 

Tobii_Eye_Experience_EyeXBox_460x300

Pierce Ng - One Time Passwords

I bought a Yubikey device and am going to write a Pharo library for it. Meanwhile, I discovered that Richard Prinz has an implementation of RFC 6536 Time-based One Time Passwords for Pharo.

Benoit St-Jean - Time-based One-time Password

Si vous avec besoin d’une implémentation de Time-based One-time Password (TOTP), il y a ce package pour Pharo. Les spécifications de l’algorithme sont décrites dans le RFC 6238.


Classé dans:Pharo, Smalltalk Tagged: mot de passe, Pharo, RFC 6238, Smalltalk, Time-based One-time password, TOTP

Pharo News - Event in Bern on March 31: Bloc + working session on Pharo IDE

<p>Choose event in Bern on March 31: alain plantec on Bloc and working session on Pharo IDE.</p> <p>On March 31, we will have a one day of Pharo in Bern:</p> <ul><li> 10:15 - 11:00 Talk by Alain Plantec on Bloc: Reinventing Morphic (<a href="https://www.eventbrite.com/e/bloc-reinventing-morphic-choose-talk-tickets-5790681083">Registration</a>)</li><li> 11:00 - 17:00 Working session on the Pharo IDE (<a href="https://www.eventbrite.com/e/pharo-ide-choose-working-session-tickets-16283404100">Registration</a>)</li></ul> <p>The event will be held at the Software Composition Group: Schützenmattstrasse 14, Room 107, Bern</p> <p>The event is sponsored by CHOOSE a subgroup of the Swiss Informatics Society and hosted by the Software Composition Group at the University of Bern. They are primarily organized for CHOOSE and SI members, but the events are open for other students and professionals as well.</p>

Pharo News - Event in Bern on March 31: Bloc + working session on Pharo IDE

<p>Choose event in Bern on March 31: alain plantec on Bloc and working session on Pharo IDE.</p> <p>On March 31, we will have a one day of Pharo in Bern:</p> <ul><li> 10:15 - 11:00 Talk by Alain Plantec on Bloc: Reinventing Morphic (<a href="https://www.eventbrite.com/e/bloc-reinventing-morphic-choose-talk-tickets-5790681083">Registration</a>)</li><li> 11:00 - 17:00 Working session on the Pharo IDE (<a href="https://www.eventbrite.com/e/pharo-ide-choose-working-session-tickets-16283404100">Registration</a>)</li></ul> <p>The event will be held at the Software Composition Group: Schützenmattstrasse 14, Room 107, Bern</p> <p>The event is sponsored by CHOOSE a subgroup of the Swiss Informatics Society and hosted by the Software Composition Group at the University of Bern. They are primarily organized for CHOOSE and SI members, but the events are open for other students and professionals as well.</p>

March 25, 2015

Pharo Weekly - Changing the wheels on the car at 100km/h

Ben Coman refactored a core part of Delay and Delay are really central to a system like Pharo. His testimony highlights how we can be close to the system heart and improve it.

“One of the things that drew me to do the Delay refactoring, is simply that I could. That is, I was amazed that I could dig so deep so easily, see a path to improvement and effect change at a fundamental level. Excepting complexities with the Continuous Integration due to “changing the wheels on the car at 100km/h” (and one slip), it seems to have gone reasonably smoothly.  That sense of mastery is seductive.”


Marten Feldtmann - Reading QR images via Gemstone (server side Linux)

Ok, yesterday I posted a short message about creating QR codes on the server via Gemstone. In the afternoon I wanted to implement the reverse way: you have a picture on the server and you want to have the content of the QR code.

Actually here again under Ubuntu 14.04.x one has a package and a tool which does the main mart: “zbar-tools”.

Therefore simply: “sudo apt-get install zbar-tools” and after that installation you get a tool named “zbarimg” which does a simple “scan and decode bar codes from one or more image files”.

After that with MSKLibQREncode-MSK.5.mcz you get simple code to wrap this tool.


Filed under: Smalltalk Tagged: Gemstone, Linux, zbar-tools

Benoit St-Jean - Boardician

Boardician est un framework de jeux (board games, i.e. échiquier, grille de sudoku, damier, etc).  L’annonce du projet se trouve ici.

P.S. J’adore la photo, pour la simple raison je possède un échiquier identique!


Classé dans:échecs, Pharo, Smalltalk Tagged: échiquier, damier, framework, grille, jeu, jeux, Pharo, Smalltalk

Benoit St-Jean - Conférence sur Bloc

Conférence sur Bloc, un framework graphique, intitulée Bloc : Reinventing Morphic à Berne le 31 mars.


Classé dans:Pharo, Smalltalk Tagged: Bloc, GUI, Morphic, Pharo, Smalltalk

Benoit St-Jean - Gemstone et codes QR

Comment créer des codes QR à partir de Gemstone?  C’est expliqué ici.


Classé dans:Gemstone, Pharo, Smalltalk Tagged: code, Pharo, QR, Smalltalk

March 24, 2015

Benoit St-Jean - Kendrick 0.15

Torsten Bergmann - Boardician - a framework for building board games

Benoit St-Jean - Coral

Une initiative des plus intéressantes et des plus utiles : pouvoir utiliser Smalltalk comme langage de script!  C’est ce qu’est Coral!


Classé dans:Pharo, Smalltalk Tagged: Coral, Pharo, script, scripting, Smalltalk

Cincom Smalltalk - Cincom Smalltalk’s Answer to the Web App Development Demand

In “The Move to Digital Business Demands Investment in Five Classes of Technology,” Gartner’s Jim Tully and Tom Austin state...

Marten Feldtmann - Creating QR codes from Gemstone (server side under Linux) …

A nice library to create QR codes has been created by Kentaro Fukuchi. You may either use the low level C functions offered by his library but a much easier access you get by binding his own tool to create the images …

Ok, you may download the library, do the compilation with the tool and then you might use it from with Gemstone. The make process creates and installs the libraries and tools in the according directories.

Here the simple wrapper around the external tool qrencode


Filed under: Smalltalk Tagged: Gemstone, libqrencode, Linux

Torsten Bergmann - Bloc for Pharo

Benoit St-Jean - Pharo 4.0 Beta

Pharo 4.0 Beta est arrivé! Aidez la communauté en l’installant et en le testant!


Classé dans:Pharo, Smalltalk Tagged: 4.0, Beta, Pharo, Smalltalk

March 23, 2015

Torsten Bergmann - Kendrick DSL v0.15

Kendrick DSL v0.15 is out: new syntax, more than 30 epidemiological models included. Checkout the page.

Torsten Bergmann - Pharo 4.0 Beta Test

If you want to help beta testing Pharo 4.0 then visit this page.

Pharo Weekly - Pharo 40 beta is out

Try it to help us to deliver a great Pharo 40 release.

http://pharo.org/news/pharo4-beta


Pharo News - Beta Test Pharo4 Now!

<p>Pharo4 will be released soon.</p> <p>This is your chance to test it and to help fixing the last bugs. (We have 39 issues listed to be fixed for Pharo4).</p> <div class="teaser"> <h1>Download Pharo</h1> <p><strong>Version 4.0</strong> for OS X, Linux, and Windows. The zip files contain all necessary files. Just download and run the executable.</p> <p><a class="btn download" href="http://files.pharo.org/platform/Pharo4.0-mac.zip"><i class="fa fa-apple"></i> Mac OSX</a> <a class="btn download" href="http://files.pharo.org/platform/Pharo4.0-win.zip"><i class="fa fa-windows"></i> Windows</a> <a class="btn download" href="http://files.pharo.org/platform/Pharo4.0-linux.zip"><i class="fa fa-linux"></i> Linux</a></p> </div> <ul><li> <a href="http://files.pharo.org/image/40/Pharo-Image-4.0-latest.zip">Pharo 4 image</a></li><li> <a href="http://files.pharo.org/sources/PharoV30.sources.zip">Pharo 3 sources</a> (you will need it if you download image and VM separately, still V3)</li><li> <a href="http://files.pharo.org/vm/pharo/mac/Pharo-VM-mac-stable.zip">Mac OSX virtual machine</a></li><li> <a href="http://files.pharo.org/vm/pharo/win/Pharo-VM-win-stable.zip">Windows virtual machine</a></li><li> <a href="http://files.pharo.org/vm/pharo/linux/Pharo-VM-linux-stable.zip">Linux virtual machine</a></li></ul>

Yoshiki Ohshima - [その他] 中島みゆき

子供達が日常触れる日本語の歌は、童謡か中島みゆき、ということになっています。私がみゆきばっかり車中で聞いているものですので。 というわけで、彼らもお気に入りの歌があるわけなのですが、その理由が私とはだいぶん違うということに気がついてきました。以下は彼らの人気ランキングとその理由(推定)です。 No. 5 真っ直ぐな線。真っ直ぐな線やまんまるの円を描くのは難しいから。 No. 4 本日、未熟者。自分たちも未熟者だと認識しているからか? No. 3 パラダイスカフェ。「テーブルの向こうに見る甘い ...

March 22, 2015

Torsten Bergmann - Viva

Viva - a minimal framework for animations in Pharo.

Benoit St-Jean - Smalltalk en vrac (14)

Smalltalk

Smalltalk sur un Raspberry Pi : les options.

Très intéressant article sur Smalltalk intitulé You Probably Don’t Know What a Computer Is.

Smalltalk : le langage de programmation le plus efficace et productif.

Les nombreux podcasts du très regretté James Robertson ont déménagé.

BioSmalltalk est maintenant sur GitHub.

Smalltalk Digest, édition de mars 2015.

Camp Smalltalk à Portland en Orégon en août?  Si ça vous intéresse, les détails ici.

Pharo

Pharo Sprints : à l’INRIA à Lille, le 3 avril.

Components, Agents and Robots (CAR) : un nouveau vidéo ici et un autre ici.

Google API Registry : maintenant offert pour Pharo!

Viva : un framework de base pour l’animation.

Mongo Spotter : pour consulter ou naviguer dans une BD Mongo.

Le précieux travail de Nicolas Cellier en ce qui a trait à l’aspect numérique/mathématique de Pharo a maintenant son propre package : ExtendedNumberParser.

Consulter une base de données Mongo avec GT Tools expliqué ici.

Assessment for Business Processes (A4BP) permet de visualiser les données BPM de format BPEL et BPMN.  Le projet a également une page Facebook.

GemStone

Comment sérialiser des graphes immenses avec SIXX.

 


Classé dans:Gemstone, Pharo, Smalltalk Tagged: A4BP, Agents, animation, Assessment for Business Processes, BioSmalltalk, BPEL, BPM, BPMN, Camp Smalltalk, Components, ExtendedNumberParser, gemstone, Google API Registry, graphes, GT Tools, INRIA, James Robertson, langage de programmation, Lille, Mongo Spotter, MongoDB, Nicolas Cellier, Orégon, Pharo, Pharo Sprints, podcasts, Portland, Raspberry Pi, Robots, SIXX, Smalltalk, Smalltalk Digest, Viva

ESUG news - Video about the brewing of the ifTrue:ifFalse Beer

Remember the great ifTrue: and ifFalse: Beer at ESUG in Annecy?

Here is a video where the brewer (Stéphanie Altermatt from Artmalté) explains how she produces her beer:

https://www.youtube.com/watch?v=7G1ecJNops4

(video is in french...)

March 21, 2015

Pharo Weekly - #before and #after links!

Hi,

After loading this:
Simple after and before MetaLinks are taken into account, with just one check in #visitNode of the ASTTranslator that is
false when no links are there. (which means this slice should not impact anything)
For now this is for very simple MetaLinks: no parameters, no condition, no reification, no #instead/around,
no meta-level modelling.
Here is a trivial example:
1) get a AST node from our example method:
sendNode := (ReflectivityExamples>>#exampleMethod) ast body statements first value.
2) then we define a link that is just #halt:
link := MetaLink new
metaObject: Halt;
 selector: #now.
3) we set it:
sendNode link: link.
4) when we now execute the method, we get a halt:
ReflectivityExamples new exampleMethod
5) to get rid of it, uninstall the link:
link uninstall.
If you look at the byte code, you see that it compiles the link to the code:
25 <20> pushConstant: Halt
26 <D1> send: now
Marcus

March 20, 2015