Re: [Pharo-users] Behold Pharo: The Modern Smalltalk

2017-12-09 Thread Prof. Andrew P. Black

> On 9 Dec 2017, at 07:44 , Dimitris Chloupis  wrote:
> 
> Making shortcuts in Pharo is no big deal, if 10% of people asking for Emacs 
> or vim shortcuts bothered creating just 10 shortcuts each we would have by 
> now at least 100 Emacs shortcuts in Pharo. When one say that needs something 
> that He or she is not willing to do even 1% of its work, then he does not 
> need it enough for others to bother. 

In September, I posted an Issue on pharo.fogbuz 
:  making keyboard 
shortcuts for the Pharo Smalltalk editor is not easy, but should be.   No one 
has responded to that issue saying that it really is easy, and explaining how 
to do it.  So if you know, I invite you to work on this issue.  tl;dr: I though 
that it was easy too, but after spending a couple of days trying to figure it 
out, gave up.

If 10% of the energy expended in this thread had gone into fixing open issues, 
then Pharo would be getting better every day.

Re: [Pharo-users] Behold Pharo: The Modern Smalltalk

2017-12-09 Thread serge . stinckwich


Envoyé de mon iPhone

> Le 9 déc. 2017 à 11:05, Prof. Andrew P. Black  a écrit :
> 
> 
>> On 9 Dec 2017, at 07:44 , Dimitris Chloupis  wrote:
>> 
>> Making shortcuts in Pharo is no big deal, if 10% of people asking for Emacs 
>> or vim shortcuts bothered creating just 10 shortcuts each we would have by 
>> now at least 100 Emacs shortcuts in Pharo. When one say that needs something 
>> that He or she is not willing to do even 1% of its work, then he does not 
>> need it enough for others to bother. 
> 
> In September, I posted an Issue on pharo.fogbuz:  making keyboard shortcuts 
> for the Pharo Smalltalk editor is not easy, but should be.   No one has 
> responded to that issue saying that it really is easy, and explaining how to 
> do it.  So if you know, I invite you to work on this issue.  tl;dr: I though 
> that it was easy too, but after spending a couple of days trying to figure it 
> out, gave up.
> 
> If 10% of the energy expended in this thread had gone into fixing open 
> issues, then Pharo would be getting better every day.

+1
Less talk more Pharo !



Re: [Pharo-users] HTTP request question for an arango driver

2017-12-09 Thread Norbert Hartl


> Am 08.12.2017 um 21:14 schrieb Stephane Ducasse :
> 
> Yann
> I do not think that connecting a database via a HTTP client can be as
> fast as with a FFI or other means.
> This is mainly why database like Gemstone are superior for accessing a
> lot of data.
> Stef
> 
Do you have any numbers to back this? We are not talking about a local 
database. The usual deployment case is that the database is remote and 
clustered so you need to connect one or more hosts at the same time. Via FFI 
you would trigger native code that does network calls to the database. The main 
network handling part is in the SocketPlugin. So I‘m not sure how much faster 
it will be to use FFI. IIRC using FFI is still a stop-the-world action, right? 
This has some drawbacks, too. In order to get the maximum out of it you would 
need to use callbacks (do they work with uffi?) and write a lot stuff in C. And 
debugging is hell.
I think that one of the things that make gemstone fast is that the in-memory 
format is the same as the disk-format so no need to serialize/materialize. That 
is one of the high costs in using a database. And this you would still do in 
pharo, right? So I would be really interested in some numbers of a use case 
like this.

Norbert
>> On Fri, Dec 8, 2017 at 4:32 PM, Yann Lesage  wrote:
>> Hello,
>> 
>> 
>> I write an driver for Arangodb . So like it's indicated in Arango
>> documentation, I use the HTTP API.  The repo is
>> https://github.com/Valtena/Pharango
>> 
>> 
>> Now, the problem : Arango using Znclient make around 1 000 requests/second.
>> 
>> 
>> And the question : Are there any recommended pratice to have the better
>> performance with ZNClient or a better way to perform lot of HTTP requests ?
>> 
>> 
>> Thanks for your attention,
>> 
>> Yann Lesage
>> 
>> 
>> 



