[Pharo-users] Google Protobuf and usage of Slots

2019-02-25 Thread Holger Freyther
Hi,

from my point of view the pillars of future services are Google protobuf[1] and 
gRPC. Protobuf can be used for configuration files[2], tracing/logging[3] and 
storage[4]. gRPC is built on top-of HTTP2 and is using the protobuf IDL and 
marshaling. Many projects (etcd, envoy, Google Cloud, ...) provide a gRPC based 
API (and some automatically map this from REST to gRPC) already and I would 
like to build clients and servers in Pharo.


My plan of action is to start with a protobuf compiler/model and then look into 
binding the gRPC C implementation to Pharo.


I have started with gokr's Protobuf code on Smalltalkhub and defined base types 
and a Slot and could use some help to structure this more nicely.

The code is at: https://github.com/zecke/pharo-protobuf and I could use some 
comments/review of how to use Slots in a significant way (add "type" validation 
on write, constraint checks, builder pattern?).

Given a definition like:

  syntax = "proto2";
  package foo;
  enum Color {
RED = 0;
GREEN = 1;
BLUE = 2;
  }
  message MyMessage {
optional Color color = 1;
  }

And an encoded binary message of #[8 2] the following can:

  PBTestMessage materializeFrom: #[8 2] readStream


decode and set the color field. Proper handling of mandatory and repeated 
fields are missing and decoding the other values, nested messages... :)



Looking forward to have some eyes on the code.

holger





[1] A simple IDL to define structs/enums with marshaller/materializer for a 
binary protocol, JSON (and yaml).

[2] Without having to write a XML/JSON schema and getting validation from the 
IDL.

[3] Many of us log structured to text, then have something like logstash to 
re-parse, regexp it and dump it into ElasticSearch. With protobuf we can have 
plain objects end to end for logging.

[4] We have FUEL so this is less interesting for us than others but quite 
interesting if you are mixing Pharo with other implementation languages.


Re: [Pharo-users] NeoJSON mapping question

2019-02-25 Thread BrunoBB
Hi,

Finally i found a much more acceptable solution :)

neoJsonMapping: mapper
"Map the receiver from a json with  "
mapper for: self do: [ :mapping |
mapping mapAccessor: #locator mutator: #setLocator: to: 
'booking'.
].

setLocator: aDictionary
locator := aDictionary at: '@locator'

regards,
bruno



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



Re: [Pharo-users] NeoJSON mapping question

2019-02-25 Thread BrunoBB
Hi,

The following implementation do what i want without the need to create a
class for each level of the JSON, however i really dislike my solution.
neoJsonMapping: mapper "class side"
"Map the receiver to a json with  "
mapper for: self do: [ :mapping |
(mapping mapProperty: 'booking' getter: [:obj | obj locator] 
setter: [
:obj :value | obj setLocator: value]) valueSchema: self.
].

mapper for: self do: [ :mapping |
mapping mapProperty: '@locator' getter: [:obj | obj locator] 
setter: [
:obj :value | obj locator: value]
]

The first part map 'booking' property to the class locator inst var. The
second part have access to the "second json level" and the value i'm looking
for.

