Re: [Pharo-users] Pharo image processing library

2020-01-26 Thread Hernán Morales Durand
Hi Pablo,

I did some experiment with the Form class some time ago, maybe you can
borrow something from here:
https://80738163270632.blogspot.com/2018/10/pharo-script-of-day-proto-proto-image.html

Hernán


El sáb., 25 ene. 2020 a las 13:42, Pablo Navarro ()
escribió:

> Hi everyone! Thanks for the comments, I don't create a repository yet
> because, in this first version, I just wanted to try if it was possible, so
> only create a Form subclass and add three methods.
>
> Form subclass: #ImageForm
> instanceVariableNames: 'mode'
> classVariableNames: ''
> package: ‘SmallImage'
>
> ——>
>
> + aImage
> "add two image and return a new ImageForm"
> |aImageResult|
>
> aImageResult := self deepCopy.
>
> 0 to: self width do:[:x| 0 to: self height
> do:[:y|
> |aPoint aColorA aColorB|
> aPoint := (Point x: x y: y).
> aColorA := aImageResult colorAt: aPoint.
> aColorB := aImage colorAt: aPoint.
> aImageResult colorAt: aPoint put: aColorA + aColorB. ]].
> ^ aImageResult
>
> —->
>
> show: anTitle
> "Show a image in a window, scale the image to 500"
> |im|
> im := (ImageMorph withForm: (self scaledIntoFormOfSize:500) ).
> im withSnapshotBorder.
> im borderWidth: 5.
> im color: (Color gray).
> im openInWindowLabeled: (anTitle,' | mode: ', self mode asLowercase, '| ',
> self shape).
>
> -—>
>
>
> The first problem I found was the class Form return 'Form new' and not
> 'self class new' so I had to create two class method (in ImageForm):
>
> newFrom: aForm mode: aMode
> "create an ImageForm from to a Form object."
> | aImage|
>
> aImage := self new.
> aImage copyFrom: aForm.
> aImage mode: aMode.
> ^ aImage.
>
> —>
>
> open: aFileName
> “Open a image.”
> | aImage aForm|
>  aForm := ImageReadWriter formFromFileNamed: aFileName.
> aImage := self newFrom: aForm mode: ‘ARGB’.
> ^ aImage.
>
> —>
>
>
> I think that the methods (+ and show) should be directly in the class Form
> but I didn't want to change the original. If you think it's okay, I can
> continue working and this week upload to github with their respective tests.
>
> P.S. sorry for my limited English.
>
>
>
>
> Best Regards Pablo.
> El 25 de ene. de 2020 12:10 -0300, Stéphane Ducasse <
> stephane.duca...@inria.fr>, escribió:
>
> what I always find strange is that people do not invest in tests for
> domains that are super nice to test….
>
> S.
>
> On 25 Jan 2020, at 16:04, Serge Stinckwich 
> wrote:
>
> You may have a look to Cuis library :
> https://github.com/Cuis-Smalltalk/Numerics
> There is an image analysis package.
> We have some plan in PolyMath to port it:
> https://github.com/PolyMathOrg/PolyMath/issues/158
>
> Best,
>
> On Fri, Jan 24, 2020 at 11:20 PM Pablo Navarro  wrote:
>
>> Hi everyone!
>>
>> I’m searching for one library for image processing in Pharo. I couldn't
>> find anything (only wrappers) so I tried programming one for basic
>> operations (sum,
>> subtraction) with images using class “Form”.
>>
>> What do you think about this?
>>
>>
>> For providing a context, I'm studying a PhD. in image processing, but all
>> of the operations that I do, do it in Python. I try using Pharo for more
>> fun :D.
>>
>> Best Regards Pablo.
>>
>
>
> --
> Serge Stinckwic
> ​h​
>
> Int. Research Unit
>  on Modelling/Simulation of Complex Systems (UMMISCO)
> ​Sorbonne University
>  (SU)
> French National Research Institute for Sustainable Development (IRD)​
> U
> ​niversity of Yaoundé I​, Cameroon
> "Programs must be written for people to read, and only incidentally for
> machines to execute."
> https://twitter.com/SergeStinckwich
> ​
>
>
> 
> Stéphane Ducasse
> http://stephane.ducasse.free.fr / http://www.pharo.org
> 03 59 35 87 52
> Assistant: Julie Jonas
> FAX 03 59 57 78 50
> TEL 03 59 35 86 16
> S. Ducasse - Inria
> 40, avenue Halley,
> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
> Villeneuve d'Ascq 59650
> France
>
>