Re: [Pharo-users] Simplest 'REPL'

2017-12-09 Thread H. Hirzel
I understand that you want to write a tool with an input field and an
output field and a button 'Evaluate'.  Is this correct?

If yes you need to learn a little bit of Spec to construct your own tool.

Have a look at the examples for Spec in the help system.

There is also a booklet about Spec.  http://books.pharo.org/spec-tutorial/

HTH
Hannes

On 12/9/17, cheshirecatalyst  wrote:
> I've recently picked up pharo, and am writing a small interpreter for a
> trivial language the details of which are unimportant. However I am looking
> for the simplest way to avoid having to use playground and Transcript to do
> something like
>
> | reader eval |
> reader := MyReader from: 'some stuff in my DSL'.
> eval := MyEvaluator from: reader.
> Transcript show: eval evaluate.
>
> I'm tired of having to change 'some stuff in my DSL' to a new expression
> and run it in playground.
>
> I don't really care which is easier, a Morphic with an input box at the
> bottom to put my expressions in with output up top, or a something like
> CommandShellTranscript (which i have looked at but is too complex for me to
> figure out how to get the desired result from).
>
> Basically I want to be able to use my DSL outside of playground, but still
> in image.
>



Re: [Pharo-users] Behold Pharo: The Modern Smalltalk

2017-12-09 Thread Ben Coman
An extra thing for the first article, maybe change the package name from
"HelloDemo" to "HelloWorld"


On 9 December 2017 at 11:37, horrido  wrote:

> Pharo: The Next Ten Minutes
> 
> .
>
> Feedback welcome.
>
> I will be leaving for vacation on Sunday for two weeks. Feedback should be
> given to me asap. Thanks.
>

I see you have auto-update-process turned on, but you didn't tell users to
do this.
(I think it is useful to have on.  @all, I'm curious why its not on by
default)


Double "little" in first sentence.


You should describe how you enter the second method over the top of the
first.
People sometimes get stuck thinking they'll be altering the #sayIt method.


In hindsight, when readers go to experiment themselves,
some may drop the #wait to see how fast it can generate messages
which will lock up the UI due to co-operative scheduling within a
priority.
It will be better to use...
 [...] #forkAt: 30 named: 'Count de Money'



> How do you like it?

maybe...
How do you like it?   The implication is that in the early stages of
protoyping,
you don't need to slow down to build an object/relational mapping.
Just design with pure objects and persist sample data in the Image.





-
The article is good but feels too short.  One additional demonstration
would look good.
To facilitate this, change the demo code to use two methods.

sayCount: anInteger
 self inform: anInteger printString.

counter
| count |
count := 0.
[1000 timesRepeat: [count := count + 1.
self sayCount: count.
2 seconds wait]] forkNamed: 'Count de Money'



Then after the existing end of the article...

 Now consider your current language of choice...
 Say you are part of the Testing Team and a unit test errors
intermittently, or you're in Operations where an intermittent error occurs
in a production system.
 Typically the program exits, maybe dumping state but losing the live
context where the error occurred.
 What would it take to reproduce the exact error context for Developers
to analyze?
 Lets see how Pharo handles this by introducing an error into a running
'Count de Money' process.
 (If its not running, evaluate "Greeter new counter")

 Make this modification...

 sayCount: anInteger
  self inform: anInteger * 10 printString.

 Immediately after you save this, a pre-debug window pops up...
 [screen snapshot pre-debug top of stack]
 Scroll down and click on "sayCount:"  and you should see the
debugger...
 [screen snapshot full debugger on sayCount with "* 10 printString"
highlighted]

 Now as before, you can record the execution state of all running
threads by saving a Pharo Image.
 Later when you reopen Pharo you can continue debugging the faulted
thread.
 So give this a try. Save and quit Pharo now. (You could even transfer
the .image file together with its paired .changes file to another machine
with Pharo.)

 Open the Pharo Image again.  Now we are ready to fix the error.

 To explain the error, one thing Pharo newcomers need to adapt to is
that arithmetic operators are just normal message sends with no special
precedence.
 Pharo has simple semantics with just three precedence rules, evaluated
