Re: [Pharo-users] Why do #select:thenXxx methods not return their result

2018-06-07 Thread monty
Not just more readable. They can also be more efficient. Look at #select:thenCollect: in OrderedCollection: select: selectBlock thenCollect: collectBlock " Optimized version Collection>>#select:thenCollect: " | newCollection element | newCollection := self copyEmpty.

Re: [Pharo-users] Why do #select:thenXxx methods not return their result

2018-06-07 Thread Tim Mackinnon
You are correct Peter - I jumped the gun, as it was #select:thenDo: where I hit the problem - and yes it doesn’t make sense to answer a result from Do. I do kind of miss the concept of: #select:thenDo:ifNone: as well as #select:thenCollect:ifNone: but some bracketing sorts it out, and I guess

Re: [Pharo-users] Is it bad to have an order NeoJsonObject?

2018-06-07 Thread Norbert Hartl
> Am 07.06.2018 um 21:18 schrieb Esteban A. Maringolo : > > On 07/06/2018 13:59, Sven Van Caekenberghe wrote: >>> On 7 Jun 2018, at 14:42, Norbert Hartl wrote: >>> And safer. The current implementation of NeoJSONObject is not ver good. It >>> returns nil on any missing key so you mask a lot

Re: [Pharo-users] Understanding ZnJSONReader mapping?

2018-06-07 Thread Tim Mackinnon
Its sort of an awkward format, so maybe mapping is just not the way to go (but I’m still keen to learn how to properly use it when it is appropriate). For the record (if anyone is interested), an example json sample is here

Re: [Pharo-users] Understanding ZnJSONReader mapping?

2018-06-07 Thread Tim Mackinnon
Hey thanks - so maybe there are more legs to this - although it’s the decoding I’m currently interested in (but I’m sure encoding will come up at some point on my journey). So it seems that my mapper can have multiple entries (that bit I had missed - although seems obvious in retrospect now).

Re: [Pharo-users] Understanding ZnJSONReader mapping?

2018-06-07 Thread Esteban A. Maringolo
On 07/06/2018 17:21, Tim Mackinnon wrote: > Hi - is there something I can read/study to get a bit more familiar with Json > mapping? I have read the Pharo enterprise book (chapter 8). > > I’ve been using NeoJSONObject but then it occurred to me that maybe I could > map better domain objects

[Pharo-users] Understanding ZnJSONReader mapping?

2018-06-07 Thread Tim Mackinnon
Hi - is there something I can read/study to get a bit more familiar with Json mapping? I have read the Pharo enterprise book (chapter 8). I’ve been using NeoJSONObject but then it occurred to me that maybe I could map better domain objects directly and simplify things. However it seems that the

Re: [Pharo-users] Is it bad to have an order NeoJsonObject?

2018-06-07 Thread Esteban A. Maringolo
On 07/06/2018 13:59, Sven Van Caekenberghe wrote: >> On 7 Jun 2018, at 14:42, Norbert Hartl wrote: >> And safer. The current implementation of NeoJSONObject is not ver good. It >> returns nil on any missing key so you mask a lot of errors in your code >> which I find dangerous. > > Haha, it

Re: [Pharo-users] more on "can't get keyboard shortcuts to work on Mac"

2018-06-07 Thread GreggInCA
Paul and Tim. Nope, still doesn't work. It might be some hacker-level customization I've forgotten about. Anyway, it's not worth my time or yours to track this down. Thanks for all your help. -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Re: [Pharo-users] Is it bad to have an order NeoJsonObject?

2018-06-07 Thread Sven Van Caekenberghe
> On 7 Jun 2018, at 14:42, Norbert Hartl wrote: > > > >> Am 07.06.2018 um 14:16 schrieb Tim Mackinnon : >> >> Thanks guys - it seems like I was on the right track. >> >> Making my own NeoJsonObject did work, but I will go back and see if I’m >> really using the js nature of the values

Re: [Pharo-users] Problem to use GZIPReadStream