Re: [Pharo-users] Fwd: Morph menu entries

2020-01-26 Thread Ben Coman
I guess its a carry over from Squeak and maybe Scratch which have more
focus on interactive media direct interaction than Pharo.
Personally I never use it and consider it too prominent, and think sinking
it one level to a World Menu Item would be nice.
What would be the arguments against doing that?

An alternative could be having it as a Task Bar menu item.

cheers -ben

On Sun, 26 Jan 2020 at 20:18, Richard Kenneth Eng 
wrote:

> Could someone please explain what the "World contents" menu obtained by
> right-clicking on the background is all about? (I normally left-click to
> obtain the "World" menu.) Why are there all those morphs listed? And is
> this potentially a problem?
>
> Thanks.
>
> -- Forwarded message -
> From: Bob Nemec
> Date: Sat, 25 Jan 2020 at 10:16
> Subject: Morph menu entries
>
> Hey Richard,
>
> I’m still learning Pharo, so I don’t know what this means, but when I
> right-click on the desktop I see a long list of StringMorph entries.
>
> Later I’ll try starting with a new image. Is there a more recent JRMPC
> file-out you’d like me to use?
>
>
>
>
>
>
>
> *Bob Nemec*
>
>
>
>
>
> *HTS Toronto *| ontario.htseng.com
>
> 115 Norfinch Drive | Toronto, ON M3N 1W8
>
> C: 905.442.4539 | T: 416.661.4060 Ext 2255 | F: 416.661.0100
>
>
>
> *Delivering Real Success®*
>
>
>
>
>
>
>


Re: [Pharo-users] New Smalltalk Blog

2020-01-26 Thread horrido
Here's the third from Leandro: 
https://smalltalk.tech.blog/2020/01/26/extending-the-smalltalk-syntax-3/
  

It would be really nice if I could find a few more articles to publish
(hint, hint). 



horrido wrote
> Here's the second of four in the series from Leandro:  Extending the
> Smalltalk Syntax 2
> https://smalltalk.tech.blog/2020/01/23/extending-the-smalltalk-syntax-2/;
>  
> .
> 
> I'm looking for submissions, so if any of you are interested, please send
> me
> an email.
> 
> 
> 
> horrido wrote
>> I've created a new Smalltalk blog https://smalltalk.tech.blog/;.
>> I've left
>> Medium because of their pressure to put everyone behind a paywall.
>> 
>> I've opened up the blog for third-party submissions. Anyone can email me
>> an
>> article submission and if I deem it appropriate, I will edit and publish
>> it. Here's an example from Leandro Caniglia, President of FAST: Extending
>> the Smalltalk Syntax
>> https://smalltalk.tech.blog/2020/01/20/extending-the-smalltalk-syntax/;.
>> 
>> Articles should serve to showcase why Smalltalk is such a great language.
>> If possible, an accompanying eye-catching feature image would be nice.
>> (If
>> you look at the other posts, you'll see images of a Maserati and a
>> Tesla!)
>> 
>> I would prefer the article submissions to be in LibreOffice format. It
>> would make it easier for me to edit.
>> 
>> Thanks,
>> Richard
> 
> 
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] Pharo image processing library

2020-01-26 Thread Pablo Navarro
I'll work on those tests and then we'll do the subclass for image
processing.

:)

I'm very happy to contribute to this project.

Pablo.


El dom., 26 ene. 2020 12:08, Stéphane Ducasse 
escribió:

> Pablo
>
> if you are interested I would like to increase the tests around Form.
> The three that exist are in FormTest and to a certain extent to BitBltTest.
> If you write  tests I will happily review and integrate in the system.
> ( I will see if I can hijack some time during a boring meeting to produce
> some more).
>
> I also check the reference to Form and clearly the class Form itself
> refers too much to it.
> Now with more tests we would be more confident to change.
>
>
> S.
>
>
> On 25 Jan 2020, at 17:41, Pablo Navarro  wrote:
>
> Hi everyone! Thanks for the comments, I don't create a repository yet
> because, in this first version, I just wanted to try if it was possible, so
> only create a Form subclass and add three methods.
>
> Form subclass: #ImageForm
> instanceVariableNames: 'mode'
> classVariableNames: ''
> package: ‘SmallImage'
>
> ——>
>
> + aImage
> "add two image and return a new ImageForm"
> |aImageResult|
>
> aImageResult := self deepCopy.
>
> 0 to: self width do:[:x| 0 to: self height
> do:[:y|
> |aPoint aColorA aColorB|
> aPoint := (Point x: x y: y).
> aColorA := aImageResult colorAt: aPoint.
> aColorB := aImage colorAt: aPoint.
> aImageResult colorAt: aPoint put: aColorA + aColorB. ]].
> ^ aImageResult
>
> —->
>
> show: anTitle
> "Show a image in a window, scale the image to 500"
> |im|
> im := (ImageMorph withForm: (self scaledIntoFormOfSize:500) ).
> im withSnapshotBorder.
> im borderWidth: 5.
> im color: (Color gray).
> im openInWindowLabeled: (anTitle,' | mode: ', self mode asLowercase, '| ',
> self shape).
>
> -—>
>
>
> The first problem I found was the class Form return 'Form new' and not
> 'self class new' so I had to create two class method (in ImageForm):
>
> newFrom: aForm mode: aMode
> "create an ImageForm from to a Form object."
> | aImage|
>
> aImage := self new.
> aImage copyFrom: aForm.
> aImage mode: aMode.
> ^ aImage.
>
> —>
>
> open: aFileName
> “Open a image.”
> | aImage aForm|
>  aForm := ImageReadWriter formFromFileNamed: aFileName.
> aImage := self newFrom: aForm mode: ‘ARGB’.
> ^ aImage.
>
> —>
>
>
> I think that the methods (+ and show) should be directly in the class Form
> but I didn't want to change the original. If you think it's okay, I can
> continue working and this week upload to github with their respective tests.
>
> P.S. sorry for my limited English.
>
>
>
>
> Best Regards Pablo.
> El 25 de ene. de 2020 12:10 -0300, Stéphane Ducasse <
> stephane.duca...@inria.fr>, escribió:
>
> what I always find strange is that people do not invest in tests for
> domains that are super nice to test….
>
> S.
>
> On 25 Jan 2020, at 16:04, Serge Stinckwich 
> wrote:
>
> You may have a look to Cuis library :
> https://github.com/Cuis-Smalltalk/Numerics
> There is an image analysis package.
> We have some plan in PolyMath to port it:
> https://github.com/PolyMathOrg/PolyMath/issues/158
>
> Best,
>
> On Fri, Jan 24, 2020 at 11:20 PM Pablo Navarro  wrote:
>
>> Hi everyone!
>>
>> I’m searching for one library for image processing in Pharo. I couldn't
>> find anything (only wrappers) so I tried programming one for basic
>> operations (sum,
>> subtraction) with images using class “Form”.
>>
>> What do you think about this?
>>
>>
>> For providing a context, I'm studying a PhD. in image processing, but all
>> of the operations that I do, do it in Python. I try using Pharo for more
>> fun :D.
>>
>> Best Regards Pablo.
>>
>
>
> --
> Serge Stinckwic
> ​h​
>
> Int. Research Unit
>  on Modelling/Simulation of Complex Systems (UMMISCO)
> ​Sorbonne University
>  (SU)
> French National Research Institute for Sustainable Development (IRD)​
> U
> ​niversity of Yaoundé I​, Cameroon
> "Programs must be written for people to read, and only incidentally for
> machines to execute."
> https://twitter.com/SergeStinckwich
> ​
>
>
> 
> Stéphane Ducasse
> http://stephane.ducasse.free.fr / http://www.pharo.org
> 03 59 35 87 52
> Assistant: Julie Jonas
> FAX 03 59 57 78 50
> TEL 03 59 35 86 16
> S. Ducasse - Inria
> 40, avenue Halley,
> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
> Villeneuve d'Ascq 59650
> France
>
>
> 
> Stéphane Ducasse
> http://stephane.ducasse.free.fr / http://www.pharo.org
> 03 59 35 87 52
> Assistant: Julie Jonas
> FAX 03 59 57 78 50
> TEL 03 59 35 86 16
> S. Ducasse - Inria
> 40, avenue Halley,
> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
> Villeneuve d'Ascq 59650
> France
>
>