right to left.
 Unary messages like "printString" are always evaluated first.  Binary
messages like " * " are evaluated second.
 Keyword messages like "inform:" are evaluated last.   So the error
here is that we multiplied an integer with a string.
 Easily fixed...

 sayCount: anInteger
  self inform: (anInteger * 10) printString.

After saving, click  and observe the running process continues
rather than needing to restart it.
In many situations, continuing from errors like this rather than
waiting for a restarted program to progress to the same state facilitates a
very quick "debug->edit->compile->run" development loop.

For a similar demonstration, check out [PharoLambda Serverless
Debugging, https://www.youtube.com/watch?v=bNNCT1hLA3E  ]


HTH
cheers -ben


Re: [Pharo-users] Simplest 'REPL'

2017-12-09 Thread Ben Coman
On 9 December 2017 at 07:04, cheshirecatalyst  wrote:

> I've recently picked up pharo, and am writing a small interpreter for a
> trivial language the details of which are unimportant. However I am looking
> for the simplest way to avoid having to use playground and Transcript to do
> something like
>
> | reader eval |
> reader := MyReader from: 'some stuff in my DSL'.
> eval := MyEvaluator from: reader.
> Transcript show: eval evaluate.
>
> I'm tired of having to change 'some stuff in my DSL' to a new expression
> and run it in playground.
>
> I don't really care which is easier, a Morphic with an input box at the
> bottom to put my expressions in with output up top, or a something like
> CommandShellTranscript (which i have looked at but is too complex for me to
> figure out how to get the desired result from).
>
> Basically I want to be able to use my DSL outside of playground, but still
> in image.
>


A while ago I had success embedding the old Workspace into an application.
Start with...

Workspace subclass: #MyWorkspace
instanceVariableNames: ''
classVariableNames: ''
package: 'Tool-Workspace'

MyWorkspace >> whenTextAccepted: anAnnouncement
"MyWorkspace open"
self inform: anAnnouncement text

MyWorkspace >> createTextView
| v |
v := super createTextView.
v beForPlainText.
^v.


cheers -ben


Re: [Pharo-users] HTTP request question for an arango driver

2017-12-09 Thread Sven Van Caekenberghe
Hi Yann,

Zinc HTTP Components can do 1000s of requests per second, to localhost (so 
excluding a real network) and using a single ZnClient instance with a reused 
connection (HTTP/1.1's default). Of course, data size is also a factor, I am 
talking about small requests/responses.

I browsed your code a bit on GitHub. You do reuse an instance, so that is good. 
But I think you are using HTTPS (TLS), which is a real slowdown (encryption is 
native, but costs real resources). Also, your data payload is using JSON which 
also adds a cost (parsing, generating).

So what you measured sounds about right. You might be able to optimise a bit, 
but that won't give you a factor 10 improvement, IMHO. The trick is usually to 
make as few requests as possible.

Sven

> On 8 Dec 2017, at 16:32, Yann Lesage  wrote:
> 
> Hello,
> 
> 
> I write an driver for Arangodb . So like it's indicated in Arango 
> documentation, I use the HTTP API.  The repo is 
> https://github.com/Valtena/Pharango
> 
> 
> Now, the problem : Arango using Znclient make around 1 000 requests/second.
> 
> 
> And the question : Are there any recommended pratice to have the better 
> performance with ZNClient or a better way to perform lot of HTTP requests ?
> 
> 
> Thanks for your attention,
> 
> Yann Lesage
> 
> 
> 




Re: [Pharo-users] Behold Pharo: The Modern Smalltalk

2017-12-09 Thread Dimitris Chloupis
The beginner way
--
1. Open Pharo 6
2. Go to Welcome window
3. Go to Keymap Browser tab
4. Right click on a shortcut entry (for example global shortcut for close
window)
5. Choose Inspect Action
6. Go to Source Code tab
7. Profit

The Pharo coder way

Or go to SystemWindow class >> buildShortcutsOn:
or got to NautilusWindow class >> buildShortcutsOn: (any method will do)
or search for any method using the  pragma


On Sat, Dec 9, 2017 at 12:06 PM Prof. Andrew P. Black 
wrote:

>
> On 9 Dec 2017, at 07:44 , Dimitris Chloupis  wrote:
>
> Making shortcuts in Pharo is no big deal, if 10% of people asking for
> Emacs or vim shortcuts bothered creating just 10 shortcuts each we would
> have by now at least 100 Emacs shortcuts in Pharo. When one say that needs
> something that He or she is not willing to do even 1% of its work, then he
> does not need it enough for others to bother.
>
>
> In September, I posted an Issue on pharo.fogbuz
> :  making
> keyboard shortcuts for the Pharo Smalltalk editor is not easy, but should
> be.   No one has responded to that issue saying that it really is easy, and
> explaining how to do it.  So if you know, I invite you to work on this
> issue.  tl;dr: I though that it was easy too, but after spending a couple
> of days trying to figure it out, gave up.
>
> If 10% of the energy expended in this thread had gone into fixing open
> issues, then Pharo would be getting better every day.
>


Re: [Pharo-users] HTTP request question for an arango driver

2017-12-09 Thread Yann Lesage



Le 09/12/2017 à 15:52, Sven Van Caekenberghe a écrit :

Hi Yann,

Zinc HTTP Components can do 1000s of requests per second, to localhost (so 
excluding a real network) and using a single ZnClient instance with a reused 
connection (HTTP/1.1's default). Of course, data size is also a factor, I am 
talking about small requests/responses.

I browsed your code a bit on GitHub. You do reuse an instance, so that is good. 
But I think you are using HTTPS (TLS), which is a real slowdown (encryption is 
native, but costs real resources). Also, your data payload is using JSON which 
also adds a cost (parsing, generating).

Thanks for this review.


So what you measured sounds about right. You might be able to optimise a bit, 
but that won't give you a factor 10 improvement, IMHO. The trick is usually to 
make as few requests as possible.

A factor of 10 maximum ? Ok, this indication help me.

For the trick, I know it. But it's must be performed by user no ?


Sven


On 8 Dec 2017, at 16:32, Yann Lesage  wrote:

Hello,


I write an driver for Arangodb . So like it's indicated in Arango 
documentation, I use the HTTP API.  The repo is 
https://github.com/Valtena/Pharango


Now, the problem : Arango using Znclient make around 1 000 requests/second.


And the question : Are there any recommended pratice to have the better 
performance with ZNClient or a better way to perform lot of HTTP requests ?


Thanks for your attention,

Yann Lesage










Re: [Pharo-users] Simplest 'REPL'

2017-12-09 Thread Tudor Girba
Hi,

I would encourage you to simply extend the inspector. Something like this:

MyEvaluator>>gtInspectorEvaluateIn: composite

composite text
title: ‘Evaluator’;
populate: #selection iconName:#glamorousGo entitled: ‘Evaluate' 
with: [ :textPresentation | 
self from: (MyReader from: textPresentation text)]

And then inspect MyEvaluator new.

If you cannot have an evaluator instance without the reader, add the extension 
to the class side of MyEvaluator and inspect the MyEvaluator class.

Cheers,
Doru



> On Dec 9, 2017, at 12:04 AM, cheshirecatalyst  wrote:
> 
> I've recently picked up pharo, and am writing a small interpreter for a 
> trivial language the details of which are unimportant. However I am looking 
> for the simplest way to avoid having to use playground and Transcript to do 
> something like
> 
> | reader eval |
> reader := MyReader from: 'some stuff in my DSL'.
> eval := MyEvaluator from: reader.
> Transcript show: eval evaluate.
> 
> I'm tired of having to change 'some stuff in my DSL' to a new expression and 
> run it in playground.
> 
> I don't really care which is easier, a Morphic with an input box at the 
> bottom to put my expressions in with output up top, or a something like 
> CommandShellTranscript (which i have looked at but is too complex for me to 
> figure out how to get the desired result from).
> 
> Basically I want to be able to use my DSL outside of playground, but still in 
> image. 

--
www.tudorgirba.com
www.feenk.com

"Yesterday is a fact.
 Tomorrow is a possibility.
 Today is a challenge."







Re: [Pharo-users] Simplest 'REPL'

2017-12-09 Thread Seth
Thanks I ended up going in this direction sort of.



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



[Pharo-users] KeyNotFound: key #nil not found in SystemDicitonary

2017-12-09 Thread Seth
So, I've been trying to save and close my image for a while now.

It won't even just close without saving, it constantly pops up the error
from this subject.

I'm fairly new to all this, but I followed it to I think an Array of
ClassSessionHandlers one of which is ClassSessionHandlers(nil) but I don't
know how to get rid of it, I also opened the process browser and found a
Morphic UI Process: nil which i tried to terminate. None of which seems to
work. How to I get this nil value out of my image save / shutdown process?



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



Re: [Pharo-users] KeyNotFound: key #nil not found in SystemDicitonary

2017-12-09 Thread Ben Coman
hi Seth,

I've never heard of that error before, and others are better placed to
advise on session handling,
but just to provide an escape path...

Right-click on your package and choose "File Out", and it will inform you
of the created file name.
Then in a fresh image go World > Tools > File Browser, find the file and
right-click on it then "FileIn entire file"

cheers -ben


On 10 December 2017 at 09:54, Seth  wrote:

> So, I've been trying to save and close my image for a while now.
>
> It won't even just close without saving, it constantly pops up the error
> from this subject.
>
> I'm fairly new to all this, but I followed it to I think an Array of
> ClassSessionHandlers one of which is ClassSessionHandlers(nil) but I don't
> know how to get rid of it, I also opened the process browser and found a
> Morphic UI Process: nil which i tried to terminate. None of which seems to
> work. How to I get this nil value out of my image save / shutdown process?
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>


Re: [Pharo-users] KeyNotFound: key #nil not found in SystemDicitonary

2017-12-09 Thread Seth
Thanks Ben.

I did the file out part. How do I start start a fresh image?

On Sun, Dec 10, 2017 at 11:16 AM, Ben Coman  wrote:

> hi Seth,
>
> I've never heard of that error before, and others are better placed to
> advise on session handling,
> but just to provide an escape path...
>
> Right-click on your package and choose "File Out", and it will inform you
> of the created file name.
> Then in a fresh image go World > Tools > File Browser, find the file and
> right-click on it then "FileIn entire file"
>
> cheers -ben
>
>
> On 10 December 2017 at 09:54, Seth  wrote:
>
>> So, I've been trying to save and close my image for a while now.
>>
>> It won't even just close without saving, it constantly pops up the error
>> from this subject.
>>
>> I'm fairly new to all this, but I followed it to I think an Array of
>> ClassSessionHandlers one of which is ClassSessionHandlers(nil) but I don't
>> know how to get rid of it, I also opened the process browser and found a
>> Morphic UI Process: nil which i tried to terminate. None of which seems to
>> work. How to I get this nil value out of my image save / shutdown process?
>>
>>
>>
>> --
>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>>
>>
>


Re: [Pharo-users] REST client hints

2017-12-09 Thread Ben Coman
On 5 December 2017 at 20:44, Sven Van Caekenberghe  wrote:
>
>
> > On 5 Dec 2017, at 13:33, Ben Coman  wrote:
>
> > @sven, I started reading Enterprise Pharo a couple of hours ago.
> > I don't quite get your section references. I presume you
> > don't mean "chapter 11 Persisting Objects with Voyage, 11.3 Enhancing
> Storage"
> > That seems off topic. And "chapter 4  Zinc HTTP: The Client Side, 4.11
> Headers"
> > doesn't have a sub-part "3".
>
> I meant 11.3 in this page https://ci.inria.fr/pharo-contribution/job/
> EnterprisePharoBook/lastSuccessfulBuild/artifact/
> book-result/Zinc-HTTP-Server/Zinc-HTTP-Server.html a section called 11.3.
> A Zinc Client.
>
> > I guess part of what I'm interested in are patterns for hooking
> > NeoJSON up to parse a REST response into objects to build a wrapper
> > around a REST service. I see a chapter in Enterprise Pharo, which I'll
> > get to that soon.  Perhaps I was premature asking before reading that,
> > but its good to have a few paths to explore.
>
> Here is a recent example http://forum.world.st/Another-
> example-of-invoking-a-REST-JSON-web-service-resolving-
> User-Agent-strings-tt5017489.html



Thanks Sven.  That helped a lot.   I'd like to report success.
It may be useful to others to see how to progressively build up to parsing
a Nested JSON REST


1. First parse the JSON into simple Dictionaries...

(ZnClient new
url: 'https://bittrex.com/api/v1.1/public/getmarkets';
enforceHttpSuccess: true;
accept: ZnMimeType applicationJson;
contentReader: [ :entity | NeoJSONReader fromString: entity contents ];
get) inspect.

==>Dictionary(
  'success' ==> true
  'message' ==> ''
  'result ' ==> an Array(a Dictionary('BaseCurrency'->'BTC'
'BaseCurrencyLong'->'Bitcoin')
... a Dictionary('BaseCurrency'->'ETH' 'BaseCurrencyLong'->'Ethereum')



2. Then parse the first level response into a real object...

Object subclass: #BittrexResponse
instanceVariableNames: 'success message result'
classVariableNames: ''
package: 'Bittrex'

(ZnClient new
url: 'https://bittrex.com/api/v1.1/public/getmarkets';
enforceHttpSuccess: true;
accept: ZnMimeType applicationJson;
contentReader: [ :entity |
(NeoJSONReader on: entity readStream)
mapInstVarsFor: BittrexResponse ;
nextAs: BittrexResponse ];
   get) inspect.

==>BittrexResponse
  success => true
  message => ''
  result => an Array(a Dictionary('BaseCurrency'->'BTC'
'BaseCurrencyLong'->'Bitcoin')
... a Dictionary('BaseCurrency'->'ETH' 'BaseCurrencyLong'->'Ethereum')


Or alternatively...
(ZnClient new
url: 'https://bittrex.com/api/v1.1/public/getmarkets';
enforceHttpSuccess: true;
accept: ZnMimeType applicationJson;
contentReader: [ :entity | |reader|
reader := (NeoJSONReader on: entity readStream).
reader for: BittrexResponse do: [:m|
m mapInstVar: #success.
m mapInstVar: #message.
m mapInstVar: #result ].
  reader nextAs: BittrexResponse ];
   get) inspect.

==>BittrexResponse
  success => true
  message => ''
  result => an Array(a Dictionary('BaseCurrency'->'BTC'
'BaseCurrencyLong'->'Bitcoin')
... a Dictionary('BaseCurrency'->'ETH' 'BaseCurrencyLong'->'Ethereum')


3. Finally parse into real objects the nested level holding the data you
really want...

Object subclass: #Market
instanceVariableNames: 'MarketCurrency BaseCurrency MarketCurrencyLong
BaseCurrencyLong MinTradeSize MarketName IsActive Created Notice
IsSponsored LogoUrl'
classVariableNames: ''
package: 'Bittrex'

(ZnClient new
url: 'https://bittrex.com/api/v1.1/public/getmarkets';
enforceHttpSuccess: true;
accept: ZnMimeType applicationJson;
contentReader: [ :entity | |reader|
reader := (NeoJSONReader on: entity readStream).
reader for: BittrexResponse do: [:m|
m mapInstVar: #success.
m mapInstVar: #message.
(m mapInstVar: #result) valueSchema: #ArrayOfMarkets].
reader for: #ArrayOfMarkets customDo: [ :mapping | mapping
listOfElementSchema: Market ].
reader mapInstVarsFor: Market.
  reader nextAs: BittrexResponse ];
   get) inspect.

==>BittrexResponse
  success => true
  message => ''
  result => an Array(a Market(LTC) a Market(DOGE) a Market(VTC) a
Market(PPC) a Market(FTC) a Market(RDD)
... Market(POWR) a Market(BTG) a Market(BTG) a Market(BTG) a Market(ADA) a
Market(ENG) a Market(ENG))


WhooHoo!


A couple of things remaining:

* The instance variables of Market currently start with an upper-case to
match the JSON fields.
  Lower-casing the first letter breaks things.
  What strategies can be used to conform here to Smalltalk conventions?
  Or is it easy enough to live with it?

* In various posts I've seen mention of a class-side method #neoJsonMapping:
   but there is no explanation of this in the Enterprise Book.
   How might #neoJsonMapping: come into the picture for my use case above?

cheers -ben


Re: [Pharo-users] KeyNotFound: key #nil not found in SystemDicitonary

2017-12-09 Thread Ben Coman
Depends on how you downloaded Pharo.
* With PharoLauncher, just right click a template and "Create image"
* If you downloaded a Zip, extract it again, or specifically delete
Pharo.image and Pharo.changes and replace with a fresh copy from the zip.
* If via Zeroconf, unfortunately it removes the zip after it extracts it,
so usually after it finishes I zip up my own local copy prior to working
with it.

cheers -ben

On 10 December 2017 at 10:22, Seth  wrote:

> Thanks Ben.
>
> I did the file out part. How do I start start a fresh image?
>
> On Sun, Dec 10, 2017 at 11:16 AM, Ben Coman  wrote:
>
>> hi Seth,
>>
>> I've never heard of that error before, and others are better placed to
>> advise on session handling,
>> but just to provide an escape path...
>>
>> Right-click on your package and choose "File Out", and it will inform you
>> of the created file name.
>> Then in a fresh image go World > Tools > File Browser, find the file and
>> right-click on it then "FileIn entire file"
>>
>> cheers -ben
>>
>>
>> On 10 December 2017 at 09:54, Seth  wrote:
>>
>>> So, I've been trying to save and close my image for a while now.
>>>
>>> It won't even just close without saving, it constantly pops up the error
>>> from this subject.
>>>
>>> I'm fairly new to all this, but I followed it to I think an Array of
>>> ClassSessionHandlers one of which is ClassSessionHandlers(nil) but I
>>> don't
>>> know how to get rid of it, I also opened the process browser and found a
>>> Morphic UI Process: nil which i tried to terminate. None of which seems
>>> to
>>> work. How to I get this nil value out of my image save / shutdown
>>> process?
>>>
>>>
>>>
>>> --
>>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>>>
>>>
>>
>


Re: [Pharo-users] REST client hints

2017-12-09 Thread Stephane Ducasse
Tx for your report :)

https://wordpress.com/post/pharoweekly.wordpress.com/2347

Did you look at SmartShackles? on our inria github repo. Because
Santiago is extracting information from blockchains.

On Sun, Dec 10, 2017 at 4:45 AM, Ben Coman  wrote:
>
> On 5 December 2017 at 20:44, Sven Van Caekenberghe  wrote:
>>
>>
>> > On 5 Dec 2017, at 13:33, Ben Coman  wrote:
>>
>> > @sven, I started reading Enterprise Pharo a couple of hours ago.
>> > I don't quite get your section references. I presume you
>> > don't mean "chapter 11 Persisting Objects with Voyage, 11.3 Enhancing
>> > Storage"
>> > That seems off topic. And "chapter 4  Zinc HTTP: The Client Side, 4.11
>> > Headers"
>> > doesn't have a sub-part "3".
>>
>> I meant 11.3 in this page
>> https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/book-result/Zinc-HTTP-Server/Zinc-HTTP-Server.html
>> a section called 11.3. A Zinc Client.
>>
>> > I guess part of what I'm interested in are patterns for hooking
>> > NeoJSON up to parse a REST response into objects to build a wrapper
>> > around a REST service. I see a chapter in Enterprise Pharo, which I'll
>> > get to that soon.  Perhaps I was premature asking before reading that,
>> > but its good to have a few paths to explore.
>>
>> Here is a recent example
>> http://forum.world.st/Another-example-of-invoking-a-REST-JSON-web-service-resolving-User-Agent-strings-tt5017489.html
>
>
>
> Thanks Sven.  That helped a lot.   I'd like to report success.
> It may be useful to others to see how to progressively build up to parsing a
> Nested JSON REST
>
>
> 1. First parse the JSON into simple Dictionaries...
>
> (ZnClient new
> url: 'https://bittrex.com/api/v1.1/public/getmarkets';
> enforceHttpSuccess: true;
> accept: ZnMimeType applicationJson;
> contentReader: [ :entity | NeoJSONReader fromString: entity contents ];
> get) inspect.
>
> ==>Dictionary(
>   'success' ==> true
>   'message' ==> ''
>   'result ' ==> an Array(a Dictionary('BaseCurrency'->'BTC'
> 'BaseCurrencyLong'->'Bitcoin')
> ... a Dictionary('BaseCurrency'->'ETH' 'BaseCurrencyLong'->'Ethereum')
>
>
>
> 2. Then parse the first level response into a real object...
>
> Object subclass: #BittrexResponse
> instanceVariableNames: 'success message result'
> classVariableNames: ''
> package: 'Bittrex'
>
> (ZnClient new
> url: 'https://bittrex.com/api/v1.1/public/getmarkets';
> enforceHttpSuccess: true;
> accept: ZnMimeType applicationJson;
> contentReader: [ :entity |
> (NeoJSONReader on: entity readStream)
> mapInstVarsFor: BittrexResponse ;
> nextAs: BittrexResponse ];
>get) inspect.
>
> ==>BittrexResponse
>   success => true
>   message => ''
>   result => an Array(a Dictionary('BaseCurrency'->'BTC'
> 'BaseCurrencyLong'->'Bitcoin')
> ... a Dictionary('BaseCurrency'->'ETH' 'BaseCurrencyLong'->'Ethereum')
>
>
> Or alternatively...
> (ZnClient new
> url: 'https://bittrex.com/api/v1.1/public/getmarkets';
> enforceHttpSuccess: true;
> accept: ZnMimeType applicationJson;
> contentReader: [ :entity | |reader|
> reader := (NeoJSONReader on: entity readStream).
> reader for: BittrexResponse do: [:m|
> m mapInstVar: #success.
> m mapInstVar: #message.
> m mapInstVar: #result ].
>   reader nextAs: BittrexResponse ];
>get) inspect.
>
> ==>BittrexResponse
>   success => true
>   message => ''
>   result => an Array(a Dictionary('BaseCurrency'->'BTC'
> 'BaseCurrencyLong'->'Bitcoin')
> ... a Dictionary('BaseCurrency'->'ETH' 'BaseCurrencyLong'->'Ethereum')
>
>
> 3. Finally parse into real objects the nested level holding the data you
> really want...
>
> Object subclass: #Market
> instanceVariableNames: 'MarketCurrency BaseCurrency MarketCurrencyLong
> BaseCurrencyLong MinTradeSize MarketName IsActive Created Notice IsSponsored
> LogoUrl'
> classVariableNames: ''
> package: 'Bittrex'
>
> (ZnClient new
> url: 'https://bittrex.com/api/v1.1/public/getmarkets';
> enforceHttpSuccess: true;
> accept: ZnMimeType applicationJson;
> contentReader: [ :entity | |reader|
> reader := (NeoJSONReader on: entity readStream).
> reader for: BittrexResponse do: [:m|
> m mapInstVar: #success.
> m mapInstVar: #message.
> (m mapInstVar: #result) valueSchema: #ArrayOfMarkets].
> reader for: #ArrayOfMarkets customDo: [ :mapping | mapping
> listOfElementSchema: Market ].
> reader mapInstVarsFor: Market.
>   reader nextAs: BittrexResponse ];
>get) inspect.
>
> ==>BittrexResponse
>   success => true
>   message => ''
>   result => an Array(a Market(LTC) a Market(DOGE) a Market(VTC) a
> Market(PPC) a Market(FTC) a Market(RDD)
> ... Market(POWR) a Market(BTG) a Market(BTG) a Market(BTG) a Market(ADA) a
> Market(ENG) a Market(ENG))
>
>
> WhooHoo!
>
>
> A couple of things remaining:
>
> * The instance variables of Market currently start with an upper-case to
> match the JSON fields.
>   Lower-casing the first letter breaks things.
>   What strategies can be used to conform here to Smalltalk