Re: [Pharo-users] UI Frameworks

2019-03-12 Thread Konrad Hinsen
Bob Cowdery  writes:

> I also found Block and Brick which say they are next generation, Block 
> being for graphics and  Brick for widgets. These are not yet in Pharo 
> and again I couldn't find any info although there is a tutorial for 
> Block but not for Brick. Having forgotten most everything I knew I 
> didn't have much success trying to run the Brick examples.

The best existing illustration of what you can do with Bloc and Bric
is probably GToolkit: https://gtoolkit.com/. It also serves as a warning
that this is not ready for prime time yet. For example, the current
version crashes Pharo rather quickly if you use native windows. It isn't
a tutorial either, of course, but a huge reservoir of examples.

So an important consideration is your development time scale. If you
have a deadline for a usable product, better don't bet on Bloc and Bric
yet.

Konrad.



Re: [Pharo-users] Hmmm sending at:put: to an undefined object (nil) gives a confusing error message

2019-03-12 Thread K K Subbu

On 12/03/19 9:25 AM, Richard O'Keefe wrote:

Squeak where (20 factorial at: 1) answers 0 (oh dear oh dear oh
dear).


Richard,

Could you please elaborate on why this is an error?

Large integers are place value encoded (base 256 little endian) and 
stored in byte arrays, so they need #at:/#at:put: (as private methods). 
Place value encoding is not architecture-specific so it doesn't affect 
portability of an image.


Regards .. Subbu



[Pharo-users] PharoLauncher Baseline Templates

2019-03-12 Thread Ben Coman
Recently I was asked about moving personal projects between images to
keep up with latest Pharo 8 development version.  My suggestion was of
course creating a Baseline to load into each fresh Image.

This morning I was contemplating that further and what would be cool
is in PharoLauncher being able to right-click a template and have a
list of favourite Baselines I could install e.g. BaselineMyProject.
Perhaps even be able to define Baseline-Templates that auto-recreate
every time the Baseline version moves, so I don't have to wait for all
the dependencies to be pulled in.

This is just a a seed of an idea and I'm seeking feedback to flesh it out.
Could be a useful GSoC project?

cheers -ben



[Pharo-users] [ANN] CouchDB Client for Pharo

2019-03-12 Thread Esteban Maringolo
Hello all,

I finished polishing the repository a CouchDB client for Pharo that I
forked from an old, and seemingly abandoned, client for VisualWorks.

I took that code and refactored heavily to use Pharo and Zinc core classes,
and that included renaming the client classes, methods and the strategy
used to map objects to/from JSON.

It is available at:
https://github.com/eMaringolo/pharo-couchdb

I'm open to questions or suggestions about this or how to use it.

Disclaimer:
This is mostly experimental since I'm not using it in production and was
done as a means of exploration of CouchDB itself for a project I'm
prospecting.

There are a lot of features that could be added to the client, and things
that could be refactored further (such as the class side request methods),
but adding that is simple, and the current state provides almost feature
complete coverage.

Best regards,

Esteban A. Maringolo


Re: [Pharo-users] complex json parsing.

2019-03-12 Thread Ben Coman
On Wed, 13 Mar 2019 at 04:59, Roelof Wobben  wrote:

> Op 11-3-2019 om 00:03 schreef Ben Coman:
>
> getMoreData  "or a better name of your own"
> | url json artObjectJson |
> url := 'https://www.rijksmuseum.nl/api/nl/collection/' ,
> objectNumber , '?key=[API_KEY]&format=json'
> Transcript crShow: 'Getting description from ', url.
> json  := (NeoJSONReader fromString: (ZnEasy get: url) contents).
> artObjectJson := json at: 'artObject.
>  description := artObjectJson at: 'description'.
>  title := artObjectJson at: 'title'.
>
>
>
> hello Ben,
>
> I think I almost see what you mean but still one problem
>
> when doing this code :
>
>  collectionUrl :=  '
> https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True
> '.
> json := NeoJSONReader fromString: (ZnEasy get: collectionUrl) contents.
> paintings := Paintings fromJSON: json.
> paintings do: [:painting | painting getMoreData  ]
>
> here I see a error : instance of Paintings do not understand do:
>
> I think we have to get the directory named paintings out of the object,
>
>
> this seems to be working :
>
>  collectionUrl :=  '
> https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True
> '.
> json := NeoJSONReader fromString: (ZnEasy get: collectionUrl) contents.
> paintings := Paintings fromJSON: json.
> (paintings paintings)  do: [:painting | painting getMoreData  ]
>

You are right.  An alternative fix is...
Paintings >> do: aBlock
 ^ paintings do: aBlock

cheers -ben


Re: [Pharo-users] complex json parsing.

2019-03-12 Thread Ben Coman
On Wed, 13 Mar 2019 at 02:10, Roelof Wobben  wrote:

> Op 12-3-2019 om 18:46 schreef Ben Coman:
>
> Then in Playground do...
> collectionUrl :=  '
> https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True
> '.
> json := NeoJSONReader fromString: (ZnEasy get: collectionUrl) contents.
> paintings := Paintings fromJSON: json.
> paintings inspect.
>
> and then debug trace through that whole thing.
> Is that what you were trying to do?  Or have I got the wrong end of the
> stick?
>
> cheers -ben
>
>
> There is a one to one relationship between the objectNumber and a Painting
>
> I do not use the imageUrl found on this url because it's to big .
>

