Re: [Pharo-users] X11 options on Ubuntu VM / Athens rendering problems

2017-09-24 Thread Clément Bera
On Mon, Sep 25, 2017 at 2:33 AM, J.F. Rick  wrote:

> Hi Clement and and Stef,
>
> thanks for sharing. The video looks cool and it seems like a
> high-performance approach. Unfortunately, it doesn't seem to be working in
> Linux. I'm attaching the Pharo debug file, but it seems like the Handler
> being OSNullWindowHandle indicates a problem. I'm also not sure that this
> approach would allow me to do fullscreen apps. I noticed that your video
> shows a title bar in MacOS.
>
>
I've never made the demo work on linux, I am not surprised it doesn't work.
This demo is based on the Pharo 4 OSWindow version, and more recent
versions are working fine on linux.

About fullscreen as I said in the previous mail it is possible to enable
it, I tried it worked, but I did not do it as I don't think it make sense
with this game.

I will consider in the future making it work on the latest Pharo version on
multiple OS if it makes sense to show people how to do it. I'm busy with
other concerns right now.

Anyway, it's just one approach, you can use another one.


> Cheers,
>
> Jeff
>
>
>
>
>
> On Sun, Sep 24, 2017 at 7:53 AM Clément Bera 
> wrote:
>
>> Hi,
>>
>> I describe in the next paragraphs what I do to build application with
>> Pharo at 50 fps. Now I am using a SDL2 window with OSWindow and not the
>> default Pharo window for rendering. There is a fullscreen option with
>> OSWindow, I don't use it but I've just tried it works fine.
>>
>> To use Athens/Cairo I start the VM headless and I open from the code a
>> window using the SDL2 binding (OSWindow), then I extract the window surface
>> as a cairo surface to draw on it using Athens and I use SDL2 to manage
>> events (mouse, keyboard). That way I don't even start morphic/WorldMorph
>> which wastes cpu ressources.
>>
>> I built this video game that way:
>> https://clementbera.wordpress.com/2016/08/29/sdl2-cairo-
>> headless-for-realtime-native-applications/
>> https://www.youtube.com/watch?v=srPdFgbyS6s
>>
>> The game is running in Pharo 4 (pre-Spur). I configured it to run at 50
>> fps but from time to time some frames are dropped for performance so I
>> would say it is running at around 48-49 fps in practice. I think it should
>> work on the latest Pharo but you need to ask on pharo-dev how to use
>> OSWindow. Some APIs have changed since Pharo 4. Since the latest Pharo
>> version is now using Spur I expect the performance to be way better and I
>> think 50 fps is definitely manageable on a laptop.
>>
>> Note that this is still Pharo so if you want something which looks
>> real-time you need to be careful about you object allocation rate
>> in-between frame rendering.
>>
>> I hope this can help.
>>
>> Regards
>>
>>
>>
>> On Sun, Sep 24, 2017 at 9:43 AM, Stephane Ducasse <
>> stepharo.s...@gmail.com> wrote:
>>
>>> Hi jeff
>>>
>>> let us know if this is working. the start.sh script is not working on
>>> my machine. but clement made it worked on his machine and he should
>>> publish a zip.
>>>
>>> Stef
>>>
>>>
>>>
>>> On Sun, Sep 24, 2017 at 9:39 AM, Stephane Ducasse
>>>  wrote:
>>> > Yes I will share a dropbox with you for now.
>>> >
>>> > On Sat, Sep 23, 2017 at 9:44 PM, J.F. Rick  wrote:
>>> >> Hi Stef,
>>> >>
>>> >> since I'm only doing Athens rendering, it might be possible to do a
>>> native
>>> >> window implementation. That said, I don't know how to get started
>>> with that.
>>> >> Documentation seems to be hard to find. The last time I saw any work
>>> on that
>>> >> it was too early to be usable. I'm also not sure if it solves my "it
>>> needs
>>> >> to run in fullscreen at full speed" problem. If someone like Clement
>>> could
>>> >> get me started, that would be awesome.
>>> >>
>>> >> Cheers,
>>> >>
>>> >> Jeff
>>> >>
>>> >> On Fri, Sep 22, 2017 at 12:27 PM Stephane Ducasse <
>>> stepharo.s...@gmail.com>
>>> >> wrote:
>>> >>>
>>> >>> Hi Jeff
>>> >>>
>>> >>> Nice to see you. I do not know anybody running on X11. Esteban is
>>> >>> working on better SDL20 integration.
>>> >>> Did you try having a native window? I asked clement if he could
>>> >>> release the Wizard Battle Arena because it was a game he did in a
>>> >>> couple of days (yes he is good this guy) and that use cairo athens
>>> >>> based for drawing on native window.
>>> >>>
>>> >>> stef
>>> >>>
>>> >>> On Fri, Sep 22, 2017 at 3:11 PM, J.F. Rick  wrote:
>>> >>> > I'm running a fullscreen Pharo application on Ubuntu and I've
>>> noticed
>>> >>> > that
>>> >>> > Athens rendering gets way worse (maybe 10 updates per second) when
>>> I
>>> >>> > switch
>>> >>> > to fullscreen mode from inside Pharo. Ideally, I'd love for that
>>> to be
>>> >>> > fixed.
>>> >>> >
>>> >>> > In lieu of that, it would be cool if I could just maximize Pharo
>>> to the
>>> >>> > size
>>> >>> > of the screen to achieve good performance. Two things stop that:
>>> the
>>> >>> > Unity
>>> >>> > application bar and the title-bar. For the former, I can configure
>>> Unity
>>> >>> > to
>>> >>> > hide it. I noticed a '-notitle' X11 o