2018-06-07 Thread Serge Stinckwich
On Thu, Jun 7, 2018 at 4:59 PM Guillermo Polito wrote: > Hi Serge, > > What Pharo version are you on? What is your `file` object? If `file` is a > FileReference, you need to know that by default, using `readStream` > provides now an encoded file (to keep backwards compatibility with what > most

Re: [Pharo-users] Problem to use GZIPReadStream

2018-06-07 Thread Guillermo Polito
Hi Serge, What Pharo version are you on? What is your `file` object? If `file` is a FileReference, you need to know that by default, using `readStream` provides now an encoded file (to keep backwards compatibility with what most users were doing until now). And I think that GZip should just

[Pharo-users] Problem to use GZIPReadStream

2018-06-07 Thread Serge Stinckwich
I try to decompress a gzip file like that: compressed := file readStream. stream := (GZipReadStream on: compressed) upToEnd asByteArray readStream. ​but I have the following error: Illegal leading byte for utf-8 encoding ​ -- Serge Stinckwich UMI UMMISCO 209 (SU/IRD/UY1) "Programs must be

Re: [Pharo-users] Is it bad to have an order NeoJsonObject?

2018-06-07 Thread Norbert Hartl
> Am 07.06.2018 um 14:16 schrieb Tim Mackinnon : > > Thanks guys - it seems like I was on the right track. > > Making my own NeoJsonObject did work, but I will go back and see if I’m > really using the js nature of the values and if for this, just an > OrderedDictionary might be clearer. >

Re: [Pharo-users] Why do #select:thenXxx methods not return their result

2018-06-07 Thread Peter Uhnák
How do you mean? (1 to: 10) select: #odd thenCollect: [ :x | x ** 2 ] "-> #(1 9 25 49 81)" It wouldn't make sense otherwise to have the collect method if it wouldn't return anything. Peter On Thu, Jun 7, 2018 at 2:20 PM, Tim Mackinnon wrote: > Hi - are the methods like #select:thenCollect:

[Pharo-users] Why do #select:thenXxx methods not return their result

2018-06-07 Thread Tim Mackinnon
Hi - are the methods like #select:thenCollect: frowned upon? They seem quite readable , however in using them I’ve noticed that unlike the core methods they done return the result of evaluation (they are missing a ^). This is a shame, but possibly an oversight? Tim Sent from my iPhone

Re: [Pharo-users] Is it bad to have an order NeoJsonObject?

2018-06-07 Thread Tim Mackinnon
Thanks guys - it seems like I was on the right track. Making my own NeoJsonObject did work, but I will go back and see if I’m really using the js nature of the values and if for this, just an OrderedDictionary might be clearer. As an aside, I was doing some experiments with prismic.io (a

Re: [Pharo-users] more on "can't get keyboard shortcuts to work on Mac"

2018-06-07 Thread Tim Mackinnon
Yes they all work for me too - so we ‘re a bit confused by what your reporting Greg, as they should all work on a Mac. I’m sure we can help you get to the bottom of it. Tim Sent from my iPhone > On 7 Jun 2018, at 06:39, Paul DeBruicker wrote: > > oh and a typo. Which should have been: > >

Re: [Pharo-users] Is it bad to have an order NeoJsonObject?

2018-06-07 Thread Sven Van Caekenberghe
> On 7 Jun 2018, at 08:16, Norbert Hartl wrote: > > > >> Am 07.06.2018 um 07:29 schrieb Sven Van Caekenberghe : >> >> Tim, >> >>> On 7 Jun 2018, at 01:37, Tim Mackinnon wrote: >>> >>> Hi - I’ve hit some Json where the outputted values (they are field names) >>> are written out in a

Re: [Pharo-users] Is it bad to have an order NeoJsonObject?

2018-06-07 Thread Norbert Hartl
> Am 07.06.2018 um 07:29 schrieb Sven Van Caekenberghe : > > Tim, > >> On 7 Jun 2018, at 01:37, Tim Mackinnon wrote: >> >> Hi - I’ve hit some Json where the outputted values (they are field names) >> are written out in a specific order - and the author hasn’t chosen to use an >> array to