Re: [Pharo-users] Workspace with reliable save feature

2020-01-26 Thread Offray Vladimir Luna Cárdenas
Hi Hilaire,

We use kind of a similar approach for our community workshops.
Participants organize their scripts in a Grafoscopio node and they save
future/improved versions there as new nodes or overwriting old ones. I
don't see this as a long term solution, but kind of practical in
practice based educational settings, formal or informal.

Cheers,

Offray

On 26/01/20 4:50 a. m., HilaireFernandes wrote:
> Torsten, Offray, Trygve,
>
> Thanks for your suggestions for long term thinking. 
>
> In the meantime I need a workable solution for the coming weeks, I found the
> safer is to instruct the students how to operate with Playground to not lost
> their scripts.  
>
> We design our teaching unit around one example and practical cases. The
> example part contains a Pharo script and the resulting DrGeo sketch. The
> practical case contains several DrGeo sketches and the students must write
> the Pharo scripts. They extrapolate from the script in the example. 
>
> Therefore the work is incremental and before modifying any script they must
> rename the Page in the Playground. Some script will be reused in later
> units. I am pretty sure some, if not the majority, will forget to follow
> this protocol. 
>
> Anyway we will see.
>
> Hilaire
>
> Example of the first unit:
>  
>  
>
>
>
>
> -
> http://drgeo.eu
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>



[Pharo-users] Fwd: Morph menu entries

2020-01-26 Thread Richard Kenneth Eng
Could someone please explain what the "World contents" menu obtained by
right-clicking on the background is all about? (I normally left-click to
obtain the "World" menu.) Why are there all those morphs listed? And is
this potentially a problem?

Thanks.

-- Forwarded message -
From: Bob Nemec
Date: Sat, 25 Jan 2020 at 10:16
Subject: Morph menu entries

Hey Richard,

I’m still learning Pharo, so I don’t know what this means, but when I
right-click on the desktop I see a long list of StringMorph entries.

Later I’ll try starting with a new image. Is there a more recent JRMPC
file-out you’d like me to use?







*Bob Nemec*





*HTS Toronto *| ontario.htseng.com

115 Norfinch Drive | Toronto, ON M3N 1W8

C: 905.442.4539 | T: 416.661.4060 Ext 2255 | F: 416.661.0100



*Delivering Real Success®*


Re: [Pharo-users] ByteArray for UDP datagram

2020-01-26 Thread HilaireFernandes
Thanks for the tips.

So far, I've found two ways to write the datagram. One with stream, the
other one with hexadecimal representation.

The former is verbose but helps for the clarity. The latter is shorter while
tricky when variable content need to be inserted in the datagram

Are they better way to write the datagram?

Thanks

Hilaire

8<--
| server socket packet result |

packet := ByteArray streamContents: [ :str |
str uint32: 16r4F457403;
uint16: 0;
nextPut: 0;
nextPut: 3;
uint16: 65500;
nextPut: 1].
"Shorted but not as readable"
packet := ByteArray readHexFrom: '4F4574030003FFDC01'.

server := NetNameResolver addressForName: 'localhost'.
socket := Socket newUDP setPort: 3; yourself.
socket sendUDPData: packet toHost: server port: 3.
socket waitForDataFor: 1.
packet := ByteArray new: 200.
result := socket receiveUDPDataInto: packet.
result first isZero ifFalse: [ 
| peerId |
peerId := packet unsignedShortAt: 13 bigEndian: true.
UIManager default inform: 'Connected to Minetest server, peer id: ', 
peerId
asString.
"Disconnect"
packet := ByteArray streamContents: [ :str |
str uint32: 16r4F457403;
uint16: peerId;
nextPut: 0;
nextPut: 0;
nextPut: 3].
"Shorter but tricky"
packet := ByteArray readHexFrom: '4F457403', (peerId printStringBase: 16
length: 4 padded: true), '03'.

socket sendUDPData: packet toHost: server port: 3.
UIManager default inform: 'Disconnected from Minetest server.'.
  ].
socket closeAndDestroy.




-
http://drgeo.eu
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html