[Pharo-users] Pharo and Moose lectures in Serbia

2018-02-18 Thread Stephane Ducasse
Hi

just a little mail to announce that next week I will give some
lectures at the University of Novi sad on Pharo and Moose.
I hope that we will have some serbian pharoers soon.

Stef



Re: [Pharo-users] [ANN] PI

2018-02-18 Thread Hernán Morales Durand
Thanks, please let me know issues or ideas for enhacements.

I just uploaded a new version adding a search packages feature,
supporting both GitHub and SmalltalkHub repositories.

Cheers,

Hernán


2018-02-18 5:12 GMT-03:00 john pfersich :
> Congrats! Looks really useful. Can’t wait to try it out.
>
> Sent from my iPhone
> Encrypted email at jgpfers...@protonmail.com
>
>> On Feb 17, 2018, at 23:23, Hernán Morales Durand  
>> wrote:
>>
>> Hi,
>>
>> PI is a MIT-pip-like command line program for Pharo Smalltalk. PI
>> stands for Pharo Install. It is written in bash and tested
>> successfully under MSYS and GNU/Linux.
>>
>> Look for details in the GitHub repository:
>>
>> https://github.com/hernanmd/pi
>>
>> Try and play around, if you found any bugs or want to integrate new
>> feature, feel free to submit PR.
>>
>> Cheers,
>>
>> Hernán
>>
>



Re: [Pharo-users] Exporting Pillar docs (Pillar7)

2018-02-18 Thread Stephane Ducasse
Hi arturo

What you saw is the pipeline to produce book and others. Now I do not
think that you need it.
To export markdown you do not need the pillar configuration and the rest.
Check the chapter 6 in the publishing a booklet with pillar document.

You can just get your document using the Pillar parser.

| wiki doc |
wiki := '!My Document'.
doc := PRPillarParser parse: wiki

Or from a file:

  PRPillarParser parse: (FileSystem workingDirectory / 'foo.pillar')

  readStream

You can also instantiate the document model, one node after the other,
start- ing with PRDocument and adding sub-instances of PRDocumentItem:

  | document title figure|

  document := PRDocument new.

  title := PRHeader new

 level: 1;

 add: (PRText content: 'foo');

 yourself.

  figure := PRFigure new

 add: (PRText content: 'Alias');

then to export in HTML you just ask the htmlWriter. So I think that
this is the same for markdown.

PRHTMLWriter write: document


Now pay attention because we are currently rewriting the pipeline of
document production in Pillar 70.
This is why this is not in master but in a specific branch.

Stef






On Sun, Feb 18, 2018 at 7:13 PM, Arturo Zambrano
 wrote:
> Hi,
> I figured it out (at least in part)
>
>   configuration := PRPillarConfiguration new.
>   configuration outputType: PRMarkdownWriter.
>   export:=PRExportPhase new .
>   export executeOn:
>   (PRCompilationContext withDocument: document withConfiguration:
> configuration)
>
>
> This code snipped generates a Json file which contains the markdown... how
> do I generate just the markdown?
>
> TIA
> Arturo
>
>
> On Sun, Feb 18, 2018 at 2:16 PM, Arturo Zambrano 
> wrote:
>>
>> Hi,
>>   can someone please tell me how to export a document using pillar7?
>>
>>  For pillar5  the example used to be:
>>
>> configuration := PRPillarConfiguration new.
>> configuration outputType: PRHTMLWriter.
>> PRExportPhase executeOn: { document } with: configuration.
>>
>>
>> Thanks!
>
>



Re: [Pharo-users] Exporting Pillar docs (Pillar7)

2018-02-18 Thread Arturo Zambrano
Hi,
I figured it out (at least in part)

  configuration := PRPillarConfiguration new.
  configuration outputType: PRMarkdownWriter.
  export:=PRExportPhase new .
  export executeOn:
  (PRCompilationContext withDocument: document withConfiguration:
configuration)


This code snipped generates a Json file which contains the markdown... how
do I generate just the markdown?

TIA
Arturo


On Sun, Feb 18, 2018 at 2:16 PM, Arturo Zambrano 
wrote:

> Hi,
>   can someone please tell me how to export a document using pillar7?
>
>  For pillar5  the example used to be:
>
>1.
>
>configuration := PRPillarConfiguration new.
>configuration outputType: PRHTMLWriter.
>PRExportPhase executeOn: { document } with: configuration.
>
>
>
> Thanks!
>


[Pharo-users] Exporting Pillar docs (Pillar7)

2018-02-18 Thread Arturo Zambrano
Hi,
  can someone please tell me how to export a document using pillar7?

 For pillar5  the example used to be:

   1.

   configuration := PRPillarConfiguration new.
   configuration outputType: PRHTMLWriter.
   PRExportPhase executeOn: { document } with: configuration.



Thanks!