But setLocator: anObject is the ugly thing :(
setLocator: anObject
(anObject class == PmsJsonInput) ifTrue: [^locator := anObject locator].
locator := anObject

I'm sure there must be another way to do this.

regards,
bruno



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



[Pharo-users] NeoJSON mapping question

2019-02-25 Thread BrunoBB
Hi,

How to set a path to JSON value in the mapping definition ?

I mean i have a simple object with and instance variable but the value of
this inst var is deep inside the JSON.

mapping mapInstVar: #locator to: 'locator'.

This fail because 'locator' is not in the first JSON level.

Is possible to do something like:
mapping mapInstVar: #locator to: 'booking.vars.locator'.

I already tried and fail. But i was not able to find something similar.

regards,
bruno



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



Re: [Pharo-users] what did I do wrong here

2019-02-25 Thread Sven Van Caekenberghe



> On 25 Feb 2019, at 22:30, Roelof Wobben  wrote:
> 
> Thanks,
> 
> How do I know the next time if I need to use a instance or a class method ?

Instance creation happens on the class side, when your are on the instance 
side, your already have an instance (self) that was already created [this is by 
definition/design], so there is no point in creating a new instance, unless you 
want to make a copy or convert to something else.

> That was the trick.
> 
> Roelof
> 
> 
> 
> Op 25-2-2019 om 22:05 schreef Sven Van Caekenberghe:
>> json := (NeoJSONReader fromString: (ZnEasy get: 
>> 'https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True
>> ') contents).
>> 
>> Paintings new fromJSON:  json
> 
> 




[Pharo-users] Display MozCanvas on screen?

2019-02-25 Thread David Richards
| canvas |
. canvas := BlSpartaMozCanvasBuilder extent: 600@400

How do I display this MosCanvas on screen?

Does anyone know where I can get documentation on how to do graphics in
Pharo? The comments in the code are not understandable to a beginner.


[Pharo-users] [Seaside] Resource Based routing

2019-02-25 Thread sergio ruiz
Okay, gathering info regarding my last post.

I need to create REST urls to point to things in my app like blog posts,
show notes, etc..

I am thinking to do this, I should probably follow this:

http://book.seaside.st/book/advanced/restful/handler-filter

Am I on the right track?

Thanks!


peace,
sergio
photographer, journalist, visionary

Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101


Re: [Pharo-users] what did I do wrong here

2019-02-25 Thread Roelof Wobben

Thanks,

How do I know the next time if I need to use a instance or a class method ?

That was the trick.

Roelof



Op 25-2-2019 om 22:05 schreef Sven Van Caekenberghe:

json := (NeoJSONReader fromString: (ZnEasy get: 
'https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True
') contents).

Paintings new fromJSON:  json





Re: [Pharo-users] what did I do wrong here

2019-02-25 Thread Sven Van Caekenberghe
Your #fromJSON: methods should be on the class not the instance side.

> On 25 Feb 2019, at 21:52, Roelof Wobben  wrote:
> 
> Hello, 
> 
> I try to ask a api for some data and then display the data  I want. 
> 
> But when I do : 
> 
> json := (NeoJSONReader fromString: (ZnEasy get: 
> 'https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True
> ') contents).
> 
> Paintings new fromJSON:  json 
> 
> 
> I still see a message that Paintings do not understand new.
> 
> What did I do wrong here.
> 
> I will include  a file-out of my code 
> 
> 
> Regards, 
> 
> Roelof
> 
> 




Re: [Pharo-users] Mac OS X test [ smaller image ]

2019-02-25 Thread Sven Van Caekenberghe



> On 25 Feb 2019, at 21:41, Hilaire  wrote:
> 
> I think I am running out of option.
> 
> Since about 10 years, it is the first time I am stuck with Pharo to
> deliver an end user application on Mac.
> 
> Any idea?
> 
> Can some try on a mac to run as this for any meaningful feedback?
> 
> cd ./DrGeo.app
> 
> ./Contents/MacOS/Pharo ./Contents/Resources/drgeo.image

prometheus:DrGeo.app sven$ ./Contents/vm/Pharo ./Contents/Resources/drgeo.image 
2019-02-25 21:49:49.816 Pharo[68128:5223153] No Info.plist file in application 
bundle or no NSPrincipalClass in the Info.plist file, exiting

This is not my area of expertise, but you are trying to do this without having 
a Mac and/or basic Mac developer experience ?

Those .app bundles are really harder than they look. This is very much related 
to how macOS works (including virus and malware protection).

Can't you look at the PharoLauncher for how this should be done ? Maybe the 
developers working on PharoLauncher can help ?

> Thanks
> 
> Hilaire
> 
> Le 24/02/2019 à 20:55, Hilaire a écrit :
>> Thanks Sven,
>> 
>> It looks like the same VM I used with the previous bundle. md5sum on the
>> Pharo executable produced the same check sum.
>> 
>> Still I packaged one with this bundle, this time I preserved the plugin
>> lib symlink in the zip archive, if you want to give a try.
>> 
>> https://www.dropbox.com/s/me1z6prfln1pbe8/DrGeo-mac-19.03a.zip?dl=0
> 
> -- 
> Dr. Geo
> http://drgeo.eu
> 
> 
> 




[Pharo-users] what did I do wrong here

2019-02-25 Thread Roelof Wobben

  
  
Hello, 

I try to ask a api for some data and then display the data  I want.


But when I do : 

json := (NeoJSONReader fromString: (ZnEasy get: 'https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True') contents).

Paintings new fromJSON:  json 


I still see a message that Paintings do not understand new.

What did I do wrong here.

I will include  a file-out of my code 


Regards, 

Roelof

  

Object subclass: #Painting
instanceVariableNames: 'title painter imageUrl'
classVariableNames: ''
poolDictionaries: ''
category: 'Paintings'!

!Painting methodsFor: 'accessing' stamp: 'RoelofWobben 2/25/2019 20:09'!
painter
^ painter! !

!Painting methodsFor: 'accessing' stamp: 'RoelofWobben 2/25/2019 20:09'!
title: anObject
title := anObject! !

!Painting methodsFor: 'accessing' stamp: 'RoelofWobben 2/25/2019 20:17'!
imageUrl: anObject
imageUrl := anObject! !

!Painting methodsFor: 'accessing' stamp: 'RoelofWobben 2/25/2019 20:17'!
imageUrl
^ imageUrl! !

!Painting methodsFor: 'accessing' stamp: 'RoelofWobben 2/25/2019 20:09'!
title
^ title! !

!Painting methodsFor: 'accessing' stamp: 'RoelofWobben 2/25/2019 20:09'!
painter: anObject
painter := anObject! !


!Painting methodsFor: 'instance creation' stamp: 'RoelofWobben 2/25/2019 20:10'!
fromJSON: json
| instance |
instance := self new.
instance
title: (json at: 'title');
painter: (json at: 'principalOrFirstMaker');
imageUrl: ((json at: 'webImage') at: 'url').
^ instance
 ! !


Object subclass: #Paintings
instanceVariableNames: 'paintings'
classVariableNames: ''
poolDictionaries: ''
category: 'Paintings'!

!Paintings methodsFor: 'instance creation' stamp: 'RoelofWobben 2/25/2019 
20:29'!
addPainting: aPainting
paintings  add: aPainting. 
! !

!Paintings methodsFor: 'instance creation' stamp: 'RoelofWobben 2/25/2019 
20:12'!
fromJSON: json
| instance artObjects |
instance := self new.
artObjects := json at: #artObjects.
artObjects
do: [ :eachArtObject | instance addPainting: (Painting fromJSON: 
eachArtObject) ].
^ instance! !

!Paintings methodsFor: 'instance creation' stamp: 'RoelofWobben 2/25/2019 
20:15'!
initialize 
super initialize. 
paintings := OrderedCollection new. 
! !


Re: [Pharo-users] Mac OS X test [ smaller image ]

2019-02-25 Thread Hilaire
I think I am running out of option.

Since about 10 years, it is the first time I am stuck with Pharo to
deliver an end user application on Mac.

Any idea?

Can some try on a mac to run as this for any meaningful feedback?

cd ./DrGeo.app

./Contents/MacOS/Pharo ./Contents/Resources/drgeo.image

Thanks

Hilaire

Le 24/02/2019 à 20:55, Hilaire a écrit :
> Thanks Sven,
>
> It looks like the same VM I used with the previous bundle. md5sum on the
> Pharo executable produced the same check sum.
>
> Still I packaged one with this bundle, this time I preserved the plugin
> lib symlink in the zip archive, if you want to give a try.
>
> https://www.dropbox.com/s/me1z6prfln1pbe8/DrGeo-mac-19.03a.zip?dl=0

-- 
Dr. Geo
http://drgeo.eu





Re: [Pharo-users] Repeateble URLs - REST?

2019-02-25 Thread sergio ruiz
Gotcha..

So, in Seaside, should how should I handle the routes? with Seaside REST?

On February 25, 2019 at 2:56:49 PM, S Krish (
krishnamachari.sudha...@gmail.com) wrote:

https://restfulapi.net/resource-naming/

https://docs.microsoft.com/en-us/azure/architecture/best-practices/api-design

Given the conflicting advices on REST, you can try and adhere to one-two
sources of advice.


peace,
sergio
photographer, journalist, visionary

Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101


Re: [Pharo-users] Repeateble URLs - REST?

2019-02-25 Thread S Krish
This is fine:
www.bagelconcertfinder.com/zipcodes/{zipCode}

Preferred is :
*https://..siteName.../boundedContext/resourceInPlural/{resourceId}*

So this can be as you state but without _ underscores and "concertBlogging"
is identified bounded context for a set of resources
https://siteName../*concertBlogging*/blogs/{blogId}

Plurals are recommended. Lots of Style conformance is recommended, stick to
REST and not use actions/ verbs in urls et als..
You can break many of the so called rules and still it will work fine for
you, but its up to you, to decide what you adhere to and what you define
for yourself

https://restfulapi.net/resource-naming/

https://docs.microsoft.com/en-us/azure/architecture/best-practices/api-design

Given the conflicting advices on REST, you can try and adhere to one-two
sources of advice.




On Mon, Feb 25, 2019 at 12:13 PM sergio ruiz  wrote:

> Hi, all..
>
> I am looking to have a repeatable url so users can save them and share
> them.. something like:
>
> www.bagelconcertfinder.com/zipcode/44805
>
> and in my next project, I’ll be doing something like a CMS where you would
> get:
>
> /blog_entries/this-is-the-path
>
> I am thinking of using REST to flesh out the paths..
>
> does this seem reasonable?
>
> 
> peace,
> sergio
> photographer, journalist, visionary
>
> Public Key: http://bit.ly/29z9fG0
> #BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
> http://www.codeandmusic.com
> http://www.twitter.com/sergio_101
> http://www.facebook.com/sergio101
>


[Pharo-users] Repeateble URLs - REST?

2019-02-25 Thread sergio ruiz
Hi, all..

I am looking to have a repeatable url so users can save them and share
them.. something like:

www.bagelconcertfinder.com/zipcode/44805

and in my next project, I’ll be doing something like a CMS where you would
get:

/blog_entries/this-is-the-path

I am thinking of using REST to flesh out the paths..

does this seem reasonable?


peace,
sergio
photographer, journalist, visionary

Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101


Re: [Pharo-users] Can't addChild:

2019-02-25 Thread Tudor Girba
Hi,

addChild: expects a BlElement not a canvas. A BlElement draws on a canvas 
object that is passed to it.

SpartaCanvas is an abstract class. If you want to instantiate a canvas, pick 
one of the subclasses.

For example, for MozCanvas, see MozExamples.

Cheers,
Tudor



> On Feb 25, 2019, at 4:55 PM, David Richards  
> wrote:
> 
> | canvas space node text |
> 
> . BlUniverse reset
> 
> . space := BlSpace new
> . space show
> . space title: 'Test Space'
> . space extent: 800@400
> . space root background: Color lightBlue 
> . space position: 1@25
>  
> . canvas := BlSpartaMozCanvasBuilder extent: 400@250
> 
> . space root addChild: canvas
> 
> This fails.
> 
> Any ideas how to create a Sparta Canvas, to draw some text on?
> 
> 

--
www.feenk.com

"There are no old things, there are only old ways of looking at them."








Re: [Pharo-users] What does the Package and Sub-Package comment do?

2019-02-25 Thread Denis Kudriashov
Hi Tim.

Behaviour is similar to Pharo 6. When class is selected the comment belongs
to the class. If not then it belongs to the package.
There is no such thing as a tag comment.

I thought the default comment text is clear enough to avoid confusion. But
probably it's not as you wrote this mail.
So it is a room for improvements.

Package comment is managed as a comment of ts manifest class. When you
first time add it the manifest class is created.





25 февр. 2019 г. 15:09 пользователь "Tim Mackinnon" 
написал:

Anyone have any thoughts on this? Not sure whether to report a bug or not.



> On 22 Feb 2019, at 14:48, Tim Mackinnon  wrote:
>
> Hi - I notice that you can sort of put comments on packages - but I’m not
sure if this is working or if its supposed to work?
>
> When I type something it seems to create and extra Manifest tag, and then
the comment that I type seems to be the same for the package and all of its
sub tags?
>
> Is this a work in progress? Should Calypso even show a comment for the
tags (or is it read only for them - as its the parent).
>
> I’m just not clear on what it does, and whether I can programmatically
add stuff to it or not? (I was thinking for exercism to store exercise
information there - but maybe I will stick to the test class comment)
>
> Tim


Re: [Pharo-users] Windows 64bit, long filename issue but after a second load, how to categorise and report this?

2019-02-25 Thread Tim Mackinnon
I’ve created - https://github.com/pharo-vcs/iceberg/issues/1204

> On 25 Feb 2019, at 17:12, Tim Mackinnon  wrote:
> 
> Just to add some additional notes on this (and I will also file an issue, as 
> I don’t think one has been submitted, and I don’t think this is fully down to 
> file path length alone) -
> 
> After some more testing, we have also seen the error on Windows 32bit as well 
> (so while easier to get in 64bit, it does occur in 32bit like others have 
> reported).
> 
> My real concern however, is that a simple project (which admittedly pulls in 
> a single Filetree prerequisite - PharoWebBrowser) seems to trigger this error 
> - but confusingly references files that don’t appear to be in the image. 
> Tracing through PharoWebBrowser - there are some file tree based pre-reques 
> and some that are mcz - and none of them have files like: 
> testRaiseUnexpectedMessageWhenTooMuchMessages.st
> 
> And this method is not in the image that gets loaded into OSX.  So I am 
> wondering where these long files are coming from?
> 
> So yes, while there is a long filename issue - is there another hidden issue 
> underneath all of this where files we aren’t even using are getting reference 
> somehow?
> 
> Tim
> 
>> On 22 Feb 2019, at 00:01, Tim Mackinnon  wrote:
>> 
>> Some interesting thoughts below - but my understanding is these images are 
>> being created by Pharo Launcher , so they should be isolated from one 
>> another?
>> 
>> I also don’t understand why you can load with 32bit (multiple images) but 
>> only once with 64bit. Do we load radically different git code with longer 
>> paths on 64bit? (Strange isn’t it?)
>> 
>> Possibly worth caveating this is with 2-3 users so far, and only noticed 
>> this pattern with the last one.
>> 
>> Also - has anyone created an issue for these path problems - I’m curious if 
>> my results match anything else.
>> 
>> Tim 
>> 
>> Sent from my iPhone
>> 
>>> On 21 Feb 2019, at 16:01, Henrik Sperre Johansen 
>>>  wrote:
>>> 
>>> Tim Mackinnon wrote
 Hi Ben - while I understand the description below - why would it work the
 first time (no errors) and then fail the second time in a fresh image? Are
 we really sure its just down to non-determinism of the load process
 (possibly - but it seems very suspicious to me). There is something more
 fishy about windows going on I suspect…
>>> 
>>> The Iceberg cache path is relative to the image folder, so it's at least
>>> possible to have success in one image, located in C:\Pharo\testImage\, while
>>> another image, reciding in something like
>>> C:\Users\sam\Documents\Pharo\images\exercism-test-run-7.0-32\ , fails to
>>> load the exact same filetree package...
>>> 
>>> 
>>> Tim Mackinnon wrote
 I will track down the Exercism dependencies to see if any of them are
 FileTree - having said that, on OSX (where it loads cleanly - I would
 expect to be able to find one of those methods in my image - but again I
 can’t? They look like valid methods - but why aren’t they in my image? Its
 like the load process is downloading other stuff on its own and then not
 loading that into the image?
>>> 
>>> Yeaaah, that sounds fishy.
>>> But at least the first method sounds like a test, which may be part of the
>>> packages in the git repo that gets cloned without being loaded by Metacello,
>>> if the Metacello dependency specifies a *Core group which does not include
>>> tests.
>>> 
>>> 
>>> Tim Mackinnon wrote
 I’m just worried that we keep blaming windows (and yes its dumb having a
 file length restriction I this day and age) - but maybe we are missing
 another problem too?
 
 Tim
>>> 
>>> To be pendantic, (and not of much actual help, sorry :/ ) the problem isn't
>>> really with Windows, which provides API's for getting file info that handle
>>> long paths just fine, but with libgit, which is probably compiled against
>>> some POSIX stat implementation provided by Cygwin/mingw, which does not.
>>> 
>>> Cheers,
>>> Henry 
>>> 
>>> 
>>> 
>>> --
>>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>>> 
>> 
>> 
> 
> 




Re: [Pharo-users] Windows 64bit, long filename issue but after a second load, how to categorise and report this?

2019-02-25 Thread Tim Mackinnon
Just to add some additional notes on this (and I will also file an issue, as I 
don’t think one has been submitted, and I don’t think this is fully down to 
file path length alone) -

After some more testing, we have also seen the error on Windows 32bit as well 
(so while easier to get in 64bit, it does occur in 32bit like others have 
reported).

My real concern however, is that a simple project (which admittedly pulls in a 
single Filetree prerequisite - PharoWebBrowser) seems to trigger this error - 
but confusingly references files that don’t appear to be in the image. Tracing 
through PharoWebBrowser - there are some file tree based pre-reques and some 
that are mcz - and none of them have files like: 
testRaiseUnexpectedMessageWhenTooMuchMessages.st

And this method is not in the image that gets loaded into OSX.  So I am 
wondering where these long files are coming from?

So yes, while there is a long filename issue - is there another hidden issue 
underneath all of this where files we aren’t even using are getting reference 
somehow?

Tim

> On 22 Feb 2019, at 00:01, Tim Mackinnon  wrote:
> 
> Some interesting thoughts below - but my understanding is these images are 
> being created by Pharo Launcher , so they should be isolated from one another?
> 
> I also don’t understand why you can load with 32bit (multiple images) but 
> only once with 64bit. Do we load radically different git code with longer 
> paths on 64bit? (Strange isn’t it?)
> 
> Possibly worth caveating this is with 2-3 users so far, and only noticed this 
> pattern with the last one.
> 
> Also - has anyone created an issue for these path problems - I’m curious if 
> my results match anything else.
> 
> Tim 
> 
> Sent from my iPhone
> 
>> On 21 Feb 2019, at 16:01, Henrik Sperre Johansen 
>>  wrote:
>> 
>> Tim Mackinnon wrote
>>> Hi Ben - while I understand the description below - why would it work the
>>> first time (no errors) and then fail the second time in a fresh image? Are
>>> we really sure its just down to non-determinism of the load process
>>> (possibly - but it seems very suspicious to me). There is something more
>>> fishy about windows going on I suspect…
>> 
>> The Iceberg cache path is relative to the image folder, so it's at least
>> possible to have success in one image, located in C:\Pharo\testImage\, while
>> another image, reciding in something like
>> C:\Users\sam\Documents\Pharo\images\exercism-test-run-7.0-32\ , fails to
>> load the exact same filetree package...
>> 
>> 
>> Tim Mackinnon wrote
>>> I will track down the Exercism dependencies to see if any of them are
>>> FileTree - having said that, on OSX (where it loads cleanly - I would
>>> expect to be able to find one of those methods in my image - but again I
>>> can’t? They look like valid methods - but why aren’t they in my image? Its
>>> like the load process is downloading other stuff on its own and then not
>>> loading that into the image?
>> 
>> Yeaaah, that sounds fishy.
>> But at least the first method sounds like a test, which may be part of the
>> packages in the git repo that gets cloned without being loaded by Metacello,
>> if the Metacello dependency specifies a *Core group which does not include
>> tests.
>> 
>> 
>> Tim Mackinnon wrote
>>> I’m just worried that we keep blaming windows (and yes its dumb having a
>>> file length restriction I this day and age) - but maybe we are missing
>>> another problem too?
>>> 
>>> Tim
>> 
>> To be pendantic, (and not of much actual help, sorry :/ ) the problem isn't
>> really with Windows, which provides API's for getting file info that handle
>> long paths just fine, but with libgit, which is probably compiled against
>> some POSIX stat implementation provided by Cygwin/mingw, which does not.
>> 
>> Cheers,
>> Henry 
>> 
>> 
>> 
>> --
>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>> 
> 
> 




[Pharo-users] How can I the best filter out data and make a collection of paintings

2019-02-25 Thread Roelof Wobben

  
  
Hello, 

I have ask this before on the discord channels but I cannot find
there the solutions anymore.

I try to make a website that displays the paintings of the
Rijksmuseaum in Amsterdam.
That provides a json response

So I do : 

| json paintingCollection |

json := (NeoJSONReader fromString: (ZnEasy get:
'https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True')
contents) at: #artObjects.

so I still have this json : 

{
  "links": {
"self": "https://www.rijksmuseum.nl/api/nl/collection/SK-C-5",
"web": "https://www.rijksmuseum.nl/nl/collection/SK-C-5"
  },
  "id": "nl-SK-C-5",
  "objectNumber": "SK-C-5",
  "title": "Schutters van wijk II onder leiding van kapitein Frans Banninck Cocq, bekend als de ‘Nachtwacht’",
  "hasImage": true,
  "principalOrFirstMaker": "Rembrandt Harmensz. van Rijn",
  "longTitle": "Schutters van wijk II onder leiding van kapitein Frans Banninck Cocq, bekend als de ‘Nachtwacht’, Rembrandt Harmensz. van Rijn, 1642",
  "showImage": true,
  "permitDownload": true,
  "webImage": {
"guid": "92253da1-794d-49f4-9e3c-e4c160715f53",
"offsetPercentageX": 50,
"offsetPercentageY": 100,
"width": 2500,
"height": 2034,
"url": "http://lh6.ggpht.com/wwx2vAS9DzFmmyeZefPjMtmCNOdjD80gvkXJcylloy40SiZOhdLHVddEZLBHtymHu53TcvqJLYZfZF7M-uvoMmG_wSI=s0"
  },
  "headerImage": {
"guid": "29a2a516-f1d2-4713-9cbd-7a4458026057",
"offsetPercentageX": 50,
"offsetPercentageY": 50,
"width": 1920,
"height": 460,
"url": "http://lh5.ggpht.com/SgH3Qo-vYI8GGm7-b-Qt6lXgsCAIoU2VDRwO5LYSBVNhhbZCetcvc88ZPi518MTy0MHDrna4X4ZC1ymxVJVpzps8gqw=s0"
  },
  "productionPlaces": []
},

but then as a object 

now I wonder how I can change the code with I think a object named Painting thatI onky want to use these
fields :  objectNumber, principalOrFirstMaker and webImage/url 
so that I have a collection of paintings with only these things

Roelof
 
- 

  




Re: [Pharo-users] JSON keys not quoted?

2019-02-25 Thread Sven Van Caekenberghe



> On 23 Feb 2019, at 03:53, Ben Coman  wrote:
> 
> Just curiousity... Is an idempotent round trip required/expected ?

Not necessarily, but symmetry is important and a lack of symmetry is often a 
possible indication of trouble.

Anyway, since the standard is crystal clear that JSON keys/names in objects 
must be strings, I am enforcing that now. It is not OK to silently generate 
illegal JSON.

https://github.com/svenvc/NeoJSON/commit/c368bbf475f60d564cd3fb708e99b92efea8ffd3

(And I made the same change to STON in JSON mode)

> cheers -ben
> 
> On Sat, 23 Feb 2019 at 05:24, Sven Van Caekenberghe  wrote:
> Good catch.
> 
> Indeed, JSON keys have to be strings.
> 
> The question is, should the writer convert them for you, or should you simply 
> not use them ?
> 
> I mean, there are many Pharo constructs that cannot be converted to JSON.
> 
> Some could be output to JSON, but you won't be able to read them back in.
> 
> So, if conversion would happen, the dictionary with integer keys will be read 
> back with strings keys.
> 
> In STON, keys can be anything, even complex objects, like in Pharo itself.
> 
> What will you do with { (1@2)->100 } asDictionary in JSON ?
> 
> I have to think about this.
> 
> > On 22 Feb 2019, at 21:21, Esteban Maringolo  wrote:
> > 
> > If you convert a Dictionary with numbers as keys it will produce not
> > valid JSON [1], since all object keys must be quoted.
> > 
> > E.g.
> > NeoJSONWriter toString: (Dictionary with: 1->'foo').
> > or
> > (Dictionary with: 1->'foo') asJson
> > 
> > Should the library generate quoted keys?
> > 
> > Seaside's WAJsonCanvas is manual, so it is up to the developer to
> > render the object properly, but NeoJSON does it automatically.
> > 
> > In Javascript this will throw a syntax error:
> >> JSON.parse('{1: "foo"}')
> > 
> > And this would generate a quoted key when serialized:
> >> JSON.stringify({1: "foo"})
> >> {"1": "foo"}
> > 
> > So my question is: should the library quote whatever you put as key in
> > order to produce valid JSON syntax? [2]
> > 
> > Regards.
> > 
> > [1] https://jsonlint.com/
> > [2] https://www.ecma-international.org/publications/standards/Ecma-404.htm
> > 
> > Esteban A. Maringolo
> > 
> 
> 




[Pharo-users] Can't addChild:

2019-02-25 Thread David Richards
| canvas space node text |

. BlUniverse reset

. space := BlSpace new
. space show
. space title: 'Test Space'
. space extent: 800@400
. space root background: Color lightBlue
. space position: 1@25

. canvas := BlSpartaMozCanvasBuilder extent: 400@250

. space root addChild: canvas

This fails.

Any ideas how to create a Sparta Canvas, to draw some text on?


Re: [Pharo-users] What does the Package and Sub-Package comment do?

2019-02-25 Thread Tim Mackinnon
Anyone have any thoughts on this? Not sure whether to report a bug or not.


> On 22 Feb 2019, at 14:48, Tim Mackinnon  wrote:
> 
> Hi - I notice that you can sort of put comments on packages - but I’m not 
> sure if this is working or if its supposed to work?
> 
> When I type something it seems to create and extra Manifest tag, and then the 
> comment that I type seems to be the same for the package and all of its sub 
> tags?
> 
> Is this a work in progress? Should Calypso even show a comment for the tags 
> (or is it read only for them - as its the parent).
> 
> I’m just not clear on what it does, and whether I can programmatically add 
> stuff to it or not? (I was thinking for exercism to store exercise 
> information there - but maybe I will stick to the test class comment)
> 
> Tim




Re: [Pharo-users] Pharo Launcher update installation issues

2019-02-25 Thread Christophe Demarey
Hi,

> Le 24 févr. 2019 à 06:33, Sanjay Minni  a écrit :
> 
> Hi,
> 
> I am trying to install Pharo Launcher 1.6 (.msi) in Windows 10
> it says "a more ecent version is already installed" and does not proceed
> but the version installed is 1.5.1
> 
> also 
> in 1.5.1 the left panel shows in the Distributions list 7.0 as "Development
> version" - should it not change to « Stable"

There was an issue : https://github.com/pharo-project/pharo-launcher/issues/310
If you download latest launcher version, it should be fixed. 
http://pharo.org/download

Regards,
Christophe


[Pharo-users] instantiate Sparta canvas?

2019-02-25 Thread David Richards
canvas := SpartaCanvas extent: 400@250

This fails even though the documentation says:

''I am an abstract class and should not be instantiated. However, the best
way to create an instance of sparta canvas is to send extent: message.''

!! Example:

Create an empty canvas of size 400@250:
[[[language=smalltalk
canvas := SpartaCanvas extent: 400@250.
]]]


So, how do instantiate and display a Sparta canvas?

Where can I find good documentation about Sparta?

Thanks.

David


Re: [Pharo-users] Why is #findString: in accessing?

2019-02-25 Thread Tim Mackinnon
Hi Sven, thanks for kicking in - yes I do resort to that Finder (and I keep 
meaning to learn how to port that example search to spotter somehow) - however 
it only works for non-keyword selectors… (another one to investigate to see if 
it could potentially let you specify a parameter for its search).

I still wonder however if a category for ‘searching’ might be way more 
approachable - as accessing is far to broad on collection classes?

Tim

> On 25 Feb 2019, at 11:40, Sven Van Caekenberghe  wrote:
> 
> Tim,
> 
> It always takes effort to learn a new language/environment/library. You can't 
> expect it to be the same to what you know, or for things to be where you 
> expect them.
> 
> String is also one of the most overloaded classes in the system, it will 
> never be clean.
> 
> Lots of things fall under 'accessing', that finding something is classified 
> as such, does not really surprise me.
> 
> Did you know about the Finder 'by example search' ? Here is how to find your 
> selector:
> 
> 
> 
> HTH,
> 
> Sven
> 
>> On 25 Feb 2019, at 12:19, Tim Mackinnon > > wrote:
>> 
>> I always struggle (even after years of casually using smalltalk) to find the 
>> String methods that do the heavy lifting (and are comparable to other 
>> languages). The methods are normally there, but they often have names that 
>> don’t compare well with other languages.
>> 
>> I think that what doesn’t help is the categorisation of methods in String - 
>> for example - if I want to do some searching in a String - why is 
>> #findString: in ‘accessing’ - I totally didn’t think to look in there. To be 
>> honest, I really wanted a protocol called ‘searching’ - but its not there? 
>> 
>> I find the protocols in the system to be pretty bad in all honesty. Its a 
>> good idea, but I don’t think its clear on whether its protocol, or category. 
>> And if the former - where are the tools to help ensure things conform to a 
>> protocol? If the latter - where are the useful, commonly used categories?
>> 
>> Are there any plans to do anything in this area - or is it just a lump it 
>> scenario?
>> 
>> Tim
> 



[Pharo-users] Why is #findString: in accessing?

2019-02-25 Thread Tim Mackinnon
I always struggle (even after years of casually using smalltalk) to find the 
String methods that do the heavy lifting (and are comparable to other 
languages). The methods are normally there, but they often have names that 
don’t compare well with other languages.

I think that what doesn’t help is the categorisation of methods in String - for 
example - if I want to do some searching in a String - why is #findString: in 
‘accessing’ - I totally didn’t think to look in there. To be honest, I really 
wanted a protocol called ‘searching’ - but its not there? 

I find the protocols in the system to be pretty bad in all honesty. Its a good 
idea, but I don’t think its clear on whether its protocol, or category. And if 
the former - where are the tools to help ensure things conform to a protocol? 
If the latter - where are the useful, commonly used categories?

Are there any plans to do anything in this area - or is it just a lump it 
scenario?

Tim