Re: [Pharo-users] New convenience method: ZnClient>>forJsonREST

2018-11-07 Thread Tudor Girba
This is nice!

Doru


> On Nov 7, 2018, at 5:36 PM, Sven Van Caekenberghe  wrote:
> 
> Hi,
> 
> I added a new convenience method to Zinc HTTP Components: 
> ZnClient>>forJsonREST. This configures a ZnClient (HTTP client) to talk to 
> standard JSON REST web services. Here are a couple of examples:
> 
> ZnClient new
>  forJsonREST;
>  get: 'https://jsonplaceholder.typicode.com/users'.
> 
> What #forJsonREST does is 3 things: set the 'Accept' header to 
> 'application/json', install a #contentReader that parses incoming JSON as 
> well as a #contentWriter that generates JSON.
> 
> ZnClient new
>  systemPolicy;
>  forJsonREST;
>  url: 'https://jsonplaceholder.typicode.com/posts';
>  contents: { #foo->1. #bar->2 } asDictionary;
>  post.
> 
> As you can see, the full ZnClient API can be combined when needed.
> 
> ZnClient new
>  forJsonREST;
>  post: 'https://jsonplaceholder.typicode.com/posts' 
>  contents: (NeoJSONObject new foo: 1; bar: 2; yourself).
> 
> #post:contents: combines separate #url: #contents: and #post message.
> 
> #forJsonREST uses NeoJSON[Object|Writer] if found, else STONJSON. If both are 
> missing, this results in an error.
>   
> ZnClient new
>  systemPolicy;
>  forJsonREST;
>  url: 'http://easy.t3-platform.net/rest/geo-ip';
>  queryAt: #address put: '81.83.7.35';
>  get.
> 
> Finally, here is a more sophisticated example, doing a DNS request over HTTPS:
> 
> ZnClient new
>  systemPolicy;
>  beOneShot;
>  forJsonREST;
>  accept: 'application/dns-json';
>  url: 'https://cloudflare-dns.com/dns-query';
>  queryAt: #name put: 'stfx.eu';
>  queryAt: #type put: #;
>  get.
> 
> Note that in most cases, you will configure one client to a specific endpoint 
> and keep on reusing it. At one point in time it might be good to #close the 
> client (although that happens on finalise as well). For single requests, you 
> can use #beOneShot.
> 
> All this can be found in #bleedingEdge (HEAD). There are unit tests as well.
> 
> Sven
> 
> 

--
www.feenk.com

"In a world where everything is moving ever faster,
one might have better chances to win by moving slower."








Re: [Pharo-users] New convenience method: ZnClient>>forJsonREST

2018-11-07 Thread Cédrick Béler
You’re (one of) my heroes !

Thanks Sven a lot for all your great contributions !

Cédrick

Side note: perfect late binding information for the lecture I do tomorrow with 
Pharo where I show students client server interaction with ZnClient, ZnServer … 
^_^

> Le 7 nov. 2018 à 17:36, Sven Van Caekenberghe  a écrit :
> 
> Hi,
> 
> I added a new convenience method to Zinc HTTP Components: 
> ZnClient>>forJsonREST. This configures a ZnClient (HTTP client) to talk to 
> standard JSON REST web services. Here are a couple of examples:
> 
> ZnClient new
>  forJsonREST;
>  get: 'https://jsonplaceholder.typicode.com/users'.
> 
> What #forJsonREST does is 3 things: set the 'Accept' header to 
> 'application/json', install a #contentReader that parses incoming JSON as 
> well as a #contentWriter that generates JSON.
> 
> ZnClient new
>  systemPolicy;
>  forJsonREST;
>  url: 'https://jsonplaceholder.typicode.com/posts';
>  contents: { #foo->1. #bar->2 } asDictionary;
>  post.
> 
> As you can see, the full ZnClient API can be combined when needed.
> 
> ZnClient new
>  forJsonREST;
>  post: 'https://jsonplaceholder.typicode.com/posts' 
>  contents: (NeoJSONObject new foo: 1; bar: 2; yourself).
> 
> #post:contents: combines separate #url: #contents: and #post message.
> 
> #forJsonREST uses NeoJSON[Object|Writer] if found, else STONJSON. If both are 
> missing, this results in an error.
>   
> ZnClient new
>  systemPolicy;
>  forJsonREST;
>  url: 'http://easy.t3-platform.net/rest/geo-ip';
>  queryAt: #address put: '81.83.7.35';
>  get.
> 
> Finally, here is a more sophisticated example, doing a DNS request over HTTPS:
> 
> ZnClient new
>  systemPolicy;
>  beOneShot;
>  forJsonREST;
>  accept: 'application/dns-json';
>  url: 'https://cloudflare-dns.com/dns-query';
>  queryAt: #name put: 'stfx.eu';
>  queryAt: #type put: #;
>  get.
> 
> Note that in most cases, you will configure one client to a specific endpoint 
> and keep on reusing it. At one point in time it might be good to #close the 
> client (although that happens on finalise as well). For single requests, you 
> can use #beOneShot.
> 
> All this can be found in #bleedingEdge (HEAD). There are unit tests as well.
> 
> Sven
> 
> 




[Pharo-users] New convenience method: ZnClient>>forJsonREST

2018-11-07 Thread Sven Van Caekenberghe
Hi,

I added a new convenience method to Zinc HTTP Components: 
ZnClient>>forJsonREST. This configures a ZnClient (HTTP client) to talk to 
standard JSON REST web services. Here are a couple of examples:

ZnClient new
  forJsonREST;
  get: 'https://jsonplaceholder.typicode.com/users'.

What #forJsonREST does is 3 things: set the 'Accept' header to 
'application/json', install a #contentReader that parses incoming JSON as well 
as a #contentWriter that generates JSON.

ZnClient new
  systemPolicy;
  forJsonREST;
  url: 'https://jsonplaceholder.typicode.com/posts';
  contents: { #foo->1. #bar->2 } asDictionary;
  post.

As you can see, the full ZnClient API can be combined when needed.

ZnClient new
  forJsonREST;
  post: 'https://jsonplaceholder.typicode.com/posts' 
  contents: (NeoJSONObject new foo: 1; bar: 2; yourself).

#post:contents: combines separate #url: #contents: and #post message.

#forJsonREST uses NeoJSON[Object|Writer] if found, else STONJSON. If both are 
missing, this results in an error.

ZnClient new
  systemPolicy;
  forJsonREST;
  url: 'http://easy.t3-platform.net/rest/geo-ip';
  queryAt: #address put: '81.83.7.35';
  get.

Finally, here is a more sophisticated example, doing a DNS request over HTTPS:

ZnClient new
  systemPolicy;
  beOneShot;
  forJsonREST;
  accept: 'application/dns-json';
  url: 'https://cloudflare-dns.com/dns-query';
  queryAt: #name put: 'stfx.eu';
  queryAt: #type put: #;
  get.

Note that in most cases, you will configure one client to a specific endpoint 
and keep on reusing it. At one point in time it might be good to #close the 
client (although that happens on finalise as well). For single requests, you 
can use #beOneShot.

All this can be found in #bleedingEdge (HEAD). There are unit tests as well.

Sven




Re: [Pharo-users] [ANN] Iceberg v1.3.1

2018-11-07 Thread Offray Vladimir Luna Cárdenas
Really nice.

Just a quick question: Self hosted GitLab support can be used for self
hosted Gitea[1] support? What would be needed for that? (I'm thinking in
using Gitea as a bridge between Pharo and Fossil).

[1] https://gitea.io/en-us/

Cheers,

Offray

On 11/5/18 8:15 AM, Cyril Ferlicot wrote:
>  Hello!
>
> This week we are releasing the version v1.3 of Iceberg.
> (https://github.com/pharo-vcs/iceberg/releases/tag/v1.3.0
> +https://github.com/pharo-vcs/iceberg/releases/tag/v1.3.1)
>
> This version will be available after we merge this PR:
>
> https://github.com/pharo-project/pharo/pull/1951
>
> This release contains some new features such as the support of self
> hosted gitlab, integration with github, etc.
> It also contains multiple bug fixes, cleanups and enhancements.
>
> On the CI part, Guille made the Appveyor build green! This will
> increase the stability of the windows support.
>
> Thanks to all contributors.
>
> Enjoy!
>
> Full changelog:
>
> Features
>
> #1021 Self hosted gitlab support
> #1027 Improved new tag dialog to generate semantic versionning tags
> #1044 Show a button "View on Github" when creating a PR
> #1008 Add "create branch from GitHub issue" option
> #1048 Add commands to open remotes on Github
> #1010 Add menu entry in extras to force calculate diff
>
> Bug corrections
>
> #975 Metacello asks too many times what to install when there are
> conflicting versions
> #980 Iceberg should Identify better the packages and the normal files
> #982 The Edit Project should have a Warning if it will affect the packages
> #986 Iceberg does not realize changes in extended classes
> #999 Pulling and pushing to a gitolite server asks password
> #984 Conversion to Tonel generates corrupted .properties
> #1041 Filter in repository view don't work with capital letters
> #1019 Metacello Integration leaves Monticello leftover repositories
> #859 Creating a branch and pushing does not sets the upstream
> #1043 Packages starting with lowercase not recognized
> #991 Error on right click in the project editon wizard
> #775 Reviewing a PR is broken
> #1036 Debugger if we try to merge without selecting a branch
> #1064 Fix failing tests regarding clean code in Pharo
>
> Enhancements
>
> #988 Iceberg should load the packages in a single MCLoader (This will
> make the loads of packages atomic)
> #1001 Use "instance creation" instead of "instance-creation" for
> method protocol name
> #1004 Use displayScaleFactor in UI
> #977 Add ToolTip help to the Commands
> #1030 Better support for binary files
> #1034 SSH passphrase is now hidden
>
> Cleanups
>
> #1018 Iceberg UI relies on deprecated classes from Spec and Commander
> #1051 Clean useless huge hierarchy in Github plugin UI
>
> Infrastructure Enhancements
>
> #1023 Fix CI for windows
>



Re: [Pharo-users] [Pharo-dev] [ANN] Iceberg v1.4.0

2018-11-07 Thread Ben Coman via Pharo-users
--- Begin Message ---
On Wed, 7 Nov 2018 at 17:09, Cyril Ferlicot  wrote:
>
> Hello!
>
> This week we are releasing the version v1.4.0 of Iceberg.
> (https://github.com/pharo-vcs/iceberg/releases/tag/v1.4.0)
>
> This version is available in the latest Pharo 7.
>
> This release fixes a bug introduced in v1.3. It also add new features
> in the repository view, add some cleaning and also re-introduce a
> feature that was lost.
>
> Thanks to all contributors.
>
> Enjoy!
>
> Full changelog:
>
> Bugfixes
>
> #1068 'There is no associated repository configured.' warning on right
> clicking missing repository
>
> Features
>
> #1077 Repository view: Allow to collapse branches/remotes/tags trees
> #847 Move tags under remotes in Repository view

Ohh, those two are very nice.   I'm meant to be working on something
else but needed to try those out.
That long list of tags had been mildly annoying me for a while, but
not enough for me to get around to complaining about it.
Glad its fixed already.


> #1070 set upstream if missing
>
> Cleanups
>
> #1066 Pharo 7: PackageManifest subclasses should be packaged with "Manifest"
> #1015 Replace usages of Glamour in the Github Plugin
> #1063 
> 1061-Introduce-iconNamed-in-IceDefinition-and-IceTipModel-and-remove-all-the-terrible-Smalltalk-ui-icons

Cool. I like the way the changes are reported and the semantic versioning.

cheers -ben

--- End Message ---


Re: [Pharo-users] MetaLink>>level: failing?

2018-11-07 Thread Marcus Denker
Hi,

I added 


https://pharo.fogbugz.com/f/cases/22642/instead-links-and-meta-level-original-code-not-executed

as a workaround, you can use a #before link with an explicit return:


choice := true.
link := MetaLink new metaObject: [ :object :selector :arguments :context | 
  UIManager default alert: 'Linked 
Version'.
  choice ifTrue: [ context sender 
sender sender sender return: (object perform: selector withArguments: 
arguments)].
   ]; 
selector: #value:value:value:value:;
 arguments: #(#object #selector #arguments #context);
 control: #before;
 level: 0.

(TestMetaLink >> #execute) ast link: link.
TestMetaLink new execute.
link uninstall.

(yes, the  context sender sender sender  shows that #context needs to do the 
right thing when using  level: 0. or not… another thing to fix)

Marcus

> On 7 Nov 2018, at 15:08, Marcus Denker  wrote:
> 
> Hello,
> 
> I added a fist issue (and fix) for parts of the problem
> 
> https://pharo.fogbugz.com/f/cases/22641/Semantic-analysis-needs-to-take-instead-preambles-into-account
>  
> 
> https://github.com/pharo-project/pharo/pull/1960 
> 
> 
> But after this, it does not work as the level just turns off calling the meta 
> level code, but does not execute the
> original code where the #instead is put.
> (#instead in general needs more work in this implementation).
> 
> I will open another issue for that.
> 
>   Marcus
> 
>> On 31 Oct 2018, at 18:03, Vitor Medina Cruz > > wrote:
>> 
>> Thanks! Is there an issue on fogbuzz where I can be notified of resolution? 
>> Do you need me to create it?
>> 
>> After that how can update the code? Software update is safe or should I 
>> create a new image?
>> 
>> regards,
>> Vitor
>> 
>> On Mon, Oct 29, 2018 at 12:08 PM Marcus Denker > > wrote:
>> 
>> 
>>> On 25 Oct 2018, at 01:33, Vitor Medina Cruz >> > wrote:
>>> 
>>> Hello,
>>> 
>>> I am playing with MetaLink, really cool!, but I am having issues that I am 
>>> unsure if it's some erro or if I am doing something wrong (I am using Pharo 
>>> 6.1 32 bits in windows.). Consider:
>>> 
>>> TestMetaLink>>execute
>>> UIManager default alert: 'Actual Version'.
>>> 
>>> And in Playground:
>>> 
>>> | link | 
>>> 
>>> link := MetaLink new metaObject: [ :object | UIManager default alert: 
>>> 'Linked Version' ];
>>> selector: #value:;
>>>  arguments: #(#object);
>>>  control: #instead.
>>> 
>>> 
>>> (TestMetaLink >> #execute) ast link: link.
>>> TestMetaLink new execute.
>>> link uninstall.
>>> 
>>> This works as expected, an alert with 'Linked Version' is promped. But then 
>>> suppose I want to execute the actual node alongside with the linked one 
>>> considering some condition:
>>> 
>>> | link choice | 
>>> 
>>> choice := true.
>>> link := MetaLink new metaObject: [ :object :selector :arguments | 
>>>   UIManager default alert: 
>>> 'Linked Version'.
>>>   choice ifTrue: [ object 
>>> perform: selector withArguments: arguments].
>>>]; 
>>> selector: #value:value:value:;
>>>  arguments: #(#object #selector #arguments);
>>>  control: #instead;
>>>  level: 0.
>>> 
>>> 
>>> (TestMetaLink >> #execute) ast link: link.
>>> TestMetaLink new execute.
>>> link uninstall.
>>> 
>>> As I understand, level:0 is necessary in order to avoid an infinite loop, 
>>> but then I get an error:
>>> 
>>> KeyNotFound: key #RFArgumentsReificationVar not found in Dictionary
>>> 
>>> Am I doing something wrong? Is that an error? 
>>> 
>> Hello,
>> 
>> Yes, this looks like a bug. I will fix it over the next days.
>> 
>>  Marcus
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 



Re: [Pharo-users] MetaLink>>level: failing?

2018-11-07 Thread Marcus Denker
Hello,

I added a fist issue (and fix) for parts of the problem

https://pharo.fogbugz.com/f/cases/22641/Semantic-analysis-needs-to-take-instead-preambles-into-account
https://github.com/pharo-project/pharo/pull/1960

But after this, it does not work as the level just turns off calling the meta 
level code, but does not execute the
original code where the #instead is put.
(#instead in general needs more work in this implementation).

I will open another issue for that.

Marcus

> On 31 Oct 2018, at 18:03, Vitor Medina Cruz  wrote:
> 
> Thanks! Is there an issue on fogbuzz where I can be notified of resolution? 
> Do you need me to create it?
> 
> After that how can update the code? Software update is safe or should I 
> create a new image?
> 
> regards,
> Vitor
> 
> On Mon, Oct 29, 2018 at 12:08 PM Marcus Denker  > wrote:
> 
> 
>> On 25 Oct 2018, at 01:33, Vitor Medina Cruz > > wrote:
>> 
>> Hello,
>> 
>> I am playing with MetaLink, really cool!, but I am having issues that I am 
>> unsure if it's some erro or if I am doing something wrong (I am using Pharo 
>> 6.1 32 bits in windows.). Consider:
>> 
>> TestMetaLink>>execute
>> UIManager default alert: 'Actual Version'.
>> 
>> And in Playground:
>> 
>> | link | 
>> 
>> link := MetaLink new metaObject: [ :object | UIManager default alert: 
>> 'Linked Version' ];
>> selector: #value:;
>>  arguments: #(#object);
>>  control: #instead.
>> 
>> 
>> (TestMetaLink >> #execute) ast link: link.
>> TestMetaLink new execute.
>> link uninstall.
>> 
>> This works as expected, an alert with 'Linked Version' is promped. But then 
>> suppose I want to execute the actual node alongside with the linked one 
>> considering some condition:
>> 
>> | link choice | 
>> 
>> choice := true.
>> link := MetaLink new metaObject: [ :object :selector :arguments | 
>>   UIManager default alert: 
>> 'Linked Version'.
>>   choice ifTrue: [ object 
>> perform: selector withArguments: arguments].
>>]; 
>> selector: #value:value:value:;
>>  arguments: #(#object #selector #arguments);
>>  control: #instead;
>>  level: 0.
>> 
>> 
>> (TestMetaLink >> #execute) ast link: link.
>> TestMetaLink new execute.
>> link uninstall.
>> 
>> As I understand, level:0 is necessary in order to avoid an infinite loop, 
>> but then I get an error:
>> 
>> KeyNotFound: key #RFArgumentsReificationVar not found in Dictionary
>> 
>> Am I doing something wrong? Is that an error? 
>> 
> Hello,
> 
> Yes, this looks like a bug. I will fix it over the next days.
> 
>   Marcus
> 
> 
> 
> 
> 
> 
> 



[Pharo-users] [ANN] Iceberg v1.4.0

2018-11-07 Thread Cyril Ferlicot
Hello!

This week we are releasing the version v1.4.0 of Iceberg.
(https://github.com/pharo-vcs/iceberg/releases/tag/v1.4.0)

This version is available in the latest Pharo 7.

This release fixes a bug introduced in v1.3. It also add new features
in the repository view, add some cleaning and also re-introduce a
feature that was lost.

Thanks to all contributors.

Enjoy!

Full changelog:

Bugfixes

#1068 'There is no associated repository configured.' warning on right
clicking missing repository

Features

#1077 Repository view: Allow to collapse branches/remotes/tags trees
#847 Move tags under remotes in Repository view
#1070 set upstream if missing

Cleanups

#1066 Pharo 7: PackageManifest subclasses should be packaged with "Manifest"
#1015 Replace usages of Glamour in the Github Plugin
#1063 
1061-Introduce-iconNamed-in-IceDefinition-and-IceTipModel-and-remove-all-the-terrible-Smalltalk-ui-icons


-- 
Cyril Ferlicot
https://ferlicot.fr



Re: [Pharo-users] [Pharo-dev] [ANN] Pharo v7.0.0-rc1 released!

2018-11-07 Thread Tudor Girba
Excellent!

Doru


> On Nov 5, 2018, at 4:11 PM, Esteban Lorenzano  wrote:
> 
> Greetings!
> 
> I’m announcing today we reach Pharo 7.0.0-rc1!
> 
> This is the first step to release a definitive version, and while we will 
> continue integrating bug fixes, API change Pull Requests will be delayed 
> until the open of Pharo 8.0.0 development. 
> Now, you would wonder what is the ChangeLog of this release… and answer is we 
> still do not have one (btw, we should find a way to automate this).
> 
> Anyway… we are very close to release now :)
> 
> Please download, test, report issues.
> 
> Esteban

--
www.feenk.com

"Speaking louder won't make the point worthier."