Re: [Pharo-users] X11 options on Ubuntu VM / Athens rendering problems

2017-09-24 Thread J.F. Rick
Hi Clement and and Stef,

thanks for sharing. The video looks cool and it seems like a
high-performance approach. Unfortunately, it doesn't seem to be working in
Linux. I'm attaching the Pharo debug file, but it seems like the Handler
being OSNullWindowHandle indicates a problem. I'm also not sure that this
approach would allow me to do fullscreen apps. I noticed that your video
shows a title bar in MacOS.

Cheers,

Jeff





On Sun, Sep 24, 2017 at 7:53 AM Clément Bera  wrote:

> Hi,
>
> I describe in the next paragraphs what I do to build application with
> Pharo at 50 fps. Now I am using a SDL2 window with OSWindow and not the
> default Pharo window for rendering. There is a fullscreen option with
> OSWindow, I don't use it but I've just tried it works fine.
>
> To use Athens/Cairo I start the VM headless and I open from the code a
> window using the SDL2 binding (OSWindow), then I extract the window surface
> as a cairo surface to draw on it using Athens and I use SDL2 to manage
> events (mouse, keyboard). That way I don't even start morphic/WorldMorph
> which wastes cpu ressources.
>
> I built this video game that way:
>
> https://clementbera.wordpress.com/2016/08/29/sdl2-cairo-headless-for-realtime-native-applications/
> https://www.youtube.com/watch?v=srPdFgbyS6s
>
> The game is running in Pharo 4 (pre-Spur). I configured it to run at 50
> fps but from time to time some frames are dropped for performance so I
> would say it is running at around 48-49 fps in practice. I think it should
> work on the latest Pharo but you need to ask on pharo-dev how to use
> OSWindow. Some APIs have changed since Pharo 4. Since the latest Pharo
> version is now using Spur I expect the performance to be way better and I
> think 50 fps is definitely manageable on a laptop.
>
> Note that this is still Pharo so if you want something which looks
> real-time you need to be careful about you object allocation rate
> in-between frame rendering.
>
> I hope this can help.
>
> Regards
>
>
>
> On Sun, Sep 24, 2017 at 9:43 AM, Stephane Ducasse  > wrote:
>
>> Hi jeff
>>
>> let us know if this is working. the start.sh script is not working on
>> my machine. but clement made it worked on his machine and he should
>> publish a zip.
>>
>> Stef
>>
>>
>>
>> On Sun, Sep 24, 2017 at 9:39 AM, Stephane Ducasse
>>  wrote:
>> > Yes I will share a dropbox with you for now.
>> >
>> > On Sat, Sep 23, 2017 at 9:44 PM, J.F. Rick  wrote:
>> >> Hi Stef,
>> >>
>> >> since I'm only doing Athens rendering, it might be possible to do a
>> native
>> >> window implementation. That said, I don't know how to get started with
>> that.
>> >> Documentation seems to be hard to find. The last time I saw any work
>> on that
>> >> it was too early to be usable. I'm also not sure if it solves my "it
>> needs
>> >> to run in fullscreen at full speed" problem. If someone like Clement
>> could
>> >> get me started, that would be awesome.
>> >>
>> >> Cheers,
>> >>
>> >> Jeff
>> >>
>> >> On Fri, Sep 22, 2017 at 12:27 PM Stephane Ducasse <
>> stepharo.s...@gmail.com>
>> >> wrote:
>> >>>
>> >>> Hi Jeff
>> >>>
>> >>> Nice to see you. I do not know anybody running on X11. Esteban is
>> >>> working on better SDL20 integration.
>> >>> Did you try having a native window? I asked clement if he could
>> >>> release the Wizard Battle Arena because it was a game he did in a
>> >>> couple of days (yes he is good this guy) and that use cairo athens
>> >>> based for drawing on native window.
>> >>>
>> >>> stef
>> >>>
>> >>> On Fri, Sep 22, 2017 at 3:11 PM, J.F. Rick  wrote:
>> >>> > I'm running a fullscreen Pharo application on Ubuntu and I've
>> noticed
>> >>> > that
>> >>> > Athens rendering gets way worse (maybe 10 updates per second) when I
>> >>> > switch
>> >>> > to fullscreen mode from inside Pharo. Ideally, I'd love for that to
>> be
>> >>> > fixed.
>> >>> >
>> >>> > In lieu of that, it would be cool if I could just maximize Pharo to
>> the
>> >>> > size
>> >>> > of the screen to achieve good performance. Two things stop that: the
>> >>> > Unity
>> >>> > application bar and the title-bar. For the former, I can configure
>> Unity
>> >>> > to
>> >>> > hide it. I noticed a '-notitle' X11 option when I execute pharo
>> -help.
>> >>> > I've
>> >>> > tried using these X11 options and neither -notitle or -fullscreen
>> seem
>> >>> > to
>> >>> > have any effect. Here's the command I run:
>> >>> >
>> >>> > ./bin/pharo --encoding utf8 -vm-display-X11 -fullscreen
>> PATH_TO_IMAGE &
>> >>> >
>> >>> > Pharo starts fine but neither option seems to have any effect. I've
>> also
>> >>> > tried this in GNOME, thinking that Unity was the problem. Again, no
>> >>> > effect.
>> >>> >
>> >>> > Any suggestions?
>> >>> >
>> >>> > Jeff
>> >>> >
>> >>> >
>> >>>
>> >>
>>
>>
>
THERE_BE_DRAGONS_HERE
 Startup Error: SubclassResponsibility: OSNullWindowHandle had the subclass responsibility to implement #title:
24 September 2017 8:08:59.17231 pm

VM: unix - i686 - linux-gnu - NBCoInterpreter NativeBoos

Re: [Pharo-users] Is a non-break space whitespace?

2017-09-24 Thread Stephane Ducasse
may be we should have a trimWithSeparators: #() where we can specify
what we want.
For the question about isSeparator I do not know.

On Sun, Sep 24, 2017 at 1:53 PM, PBKResearch  wrote:
> Hello All
>
>
>
> I have a little puzzle to disturb your Sunday lunch, maybe. I have been
> scraping text data from web pages, which often comes with redundant space
> before or after. I routinely use ‘trim’ on the final string output, but I
> have found cases where there are still redundant spaces. Inspecting the
> results, I find that the characters are non-break spaces (codepoint 160,
> Unicode U+00A0). Looking at the code, String>>#trim depends on
> Character>>#isSeparator, which does not answer true for a non-break space. I
> can use trimBoth: [:char| char asInteger = 160] to remove the redundant
> spaces if I know where to expect them, so it is not a major problem. But the
> question remains: should non-break space be included in the list of
> separators in Character>>#isSeparator.
>
>
>
> Peter Kenny
>
>



Re: [Pharo-users] Roasssal not working on Windows with Pharo 6.1

2017-09-24 Thread kmo
Many thanks. I tried this and it worked fine and Roassal installs and runs.

I then typed the same gofer command into my original Pharo 6.1 directory and
I got an error - #withSqueakLineEndings was sent to nil. Perhaps that's a
clue to what was going wrong.





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



Re: [Pharo-users] Is a non-break space whitespace?

2017-09-24 Thread stephan

On 24-09-17 13:53, PBKResearch wrote:
I have a little puzzle to disturb your Sunday lunch, maybe. I have been 
scraping text data from web pages, which often comes with redundant 
space before or after. I routinely use ‘trim’ on the final string 
output, but I have found cases where there are still redundant spaces. 
Inspecting the results, I find that the characters are non-break spaces 
(codepoint 160, Unicode U+00A0). Looking at the code, String>>#trim 
depends on Character>>#isSeparator, which does not answer true for a 
non-break space. I can use trimBoth: [:char| char asInteger = 160] to 
remove the redundant spaces if I know where to expect them, so it is not 
a major problem. But the question remains: should non-break space be 
included in the list of separators in Character>>#isSeparator.


In unicode, there are many more 'characters' that could be considered 
whitespace. You are collecting data from web pages, so you have no 
influence on what you'll get as input. I don't think this should be 
solved in #isSeparator.


Stephan





Re: [Pharo-users] Usability issues with Calypso

2017-09-24 Thread Denis Kudriashov
Hi Sean

2017-09-23 19:57 GMT+02:00 Sean P. DeNigris :

> Stephane Ducasse-3 wrote
> > Calypso is still an enfant and this is
> > IMPORTANT that people tell what
> > they do not like so that we can improve.
>
> A few more impressions now that I've been using Calypso as my default
> browser:
> - Overall really enjoying it!
> - When browsing a class from its own package, and then adding an extension
> protocol via '*...' in "New protocol" context menu, the dialog closes
> without objection, but then the new protocol doesn't seem to exist. I had
> to
> create a dummy protocol and then DND the methods into the
> package-to-be-extended.
>

In Calypso you should not create protocols with star. In method editor
status bar there is explicit checkbox "extension"  to specify external
package for the method.
We should move away from star convention and work directly with packages.
Calypso gives you the tools for this.

But I will add special notification when user creates new protocol with
star. I think it will help "old" Pharo users to adopt.
https://github.com/dionisiydk/Calypso/issues/96


> - When Calypso is set to be the default browser, it would be helpful if the
> World menu item changed from "Calypso Browser" to "Nautilus"
> - Lack of word wrapping is becoming teeedious
>
>
>
> -
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>


Re: [Pharo-users] X11 options on Ubuntu VM / Athens rendering problems

2017-09-24 Thread Clément Bera
Hi,

I describe in the next paragraphs what I do to build application with Pharo
at 50 fps. Now I am using a SDL2 window with OSWindow and not the default
Pharo window for rendering. There is a fullscreen option with OSWindow, I
don't use it but I've just tried it works fine.

To use Athens/Cairo I start the VM headless and I open from the code a
window using the SDL2 binding (OSWindow), then I extract the window surface
as a cairo surface to draw on it using Athens and I use SDL2 to manage
events (mouse, keyboard). That way I don't even start morphic/WorldMorph
which wastes cpu ressources.

I built this video game that way:
https://clementbera.wordpress.com/2016/08/29/sdl2-cairo-headless-for-realtime-native-applications/
https://www.youtube.com/watch?v=srPdFgbyS6s