okay. So I presume you want "artObject/webImage/url" ?
{
  "artObject": {
"webImage": {
  "url": "
http://lh6.ggpht.com/wwx2vAS9DzFmmyeZefPjMtmCNOdjD80gvkXJcylloy40SiZOhdLHVddEZLBHtymHu53TcvqJLYZfZF7M-uvoMmG_wSI=s0
"



>
> So what I try now is first put all the objectNumber in a collection
> and use that collection on a second url to fetch a image of the right size
>

Okay. I understand, but I am *still* coaching you to *not* do that.
Rather than gathering a collection of dumb numbers and then creating new
Painting objects from those,
(which is awkward for joining the new data with the previous data)
work with the Painting objects you already have.
Add a new instance variables "webImageUrl" and "webImage"

Then either
Painting >> getMoreData
 |entity|
  ...
  webImageUrl := (artObjectJson at: 'webImage') at: 'url'.
  entity :=  (ZnEasy get: webImageUrl) entity.
  webImage := ImageReadWriter formFromStream: entity readStream.

which may lock the UI for a moment downloading them all,
or download lazily (slight variation on my previous imageEntity which
doubles up on storage)...

Painting >> getMoreData
   ...
   webImageUrl := (artObjectJson at: 'webImage') at: 'url'.


Painting >> webImage
|entity|
webImageUrl ifNil: [^nil].
webImage ifNil: [
  entity :=  (ZnEasy get: webImageUrl) entity.
  webImage := ImageReadWriter
formFromStream: entity readStream].
   ^ webImage

Painting >> gtInspectorJpegIn: composite

composite morph
title: 'Painting';
display: [ self webImage ]


> I hope im clear what I try to do in this step
>

yes it is.  Please take my coaching and kill your collection of numbers.
Keeping them keeps you stuck in old ways of thinking. So just kill it :)
Once you've done that, alternatives will open up for you
and you'll be on the path to a new way of thinking about programming. :) :)


> so numbers should be a collection of objectNumbers
>

no.


> and paintings a collection of painting with the info I need
>

yes, and objectNumber is part of the info of a painting.


>
> so to recap
>
> this one must give me a collection of objectNumbers : '
> https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True
> '.
>

no. it gives you a collection of paintings, of which objectNumber is one
attribute.



>
> and the objectNumbers I can use for this url :
>
> https://www.rijksmuseum.nl/api/nl/collection/ objectNumber/tiles?key=14OGzuak&format=json
>
> and I do not store the objectNumber in Paintings because I do not use it to 
> display it in a seaside project.
>
>
Regardless of whether you display it or not, objectNumber is supplied by
the server "as an attribute belonging to painting"
so store it inside your Painting objects.

Then rather than Seaside asking a collection of dumb numbers for each JPEG
to display
it asks a collection of smart Painting objects for their JPEG to display
(since they know their own objectNumber, they can get the JPEG themselves).

cheers -ben




On Wed, 13 Mar 2019 at 02:10, Roelof Wobben  wrote:

> Op 12-3-2019 om 18:46 schreef Ben Coman:
>
> On Wed, 13 Mar 2019 at 00:43, Roelof Wobben  wrote:
> > I did try to make this idea work but now im complete lost.
> >
> > Right now the collection that should contain the objectNumbers is total
> empty
> > anyone who can see where I went wrong.
> >
> > I included my code so far.
>
>
> A few things...
> !Paintings class methodsFor: 'instance creation' stamp: 'RoelofWobben
> 3/12/2019 17:26'!
> getImagesDataFromJSON: json
> | instance |
> instance := Painting new.
> (json at: #values)
> do: [ :artObjectJson |
> | painting |
> painting := Painting new.
> painting imageUrl: (json at: #name).
> instance addPainting: painting ].
> ^ instance! !
>
> You are adding a painting to a painting, which semantically makes no sense.
> i.e. where #addPainting: is sent to "instance" , that is holding a
> Painting.
>
> I would not expect your Painting class to have a method addPainting:
> Paintings should have that method.
>
> btw, Stop using "instance" as a variable name.
> Its as bad as variables named "a", "i", "t", "z" - it provides no semantic
> context.
>

Re: [Pharo-users] Hmmm sending at:put: to an undefined object (nil) gives a confusing error message

2019-03-12 Thread Richard O'Keefe
Putting public methods in Object that it cannot honestly support makes
#respondsTo: pretty unreliable.  It is an obsolete practice, because
having Traits means that those methods can be mixed in with (part of)
a single line.

On Wed, 13 Mar 2019 at 03:20, Ben Coman  wrote:

> On Tue, 12 Mar 2019 at 21:56, Marcus Denker 
> wrote:
> >
> > Hi,
> >
> > Yes, I do not like it… I think it is there so that you can just make a
> variable subclass and at: / at:put: will work without
> > having to re-implement them…
>
> So we should consider...
> * how often are variable subclasses created ?  by novices or experts ?
> * how much work is it to reimplement those methods ? how difficult to
> know what needs to be done ?
> * what is the balance
>
> cheers -ben
>
>
> >
> > Marcus
> >
> > On 12 Mar 2019, at 04:55, Richard O'Keefe  wrote:
> >
> > I understand #basicAt:[put:] being in Object, but I never understood
> #at:[put:] being there.
> > GNU Smalltalk:
> > st> nil at: 1
> > Object: nil error: Invalid value nil: object not indexable
> > In my Smalltalk, you get a DNU.
> > In Squeak you get a debugger window with title
> > Error: instances of UndefinedObject are not indexable
> > The same for Boolean, Character, and Integer,
> > except Squeak where (20 factorial at: 1) answers 0 (oh dear oh dear oh
> dear).
> > In VW you get a "Subscript out of bounds" error, which is disappointing,
> > as do true and $a, but a LargePositiveinteger gets #shouldNotImplement.
> >
> >
> > On Tue, 12 Mar 2019 at 15:28, Tim Mackinnon  wrote:
> >>
> >> If you forget to initialise a variable which you thought was a
> Dictionary - you get a confusing error message: "Error: only integers
> should be used as indices” if you try an at:put:
> >>
> >> This is a consequence of having at:put: defined on Object (which is a
> bit nasty)
> >>
> >> Should UndefinedObject at least override this and signal something a
> bit more obvious? This is a common and easily done thing and we don't
> support it very well.
> >>
> >> I just did it in some code, and was scratching my head initially until
> I read the stack properly and realised it was something much simpler than I
> thought I had done.
> >>
> >> Any thoughts on this?
> >
> >
>
>


Re: [Pharo-users] complex json parsing.

2019-03-12 Thread Roelof Wobben

  
  
Op 11-3-2019 om 00:03 schreef Ben
  Coman:


  getMoreData  "or a better name of your own"
              | url json artObjectJson | 
              url := 'https://www.rijksmuseum.nl/api/nl/collection/'
, objectNumber , '?key=[API_KEY]&format=json'
  Transcript crShow: 'Getting description from ', url.
  
json  := (NeoJSONReader fromString: (ZnEasy get: url) contents).
   artObjectJson := json at: 'artObject.
               description := artObjectJson at:
'description'.
               title := artObjectJson at: 'title'.



hello Ben, 

I think I almost see what you mean but still one problem 

when doing this code : 

 collectionUrl := 
'https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True'.
    json := NeoJSONReader fromString: (ZnEasy get: collectionUrl)
contents.
    paintings := Paintings fromJSON: json.
    paintings do: [:painting | painting getMoreData  ]

here I see a error : instance of Paintings do not understand do: 

I think we have to get the directory named paintings out of the
object, 


this seems to be working : 

 collectionUrl := 
'https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True'.
    json := NeoJSONReader fromString: (ZnEasy get: collectionUrl)
contents.
    paintings := Paintings fromJSON: json.
    (paintings paintings)  do: [:painting | painting getMoreData  ]

Roelof

  




[Pharo-users] TelePharo in Tonel

2019-03-12 Thread Torsten Bergmann
Hi Denis,

would it be possible to convert TelePharo to Tonel? 

   https://github.com/pharo-ide/TelePharo

Currently one gets load problem on Windows due to long file names and Tonel 
would 
solve that.

Thanks
T.



Re: [Pharo-users] doWithIndex: or withIndexDo: ?

2019-03-12 Thread Richard O'Keefe
Neither.  No two ways about it.  #keysAndValuesDo:
However,
  seq with: seq keys do: aBlock
and
  seq withIndexDo: aBlock
do the same thing, so #withIndexDo: makes some sense.

This is not my opinion alone.  I'm typing this on a machine
that has Squeak but not Pharo.  In Squeak we find

doWithIndex: elementAndIndexBlock
"Use the new version with consistent naming"
^ self withIndexDo: elementAndIndexBlock

"New" means since 1997.

On Wed, 13 Mar 2019 at 04:27, Oleksandr Zaytsev 
wrote:

> Hello,
>
> I am working on a new collection and this question caught my interest.
> Between doWithIndex: or withIndexDo:, which do you find more logical and
> why?
>
> Oleks
>


Re: [Pharo-users] complex json parsing.

2019-03-12 Thread Roelof Wobben

  
  
Op 12-3-2019 om 18:46 schreef Ben
  Coman:


  
  

  

  

  
On Wed, 13 Mar 2019 at 00:43, Roelof
  Wobben 
  wrote:
  > I did try to make this idea work but now im
  complete lost.
  >
  > Right now the collection that should contain
  the objectNumbers is total empty
  > anyone who can see where I went wrong.
  >
  > I included my code so far.
  
  
  
  A few things...
  
!Paintings class methodsFor: 'instance
  creation' stamp: 'RoelofWobben 3/12/2019
  17:26'!
getImagesDataFromJSON: json
	|
  instance |
	instance
  := Painting new.
	(json
  at: #values)
		do:
  [ :artObjectJson | 
			|
  painting |
			painting
  := Painting new.
			painting
  imageUrl: (json at: #name).
			instance
  addPainting: painting ].
	^
  instance! !
  
  
  
  You are adding a painting to a painting,
which semantically makes no sense.
  i.e. where #addPainting: is sent to
"instance" , that is holding a Painting.
  
  
  I would not expect your Painting class to
have a method addPainting:
Paintings should have that method.
  
  
  btw, Stop using "instance" as a variable
name.  
  Its as bad as variables named "a", "i", "t",
"z" - it provides no semantic context.
  
  
  
  Object subclass: #Paintings
  
  
	instanceVariableNames:
  'paintings numbers'
  
  
  
  
Paintings class
	instanceVariableNames:
  'numbers paintings'!
  
  
  
  You've defined these variables on both the
instance-side and class-side.
  I'll hazard a guess that you should delete
the class-side definition. 
  
  
  --
  
  
  TBApplicationRootComponent initialize!Object
subclass: #Painting
  
  
	instanceVariableNames:
  'imageUrl'
  
  
  
  Why are you *not* storing objectNumber inside
each Painting?
  
What is the relationship between paintings
  and objectNumbers?
Is it one-to-many or one-to-one?


---
  
  
!Paintings methodsFor: 'instance creation'
  stamp: 'RoelofWobben 3/11/2019 08:05'!
initialize
	super
  initialize.
	numbers
  := OrderedCollection new! !
  
  
  
  Why do you *not* initialize variable
"paintings" to "OrderedCollection new" ?
  Aren't you dealing with a collection of
paintings?
  
  
  
  There is lots more confusing me here, so

Re: [Pharo-users] complex json parsing.

2019-03-12 Thread Ben Coman
On Wed, 13 Mar 2019 at 00:43, Roelof Wobben  wrote:
> I did try to make this idea work but now im complete lost.
>
> Right now the collection that should contain the objectNumbers is total
empty
> anyone who can see where I went wrong.
>
> I included my code so far.


A few things...
!Paintings class methodsFor: 'instance creation' stamp: 'RoelofWobben
3/12/2019 17:26'!
getImagesDataFromJSON: json
| instance |
instance := Painting new.
(json at: #values)
do: [ :artObjectJson |
| painting |
painting := Painting new.
painting imageUrl: (json at: #name).
instance addPainting: painting ].
^ instance! !

You are adding a painting to a painting, which semantically makes no sense.
i.e. where #addPainting: is sent to "instance" , that is holding a Painting.

I would not expect your Painting class to have a method addPainting:
Paintings should have that method.

btw, Stop using "instance" as a variable name.
Its as bad as variables named "a", "i", "t", "z" - it provides no semantic
context.


Object subclass: #Paintings
instanceVariableNames: 'paintings numbers'

Paintings class
instanceVariableNames: 'numbers paintings'!

You've defined these variables on both the instance-side and class-side.
I'll hazard a guess that you should delete the class-side definition.

--

TBApplicationRootComponent initialize!Object subclass: #Painting
instanceVariableNames: 'imageUrl'

Why are you *not* storing objectNumber inside each Painting?
What is the relationship between paintings and objectNumbers?
Is it one-to-many or one-to-one?

---
!Paintings methodsFor: 'instance creation' stamp: 'RoelofWobben 3/11/2019
08:05'!
initialize
super initialize.
numbers := OrderedCollection new! !

Why do you *not* initialize variable "paintings" to "OrderedCollection new"
?
Aren't you dealing with a collection of paintings?


There is lots more confusing me here, so before going further,
in a fresh new image, can you load NeoJSON and the attached fileout.

Then in Playground do...
collectionUrl :=  '
https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True
'.
json := NeoJSONReader fromString: (ZnEasy get: collectionUrl) contents.
paintings := Paintings fromJSON: json.
paintings inspect.

and then debug trace through that whole thing.
Is that what you were trying to do?  Or have I got the wrong end of the
stick?

cheers -ben


Rijksmuseum.st
Description: Binary data


Re: [Pharo-users] Pharo 7.0 image size

2019-03-12 Thread Trussardi Dario Romano
Ciao,

About  Hilaire:

>   Beside the browser windows, did you close all Transcript windows?

Yes.

> Hi,
> 
> I am confused by what you are reporting.

I apologize, i'm trying to understand better.
> 
> If you add 10.000 entries to the Transcript, then I don't see how that 
> results in 1000s of those Strings being alive (and certainly not after a GC).
> 
> I tried the following (both with the Transcript window open and closed):
> 
> Transcript.
> Transcript open.
> Transcript clear.
> 
> 1 to: 1e4 do: [ :each | 
>  Transcript crShow: DateAndTime now asString , ' MARKTEST ' , each asString ].
> 
> 3 timesRepeat: [ Smalltalk garbageCollect ].
> 
> [ | count |
> count := 0.
> String allSubInstancesDo: [ :each | 
>  (each includesSubstring: 'MARKTEST') ifTrue: [ count := count + 1 ] ].
> count ] value.

I did some tests following the code you reported.

The thing I noticed is that  the image size after some entry,  from 
144MB is splashed at 272MB.

+10 MB at each step:

 1 to: 1e4 do: [ :each | 
Transcript crShow: DateAndTime now asString , ' 
MARKTEST ' , each asString ].

> 
> The count never went above 100. I am using Pharo 8 but 7 would be similar.
> 
> If you are retaining so many of the messages that you wrote to the 
> Transcript, then you must be doing something else.

I haven't been able to document it for now,

but I had the feeling that the following code creates problems:

testImageSizeCreateTranscriptEntryB
" Create some transcript entry "
  | count  |
 count := 0.
 [ 1 to: 1e4 do:[ :each |
[ Transcript crShow: DateAndTime now asString, ' DARIOTEST ', each 
asString.
1 / ( 0 to: 10 ) atRandom ]
 on: Error
 do:[ :ex | count := count +1.
ex retry ] ] ]value.
 ^ count

Could it be that the retry creates, has created problems?

Thanks,

Dario

> 
> That being said, we do have an issue with the WriteStream held by the stream 
> instance variable inside ThreadSafeTranscript. It is being reset from time to 
> time and when #clear is called, but that does not bring down the size of the 
> underlying collection below its 'one time peak'.
> 
> Sven
> 
>> On 8 Mar 2019, at 11:59, Trussardi Dario Romano  
>> wrote:
>> 
>> Ciao,
>> 
>>  this morning i started with an image of about 240 MB.
>> 
>>  I have 3 System Browser open ( for a long time ).
>> 
>>  I close all the System Browser and save the image.
>> 
>>  The image size after the save is about 131 MB.
>> 
>>  The new SpaceTally printSpaceAnalysis   report:
>> 
>>  Class code space# instances inst 
>> space percent   inst average size
>>  Array   4115561766  
>> 37353480   25.60   66.49
>>  ByteString  2942249761  
>> 31313136   21.50  125.37
>> 
>> 
>>  The Transcript entry reference basically does not change:
>> 
>>  ByteString allInstances select:[ :i |  i includesSubstring: 
>> 'NETWORK' ] 
>> 
>>  where 'NETWORK' is a string used in the methods to add 
>> Transcript entry  Transcript show: .. NETWORK' ..' .
>> 
>>  
>>  The system found 2958ByteString instances( 
>> relative to the NETWORK  ) 
>> 
>>  The system found22655   ByteString instances( 
>> relative to the CASH  ) 
>> 
>> 
>>  Why are there many references in the system to the ByteString 
>> instances, created in the methods to report the data in Transcript ?
>> 
>>  Someone to considerations ?
>> 
>>  Thanks,
>> 
>>  Dario
>> 
>>> Ciao,
>>> 
>>> I thought that using Transcript as a report to analyze the operation of 
>>> the code was a good thing - solution.
>>> 
>>> Unfortunately, however, the size of the image continues to increase  ( 
>>> and I think it's due to the use of the transcript )
>>> 
>>> and i can not find the solution to avoid the problem.
>>> 
>>> I could create a file to report everything about the operations code, 
>>> but then it becomes difficult to manage, or am i wrong?
>>> 
>>> Other solutions - indications - references ?
>>> 
>>> Thanks,
>>> 
>>> Dario
>>> 
 Ciao,
 
thanks.
 
i have a Pharo 7.0  alpha build 1262.
 
I development a Seaside application.
 
> May be you have a lot of still open Seaside session, which if I remember
> correctly are automatically shutdown after 10 min when not active.
> 
> Looking at Seaside session instances may give clue.

OK, i clear the seaside session with the relative seaside status 

[Pharo-users] UI Frameworks

2019-03-12 Thread Bob Cowdery

Hi,

What is the state of the various UI frameworks. I did play with Squeak 
many moons ago and used Morphic but I wanted something a bit higher up 
the food chain.


I see in Pharo, Spec seems to be the built in framework for widgets but 
I don't see any graphics capability in there.


There does seem to be a bunch of Graphics- classes but couldn't find any 
info on those.


I also found Block and Brick which say they are next generation, Block 
being for graphics and  Brick for widgets. These are not yet in Pharo 
and again I couldn't find any info although there is a tutorial for 
Block but not for Brick. Having forgotten most everything I knew I 
didn't have much success trying to run the Brick examples.


To build a reasonably complex UI today that requires both a good widget 
collection and decent drawing capability what would the best choice be.


Thanks

bob




Re: [Pharo-users] Smalltalk CI - anyone have any luck excluding tests?

2019-03-12 Thread Tim Mackinnon
FYI: Just bumping this - but on investigation it looks like the Pharo support 
for Tags breaks in Smalltalk CI - so top level packages with similar names 
(e.g. Exercism and ExercismWIP) all seem to get included by the include 
directive of ‘Exercism’ (with no wildcard).

This is in an issue: https://github.com/hpi-swa/smalltalkCI/issues/417

It does mean that many of you might be running more tests than you need to, and 
it might explain strange build failures if you are trying to use exclude.

At some point I will have a go at fixing this, if someone doesn’t beat me to it.

Tim

> On 6 Mar 2019, at 09:10, Tim Mackinnon  wrote:
> 
> As part of Exercism we have to show our language track can build and run 
> tests - and they use Travis - so, pretty awesome we have that tooling.
> 
> So it was pretty straightforward t hook in - and there are enough examples 
> around to support the docs for the .yml and .ston file - however I hit an 
> issue with the inclusion and exclusion of test files. I put an issue on 
> SmalltalkCI - but its sat there for 8days 
> (https://github.com/hpi-swa/smalltalkCI/issues/417 
> ) so I’m wondering if 
> anyone has experience with this?
> 
> Essentially if I include my other packages ‘ExercismDev’ and ‘ExercismTools’  
> (see sample below - I’ve removed them from the include list) then some of my 
> tests run twice (I believe because the exclude of #AllExercismTests doesn’t 
> work). I also have some environmental tests that need improving to run more 
> generically (Submit/Download) and again those don’t seem to be excluded.
> 
> It’s like “exclude" simply doesn’t work - but I would think this would be 
> reported more widely if this was the case. So maybe I don’t understand the 
> overlap of include/exclude etc. Anyone have any thoughts?
> 
> Tim
> SmalltalkCISpec {
>   #loading : [
> SCIMetacelloLoadSpec {
>   #baseline : 'Exercism',
>   #directory : 'dev/src',
>   #load : [ 'dev' ],
> 
>   #platforms : [ #pharo ]
> }
>   ],
> 
>   #testing : {
> #include : {
>   #packages : [ 'Exercism' ]
> },
> #exclude : {
>   #classes : [ #AllExercismTests, #ExercismTest, #ExercismSubmitTest, 
> #ExercismDownloadTest ],
>   #packages : [ 'ExercismWIP']
> }
>   }
> }
> 



Re: [Pharo-users] doWithIndex: or withIndexDo: ?

2019-03-12 Thread Tim Mackinnon
Yes - I like the prefix doXXX too, as I often think first of do: for normal 
iteration, with suffixed selectors for other variations.

> On 12 Mar 2019, at 16:54, Henrik Sperre Johansen 
>  wrote:
> 
> #doWithIndex: for me.
> 
> Both because it's the selector I'm used to from other dialects, and the
> parameter order [:element :index | ] makes more sense to me. 
> 
> Cheers,
> Henry
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
> 




Re: [Pharo-users] doWithIndex: or withIndexDo: ?

2019-03-12 Thread Henrik Sperre Johansen
#doWithIndex: for me.
 
Both because it's the selector I'm used to from other dialects, and the
parameter order [:element :index | ] makes more sense to me. 

Cheers,
Henry



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



Re: [Pharo-users] complex json parsing.

2019-03-12 Thread Roelof Wobben

  
  
Op 11-3-2019 om 00:03 schreef Ben
  Coman:


  
  

  

  
  
  
  
On Mon, 11 Mar 2019 at
  01:09, Roelof Wobben 
  wrote:


  
Op
  10-3-2019 om 17:45 schreef Ben Coman:


  

  




  On Sun,
10 Mar 2019 at 23:40, Roelof Wobben 
wrote:
  
  

  Op
10-3-2019 om 16:19 schreef Ben
Coman:
  
  

  

  

  

  

  

  
  
  
  
  
  
  
  
  
  
  
  
  
  On Sun, 10 Mar 2019 at 17:55, Roelof Wobben  wrote:
  
  
  
  I
  could do
  something like
  this : 
  
  getImages
      | json
  numbers json2 
  |
      json :=
  NeoJSONReader
         
  fromString:
             
  (ZnEasy
             
      get:
             
          'https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True')
             
      contents.
      numbers :=
  self class
  fromJSON: json
      numbers
  do: [each | 
  json := 
  . 
   imageData = self class ??? 
  
  
  

Re: [Pharo-users] doWithIndex: or withIndexDo: ?

2019-03-12 Thread Esteban Maringolo
I don't like either of those and use #keysAndValuesDo: as it is polymorphic
with other collection classes.

That said, I'd prefer #withIndexDo: [:each :index | ... ] because it
preserves the #with:do: structure.

e.g.
#($a $b $c) with: (1 2 3) do: [:char :number | ... ]

Regards,

Esteban A. Maringolo


El mar., 12 mar. 2019 a las 12:27, Oleksandr Zaytsev ()
escribió:

> Hello,
>
> I am working on a new collection and this question caught my interest.
> Between doWithIndex: or withIndexDo:, which do you find more logical and
> why?
>
> Oleks
>


[Pharo-users] doWithIndex: or withIndexDo: ?

2019-03-12 Thread Oleksandr Zaytsev
Hello,

I am working on a new collection and this question caught my interest.
Between doWithIndex: or withIndexDo:, which do you find more logical and
why?

Oleks


[Pharo-users] Pharo Days - anyone going on Wed night (3rd) and where are folks staying?

2019-03-12 Thread Tim Mackinnon
Hi everyone - I’ve managed to sort out a family pass to attend Pharo Days, so 
keen to maximise my fun/learning/involvement.

I was looking at trains on Wed afternoon - and leaving after lunch get me in 
Lille late afternoon - so I was wondering (if like a few years ago) any other 
are around earlier and going for supper (hacking code before supper) and 
generally socialising?

I’m also curious if others have thought about accommodation (there is lots of 
reasonable accommodation in Lille centre near the main station - which was 
pretty good last time I went) - anyone booked anything yet, and I’ll try and 
position myself in a similar vicinity to aid with the first question.

Tim





Re: [Pharo-users] Hmmm sending at:put: to an undefined object (nil) gives a confusing error message

2019-03-12 Thread Ben Coman
On Tue, 12 Mar 2019 at 21:56, Marcus Denker  wrote:
>
> Hi,
>
> Yes, I do not like it… I think it is there so that you can just make a 
> variable subclass and at: / at:put: will work without
> having to re-implement them…

So we should consider...
* how often are variable subclasses created ?  by novices or experts ?
* how much work is it to reimplement those methods ? how difficult to
know what needs to be done ?
* what is the balance

cheers -ben


>
> Marcus
>
> On 12 Mar 2019, at 04:55, Richard O'Keefe  wrote:
>
> I understand #basicAt:[put:] being in Object, but I never understood 
> #at:[put:] being there.
> GNU Smalltalk:
> st> nil at: 1
> Object: nil error: Invalid value nil: object not indexable
> In my Smalltalk, you get a DNU.
> In Squeak you get a debugger window with title
> Error: instances of UndefinedObject are not indexable
> The same for Boolean, Character, and Integer,
> except Squeak where (20 factorial at: 1) answers 0 (oh dear oh dear oh dear).
> In VW you get a "Subscript out of bounds" error, which is disappointing,
> as do true and $a, but a LargePositiveinteger gets #shouldNotImplement.
>
>
> On Tue, 12 Mar 2019 at 15:28, Tim Mackinnon  wrote:
>>
>> If you forget to initialise a variable which you thought was a Dictionary - 
>> you get a confusing error message: "Error: only integers should be used as 
>> indices” if you try an at:put:
>>
>> This is a consequence of having at:put: defined on Object (which is a bit 
>> nasty)
>>
>> Should UndefinedObject at least override this and signal something a bit 
>> more obvious? This is a common and easily done thing and we don't support it 
>> very well.
>>
>> I just did it in some code, and was scratching my head initially until I 
>> read the stack properly and realised it was something much simpler than I 
>> thought I had done.
>>
>> Any thoughts on this?
>
>



Re: [Pharo-users] [ANN] Minimal telepharo

2019-03-12 Thread Ben Coman
On Tue, 12 Mar 2019 at 19:37, Norbert Hartl  wrote:
>
> I’m working on having a telepharo image based on the pharo minimal image. 
> With the help of pavel and Allex I prepared a usable artefact on github that 
> can be used. Both images are based on Pharo8.
>
> The release file
>
> https://github.com/noha/pharo-minimal/releases/download/0.1/telepharo.zip
>
> contains a 32 bit minimal telepharo server image. It is 12,1 MB in size. And 
> there is a 64 bit full pharo telepharo client image in the archive that can 
> be used to connect to the minimal server one. I did not include the vms in 
> the archive. These you need to install separately.
>
> To run the server do
>
> $ ./pharo server.image eval --no-quit "TlpRemoteUIManager registerOnPort: 
> 40423“
>
> The client.image can be started as usual. In a playground do
>
> remotePharo := TlpRemoteIDE connectTo: (TCPAddress ip: #[127 0 0 1] port: 
> 40423)
>
> remotePharo openPlayground.
>
>
> To be connected to the minimal server image. Further details on telepharo you 
> can find at
>
> https://github.com/pharo-ide/TelePharo
>
> Further relases of this will be made available at
>
> https://github.com/noha/pharo-minimal/releases
>
> I’m planning to make a pharothings release available as well when the 
> telepharo release is considered stable.
>
> Hope you like it.

It will be a few weeks before I can try it, but its a really great initiative.
Thanks Norbert for bringing such pieces together, as well as those
providing the pieces.
cheers -ben



Re: [Pharo-users] Hmmm sending at:put: to an undefined object (nil) gives a confusing error message

2019-03-12 Thread Marcus Denker
Hi,

Yes, I do not like it… I think it is there so that you can just make a variable 
subclass and at: / at:put: will work without
having to re-implement them…

Marcus

> On 12 Mar 2019, at 04:55, Richard O'Keefe  wrote:
> 
> I understand #basicAt:[put:] being in Object, but I never understood 
> #at:[put:] being there.
> GNU Smalltalk:
> st> nil at: 1
> Object: nil error: Invalid value nil: object not indexable
> In my Smalltalk, you get a DNU.
> In Squeak you get a debugger window with title
> Error: instances of UndefinedObject are not indexable
> The same for Boolean, Character, and Integer,
> except Squeak where (20 factorial at: 1) answers 0 (oh dear oh dear oh dear).
> In VW you get a "Subscript out of bounds" error, which is disappointing,
> as do true and $a, but a LargePositiveinteger gets #shouldNotImplement.
> 
> 
> On Tue, 12 Mar 2019 at 15:28, Tim Mackinnon  wrote:
> If you forget to initialise a variable which you thought was a Dictionary - 
> you get a confusing error message: "Error: only integers should be used as 
> indices” if you try an at:put:
> 
> This is a consequence of having at:put: defined on Object (which is a bit 
> nasty)
> 
> Should UndefinedObject at least override this and signal something a bit more 
> obvious? This is a common and easily done thing and we don't support it very 
> well.
> 
> I just did it in some code, and was scratching my head initially until I read 
> the stack properly and realised it was something much simpler than I thought 
> I had done.
> 
> Any thoughts on this?



[Pharo-users] [ANN] Minimal telepharo

2019-03-12 Thread Norbert Hartl
I’m working on having a telepharo image based on the pharo minimal image. With 
the help of pavel and Allex I prepared a usable artefact on github that can be 
used. Both images are based on Pharo8.

The release file 

https://github.com/noha/pharo-minimal/releases/download/0.1/telepharo.zip 


contains a 32 bit minimal telepharo server image. It is 12,1 MB in size. And 
there is a 64 bit full pharo telepharo client image in the archive that can be 
used to connect to the minimal server one. I did not include the vms in the 
archive. These you need to install separately.

To run the server do

$ ./pharo server.image eval --no-quit "TlpRemoteUIManager registerOnPort: 40423“

The client.image can be started as usual. In a playground do

remotePharo := TlpRemoteIDE connectTo: (TCPAddress ip: #[127 0 0 1] port: 40423)
remotePharo openPlayground.

To be connected to the minimal server image. Further details on telepharo you 
can find at

https://github.com/pharo-ide/TelePharo 

Further relases of this will be made available at

https://github.com/noha/pharo-minimal/releases 


I’m planning to make a pharothings release available as well when the telepharo 
release is considered stable.

Hope you like it,

Norbert

Re: [Pharo-users] Pharo and FPGA

2019-03-12 Thread Cédrick Béler

> Le 11 mars 2019 à 14:51, Noury Bouraqadi  a écrit :
> 
> Hi Norbert,
> 
> The PhD of Sang (in CC) was about FPGA and Smalltalk.
> https://lxsang.me/ 

Really cool, thanks a lot :)


> 
> Noury
> 
>> On 9 Mar 2019, at 15:31, Norbert Hartl  wrote:
>> 
>> I’m trying to collect information about programming in pharo for FPGA. The 
>> only things I found are around PharoROS like this [1]. If anyone has more 
>> information or is willing to talk about I’m open ears.
>> 
>> The background is that we did little things with the PharoThings toolkit and 
>> want to research which other combinations like Arduino, ESP32, FPGAs are 
>> there to be a good extensions to a Pi.
>> 
>> Any hint is welcomed!
>> 
>> Thanks,
>> 
>> Norbert
>> 
>> [1] 
>> http://esug.org/data/ESUG2014/IWST/Papers/iwst2014_From%20Smalltalk%20to%20Silicon_Towards%20a%20methodology%20to%20turn%20Smalltalk%20code%20into%20FPGA.pdf
> 
> 



I found this other reference (ESU15) and the associated youtube video:
IWST A meta model supporting both hardware and smalltalk-based ... 
https://www.youtube.com/watch?v=N0JNjZipcjY
  
http://esug.org/data/ESUG2015/IWST/Papers/IWST_2015_submission_6.pdf 
 

And some other there: https://info.lxsang.me/#toc9

So busy, for the next couple hours ;-) (even more with the PhD 
https://tel.archives-ouvertes.fr/tel-01661569/document 
)

Thanks,

Cédrick


Ps: I was looking at this conference who might be interesting for such subject 
and applications (but end of this week).
https://wiki.f-si.org/index.php/FSiC2019 


Re: [Pharo-users] Pharo OSX bundle in Mojave - how to sign ? (Was Re: OS X bundle, some progress)

2019-03-12 Thread Christophe Demarey
Hi Hilaire,

> Le 11 mars 2019 à 21:27, Hilaire  a écrit :
> 
> Hi,
> 
> Today I realized another problem on some Mac OSX. It looks like when you
> download an app on the net, whenever your run it, OS X re-localizes it
> on a read only location. A guess a protection measure. It leads to
> obvious problem.
> 
> For example, once I download DrGeo and run it, the image location
> resolve to this place:
> 
> /private/var/folders/bb/spq6th0s7814jgk9nybbqjrw45hrqn/T/AppTranslocation/D0FEC575-60D6-4F2B-A1C3-3259271B9C92/d/DrGeo.app/Contents/Resources

Maybe (I did not do the original packaging) it is the reason why PharoLauncher 
is delivered as a dmg bundle.
The dmg is first decompressed (in a read only location).
You the have to copy the app to /Applications (or any other location).
Doing that should solve your problems.

Regards,
Christophe

> 
> I don't have the global picture and it is hard to understand what's
> going on.
> 
> Moving to the Application place seems to resolve the issue. But some
> users told me they have to move DrGeo from Download, then Application,
> then back to Download to get it running without RW error.
> 
> What a strange world.
> 
> Guys, what about throwing away these Mac, the promise of freedom[1] is
> longtime twisted :-)
> 
> Ok just kidding, well half-kidding.
> 
> Hilaire
> 
> [1] https://www.youtube.com/watch?v=2zfqw8nhUwA
> 
> Le 09/03/2019 à 10:10, Cédrick Béler a écrit :
>> Hi,
>> 
>> I tried a bit more to make DrGeo bundle works.
>> 
>> I have Mojave (10.14) and the problem of corrupted files seems to come from 
>> Gatekeeper with prevent unsigned applications (from unknot developper) to 
>> open.
>> 
>> Gatekeeper can be temporary stopped and then the bundle work, even when 
>> Gatekeeper is reactivated. But clearly, this is not a friendly user way of 
>> installing DrGeo.
>> 
>> So I guess the actual (old ?) bundle procedure doesn’t fit Apple politic on 
>> application security. I'm pretty sure PharoLauncher faced this already.
>> 
>> So my question is:
>> - how to make a signed bundle for OSX ?
>> — do we need a real developer account ? I’ve a free one and access to a paid 
>> one. Can we do it with a general « pharaoh » account like for Pharo-Launcher 
>> ?
>> 
>> 
>> Cheers,
>> 
>> Cédrick
> 
> -- 
> Dr. Geo
> http://drgeo.eu
> 
> 
> 




Re: [Pharo-users] Pharo OSX bundle in Mojave - how to sign ? (Was Re: OS X bundle, some progress)

2019-03-12 Thread Christophe Demarey
Hi Cedrick,

> Le 9 mars 2019 à 10:10, Cédrick Béler  a écrit :
> 
> Hi,
> 
> I tried a bit more to make DrGeo bundle works.
> 
> I have Mojave (10.14) and the problem of corrupted files seems to come from 
> Gatekeeper with prevent unsigned applications (from unknot developper) to 
> open.
> 
> Gatekeeper can be temporary stopped and then the bundle work, even when 
> Gatekeeper is reactivated. But clearly, this is not a friendly user way of 
> installing DrGeo.
> 
> So I guess the actual (old ?) bundle procedure doesn’t fit Apple politic on 
> application security. I'm pretty sure PharoLauncher faced this already.

Yes.

> So my question is:
> - how to make a signed bundle for OSX ?

https://github.com/demarey/pharo-launcher/tree/development/signing#how-to-sign-on-os-x

> — do we need a real developer account ? I’ve a free one and access to a paid 
> one. Can we do it with a general « pharaoh » account like for Pharo-Launcher ?

yes, you need a (paid) developper account.
See 
https://successfulsoftware.net/2012/08/30/how-to-sign-your-mac-os-x-app-for-gatekeeper/

I do not know if a general account for apps developed in Pharo is a good idea 
because it means that the reputation of all apps signed with the same 
certificate is shared, i.e. a security problem in one app will impact all other 
apps signed with the same certificate. It has to be discussed with people 
interested in it.

Regards,
Christophe.