Re: [Pharo-users] multi-threading with websocket

2018-02-18 Thread Sven Van Caekenberghe
Ben,

> On 18 Feb 2018, at 15:29, Ben Coman  wrote:
> 
> The websockets guide here
> https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/book-result/WebSockets/WebSockets.html
> 
> says "Reading and sending are completely separate and independent" and the 
> class comment says its "full-duplex".  From these I presume sending and 
> receiving are okay to occur in separate threads, but this is not explicitly 
> stated, so can someone confirm this?

The reading and the writing over a web socket connection are independent, so 
yes that would be OK. Of course, they would both share the same network stream 
(just use each half independently) - that normally works fine.

> So for the given example
> | webSocket |
> webSocket := ZnWebSocket to: 'ws://echo.websocket.org'.
> [ webSocket
>sendMessage: 'Pharo Smalltalk using Zinc WebSockets !';
>readMessage ] ensure: [ webSocket close ].
> 
> re-implementing as follows seems to work...
> webSocket := ZnWebSocket to: 'ws://echo.websocket.org'.
> [ webSocket runWith: [ :msg | Transcript crShow: msg ] ] forkAt: 35.
> webSocket sendMessage: 'Pharo Smalltalk using Zinc WebSockets !'.
> webSocket sendMessage: 'Another multi-thread echo'.
> webSocket close
> 
> but that could just be by luck, so I ask.

No, that should work.

> btw, if I don't send the #close in the last line, after ~30 seconds I get an 
> error
> ConnectionClosed: Cannot write data
> which seems reasonable that the other end timed out and closed the connection,
> 
> but when I send the #close, after ~30 seconds I get an error...
>PrimitiveFailed: primitive #primSocketReceiveDataAvailable: in Socket 
> failed
> which is unfriendly.  What is the best way to neatly stop trying to receive 
> data when we explicitly close the websocket?

Of course that fails, you fork a reading loop containing #runWith: which has to 
end/stop somehow, the lazy way is by allowing an error to bubble up.

> cheers -ben
> 
> 
> P.S.  I wonder if when a ZnWebSocket is closed, it might be worthwhile
> to do  "role:=#closed"  to provide some visibility of its state in its 
> GTInspector [Raw] tab..

Maybe, but there is #isConnected and the Socket inspector 'Socket Info' shows 
lots of details, you can rely on that.

Sven




[Pharo-users] multi-threading with websocket

2018-02-18 Thread Ben Coman
The websockets guide here
https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/
lastSuccessfulBuild/artifact/book-result/WebSockets/WebSockets.html

says "Reading and sending are completely separate and independent" and the
class comment says its "full-duplex".  From these I presume sending and
receiving are okay to occur in separate threads, but this is not explicitly
stated, so can someone confirm this?

So for the given example
| webSocket |
webSocket := ZnWebSocket to: 'ws://echo.websocket.org'.
[ webSocket
   sendMessage: 'Pharo Smalltalk using Zinc WebSockets !';
   readMessage ] ensure: [ webSocket close ].

re-implementing as follows seems to work...
webSocket := ZnWebSocket to: 'ws://echo.websocket.org'.
[ webSocket runWith: [ :msg | Transcript crShow: msg ] ] forkAt: 35.
webSocket sendMessage: 'Pharo Smalltalk using Zinc WebSockets !'.
webSocket sendMessage: 'Another multi-thread echo'.
webSocket close

but that could just be by luck, so I ask.


btw, if I don't send the #close in the last line, after ~30 seconds I get
an error
ConnectionClosed: Cannot write data
which seems reasonable that the other end timed out and closed the
connection,

but when I send the #close, after ~30 seconds I get an error...
   PrimitiveFailed: primitive #primSocketReceiveDataAvailable: in Socket
failed
which is unfriendly.  What is the best way to neatly stop trying to receive
data when we explicitly close the websocket?

cheers -ben


P.S.  I wonder if when a ZnWebSocket is closed, it might be worthwhile
to do  "role:=#closed"  to provide some visibility of its state in its
GTInspector [Raw] tab..


Re: [Pharo-users] [ANN] PI

2018-02-18 Thread john pfersich
Congrats! Looks really useful. Can’t wait to try it out. 

Sent from my iPhone
Encrypted email at jgpfers...@protonmail.com

> On Feb 17, 2018, at 23:23, Hernán Morales Durand  
> wrote:
> 
> Hi,
> 
> PI is a MIT-pip-like command line program for Pharo Smalltalk. PI
> stands for Pharo Install. It is written in bash and tested
> successfully under MSYS and GNU/Linux.
> 
> Look for details in the GitHub repository:
> 
> https://github.com/hernanmd/pi
> 
> Try and play around, if you found any bugs or want to integrate new
> feature, feel free to submit PR.
> 
> Cheers,
> 
> Hernán
>