The game is running in Pharo 4 (pre-Spur). I configured it to run at 50 fps
but from time to time some frames are dropped for performance so I would
say it is running at around 48-49 fps in practice. I think it should work
on the latest Pharo but you need to ask on pharo-dev how to use OSWindow.
Some APIs have changed since Pharo 4. Since the latest Pharo version is now
using Spur I expect the performance to be way better and I think 50 fps is
definitely manageable on a laptop.

Note that this is still Pharo so if you want something which looks
real-time you need to be careful about you object allocation rate
in-between frame rendering.

I hope this can help.

Regards



On Sun, Sep 24, 2017 at 9:43 AM, Stephane Ducasse 
wrote:

> Hi jeff
>
> let us know if this is working. the start.sh script is not working on
> my machine. but clement made it worked on his machine and he should
> publish a zip.
>
> Stef
>
>
>
> On Sun, Sep 24, 2017 at 9:39 AM, Stephane Ducasse
>  wrote:
> > Yes I will share a dropbox with you for now.
> >
> > On Sat, Sep 23, 2017 at 9:44 PM, J.F. Rick  wrote:
> >> Hi Stef,
> >>
> >> since I'm only doing Athens rendering, it might be possible to do a
> native
> >> window implementation. That said, I don't know how to get started with
> that.
> >> Documentation seems to be hard to find. The last time I saw any work on
> that
> >> it was too early to be usable. I'm also not sure if it solves my "it
> needs
> >> to run in fullscreen at full speed" problem. If someone like Clement
> could
> >> get me started, that would be awesome.
> >>
> >> Cheers,
> >>
> >> Jeff
> >>
> >> On Fri, Sep 22, 2017 at 12:27 PM Stephane Ducasse <
> stepharo.s...@gmail.com>
> >> wrote:
> >>>
> >>> Hi Jeff
> >>>
> >>> Nice to see you. I do not know anybody running on X11. Esteban is
> >>> working on better SDL20 integration.
> >>> Did you try having a native window? I asked clement if he could
> >>> release the Wizard Battle Arena because it was a game he did in a
> >>> couple of days (yes he is good this guy) and that use cairo athens
> >>> based for drawing on native window.
> >>>
> >>> stef
> >>>
> >>> On Fri, Sep 22, 2017 at 3:11 PM, J.F. Rick  wrote:
> >>> > I'm running a fullscreen Pharo application on Ubuntu and I've noticed
> >>> > that
> >>> > Athens rendering gets way worse (maybe 10 updates per second) when I
> >>> > switch
> >>> > to fullscreen mode from inside Pharo. Ideally, I'd love for that to
> be
> >>> > fixed.
> >>> >
> >>> > In lieu of that, it would be cool if I could just maximize Pharo to
> the
> >>> > size
> >>> > of the screen to achieve good performance. Two things stop that: the
> >>> > Unity
> >>> > application bar and the title-bar. For the former, I can configure
> Unity
> >>> > to
> >>> > hide it. I noticed a '-notitle' X11 option when I execute pharo
> -help.
> >>> > I've
> >>> > tried using these X11 options and neither -notitle or -fullscreen
> seem
> >>> > to
> >>> > have any effect. Here's the command I run:
> >>> >
> >>> > ./bin/pharo --encoding utf8 -vm-display-X11 -fullscreen
> PATH_TO_IMAGE &
> >>> >
> >>> > Pharo starts fine but neither option seems to have any effect. I've
> also
> >>> > tried this in GNOME, thinking that Unity was the problem. Again, no
> >>> > effect.
> >>> >
> >>> > Any suggestions?
> >>> >
> >>> > Jeff
> >>> >
> >>> >
> >>>
> >>
>
>


[Pharo-users] Is a non-break space whitespace?

2017-09-24 Thread PBKResearch
Hello All

 

I have a little puzzle to disturb your Sunday lunch, maybe. I have been
scraping text data from web pages, which often comes with redundant space
before or after. I routinely use 'trim' on the final string output, but I
have found cases where there are still redundant spaces. Inspecting the
results, I find that the characters are non-break spaces (codepoint 160,
Unicode U+00A0). Looking at the code, String>>#trim depends on
Character>>#isSeparator, which does not answer true for a non-break space. I
can use trimBoth: [:char| char asInteger = 160] to remove the redundant
spaces if I know where to expect them, so it is not a major problem. But the
question remains: should non-break space be included in the list of
separators in Character>>#isSeparator.

 

Peter Kenny

 



Re: [Pharo-users] NeoJSON and polymorphism

2017-09-24 Thread Stephane Ducasse
Sven do you think that it is worth to create a new section with the
xample and the solution in the book?

On Sun, Sep 24, 2017 at 11:05 AM, Sven Van Caekenberghe  wrote:
> Hi Juraj,
>
> This would be a simpler form of the type/class tags that are often used in 
> JSON encoding. Since there are many ways to do this, there cannot be one 
> solution. NeoJSON mapping was not designed to cover these cases. Nor is JSON 
> meant to do this. STON is one (rather elegant if I may say so) answer to this 
> problem. Your example would be encoded as
>
> [
>   PngAttachement { #url:'http://example.com/random-name.txt', 
> #fileName:'chapter-one.txt' },
>   TxtAttachement { #url:'http://example.com/random-name.png', 
> #fileName:'image.png' }
> ]
>
> Still, the question of how to do this kind of dynamic decoding is an 
> interesting challenge. Please update to the following commits:
>
> ===
> Name: Neo-JSON-Core-SvenVanCaekenberghe.44
> Author: SvenVanCaekenberghe
> Time: 22 September 2017, 3:24:51.679449 pm
> UUID: f1ebeade-2816-0d00-a04c-ae370e598362
> Ancestors: Neo-JSON-Core-SvenVanCaekenberghe.42
>
> Implement some missing code in NeoJSONCustomMapping (the writing part of 
> #listOfElementSchema: #listOfType:andElementSchema: #mapWithValueSchema:)
>
> Add NeoJSONStreamingWriter>>#writeElementAs:
>
> Add NeoJSONMappingTests>>#testDynamicTyping as an example
> ===
> Name: Neo-JSON-Tests-SvenVanCaekenberghe.41
> Author: SvenVanCaekenberghe
> Time: 22 September 2017, 3:25:09.881494 pm
> UUID: a9a900e0-2816-0d00-a04d-a6fb0e598362
> Ancestors: Neo-JSON-Tests-SvenVanCaekenberghe.39
>
> Implement some missing code in NeoJSONCustomMapping (the writing part of 
> #listOfElementSchema: #listOfType:andElementSchema: #mapWithValueSchema:)
>
> Add NeoJSONStreamingWriter>>#writeElementAs:
>
> Add NeoJSONMappingTests>>#testDynamicTyping as an example
> ===
>
> Now you can do as follows:
>
> NeoJSONMappingTests>>#testDynamicTyping
>   | data customMapping json result |
>   data := Array with: #foo->1 with: #(foo 2).
>   "The idea is to map a key value combination as either a classic association 
> or a simple pair,
>using key & value properties as well as a type property to distinguish 
> between the two"
>   customMapping := [ :mapper |
> mapper
>   for: #AssocOrPair customDo: [ :mapping |
> mapping
>   encoder: [ :x |
> x isArray
>   ifTrue: [ { #type->#pair. #key->x first. #value->x second } 
> asDictionary ]
>   ifFalse: [ { #type->#assoc. #key->x key. #value->x value } 
> asDictionary ] ];
>   decoder: [ :x |
> (x at: #type) = #pair
>   ifTrue: [ Array with: (x at: #key) with: (x at: #value) ]
>   ifFalse: [ (x at: #key) -> (x at: #value)] ] ];
>   for: #ArrayOfAssocOrPair customDo: [ :mapping |
> mapping listOfType: Array andElementSchema: #AssocOrPair ];
>   yourself ].
>   json := String streamContents: [ :out |
> (customMapping value: (NeoJSONWriter on: out)) nextPut: data as: 
> #ArrayOfAssocOrPair ].
>   result := (customMapping value: (NeoJSONReader on: json readStream)) 
> nextAs: #ArrayOfAssocOrPair.
>   self assert: result equals: data
>
> Everything is virtual (not implemented as methods on actual classes) which 
> makes the example self contained and non intrusive, but not very elegant, nor 
> object oriented or extendable. Also, it is not as efficient as NeoJSON 
> mapping was designed for, since it creates intermediate structures.
>
> HTH,
>
> Sven
>
>> On 21 Sep 2017, at 22:07, Juraj Kubelka  wrote:
>>
>> Hi,
>>
>> By studying the NeoJSON book chapter (Pharo Enterprise), I do not understand 
>> how to modify the following example:
>>
>> -=-=-=-=-=-=-=-
>> "Let us say that we have an Attachment class..."
>>
>> Object subclass: #Attachment
>>   instanceVariableNames: 'url fileName'
>>   classVariableNames: ''
>>   package: 'NeoJSON-Use-Case'.
>>
>> "...with url: and fileName: methods."
>> Attachment compile: 'url: anObject', String cr, String tab, 'url := 
>> anObject' classified: 'accessing'.
>> Attachment compile: 'fileName: anObject', String cr, String tab, 'fileName 
>> := anObject' classified: 'accessing'.
>>
>> "Let's create a collection of two instances:"
>> collectionOne := {
>>   Attachment new
>>   url: 'http://example.com/random-name.txt' asZnUrl;
>>   fileName: 'chapter-one.txt'
>>   yourself.
>>   Attachment new
>>   url: 'http://example.com/random-name.png' asZnUrl;
>>   fileName: 'image.png';
>>   yourself.
>> }.
>>
>> "And let's map it to a JSON structure:"
>> String streamContents: [ :aStream |
>>   (NeoJSONWriter on: aStream)
>>   for: #CollectionOfAttachments customDo: [ :mapping |
>>   mapping listOfElementSchema: Attachment ];
>>   mapAllInstVarsFor: Attachment;
>>   for: ZnUrl customDo: [ :mapping |
>> 

Re: [Pharo-users] NeoJSON and polymorphism

2017-09-24 Thread Sven Van Caekenberghe
Hi Juraj,

This would be a simpler form of the type/class tags that are often used in JSON 
encoding. Since there are many ways to do this, there cannot be one solution. 
NeoJSON mapping was not designed to cover these cases. Nor is JSON meant to do 
this. STON is one (rather elegant if I may say so) answer to this problem. Your 
example would be encoded as

[   
  PngAttachement { #url:'http://example.com/random-name.txt', 
#fileName:'chapter-one.txt' },
  TxtAttachement { #url:'http://example.com/random-name.png', 
#fileName:'image.png' }
]

Still, the question of how to do this kind of dynamic decoding is an 
interesting challenge. Please update to the following commits:

===
Name: Neo-JSON-Core-SvenVanCaekenberghe.44
Author: SvenVanCaekenberghe
Time: 22 September 2017, 3:24:51.679449 pm
UUID: f1ebeade-2816-0d00-a04c-ae370e598362
Ancestors: Neo-JSON-Core-SvenVanCaekenberghe.42

Implement some missing code in NeoJSONCustomMapping (the writing part of 
#listOfElementSchema: #listOfType:andElementSchema: #mapWithValueSchema:)

Add NeoJSONStreamingWriter>>#writeElementAs:

Add NeoJSONMappingTests>>#testDynamicTyping as an example
===
Name: Neo-JSON-Tests-SvenVanCaekenberghe.41
Author: SvenVanCaekenberghe
Time: 22 September 2017, 3:25:09.881494 pm
UUID: a9a900e0-2816-0d00-a04d-a6fb0e598362
Ancestors: Neo-JSON-Tests-SvenVanCaekenberghe.39

Implement some missing code in NeoJSONCustomMapping (the writing part of 
#listOfElementSchema: #listOfType:andElementSchema: #mapWithValueSchema:)

Add NeoJSONStreamingWriter>>#writeElementAs:

Add NeoJSONMappingTests>>#testDynamicTyping as an example
===

Now you can do as follows:

NeoJSONMappingTests>>#testDynamicTyping
  | data customMapping json result |
  data := Array with: #foo->1 with: #(foo 2).
  "The idea is to map a key value combination as either a classic association 
or a simple pair, 
   using key & value properties as well as a type property to distinguish 
between the two"
  customMapping := [ :mapper |
mapper 
  for: #AssocOrPair customDo: [ :mapping |
mapping
  encoder: [ :x | 
x isArray 
  ifTrue: [ { #type->#pair. #key->x first. #value->x second } 
asDictionary ] 
  ifFalse: [ { #type->#assoc. #key->x key. #value->x value } 
asDictionary ] ];
  decoder: [ :x |
(x at: #type) = #pair
  ifTrue: [ Array with: (x at: #key) with: (x at: #value) ]
  ifFalse: [ (x at: #key) -> (x at: #value)] ] ];
  for: #ArrayOfAssocOrPair customDo: [ :mapping |
mapping listOfType: Array andElementSchema: #AssocOrPair ];
  yourself ].
  json := String streamContents: [ :out |
(customMapping value: (NeoJSONWriter on: out)) nextPut: data as: 
#ArrayOfAssocOrPair ].
  result := (customMapping value: (NeoJSONReader on: json readStream)) nextAs: 
#ArrayOfAssocOrPair.
  self assert: result equals: data

Everything is virtual (not implemented as methods on actual classes) which 
makes the example self contained and non intrusive, but not very elegant, nor 
object oriented or extendable. Also, it is not as efficient as NeoJSON mapping 
was designed for, since it creates intermediate structures.

HTH,

Sven

> On 21 Sep 2017, at 22:07, Juraj Kubelka  wrote:
> 
> Hi,
> 
> By studying the NeoJSON book chapter (Pharo Enterprise), I do not understand 
> how to modify the following example:
> 
> -=-=-=-=-=-=-=-
> "Let us say that we have an Attachment class..."
> 
> Object subclass: #Attachment
>   instanceVariableNames: 'url fileName'
>   classVariableNames: ''
>   package: 'NeoJSON-Use-Case'.
> 
> "...with url: and fileName: methods."
> Attachment compile: 'url: anObject', String cr, String tab, 'url := anObject' 
> classified: 'accessing'.
> Attachment compile: 'fileName: anObject', String cr, String tab, 'fileName := 
> anObject' classified: 'accessing'.
>   
> "Let's create a collection of two instances:"
> collectionOne := { 
>   Attachment new 
>   url: 'http://example.com/random-name.txt' asZnUrl; 
>   fileName: 'chapter-one.txt'
>   yourself.
>   Attachment new 
>   url: 'http://example.com/random-name.png' asZnUrl; 
>   fileName: 'image.png';
>   yourself.
> }.
> 
> "And let's map it to a JSON structure:"
> String streamContents: [ :aStream |
>   (NeoJSONWriter on: aStream)
>   for: #CollectionOfAttachments customDo: [ :mapping | 
>   mapping listOfElementSchema: Attachment ];
>   mapAllInstVarsFor: Attachment;
>   for: ZnUrl customDo: [ :mapping |
>   mapping encoder: [ :aZnUrl |
>   aZnUrl asString ] ];
>   nextPut: collectionOne as: #CollectionOfAttachments.
> ].
> 
> "And read the JSON structure:"
> (NeoJSONReader on: 
> '[{"url":"http://example.com/random-name.txt","fileName":"chapter-one.txt"},{"url":"http://example.com/random-name.png

Re: [Pharo-users] X11 options on Ubuntu VM / Athens rendering problems

2017-09-24 Thread Stephane Ducasse
Hi jeff

let us know if this is working. the start.sh script is not working on
my machine. but clement made it worked on his machine and he should
publish a zip.

Stef



On Sun, Sep 24, 2017 at 9:39 AM, Stephane Ducasse
 wrote:
> Yes I will share a dropbox with you for now.
>
> On Sat, Sep 23, 2017 at 9:44 PM, J.F. Rick  wrote:
>> Hi Stef,
>>
>> since I'm only doing Athens rendering, it might be possible to do a native
>> window implementation. That said, I don't know how to get started with that.
>> Documentation seems to be hard to find. The last time I saw any work on that
>> it was too early to be usable. I'm also not sure if it solves my "it needs
>> to run in fullscreen at full speed" problem. If someone like Clement could
>> get me started, that would be awesome.
>>
>> Cheers,
>>
>> Jeff
>>
>> On Fri, Sep 22, 2017 at 12:27 PM Stephane Ducasse 
>> wrote:
>>>
>>> Hi Jeff
>>>
>>> Nice to see you. I do not know anybody running on X11. Esteban is
>>> working on better SDL20 integration.
>>> Did you try having a native window? I asked clement if he could
>>> release the Wizard Battle Arena because it was a game he did in a
>>> couple of days (yes he is good this guy) and that use cairo athens
>>> based for drawing on native window.
>>>
>>> stef
>>>
>>> On Fri, Sep 22, 2017 at 3:11 PM, J.F. Rick  wrote:
>>> > I'm running a fullscreen Pharo application on Ubuntu and I've noticed
>>> > that
>>> > Athens rendering gets way worse (maybe 10 updates per second) when I
>>> > switch
>>> > to fullscreen mode from inside Pharo. Ideally, I'd love for that to be
>>> > fixed.
>>> >
>>> > In lieu of that, it would be cool if I could just maximize Pharo to the
>>> > size
>>> > of the screen to achieve good performance. Two things stop that: the
>>> > Unity
>>> > application bar and the title-bar. For the former, I can configure Unity
>>> > to
>>> > hide it. I noticed a '-notitle' X11 option when I execute pharo -help.
>>> > I've
>>> > tried using these X11 options and neither -notitle or -fullscreen seem
>>> > to
>>> > have any effect. Here's the command I run:
>>> >
>>> > ./bin/pharo --encoding utf8 -vm-display-X11 -fullscreen PATH_TO_IMAGE &
>>> >
>>> > Pharo starts fine but neither option seems to have any effect. I've also
>>> > tried this in GNOME, thinking that Unity was the problem. Again, no
>>> > effect.
>>> >
>>> > Any suggestions?
>>> >
>>> > Jeff
>>> >
>>> >
>>>
>>



Re: [Pharo-users] X11 options on Ubuntu VM / Athens rendering problems

2017-09-24 Thread Stephane Ducasse
Yes I will share a dropbox with you for now.

On Sat, Sep 23, 2017 at 9:44 PM, J.F. Rick  wrote:
> Hi Stef,
>
> since I'm only doing Athens rendering, it might be possible to do a native
> window implementation. That said, I don't know how to get started with that.
> Documentation seems to be hard to find. The last time I saw any work on that
> it was too early to be usable. I'm also not sure if it solves my "it needs
> to run in fullscreen at full speed" problem. If someone like Clement could
> get me started, that would be awesome.
>
> Cheers,
>
> Jeff
>
> On Fri, Sep 22, 2017 at 12:27 PM Stephane Ducasse 
> wrote:
>>
>> Hi Jeff
>>
>> Nice to see you. I do not know anybody running on X11. Esteban is
>> working on better SDL20 integration.
>> Did you try having a native window? I asked clement if he could
>> release the Wizard Battle Arena because it was a game he did in a
>> couple of days (yes he is good this guy) and that use cairo athens
>> based for drawing on native window.
>>
>> stef
>>
>> On Fri, Sep 22, 2017 at 3:11 PM, J.F. Rick  wrote:
>> > I'm running a fullscreen Pharo application on Ubuntu and I've noticed
>> > that
>> > Athens rendering gets way worse (maybe 10 updates per second) when I
>> > switch
>> > to fullscreen mode from inside Pharo. Ideally, I'd love for that to be
>> > fixed.
>> >
>> > In lieu of that, it would be cool if I could just maximize Pharo to the
>> > size
>> > of the screen to achieve good performance. Two things stop that: the
>> > Unity
>> > application bar and the title-bar. For the former, I can configure Unity
>> > to
>> > hide it. I noticed a '-notitle' X11 option when I execute pharo -help.
>> > I've
>> > tried using these X11 options and neither -notitle or -fullscreen seem
>> > to
>> > have any effect. Here's the command I run:
>> >
>> > ./bin/pharo --encoding utf8 -vm-display-X11 -fullscreen PATH_TO_IMAGE &
>> >
>> > Pharo starts fine but neither option seems to have any effect. I've also
>> > tried this in GNOME, thinking that Unity was the problem. Again, no
>> > effect.
>> >
>> > Any suggestions?
>> >
>> > Jeff
>> >
>> >
>>
>



Re: [Pharo-users] Usability issues with Calypso

2017-09-24 Thread Stephane Ducasse
can you explain lack of word wrapping

On Sat, Sep 23, 2017 at 7:57 PM, Sean P. DeNigris  wrote:
> Stephane Ducasse-3 wrote
>> Calypso is still an enfant and this is
>> IMPORTANT that people tell what
>> they do not like so that we can improve.
>
> A few more impressions now that I've been using Calypso as my default
> browser:
> - Overall really enjoying it!
> - When browsing a class from its own package, and then adding an extension
> protocol via '*...' in "New protocol" context menu, the dialog closes
> without objection, but then the new protocol doesn't seem to exist. I had to
> create a dummy protocol and then DND the methods into the
> package-to-be-extended.
> - When Calypso is set to be the default browser, it would be helpful if the
> World menu item changed from "Calypso Browser" to "Nautilus"
> - Lack of word wrapping is becoming teeedious
>
>
>
> -
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>



Re: [Pharo-users] Bloc Space within a Space

2017-09-24 Thread Stephane Ducasse
Hi sean

normally with bloc you should be able to build the expose mode on mac os X.
with multiple little worlds showing windows inside and to control all
the events.
It was the goal of alain now I do not know but it should
Stef

BlUniverse

I am the lowest level in Bloc.
My responsibility is to manage the low-level services such as managing
windows, event queue and the drawing synchronization.

My main responsibility is to manage and to keep in sync the opened Spaces.

I am the interface used to create/delete window.
To achieve that, i use the notion of Host (see: BlHost).

Users can choose a preferable host. In order to do that a universe
must be stopped first.
Example:

universe stop.
universe preferableHost: MyHost new.
universe start.

BLSpaceManager

I am a Universe space manager.

I contain Bloc spaces, can add or remove them. I am also responsible
for sending pulses(tick) messages to spaces I know.

I am used by Universe in order to provide support of multiple spaces
within the Universe.

- addSpace: add a space
- removeSpace: remove a given space
- clear close all spaces
- pulse send pulse message to all spaces

   One simple example is simply gorgeous.

Internal Representation and Key Implementation Points.

Instance Variables
spaces: 


Implementation Points



On Sun, Sep 24, 2017 at 3:49 AM, Sean P. DeNigris  wrote:
> Pharo Smalltalk Users mailing list wrote
>>> But how to drive it? e.g. simulate events
>>
>> ok, so we agree here. Bloc is done in that perspective.
>> For now, you have to implement your own BlocSpace with an adequate
>> #processEvents method,
>> your can also implement your own main loop manager (polymorphic with
>> BlMainLoopManager).
>
> Given the flurry of Bloc development, are we able (or any closer) today to
> simulate a Bloc world/space/whatever-the-lingo-is, taking full control over
> the hand, events, etc? For years I've dreamed of being able to mock/stub out
> all the dependencies and have full control over a world within a world.
> There seemed to be agreement in principle, but it always seemed "just around
> the bend". I loaded Bloc in latest Pharo to play around, but am not quite
> sure if this is yet possible.
>
> Thanks!
>
>
>
> -
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>



Re: [Pharo-users] Web stack practices (Glorp / QCMagritte)

2017-09-24 Thread Stephane Ducasse
So if the consortium makes an effort and support the cost would it help.
Or is it for nothing?
What if you come to visit us?

Stef

On Sat, Sep 23, 2017 at 3:37 PM, Laurent Laffont
 wrote:
> Thanks Stef, it would be nice, nevertheless I don't think the boss will pay
> a consultant :(
>
> Laurent
>
>
> Le 22 septembre 2017 18:18:32 GMT+02:00, Stephane Ducasse
>  a écrit :
>>
>> Laurent
>>
>> do you need that we send someone to your place to help?
>>
>> Stef
>>
>> On Fri, Sep 22, 2017 at 10:28 AM, laurent 
>> wrote:
>>>
>>>  Hi Stephan,
>>>
>>>  actually the difficult part is how to manage correctly Glorp
>>>  sessions/connections and update of objects in database. My team is quite
>>> sad
>>>  because QCMagritte and Glorp looks nice but we lack experience glueing
>>> both
>>>  together and could not find any documentation on the subject.
>>>
>>>  Laurent
>>>
>>>
>>>  Le mer. 20 sept. 2017 à 11:53, stephan  a écrit :
>>>
>>>  On 18-09-17 12:22, laurent wrote:
>>>
>>>  We try QCMagritte and we enjoy what we see so far. What are the best
>>>  practices to glue Magritte and Glorp together ? Especially when you
>>>  load-balance requests on several images. Some examples ? ( FYI, I cannot
>>>  load QCMagritte in a fresh Pharo 6 image ( for #stable version,
>>>  MADescriptionBuilder missing. For #development versions of Magritte and
>>>  QCMagritte, QCConfiguration missing ). So actually I use the one built
>>> on
>>>  CI. )
>>>
>>>  I really like describing domain objects with Magritte and using chains
>>> of
>>>  visitors to add cross-cutting concerns like translations, styling and
>>> access
>>>  control. The resulting domain code is very clean and DRY. To map to
>>>  database/Glorp I would just add properties to the description wherever
>>>  needed, and add a visitor creating the mappings. We didn't need that as
>>> we
>>>  developed in Pharo and deployed on Gemstone. At the moment QC generates
>>>  applications using jQuery, and the live updating needs a round-trip to
>>> the
>>>  server. You might want to substitute that with something that does more
>>>  client side. I haven't looked in detail at what Johan Brichau is doing.
>>> An
>>>  open issue is live updates that update each other. That needs
>>> automatically
>>>  calculating dependencies and update order. I've copied the latest
>>>  configuration and added #'pharo6.x' but that is not enough. Stephan
>>
>>
>